[PATCH] drm/radeon: check if device is root before getting pci speed caps

Alex Deucher alexdeucher at gmail.com
Mon Jan 21 18:58:59 UTC 2019


Ping?

On Thu, Jan 17, 2019 at 2:44 PM Alex Deucher <alexdeucher at gmail.com> wrote:
>
> 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
> Signed-off-by: Alex Deucher <alexander.deucher at amd.com>
> ---
>  drivers/gpu/drm/radeon/ci_dpm.c | 5 +++--
>  drivers/gpu/drm/radeon/si_dpm.c | 5 +++--
>  2 files changed, 6 insertions(+), 4 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 {
> diff --git a/drivers/gpu/drm/radeon/si_dpm.c b/drivers/gpu/drm/radeon/si_dpm.c
> index 8fb60b3af015..0a785ef0ab66 100644
> --- a/drivers/gpu/drm/radeon/si_dpm.c
> +++ b/drivers/gpu/drm/radeon/si_dpm.c
> @@ -6899,7 +6899,7 @@ int si_dpm_init(struct radeon_device *rdev)
>         struct ni_power_info *ni_pi;
>         struct si_power_info *si_pi;
>         struct atom_clock_dividers dividers;
> -       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;
>
> @@ -6911,7 +6911,8 @@ int si_dpm_init(struct radeon_device *rdev)
>         eg_pi = &ni_pi->eg;
>         pi = &eg_pi->rv7xx;
>
> -       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) {
>                 si_pi->sys_pcie_mask = 0;
>         } else {
> --
> 2.20.1
>


More information about the amd-gfx mailing list