Linux PCI subsystem development
 help / color / mirror / Atom feed
* [PATCH] thunderbolt: Use is_pciehp instead of is_hotplug_bridge
@ 2025-08-12 13:42 Lukas Wunner
  2025-08-13  7:42 ` Mika Westerberg
  2025-08-13 17:25 ` Bjorn Helgaas
  0 siblings, 2 replies; 4+ messages in thread
From: Lukas Wunner @ 2025-08-12 13:42 UTC (permalink / raw)
  To: Mika Westerberg, Bjorn Helgaas
  Cc: Andreas Noever, Michael Jamet, Yehezkel Bernat, linux-usb,
	linux-pci

The thunderbolt driver sets up device link dependencies from hotplug ports
to the Host Router (aka Native Host Interface, NHI).  When resuming from
system sleep, this allows the Host Router to re-establish tunnels to
attached Thunderbolt devices before the hotplug ports resume.

To identify the hotplug ports, the driver utilizes the is_hotplug_bridge
flag which also encompasses ACPI slots handled by the ACPI hotplug driver.

Thunderbolt hotplug ports are always Hot-Plug Capable PCIe ports, so it is
more apt to identify them with the is_pciehp flag.

Similarly, hotplug ports on older Thunderbolt controllers have broken MSI
support and are quirked to use legacy INTx interrupts instead.  The quirk
identifies them with is_hotplug_bridge, even though all affected ports are
also matched by is_pciehp.  So use is_pciehp here as well.

Signed-off-by: Lukas Wunner <lukas@wunner.de>
---
The is_pciehp flag was introduced by commit 6cff20ce3b92 ("PCI/ACPI: Fix
runtime PM ref imbalance on Hot-Plug Capable ports"), which appeared in
v6.17-rc1.  This patch is submitted separately because it is intended
to be applied through thunderbolt.git instead of pci.git.  Thanks!

 drivers/pci/quirks.c     | 2 +-
 drivers/thunderbolt/tb.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index d97335a..17315a8 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -3829,7 +3829,7 @@ static void quirk_no_pm_reset(struct pci_dev *dev)
  */
 static void quirk_thunderbolt_hotplug_msi(struct pci_dev *pdev)
 {
-	if (pdev->is_hotplug_bridge &&
+	if (pdev->is_pciehp &&
 	    (pdev->device != PCI_DEVICE_ID_INTEL_CACTUS_RIDGE_4C ||
 	     pdev->revision <= 1))
 		pdev->no_msi = 1;
diff --git a/drivers/thunderbolt/tb.c b/drivers/thunderbolt/tb.c
index c14ab1f..83a33fc 100644
--- a/drivers/thunderbolt/tb.c
+++ b/drivers/thunderbolt/tb.c
@@ -3336,7 +3336,7 @@ static bool tb_apple_add_links(struct tb_nhi *nhi)
 		if (!pci_is_pcie(pdev))
 			continue;
 		if (pci_pcie_type(pdev) != PCI_EXP_TYPE_DOWNSTREAM ||
-		    !pdev->is_hotplug_bridge)
+		    !pdev->is_pciehp)
 			continue;
 
 		link = device_link_add(&pdev->dev, &nhi->pdev->dev,
-- 
2.47.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] thunderbolt: Use is_pciehp instead of is_hotplug_bridge
  2025-08-12 13:42 [PATCH] thunderbolt: Use is_pciehp instead of is_hotplug_bridge Lukas Wunner
@ 2025-08-13  7:42 ` Mika Westerberg
  2025-08-13 17:25 ` Bjorn Helgaas
  1 sibling, 0 replies; 4+ messages in thread
From: Mika Westerberg @ 2025-08-13  7:42 UTC (permalink / raw)
  To: Lukas Wunner
  Cc: Mika Westerberg, Bjorn Helgaas, Andreas Noever, Michael Jamet,
	Yehezkel Bernat, linux-usb, linux-pci

Hi,

On Tue, Aug 12, 2025 at 03:42:29PM +0200, Lukas Wunner wrote:
> The thunderbolt driver sets up device link dependencies from hotplug ports
> to the Host Router (aka Native Host Interface, NHI).  When resuming from
> system sleep, this allows the Host Router to re-establish tunnels to
> attached Thunderbolt devices before the hotplug ports resume.
> 
> To identify the hotplug ports, the driver utilizes the is_hotplug_bridge
> flag which also encompasses ACPI slots handled by the ACPI hotplug driver.
> 
> Thunderbolt hotplug ports are always Hot-Plug Capable PCIe ports, so it is
> more apt to identify them with the is_pciehp flag.
> 
> Similarly, hotplug ports on older Thunderbolt controllers have broken MSI
> support and are quirked to use legacy INTx interrupts instead.  The quirk
> identifies them with is_hotplug_bridge, even though all affected ports are
> also matched by is_pciehp.  So use is_pciehp here as well.
> 
> Signed-off-by: Lukas Wunner <lukas@wunner.de>
> ---
> The is_pciehp flag was introduced by commit 6cff20ce3b92 ("PCI/ACPI: Fix
> runtime PM ref imbalance on Hot-Plug Capable ports"), which appeared in
> v6.17-rc1.  This patch is submitted separately because it is intended
> to be applied through thunderbolt.git instead of pci.git.  Thanks!

Happy to take it, but I think I need an Ack from Bjorn as it touches PCI
too.

>  drivers/pci/quirks.c     | 2 +-
>  drivers/thunderbolt/tb.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
> index d97335a..17315a8 100644
> --- a/drivers/pci/quirks.c
> +++ b/drivers/pci/quirks.c
> @@ -3829,7 +3829,7 @@ static void quirk_no_pm_reset(struct pci_dev *dev)
>   */
>  static void quirk_thunderbolt_hotplug_msi(struct pci_dev *pdev)
>  {
> -	if (pdev->is_hotplug_bridge &&
> +	if (pdev->is_pciehp &&
>  	    (pdev->device != PCI_DEVICE_ID_INTEL_CACTUS_RIDGE_4C ||
>  	     pdev->revision <= 1))
>  		pdev->no_msi = 1;
> diff --git a/drivers/thunderbolt/tb.c b/drivers/thunderbolt/tb.c
> index c14ab1f..83a33fc 100644
> --- a/drivers/thunderbolt/tb.c
> +++ b/drivers/thunderbolt/tb.c
> @@ -3336,7 +3336,7 @@ static bool tb_apple_add_links(struct tb_nhi *nhi)
>  		if (!pci_is_pcie(pdev))
>  			continue;
>  		if (pci_pcie_type(pdev) != PCI_EXP_TYPE_DOWNSTREAM ||
> -		    !pdev->is_hotplug_bridge)
> +		    !pdev->is_pciehp)
>  			continue;
>  
>  		link = device_link_add(&pdev->dev, &nhi->pdev->dev,
> -- 
> 2.47.2

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] thunderbolt: Use is_pciehp instead of is_hotplug_bridge
  2025-08-12 13:42 [PATCH] thunderbolt: Use is_pciehp instead of is_hotplug_bridge Lukas Wunner
  2025-08-13  7:42 ` Mika Westerberg
@ 2025-08-13 17:25 ` Bjorn Helgaas
  2025-08-14  4:37   ` Mika Westerberg
  1 sibling, 1 reply; 4+ messages in thread
From: Bjorn Helgaas @ 2025-08-13 17:25 UTC (permalink / raw)
  To: Lukas Wunner
  Cc: Mika Westerberg, Andreas Noever, Michael Jamet, Yehezkel Bernat,
	linux-usb, linux-pci

On Tue, Aug 12, 2025 at 03:42:29PM +0200, Lukas Wunner wrote:
> The thunderbolt driver sets up device link dependencies from hotplug ports
> to the Host Router (aka Native Host Interface, NHI).  When resuming from
> system sleep, this allows the Host Router to re-establish tunnels to
> attached Thunderbolt devices before the hotplug ports resume.
> 
> To identify the hotplug ports, the driver utilizes the is_hotplug_bridge
> flag which also encompasses ACPI slots handled by the ACPI hotplug driver.
> 
> Thunderbolt hotplug ports are always Hot-Plug Capable PCIe ports, so it is
> more apt to identify them with the is_pciehp flag.
> 
> Similarly, hotplug ports on older Thunderbolt controllers have broken MSI
> support and are quirked to use legacy INTx interrupts instead.  The quirk
> identifies them with is_hotplug_bridge, even though all affected ports are
> also matched by is_pciehp.  So use is_pciehp here as well.
> 
> Signed-off-by: Lukas Wunner <lukas@wunner.de>

Acked-by: Bjorn Helgaas <bhelgaas@google.com>

> ---
> The is_pciehp flag was introduced by commit 6cff20ce3b92 ("PCI/ACPI: Fix
> runtime PM ref imbalance on Hot-Plug Capable ports"), which appeared in
> v6.17-rc1.  This patch is submitted separately because it is intended
> to be applied through thunderbolt.git instead of pci.git.  Thanks!
> 
>  drivers/pci/quirks.c     | 2 +-
>  drivers/thunderbolt/tb.c | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
> index d97335a..17315a8 100644
> --- a/drivers/pci/quirks.c
> +++ b/drivers/pci/quirks.c
> @@ -3829,7 +3829,7 @@ static void quirk_no_pm_reset(struct pci_dev *dev)
>   */
>  static void quirk_thunderbolt_hotplug_msi(struct pci_dev *pdev)
>  {
> -	if (pdev->is_hotplug_bridge &&
> +	if (pdev->is_pciehp &&
>  	    (pdev->device != PCI_DEVICE_ID_INTEL_CACTUS_RIDGE_4C ||
>  	     pdev->revision <= 1))
>  		pdev->no_msi = 1;
> diff --git a/drivers/thunderbolt/tb.c b/drivers/thunderbolt/tb.c
> index c14ab1f..83a33fc 100644
> --- a/drivers/thunderbolt/tb.c
> +++ b/drivers/thunderbolt/tb.c
> @@ -3336,7 +3336,7 @@ static bool tb_apple_add_links(struct tb_nhi *nhi)
>  		if (!pci_is_pcie(pdev))
>  			continue;
>  		if (pci_pcie_type(pdev) != PCI_EXP_TYPE_DOWNSTREAM ||
> -		    !pdev->is_hotplug_bridge)
> +		    !pdev->is_pciehp)
>  			continue;
>  
>  		link = device_link_add(&pdev->dev, &nhi->pdev->dev,
> -- 
> 2.47.2
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] thunderbolt: Use is_pciehp instead of is_hotplug_bridge
  2025-08-13 17:25 ` Bjorn Helgaas
@ 2025-08-14  4:37   ` Mika Westerberg
  0 siblings, 0 replies; 4+ messages in thread
From: Mika Westerberg @ 2025-08-14  4:37 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Lukas Wunner, Mika Westerberg, Andreas Noever, Michael Jamet,
	Yehezkel Bernat, linux-usb, linux-pci

On Wed, Aug 13, 2025 at 12:25:52PM -0500, Bjorn Helgaas wrote:
> On Tue, Aug 12, 2025 at 03:42:29PM +0200, Lukas Wunner wrote:
> > The thunderbolt driver sets up device link dependencies from hotplug ports
> > to the Host Router (aka Native Host Interface, NHI).  When resuming from
> > system sleep, this allows the Host Router to re-establish tunnels to
> > attached Thunderbolt devices before the hotplug ports resume.
> > 
> > To identify the hotplug ports, the driver utilizes the is_hotplug_bridge
> > flag which also encompasses ACPI slots handled by the ACPI hotplug driver.
> > 
> > Thunderbolt hotplug ports are always Hot-Plug Capable PCIe ports, so it is
> > more apt to identify them with the is_pciehp flag.
> > 
> > Similarly, hotplug ports on older Thunderbolt controllers have broken MSI
> > support and are quirked to use legacy INTx interrupts instead.  The quirk
> > identifies them with is_hotplug_bridge, even though all affected ports are
> > also matched by is_pciehp.  So use is_pciehp here as well.
> > 
> > Signed-off-by: Lukas Wunner <lukas@wunner.de>
> 
> Acked-by: Bjorn Helgaas <bhelgaas@google.com>

Applied to thunderbolt.git/next, thanks!

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-08-14  4:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-12 13:42 [PATCH] thunderbolt: Use is_pciehp instead of is_hotplug_bridge Lukas Wunner
2025-08-13  7:42 ` Mika Westerberg
2025-08-13 17:25 ` Bjorn Helgaas
2025-08-14  4:37   ` Mika Westerberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox