drm/amdgpu: Check extended configuration space register when system uses large bar
authorMa Jun <Jun.Ma2@amd.com>
Mon, 18 Dec 2023 03:32:06 +0000 (11:32 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 15 Jan 2024 23:35:36 +0000 (18:35 -0500)
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.

Signed-off-by: Ma Jun <Jun.Ma2@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_device.c

index 8beff0158c42f8458c8d0e52883c1bd6fb8c697e..a39c7127c9e8857e60cf2765e35f35aae8ae7e49 100644 (file)
@@ -1453,6 +1453,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))