Skip to contentSkip to conversation

drm/amdgpu: Prefer default discovery offset

PATCH In review Lijo Lazar 2 participants 2 messages Jul 15

Subsystems (2)
lore
Share & tools
lore

Lijo Lazar

author
#0 lore raw

PATCH 1/1 drm/amdgpu: Prefer default discovery offset

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")
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +13 -0
index 44e7d2e3e6df..186661c94d8c 100644
@@ -334,6 +334,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
Signature · 1 line
2.49.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Lijo Lazar

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")
Quoted 31 lines
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +13 -1
index 44e7d2e3e6df..186661c94d8c 100644
@@ -334,6 +334,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
--

2.49.0