]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/amdgpu: Prefer default discovery offset
authorLijo Lazar <lijo.lazar@amd.com>
Mon, 13 Jul 2026 11:04:24 +0000 (16:34 +0530)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 12 Aug 2026 14:23:07 +0000 (10:23 -0400)
If a valid signature is seen at the default offset, use the default
size/offset for discovery.

Fixes: 01bdc7e219c4 ("drm/amdgpu: New interface to get IP discovery binary v3")
Closes: https://gitlab.freedesktop.org/drm/amd/-/work_items/5447
Signed-off-by: Lijo Lazar <lijo.lazar@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit 46a0df99a0b2fa2fa61d864b04b6a5d5fe748779)
Cc: stable@vger.kernel.org
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c

index 5e83edbd313b38bfcff243b9b9972ba3ef8a3660..47e0680ed7b15f72fec3c07f4b9bf3f6039c38bb 100644 (file)
@@ -311,6 +311,19 @@ static int amdgpu_discovery_get_tmr_info(struct amdgpu_device *adev,
                        goto out;
                }
        } else {
+               if (adev->discovery.offset) {
+                       u32 signature;
+
+                       /* If VRAM holds a valid discovery signature at the default
+                        * discovery offset, use it as-is.
+                        */
+                       amdgpu_device_vram_access(adev, adev->discovery.offset,
+                                                 &signature, sizeof(signature),
+                                                 false);
+                       if (le32_to_cpu(signature) == BINARY_SIGNATURE)
+                               goto out;
+               }
+
                tmr_size = RREG32(mmDRIVER_SCRATCH_2);
                if (tmr_size) {
                        /* It's preferred to transition to PSP mailbox reg interface