All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/amdgpu: force read discovery file if set discovery=2
@ 2022-10-26  3:13 Yifan Zhang
  2022-10-27  7:50 ` Huang, Tim
  2022-10-27 15:01 ` Felix Kuehling
  0 siblings, 2 replies; 3+ messages in thread
From: Yifan Zhang @ 2022-10-26  3:13 UTC (permalink / raw)
  To: amd-gfx; +Cc: Alexander.Deucher, Tim.Huang, Aaron.Liu, Xiaojian.Du, Yifan Zhang

If discovery is set to 2 in module parameters explicitly, the
intention is to use the discovery file in FW rather than the one in
BIOS, usually because the latter is incorrect. This patch to force
read discovery file if set discovery=2.

Signed-off-by: Yifan Zhang <yifan1.zhang@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
index 3993e6134914..5ea9afaaf4f1 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
@@ -305,8 +305,13 @@ static int amdgpu_discovery_init(struct amdgpu_device *adev)
 		goto out;
 	}
 
-	if (!amdgpu_discovery_verify_binary_signature(adev->mman.discovery_bin)) {
-		dev_warn(adev->dev, "get invalid ip discovery binary signature from vram\n");
+	if (!amdgpu_discovery_verify_binary_signature(adev->mman.discovery_bin) || amdgpu_discovery == 2) {
+		/* ignore the discovery binary from vram if discovery=2 in kernel module parameter */
+		if (amdgpu_discovery == 2)
+			dev_info(adev->dev,"force read ip discovery binary from file");
+		else
+			dev_warn(adev->dev, "get invalid ip discovery binary signature from vram\n");
+
 		/* retry read ip discovery binary from file */
 		r = amdgpu_discovery_read_binary_from_file(adev, adev->mman.discovery_bin);
 		if (r) {
-- 
2.37.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [PATCH] drm/amdgpu: force read discovery file if set discovery=2
  2022-10-26  3:13 [PATCH] drm/amdgpu: force read discovery file if set discovery=2 Yifan Zhang
@ 2022-10-27  7:50 ` Huang, Tim
  2022-10-27 15:01 ` Felix Kuehling
  1 sibling, 0 replies; 3+ messages in thread
From: Huang, Tim @ 2022-10-27  7:50 UTC (permalink / raw)
  To: Zhang, Yifan, amd-gfx; +Cc: Deucher, Alexander, Liu, Aaron, Du, Xiaojian

[Public]

Reviewed-by: Tim Huang <Tim.Huang@amd.com>

Best Regards,
Tim Huang



-----Original Message-----
From: Zhang, Yifan <Yifan1.Zhang@amd.com>
Sent: Wednesday, October 26, 2022 11:14 AM
To: amd-gfx@lists.freedesktop.org
Cc: Deucher, Alexander <Alexander.Deucher@amd.com>; Huang, Tim <Tim.Huang@amd.com>; Du, Xiaojian <Xiaojian.Du@amd.com>; Liu, Aaron <Aaron.Liu@amd.com>; Zhang, Yifan <Yifan1.Zhang@amd.com>
Subject: [PATCH] drm/amdgpu: force read discovery file if set discovery=2

If discovery is set to 2 in module parameters explicitly, the intention is to use the discovery file in FW rather than the one in BIOS, usually because the latter is incorrect. This patch to force read discovery file if set discovery=2.

Signed-off-by: Yifan Zhang <yifan1.zhang@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
index 3993e6134914..5ea9afaaf4f1 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
@@ -305,8 +305,13 @@ static int amdgpu_discovery_init(struct amdgpu_device *adev)
                goto out;
        }

-       if (!amdgpu_discovery_verify_binary_signature(adev->mman.discovery_bin)) {
-               dev_warn(adev->dev, "get invalid ip discovery binary signature from vram\n");
+       if (!amdgpu_discovery_verify_binary_signature(adev->mman.discovery_bin) || amdgpu_discovery == 2) {
+               /* ignore the discovery binary from vram if discovery=2 in kernel module parameter */
+               if (amdgpu_discovery == 2)
+                       dev_info(adev->dev,"force read ip discovery binary from file");
+               else
+                       dev_warn(adev->dev, "get invalid ip discovery binary signature from
+vram\n");
+
                /* retry read ip discovery binary from file */
                r = amdgpu_discovery_read_binary_from_file(adev, adev->mman.discovery_bin);
                if (r) {
--
2.37.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] drm/amdgpu: force read discovery file if set discovery=2
  2022-10-26  3:13 [PATCH] drm/amdgpu: force read discovery file if set discovery=2 Yifan Zhang
  2022-10-27  7:50 ` Huang, Tim
@ 2022-10-27 15:01 ` Felix Kuehling
  1 sibling, 0 replies; 3+ messages in thread
From: Felix Kuehling @ 2022-10-27 15:01 UTC (permalink / raw)
  To: Yifan Zhang, amd-gfx; +Cc: Alexander.Deucher, Tim.Huang, Aaron.Liu, Xiaojian.Du

Am 2022-10-25 um 23:13 schrieb Yifan Zhang:
> If discovery is set to 2 in module parameters explicitly, the
> intention is to use the discovery file in FW rather than the one in
> BIOS, usually because the latter is incorrect. This patch to force
> read discovery file if set discovery=2.
>
> Signed-off-by: Yifan Zhang <yifan1.zhang@amd.com>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 9 +++++++--
>   1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
> index 3993e6134914..5ea9afaaf4f1 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c
> @@ -305,8 +305,13 @@ static int amdgpu_discovery_init(struct amdgpu_device *adev)
>   		goto out;
>   	}
>   
> -	if (!amdgpu_discovery_verify_binary_signature(adev->mman.discovery_bin)) {
> -		dev_warn(adev->dev, "get invalid ip discovery binary signature from vram\n");
> +	if (!amdgpu_discovery_verify_binary_signature(adev->mman.discovery_bin) || amdgpu_discovery == 2) {
I'd change the order of the conditions. There is no need to check the 
signature of the one from VRAM if we're not going to use it anyway:

	if (amdgpu_discorvery == 2 ||
	    !amdgpu_discovery_verify_binary_signature(adev->mman.discovery_bin)) {
		...


> +		/* ignore the discovery binary from vram if discovery=2 in kernel module parameter */
> +		if (amdgpu_discovery == 2)
> +			dev_info(adev->dev,"force read ip discovery binary from file");
Missing space after the ,

Regards,
   Felix


> +		else
> +			dev_warn(adev->dev, "get invalid ip discovery binary signature from vram\n");
> +
>   		/* retry read ip discovery binary from file */
>   		r = amdgpu_discovery_read_binary_from_file(adev, adev->mman.discovery_bin);
>   		if (r) {

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-10-27 15:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-26  3:13 [PATCH] drm/amdgpu: force read discovery file if set discovery=2 Yifan Zhang
2022-10-27  7:50 ` Huang, Tim
2022-10-27 15:01 ` Felix Kuehling

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.