All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH]     drm/amd/amdgpu: Test for PCI root bus before assuming bus->self
@ 2018-11-27  3:33 Yang Xiao
  0 siblings, 0 replies; only message in thread
From: Yang Xiao @ 2018-11-27  3:33 UTC (permalink / raw)
  To: alexander.deucher, christian.koenig, David1.Zhou, airlied
  Cc: Yang Xiao, ray.huang, Rex.Zhu, dri-devel, amd-gfx

From: Young_X <YangX92@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 <YangX92@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

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-11-27  3:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-27  3:33 [PATCH] drm/amd/amdgpu: Test for PCI root bus before assuming bus->self Yang Xiao

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.