[PATCH] drm/amd/amdgpu: Test for PCI root bus before assuming bus->self

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Young_X <YangX92@xxxxxxxxxxx>

    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 <YangX92@xxxxxxxxxxx>
---
 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@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/amd-gfx




[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux