drm/amdgpu: force read discovery file if set discovery=2
authorYifan Zhang <yifan1.zhang@amd.com>
Wed, 26 Oct 2022 02:55:10 +0000 (10:55 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 10 Nov 2022 20:29:05 +0000 (15:29 -0500)
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>
Reviewed-by: Tim Huang <Tim.Huang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c

index 3993e61349141b0e58e4dd4944ea9adec90eacb6..5ea9afaaf4f17808dd15eb1d5c23e3303c7de502 100644 (file)
@@ -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) {