Hi, On Mon, Apr 15, 2024 at 06:34:00PM -0400, Esther Shimanovich wrote: > Hey! > Asking for some help on implementation. > So I implemented most of this, and successfully tested the quirk on 6 > different devices with various types of discrete fixed JHL Thunderbolt > chips. > > However I want to add an additional check. A device wouldn't need this > quirk if it already has Thunderbolt functionality built in within its > Root Port. There is really no "Thunderbolt functionality built in within its Root Port". More accurate is that the Thunderbolt/USB4 controller is integrated into the CPU and the PCIe tunnels go out through the CPU PCIe Root Ports. > I tried to use "is_thunderbolt" as an identifier for that type of > device--- but when I tested on a device with a thunderbolt root port, > "is_thunderbolt" was false for all the Thunderbolt PCI components > listed below. You should not use is_thunderbolt for anything else than with the legacy Apple systems. > ~ # lspci -nn | grep Thunderbolt > 00:07.0 PCI bridge [0604]: Intel Corporation Tiger Lake-LP Thunderbolt > 4 PCI Express Root Port #1 [8086:9a25] (rev 01) > 00:07.2 PCI bridge [0604]: Intel Corporation Tiger Lake-LP Thunderbolt > 4 PCI Express Root Port #2 [8086:9a27] (rev 01) > 00:0d.0 USB controller [0c03]: Intel Corporation Tiger Lake-LP > Thunderbolt 4 USB Controller [8086:9a13] (rev 01) > 00:0d.2 USB controller [0c03]: Intel Corporation Tiger Lake-LP > Thunderbolt 4 NHI #0 [8086:9a1b] (rev 01) > 00:0d.3 USB controller [0c03]: Intel Corporation Tiger Lake-LP > Thunderbolt 4 NHI #1 [8086:9a1d] (rev 01) Okay this is integrated Thunderbolt/USB4 controller. > The device I tested was the Lenovo carbon X1 Gen 9. When > set_pcie_thunderbolt is run, the devices listed above return false on > the pci_find_next_ext_capability check. > > I have spent some time trying to see if there are any ACPI values or > any alternative indicators to reliably know if a root port has > thunderbolt capabilities. I do see that ADBG is often set to TBT but > that looks like a debugging tool in ACPI. > > I also looked through lspci -vvv and compared the output with a device > that has no Thunderbolt built into its CPU, which gave me nothing. For integrated and most recent systems (that's with the software connection manager) the tunneled PCIe ports (Root or Downstream) can be identified by looking at "usb4-host-interface" ACPI _DSD property. In addition to this there is the "External Facing Port" ACPI _DSD property attached to them too. Maybe these help? With the firmware connection manager there is only the "External Facing Port" _DSD though. The Microsoft documentation for this that we also use in Linux is here: https://learn.microsoft.com/en-us/windows-hardware/drivers/pci/dsd-for-pcie-root-ports