Skip to contentSkip to conversation

drm/amdgpu: use DISCOVERY_TMR_SIZE in ACPI TMR fallback

PATCH In review Jesse.Zhang 2 participants 2 messages Mar 23

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 3/3 drm/amdgpu: use DISCOVERY_TMR_SIZE in ACPI TMR fallback

amdgpu_acpi_get_tmr_info() returns the full TMR region size, not the IP discovery table size. Using tmr_size as discovery.size can lead to oversized allocations and probe failure.

In the ACPI fallback path, keep discovery.size as DISCOVERY_TMR_SIZE and only use ACPI data for offset calculation.

Fixes 7055e5157742 ("drm/amdgpu: New interface to get IP discovery binary v3")
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +1 -1
index f7f37d93d0ce..c42bd563467f 100644
@@ -324,7 +324,7 @@ static int amdgpu_discovery_get_tmr_info(struct amdgpu_device *adev,
 			ret = amdgpu_acpi_get_tmr_info(adev, &tmr_offset, &tmr_size);
 			if (ret)
 				return ret;
-			adev->discovery.size = (u32)tmr_size;
+			adev->discovery.size = DISCOVERY_TMR_SIZE;
 			adev->discovery.offset = tmr_offset + tmr_size - DISCOVERY_TMR_OFFSET;
 		}
 	}
Signature · 1 line
2.49.0
Reviewed-by on v1 3/3
#1 lore raw
Quoted 11 lines · Jesse.Zhang

amdgpu_acpi_get_tmr_info() returns the full TMR region size, not the IP discovery table size. Using tmr_size as discovery.size can lead to oversized allocations and probe failure.

In the ACPI fallback path, keep discovery.size as DISCOVERY_TMR_SIZE and only use ACPI data for offset calculation.

Fixes 7055e5157742 ("drm/amdgpu: New interface to get IP discovery binary v3")

Thanks,
Lijo

Quoted 17 lines
---
  drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_discovery.c +1 -1
index f7f37d93d0ce..c42bd563467f 100644
@@ -324,7 +324,7 @@ static int amdgpu_discovery_get_tmr_info(struct amdgpu_device *adev,
  			ret = amdgpu_acpi_get_tmr_info(adev, &tmr_offset, &tmr_size);
  			if (ret)
  				return ret;
-			adev->discovery.size = (u32)tmr_size;
+			adev->discovery.size = DISCOVERY_TMR_SIZE;
  			adev->discovery.offset = tmr_offset + tmr_size - DISCOVERY_TMR_OFFSET;
  		}
  	}