[PATCH 4/5] drm/radeon: Don't register Thunderbolt eGPU with vga_switcheroo

Alex Deucher alexdeucher at gmail.com
Tue Mar 7 20:30:30 UTC 2017


On Fri, Feb 24, 2017 at 2:19 PM, Lukas Wunner <lukas at wunner.de> wrote:
> An external Thunderbolt GPU can neither drive the laptop's panel nor be
> powered off by the platform, so there's no point in registering it with
> vga_switcheroo.  In fact, when the external GPU is runtime suspended,
> vga_switcheroo will cut power to the internal discrete GPU, resulting in
> a lockup.

I'm not necessarily opposed to this, but I'd prefer something more
generic.  E.g., what happens if someone uses another dGPU in a docking
station or some other sort of PCIe bridge?  I think on AMD platforms
at least we should be able to determine what devices are the
switcheroo devices based on information in the ATIF and ATPX ACPI
methods.  In that case, we can be explicit in which devices we
register with vga_switcheroo.

Alex

>
> Cc: Alex Deucher <alexander.deucher at amd.com>
> Signed-off-by: Lukas Wunner <lukas at wunner.de>
> ---
>  drivers/gpu/drm/radeon/radeon_device.c | 7 +++++--
>  drivers/gpu/drm/radeon/radeon_kms.c    | 3 ++-
>  2 files changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
> index 4b0c388be3f5..27be17f0b227 100644
> --- a/drivers/gpu/drm/radeon/radeon_device.c
> +++ b/drivers/gpu/drm/radeon/radeon_device.c
> @@ -1471,7 +1471,9 @@ int radeon_device_init(struct radeon_device *rdev,
>
>         if (rdev->flags & RADEON_IS_PX)
>                 runtime = true;
> -       vga_switcheroo_register_client(rdev->pdev, &radeon_switcheroo_ops, runtime);
> +       if (!pci_is_thunderbolt_attached(rdev->pdev))
> +               vga_switcheroo_register_client(rdev->pdev,
> +                                              &radeon_switcheroo_ops, runtime);
>         if (runtime)
>                 vga_switcheroo_init_domain_pm_ops(rdev->dev, &rdev->vga_pm_domain);
>
> @@ -1564,7 +1566,8 @@ void radeon_device_fini(struct radeon_device *rdev)
>         /* evict vram memory */
>         radeon_bo_evict_vram(rdev);
>         radeon_fini(rdev);
> -       vga_switcheroo_unregister_client(rdev->pdev);
> +       if (!pci_is_thunderbolt_attached(rdev->pdev))
> +               vga_switcheroo_unregister_client(rdev->pdev);
>         if (rdev->flags & RADEON_IS_PX)
>                 vga_switcheroo_fini_domain_pm_ops(rdev->dev);
>         vga_client_register(rdev->pdev, NULL, NULL, NULL);
> diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c
> index 56f35c06742c..e95ceec1c97a 100644
> --- a/drivers/gpu/drm/radeon/radeon_kms.c
> +++ b/drivers/gpu/drm/radeon/radeon_kms.c
> @@ -115,7 +115,8 @@ int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags)
>
>         if ((radeon_runtime_pm != 0) &&
>             radeon_has_atpx() &&
> -           ((flags & RADEON_IS_IGP) == 0))
> +           ((flags & RADEON_IS_IGP) == 0) &&
> +           !pci_is_thunderbolt_attached(rdev->pdev))
>                 flags |= RADEON_IS_PX;
>
>         /* radeon_device_init should report only fatal error
> --
> 2.11.0
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


More information about the dri-devel mailing list