Hi, On Mon, Feb 07, 2022 at 06:47:03PM +0100, Lukas Wunner wrote: > On Mon, Feb 07, 2022 at 03:52:13PM +0000, Deucher, Alexander wrote: > > > From: Mika Westerberg <mika.westerberg@xxxxxxxxxxxxxxx> > > > The other option is to look for ACPI companion (ACPI_COMPANION()) of the > > > device. AFAICT dGPUs don't have one (as the BIOS does not know in advance > > > what will be connected to the hotplug ports) whereas internal does typically > > > have one. > > > > Yeah, this is probably the right way to do this. > > No, that doesn't work. At least Apple represents the first few devices > in the Thunderbolt daisy-chain in the ACPI namespace, so IIUC you'd find > an ACPI companion for those but not for the remainder of the daisy-chain. > This is from a 2019/2020 MacBookPro16,1: > > $ grep 'Device ' acpidump/mbp161/ssdt6.dsl > Device (UPSB) > Device (DSB0) > Device (NHI0) > Device (DSB1) > Device (UPS0) > Device (DSB0) > Device (DEV0) > Device (DSB3) > Device (UPS0) > Device (DSB0) > Device (DEV0) > Device (DSB3) > Device (DEV0) > ... > > There's a *reason* why I introduced the is_thunderbolt flag, > there is no other reliable way to detect externally attached devices. In case of dGPU, the thing (I think) that is needed is whether there is some sort of power resource attached to the root port that allows powering it down or so. That can still be done without is_thunderbolt flag using the current ACPI functions. [ IMHO we should get rid of that flag completely, or rename it to some more generic like "removable" (following USB, perhaps moving to driver core) that allows drivers to check if the device is soldered on the motherboard or hanging off of some hotpluggable port. ]