Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amdgpu: check before checking pci bridge registers

Make sure we are not the root device before attempting to
read the pcie bridge registers to check the pcie gen speeed.

Fixes a crash when the device is passed through to a VM.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org

+6
+3
drivers/gpu/drm/amd/amdgpu/cik.c
··· 1567 1567 int ret, i; 1568 1568 u16 tmp16; 1569 1569 1570 + if (pci_is_root_bus(adev->pdev->bus)) 1571 + return; 1572 + 1570 1573 if (amdgpu_pcie_gen2 == 0) 1571 1574 return; 1572 1575
+3
drivers/gpu/drm/amd/amdgpu/vi.c
··· 1005 1005 u32 mask; 1006 1006 int ret; 1007 1007 1008 + if (pci_is_root_bus(adev->pdev->bus)) 1009 + return; 1010 + 1008 1011 if (amdgpu_pcie_gen2 == 0) 1009 1012 return; 1010 1013