aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Williamson <alex.williamson@redhat.com>2014-08-27 15:01:35 -0400
committerAlex Deucher <alexander.deucher@amd.com>2014-08-27 17:54:50 -0400
commit0bd252de78d406485c896508c13a8f7a78ee8353 (patch)
treeaa2899f955d4b69ad9fedfd349bf12daef9fabdc
parent0a5f6e9d60e71e4b6dbeabd97bc887d6b2b0f0c8 (diff)
radeon: Test for PCI root bus before assuming bus->self
If we assign a Radeon device to a virtual machine, we can no longer assume a fixed hardware topology, like the GPU having a parent device. This patch simply adds a few pci_is_root_bus() tests to avoid passing a NULL pointer to PCI access functions, allowing the radeon driver to work in a QEMU 440FX machine with an assigned HD8570 on the emulated PCI root bus. Signed-off-by: Alex Williamson <alex.williamson@redhat.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--drivers/gpu/drm/radeon/cik.c6
-rw-r--r--drivers/gpu/drm/radeon/si.c6
2 files changed, 10 insertions, 2 deletions
diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c
index e57698847be5..fa9565957f9d 100644
--- a/drivers/gpu/drm/radeon/cik.c
+++ b/drivers/gpu/drm/radeon/cik.c
@@ -9563,6 +9563,9 @@ static void cik_pcie_gen3_enable(struct radeon_device *rdev)
9563 int ret, i; 9563 int ret, i;
9564 u16 tmp16; 9564 u16 tmp16;
9565 9565
9566 if (pci_is_root_bus(rdev->pdev->bus))
9567 return;
9568
9566 if (radeon_pcie_gen2 == 0) 9569 if (radeon_pcie_gen2 == 0)
9567 return; 9570 return;
9568 9571
@@ -9789,7 +9792,8 @@ static void cik_program_aspm(struct radeon_device *rdev)
9789 if (orig != data) 9792 if (orig != data)
9790 WREG32_PCIE_PORT(PCIE_LC_LINK_WIDTH_CNTL, data); 9793 WREG32_PCIE_PORT(PCIE_LC_LINK_WIDTH_CNTL, data);
9791 9794
9792 if (!disable_clkreq) { 9795 if (!disable_clkreq &&
9796 !pci_is_root_bus(rdev->pdev->bus)) {
9793 struct pci_dev *root = rdev->pdev->bus->self; 9797 struct pci_dev *root = rdev->pdev->bus->self;
9794 u32 lnkcap; 9798 u32 lnkcap;
9795 9799
diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c
index 739e0a5349f8..6bce40847753 100644
--- a/drivers/gpu/drm/radeon/si.c
+++ b/drivers/gpu/drm/radeon/si.c
@@ -7188,6 +7188,9 @@ static void si_pcie_gen3_enable(struct radeon_device *rdev)
7188 int ret, i; 7188 int ret, i;
7189 u16 tmp16; 7189 u16 tmp16;
7190 7190
7191 if (pci_is_root_bus(rdev->pdev->bus))
7192 return;
7193
7191 if (radeon_pcie_gen2 == 0) 7194 if (radeon_pcie_gen2 == 0)
7192 return; 7195 return;
7193 7196
@@ -7465,7 +7468,8 @@ static void si_program_aspm(struct radeon_device *rdev)
7465 if (orig != data) 7468 if (orig != data)
7466 WREG32_PIF_PHY1(PB1_PIF_CNTL, data); 7469 WREG32_PIF_PHY1(PB1_PIF_CNTL, data);
7467 7470
7468 if (!disable_clkreq) { 7471 if (!disable_clkreq &&
7472 !pci_is_root_bus(rdev->pdev->bus)) {
7469 struct pci_dev *root = rdev->pdev->bus->self; 7473 struct pci_dev *root = rdev->pdev->bus->self;
7470 u32 lnkcap; 7474 u32 lnkcap;
7471 7475