Commit b2e33f9e authored by Alex Deucher's avatar Alex Deucher Committed by Greg Kroah-Hartman

drm/amdgpu: check before checking pci bridge registers

commit e79d5c08 upstream.

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: default avatarChristian König <christian.koenig@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 421216eb
...@@ -1565,6 +1565,9 @@ static void cik_pcie_gen3_enable(struct amdgpu_device *adev) ...@@ -1565,6 +1565,9 @@ static void cik_pcie_gen3_enable(struct amdgpu_device *adev)
int ret, i; int ret, i;
u16 tmp16; u16 tmp16;
if (pci_is_root_bus(adev->pdev->bus))
return;
if (amdgpu_pcie_gen2 == 0) if (amdgpu_pcie_gen2 == 0)
return; return;
......
...@@ -968,6 +968,9 @@ static void vi_pcie_gen3_enable(struct amdgpu_device *adev) ...@@ -968,6 +968,9 @@ static void vi_pcie_gen3_enable(struct amdgpu_device *adev)
u32 mask; u32 mask;
int ret; int ret;
if (pci_is_root_bus(adev->pdev->bus))
return;
if (amdgpu_pcie_gen2 == 0) if (amdgpu_pcie_gen2 == 0)
return; return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment