Skip to contentSkip to conversation

drm/amdgpu: Check extended configuration space register when system uses large bar

PATCH In review Ma Jun 2 participants 2 messages Jan 10, 2024

Subsystems (2)
lore
Share & tools
lore

Ma Jun

author
#0 lore raw

PATCH v3 1/1 drm/amdgpu: Check extended configuration space register when system uses large bar

Some customer platforms do not enable mmconfig for various reasons, such as bios bug, and therefore cannot access the GPU extend configuration space through mmio.

When the system enters the d3cold state and resumes, the amdgpu driver fails to resume because the extend configuration space registers of GPU can't be restored. At this point, Usually we only see some failure dmesg log printed by amdgpu driver, it is difficult to find the root cause.

Therefor print a warnning message if the system can't access the extended configuration space register when using large bar.

---
v2:
- Check the register at 0x100 but not resize bar register
- Modify the commit message

---
 drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +4 -0
index 4b694696930e..629de7f2908c 100644
@@ -1442,6 +1442,10 @@ int amdgpu_device_resize_fb_bar(struct amdgpu_device *adev)
 	if (amdgpu_sriov_vf(adev))
 		return 0;
 
+	/* PCI_EXT_CAP_ID_VNDR extended capability is located at 0x100 */
+	if (!pci_find_ext_capability(adev->pdev, PCI_EXT_CAP_ID_VNDR))
+		DRM_WARN("System can't access extended configuration space,please check!!\n");
+
 	/* skip if the bios has already enabled large BAR */
 	if (adev->gmc.real_vram_size &&
 	    (pci_resource_len(adev->pdev, 0) >= adev->gmc.real_vram_size))
Signature · 1 line
2.34.1
maintainer Reviewed-by on v3 1/1
#1 lore raw

Am 10.01.24 um 11:13 schrieb Ma Jun:

Quoted 10 lines

Some customer platforms do not enable mmconfig for various reasons, such as bios bug, and therefore cannot access the GPU extend configuration space through mmio.

When the system enters the d3cold state and resumes, the amdgpu driver fails to resume because the extend configuration space registers of GPU can't be restored. At this point, Usually we only see some failure dmesg log printed by amdgpu driver, it is difficult to find the root cause.

Quoted 4 lines

Therefor print a warnning message if the system can't access the extended configuration space register when using large bar.

Quoted 23 lines

---
v2:
- Check the register at 0x100 but not resize bar register
- Modify the commit message

---
  drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 4 ++++
  1 file changed, 4 insertions(+)
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c +4 -0
index 4b694696930e..629de7f2908c 100644
@@ -1442,6 +1442,10 @@ int amdgpu_device_resize_fb_bar(struct amdgpu_device *adev)
  	if (amdgpu_sriov_vf(adev))
  		return 0;
 
+	/* PCI_EXT_CAP_ID_VNDR extended capability is located at 0x100 */
+	if (!pci_find_ext_capability(adev->pdev, PCI_EXT_CAP_ID_VNDR))
+		DRM_WARN("System can't access extended configuration space,please check!!\n");
+
  	/* skip if the bios has already enabled large BAR */
  	if (adev->gmc.real_vram_size &&
  	    (pci_resource_len(adev->pdev, 0) >= adev->gmc.real_vram_size))