On Wed, Mar 08, 2017 at 11:46:33AM +0100, Peter Wu wrote: > On Wed, Mar 08, 2017 at 06:01:54AM +0100, Lukas Wunner wrote: > > On Tue, Mar 07, 2017 at 03:30:30PM -0500, Alex Deucher wrote: > > > 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 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. > > > > Is there public documentation on these methods somewhere? > > The ACPI interface is documented in > drivers/gpu/drm/amd/include/amd_acpi.h while > drivers/gpu/drm/amd/amdgpu/amdgpu_atpx_handler.c contains some glue for > ACPI and the amdgpu driver (similar code exists for radeon). Ah, thanks Peter. Unfortunately this method will not work on Macs. So I guess on those we're again dependent on deducing whether a dGPU is internal or external by looking at the PCI hierarchy. However on non-Macs it seems that ATIF_FUNCTION_GET_GRAPHICS_DEVICE_TYPES should return the type for each built-in GPU. @Alex: How reliable is this, e.g. is it possible that vendors may have forgotten to set these bits in the BIOS? If we depend on ATIF to determine the type of a dGPU and the information returned is incorrect, we risk not registering a device when we actually should, thus causing a regression. Also, could you explain which of these types should be registered with vga_switcheroo and which shouldn't? Likewise, which of these can be powered down by the platform and should thus use the vga_switcheroo power domain? ATIF_PX_REMOVABLE_GRAPHICS_DEVICE ATIF_XGP_PORT ATIF_VGA_ENABLED_GRAPHICS_DEVICE ATIF_XGP_PORT_IN_DOCK Thanks, Lukas