Re: [PATCH v6] thunderbolt: Add device links for Apple T2 NHI

Greg KH <[email protected]> Fri, 31 Jul 2026 07:49:48 +0200
Newsgroups org.kernel.vger.linux-usb,org.kernel.vger.linux-kernel
Message-ID <2026073154-swoop-outer-70b3@gregkh>
On Thu, Jul 30, 2026 at 06:34:33PM -0400, Atharva Tiwari wrote:
> Ice Lake Thunderbolt NHI That are only on T2 Macs. The NHI and its
> associated PCIe Root Ports all sit directly on the Root Complex
> with no upstream port. Identify the tunneled PCIe Root Ports by
> their PCI IDs and create device links back to the NHI so that
> PCIe tunnels can be re-established after sleep.
> 
> And on other Thunderbolt NHI's, like Titan Ridge, the default method
> is used to add device links.
> 
> Co-developed-by: Andre Eikmeyer <[email protected]>
> Signed-off-by: Andre Eikmeyer <[email protected]>
> 
> Signed-off-by: Atharva Tiwari <[email protected]>

No blank line here please.

> 
> Changes in v6:
> - Used for_each_pci_bridge in Icelake section
> - Removed has_apple_t2_chip as its not required now

These "Changes in" go below the --- line, right?


> +	/* Identify the tunneled PCIe Root Ports by their PCI IDs
> +	 * on Macs with Icelake NHI's
> +	 * and create device links so that
> +	 * PCIe tunnels can be re-established after sleep.
> +	 */
> +	if (nhi->pdev->device == PCI_DEVICE_ID_INTEL_ICL_NHI0 ||
> +		nhi->pdev->device == PCI_DEVICE_ID_INTEL_ICL_NHI1) {
> +		const struct device_link *link;
> +
> +		for_each_pci_bridge(pdev, nhi->pdev->bus) {

How are you able to walk all pci bridges of a pci device without a lock?

> +			if (!pci_is_pcie(pdev) || pci_pcie_type(pdev) != PCI_EXP_TYPE_ROOT_PORT)
> +				continue;
> +
> +			switch (pdev->device) {
> +			case 0x8a1d:
> +			case 0x8a1f:
> +			case 0x8a21:
> +			case 0x8a23:

What are these numbers, shouldn't they be a define?

thanks,

greg k-h