From: Young_X <yang...@hotmail.com>

    If we assign an amd device to a virtual mechine, we can no longer
    assume a fixed hardware topology, like the GPU having a parent device.
    This patch simply adds pci_is_root_bus() tests to avoid passing a
    NULL pointer to PCI access functions.

    See commit e79d5c0870ee ("drm/amdgpu: check before checking pci bridge
    registers") and commit 0bd252de78d4 ("radeon: Test for PCI root bus
    before assuming bus->self") for details.

Signed-off-by: Young_X <yang...@hotmail.com>
---
 drivers/gpu/drm/amd/amdgpu/cik.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/cik.c b/drivers/gpu/drm/amd/amdgpu/cik.c
index f41f5f5..8b51fa8 100644
--- a/drivers/gpu/drm/amd/amdgpu/cik.c
+++ b/drivers/gpu/drm/amd/amdgpu/cik.c
@@ -1622,7 +1622,8 @@ static void cik_program_aspm(struct amdgpu_device *adev)
                        if (orig != data)
                                WREG32_PCIE(ixPCIE_LC_LINK_WIDTH_CNTL, data);
 
-                       if (!disable_clkreq) {
+                       if (!disable_clkreq &&
+                           !pci_is_root_bus(adev->pdev->bus)) {
                                struct pci_dev *root = adev->pdev->bus->self;
                                u32 lnkcap;
 
-- 
2.7.4

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reply via email to