Linux USB
 help / color / mirror / Atom feed
From: Mika Westerberg <mika.westerberg@linux.intel.com>
To: Atharva Tiwari <atharvatiwarilinuxdev@gmail.com>
Cc: Alexander Fischer <alexander.fischer@kait2en.org>,
	Andre Eikmeyer <andre@negmaster.com>,
	Andreas Noever <andreas.noever@gmail.com>,
	Mika Westerberg <westeri@kernel.org>,
	Yehezkel Bernat <YehezkelShB@gmail.com>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v8 3/3] thunderbolt: Add device links for Apple systems with Icelake thunderbolt
Date: Tue, 18 Aug 2026 06:35:29 +0200	[thread overview]
Message-ID: <20260818043529.GR893316@black.igk.intel.com> (raw)
In-Reply-To: <20260817101329.1517-4-atharvatiwarilinuxdev@gmail.com>

On Mon, Aug 17, 2026 at 06:13:24AM -0400, Atharva Tiwari wrote:
> Ice Lake Thunderbolt NHI That are on some 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.
> 
> Tested-by: Alexander Fischer <alexander.fischer@kait2en.org>
> 
> Co-developed-by: Andre Eikmeyer <andre@negmaster.com>
> Signed-off-by: Andre Eikmeyer <andre@negmaster.com>
> 
> Signed-off-by: Atharva Tiwari <atharvatiwarilinuxdev@gmail.com>
> ---
>  drivers/thunderbolt/pci.c | 44 +++++++++++++++++++++++++++++++++++++++
>  1 file changed, 44 insertions(+)
> 
> diff --git a/drivers/thunderbolt/pci.c b/drivers/thunderbolt/pci.c
> index af3a7a9ba..8c0e40fb9 100644
> --- a/drivers/thunderbolt/pci.c
> +++ b/drivers/thunderbolt/pci.c
> @@ -492,6 +492,47 @@ static const struct tb_nhi_ops icl_nhi_ops = {
>  	.init_interrupts = nhi_pci_init_msi,
>  };
>  
> +static bool tb_pci_add_links_icl(struct pci_dev *nhi_pdev)
> +{
> +	struct pci_dev *pdev;
> +	const struct device_link *link;
> +	bool ret = false;
> +
> +	pci_lock_rescan_remove();

Same comment here.

Otherwise this series looks good to me.

> +	for_each_pci_bridge(pdev, nhi_pdev->bus) {
> +		if (!pci_is_pcie(pdev) ||
> +		    pci_pcie_type(pdev) != PCI_EXP_TYPE_ROOT_PORT)
> +			continue;
> +
> +		switch (pdev->device) {
> +		/* Ice Lake Thunderbolt 3 PCIe Root Ports */
> +		case 0x8a1d:
> +		case 0x8a1f:
> +		case 0x8a21:
> +		case 0x8a23:
> +			break;
> +		default:
> +			continue;
> +		}
> +
> +		link = device_link_add(&pdev->dev, &nhi_pdev->dev,
> +				       DL_FLAG_AUTOREMOVE_SUPPLIER |
> +				       DL_FLAG_PM_RUNTIME);
> +		if (link) {
> +			dev_dbg(&nhi_pdev->dev, "created link from %s\n",
> +				dev_name(&pdev->dev));
> +			ret = true;
> +		} else {
> +			dev_warn(&nhi_pdev->dev,
> +				 "device link creation from %s failed\n",
> +				 dev_name(&pdev->dev));
> +		}
> +	}
> +	pci_unlock_rescan_remove();
> +
> +	return ret;
> +}
> +
>  /*
>   * During suspend the Thunderbolt controller is reset and all PCIe
>   * tunnels are lost. The NHI driver will try to reestablish all tunnels
> @@ -514,6 +555,9 @@ bool tb_pci_add_links(struct tb_nhi *nhi)
>  	case PCI_DEVICE_ID_INTEL_TITAN_RIDGE_2C_NHI:
>  	case PCI_DEVICE_ID_INTEL_TITAN_RIDGE_4C_NHI:
>  		return tb_pci_add_links_discrete(nhi_pdev);
> +	case PCI_DEVICE_ID_INTEL_ICL_NHI0:
> +	case PCI_DEVICE_ID_INTEL_ICL_NHI1:
> +		return tb_pci_add_links_icl(nhi_pdev);
>  	default:
>  		return false;
>  	}
> -- 
> 2.43.0

      reply	other threads:[~2026-08-18  4:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-17 10:13 [PATCH v8 0/3] Add Apple T2 NHI Device links Atharva Tiwari
2026-08-17 10:13 ` [PATCH v8 1/3] thunderbolt: Shift tb_apple_add_links to pci.c Atharva Tiwari
2026-08-18  4:34   ` Mika Westerberg
2026-08-17 10:13 ` [PATCH v8 2/3] thunderbolt: Add device links for Apple machines with Titan Ridge Atharva Tiwari
2026-08-17 10:13 ` [PATCH v8 3/3] thunderbolt: Add device links for Apple systems with Icelake thunderbolt Atharva Tiwari
2026-08-18  4:35   ` Mika Westerberg [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260818043529.GR893316@black.igk.intel.com \
    --to=mika.westerberg@linux.intel.com \
    --cc=YehezkelShB@gmail.com \
    --cc=alexander.fischer@kait2en.org \
    --cc=andre@negmaster.com \
    --cc=andreas.noever@gmail.com \
    --cc=atharvatiwarilinuxdev@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=westeri@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox