Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

thunderbolt: Don't create device link from USB4 Host Interface to USB3 xHC host

USB core will create device links between tunneled USB3 devices and
USB4 Host Interface during USB device creation.

Those device links are removed with the tunneled USB3 devices, allowing
USB4 Host Interface to runtime suspend if USB3 tunnels are not used.

So remove device link creation between USB4 Host Interface and USB3 xHC
during NHI probe

Reported-by: Rajaram Regupathy <rajaram.regupathy@intel.com>
Reported-by: Saranya Gopal <saranya.gopal@intel.com>
Tested-by: Saranya Gopal <saranya.gopal@intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Link: https://lore.kernel.org/r/20240830152630.3943215-5-mathias.nyman@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Mathias Nyman and committed by
Greg Kroah-Hartman
f20998f2 f1bfb4a6

+10 -30
+10 -30
drivers/thunderbolt/acpi.c
··· 32 32 goto out_put; 33 33 34 34 /* 35 - * Try to find physical device walking upwards to the hierarcy. 36 - * We need to do this because the xHCI driver might not yet be 37 - * bound so the USB3 SuperSpeed ports are not yet created. 35 + * Ignore USB3 ports here as USB core will set up device links between 36 + * tunneled USB3 devices and NHI host during USB device creation. 37 + * USB3 ports might not even have a physical device yet if xHCI driver 38 + * isn't bound yet. 38 39 */ 39 - do { 40 - dev = acpi_get_first_physical_node(adev); 41 - if (dev) 42 - break; 43 - 44 - adev = acpi_dev_parent(adev); 45 - } while (adev); 46 - 47 - /* 48 - * Check that the device is PCIe. This is because USB3 49 - * SuperSpeed ports have this property and they are not power 50 - * managed with the xHCI and the SuperSpeed hub so we create the 51 - * link from xHCI instead. 52 - */ 53 - while (dev && !dev_is_pci(dev)) 54 - dev = dev->parent; 55 - 56 - if (!dev) 40 + dev = acpi_get_first_physical_node(adev); 41 + if (!dev || !dev_is_pci(dev)) 57 42 goto out_put; 58 43 59 - /* 60 - * Check that this actually matches the type of device we 61 - * expect. It should either be xHCI or PCIe root/downstream 62 - * port. 63 - */ 44 + /* Check that this matches a PCIe root/downstream port. */ 64 45 pdev = to_pci_dev(dev); 65 - if (pdev->class == PCI_CLASS_SERIAL_USB_XHCI || 66 - (pci_is_pcie(pdev) && 67 - (pci_pcie_type(pdev) == PCI_EXP_TYPE_ROOT_PORT || 68 - pci_pcie_type(pdev) == PCI_EXP_TYPE_DOWNSTREAM))) { 46 + if (pci_is_pcie(pdev) && 47 + (pci_pcie_type(pdev) == PCI_EXP_TYPE_ROOT_PORT || 48 + pci_pcie_type(pdev) == PCI_EXP_TYPE_DOWNSTREAM)) { 69 49 const struct device_link *link; 70 50 71 51 /*