diff options
author | Alex Deucher <alexander.deucher@amd.com> | 2019-01-15 18:05:16 +0100 |
---|---|---|
committer | Alex Deucher <alexander.deucher@amd.com> | 2019-01-25 22:15:35 +0100 |
commit | 089888c46841cef767927c9e17e4c9c037d24c4e (patch) | |
tree | 658e75bf285ccb6b90a2b3f27931a69e8c0fd941 /drivers/gpu/drm/radeon/ci_dpm.c | |
parent | drm/amdgpu: Add missing power attribute to APU check (diff) | |
download | linux-089888c46841cef767927c9e17e4c9c037d24c4e.tar.xz linux-089888c46841cef767927c9e17e4c9c037d24c4e.zip |
drm/radeon: check if device is root before getting pci speed caps
Check if the device is root rather before attempting to see what
speeds the pcie port supports. Fixes a crash with pci passthrough
in a VM.
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=109366
Reviewed-by: Evan Quan <evan.quan@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Diffstat (limited to 'drivers/gpu/drm/radeon/ci_dpm.c')
-rw-r--r-- | drivers/gpu/drm/radeon/ci_dpm.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/gpu/drm/radeon/ci_dpm.c b/drivers/gpu/drm/radeon/ci_dpm.c index d587779a80b4..a97294ac96d5 100644 --- a/drivers/gpu/drm/radeon/ci_dpm.c +++ b/drivers/gpu/drm/radeon/ci_dpm.c @@ -5676,7 +5676,7 @@ int ci_dpm_init(struct radeon_device *rdev) u16 data_offset, size; u8 frev, crev; struct ci_power_info *pi; - enum pci_bus_speed speed_cap; + enum pci_bus_speed speed_cap = PCI_SPEED_UNKNOWN; struct pci_dev *root = rdev->pdev->bus->self; int ret; @@ -5685,7 +5685,8 @@ int ci_dpm_init(struct radeon_device *rdev) return -ENOMEM; rdev->pm.dpm.priv = pi; - speed_cap = pcie_get_speed_cap(root); + if (!pci_is_root_bus(rdev->pdev->bus)) + speed_cap = pcie_get_speed_cap(root); if (speed_cap == PCI_SPEED_UNKNOWN) { pi->sys_pcie_mask = 0; } else { |