Linux kernel -stable discussions
 help / color / mirror / Atom feed
* [PATCH v3] drivers/pci: Decouple DPC from AER service
       [not found] <aTfTiBy1GoJIFqtJ@wunner.de>
@ 2025-12-11 16:42 ` Darshit Shah
  2026-02-28 23:59   ` Darshit Shah
  2026-07-10 17:00   ` Bjorn Helgaas
  0 siblings, 2 replies; 5+ messages in thread
From: Darshit Shah @ 2025-12-11 16:42 UTC (permalink / raw)
  To: lukas
  Cc: Jonthan.Cameron, bhelgaas, darnir, darnshah, feng.tang, kbusch,
	kwilczynski, linux-kernel, linux-pci, nh-open-source, olof,
	sathyanarayanan.kuppuswamy, stable

According to PCIe r7.0, sec. 6.2.11, "Implementation Note: Determination
of DPC Control", it is recommended that the Operating System link the
enablement of Downstream Port Containment (DPC) to the enablement of
Advanced Error Reporting (AER).

However, AER is advertised only on Root Port (RP) or Root Complex Event
Collector (RCEC) devices. On the other hand, DPC may be advertised on
any PCIe device in the hierarchy. In fact, since the main usecase of DPC
is for the switch upstream of an endpoint device to trigger a signal to
the host-bridge, it is imperative that it be supported on non-RP,
non-RCEC devices.

Previously portdrv has interpreted the spec to mean that the AER service
must be available on the same device in order for DPC to be available.
This is not what the implementation note meant to imply. If the firmware
hands Linux control of AER via _OSC on the host bridge upstream of the
device, then Linux should be allowed to assume control of DPC on the device.

The comment above this check alludes to this, by saying:
  > With dpc-native, allow Linux to use DPC even if it doesn't have
  > permission to use AER.

However, permission to use AER is negotiated at the host bridge, not
per-device. So we should not link DPC to enabling AER at the device.
Instead, DPC should be enabled if the OS has control of AER for the
host bridge that is upstream of the device in question, or if dpc-native
was set on the command line.

Cc: stable@vger.kernel.org
Signed-off-by: Darshit Shah <darnshah@amazon.de>
Reviewed-by: Lukas Wunner <lukas@wunner.de>
Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
---
Changes from v2:
  * + stable@vger.kernel.org since moving to v6.2+ breaks DPC on our systems
  * Minor stylistic changes to commit message
  * NO functional changes

 drivers/pci/pcie/portdrv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pci/pcie/portdrv.c b/drivers/pci/pcie/portdrv.c
index 38a41ccf79b9..8db2fa140ae2 100644
--- a/drivers/pci/pcie/portdrv.c
+++ b/drivers/pci/pcie/portdrv.c
@@ -264,7 +264,7 @@ static int get_port_device_capability(struct pci_dev *dev)
 	 */
 	if (pci_find_ext_capability(dev, PCI_EXT_CAP_ID_DPC) &&
 	    pci_aer_available() &&
-	    (pcie_ports_dpc_native || (services & PCIE_PORT_SERVICE_AER)))
+	    (host->native_aer || pcie_ports_dpc_native))
 		services |= PCIE_PORT_SERVICE_DPC;
 
 	/* Enable bandwidth control if more than one speed is supported. */
-- 
2.47.3




Amazon Web Services Development Center Germany GmbH
Tamara-Danz-Str. 13
10243 Berlin
Geschaeftsfuehrung: Christof Hellmis, Andreas Stieger
Eingetragen am Amtsgericht Charlottenburg unter HRB 257764 B
Sitz: Berlin
Ust-ID: DE 365 538 597


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

* Re: [PATCH v3] drivers/pci: Decouple DPC from AER service
  2025-12-11 16:42 ` [PATCH v3] drivers/pci: Decouple DPC from AER service Darshit Shah
@ 2026-02-28 23:59   ` Darshit Shah
  2026-07-10 17:00   ` Bjorn Helgaas
  1 sibling, 0 replies; 5+ messages in thread
From: Darshit Shah @ 2026-02-28 23:59 UTC (permalink / raw)
  To: darnshah
  Cc: Jonthan.Cameron, bhelgaas, darnir, feng.tang, kbusch, kwilczynski,
	linux-kernel, linux-pci, lukas, nh-open-source, olof,
	sathyanarayanan.kuppuswamy, stable

Hi Bjorn,

I'd like to follow up on the v3 of the patch submitted earlier and see if
we can merge them.



Amazon Web Services Development Center Germany GmbH
Tamara-Danz-Str. 13
10243 Berlin
Geschaeftsfuehrung: Christof Hellmis, Andreas Stieger
Eingetragen am Amtsgericht Charlottenburg unter HRB 257764 B
Sitz: Berlin
Ust-ID: DE 365 538 597


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

* Re: [PATCH v3] drivers/pci: Decouple DPC from AER service
  2025-12-11 16:42 ` [PATCH v3] drivers/pci: Decouple DPC from AER service Darshit Shah
  2026-02-28 23:59   ` Darshit Shah
@ 2026-07-10 17:00   ` Bjorn Helgaas
  2026-07-11 13:54     ` Darshit Shah
  2026-07-11 16:08     ` Bjorn Helgaas
  1 sibling, 2 replies; 5+ messages in thread
From: Bjorn Helgaas @ 2026-07-10 17:00 UTC (permalink / raw)
  To: Darshit Shah
  Cc: lukas, Jonthan.Cameron, bhelgaas, darnir, feng.tang, kbusch,
	kwilczynski, linux-kernel, linux-pci, nh-open-source, olof,
	sathyanarayanan.kuppuswamy, stable

On Thu, Dec 11, 2025 at 04:42:53PM +0000, Darshit Shah wrote:
> According to PCIe r7.0, sec. 6.2.11, "Implementation Note: Determination
> of DPC Control", it is recommended that the Operating System link the
> enablement of Downstream Port Containment (DPC) to the enablement of
> Advanced Error Reporting (AER).
> 
> However, AER is advertised only on Root Port (RP) or Root Complex Event
> Collector (RCEC) devices. On the other hand, DPC may be advertised on
> any PCIe device in the hierarchy. In fact, since the main usecase of DPC
> is for the switch upstream of an endpoint device to trigger a signal to
> the host-bridge, it is imperative that it be supported on non-RP,
> non-RCEC devices.
> 
> Previously portdrv has interpreted the spec to mean that the AER service
> must be available on the same device in order for DPC to be available.
> This is not what the implementation note meant to imply. If the firmware
> hands Linux control of AER via _OSC on the host bridge upstream of the
> device, then Linux should be allowed to assume control of DPC on the device.
> 
> The comment above this check alludes to this, by saying:
>   > With dpc-native, allow Linux to use DPC even if it doesn't have
>   > permission to use AER.
> 
> However, permission to use AER is negotiated at the host bridge, not
> per-device. So we should not link DPC to enabling AER at the device.
> Instead, DPC should be enabled if the OS has control of AER for the
> host bridge that is upstream of the device in question, or if dpc-native
> was set on the command line.
> 
> Cc: stable@vger.kernel.org
> Signed-off-by: Darshit Shah <darnshah@amazon.de>
> Reviewed-by: Lukas Wunner <lukas@wunner.de>
> Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>

Sorry for the delay in picking this up.  Thanks for doing this; I
think it's the right thing.  I think the commit log is not completely
accurate in terms on which devices advertise AER and DPC, so I propose
the following.  I also reordered the || operands to make the patch
easier to read.  Your thoughts?


commit 97ca178c899d ("PCI/DPC: Allow DPC on all Downstream Ports when OS controls AER")
Author: Darshit Shah <darnshah@amazon.de>
Date:   Thu Dec 11 16:42:53 2025 +0000

    PCI/DPC: Allow DPC on all Downstream Ports when OS controls AER
    
    PCIe r7.0, sec 6.2.11, "Implementation Note: Determination of DPC Control",
    recommends that "... operating systems always link control of DPC to the
    control of Advanced Error Reporting."
    
    Any PCIe device may advertise AER, but only Root Ports and Root Complex
    Event Collectors can generate AER interrupts, so the AER driver only binds
    to RPs and RCECs.
    
    Any Root Port or Switch Downstream Port may advertise Downstream Port
    Containment (DPC), but previously the DPC driver was limited to devices the
    AER driver could bind to, i.e., only RPs that advertised AER.
    
    Since any Port with DPC can generate DPC interrupts, allow the DPC driver
    to bind to such a Port as long as the OS controls AER, regardless of
    whether the AER driver binds to it.
    
    Signed-off-by: Darshit Shah <darnshah@amazon.de>
    [bhelgaas: commit log, reorder || operands to simplify patch]
    Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
    Reviewed-by: Lukas Wunner <lukas@wunner.de>
    Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
    Cc: stable@vger.kernel.org
    Link: https://patch.msgid.link/20251211164257.81655-1-darnshah@amazon.de


diff --git a/drivers/pci/pcie/portdrv.c b/drivers/pci/pcie/portdrv.c
index 2d6aa488fe7b..65f502602dee 100644
--- a/drivers/pci/pcie/portdrv.c
+++ b/drivers/pci/pcie/portdrv.c
@@ -264,7 +264,7 @@ static int get_port_device_capability(struct pci_dev *dev)
 	 */
 	if (pci_find_ext_capability(dev, PCI_EXT_CAP_ID_DPC) &&
 	    pci_aer_available() &&
-	    (pcie_ports_dpc_native || (services & PCIE_PORT_SERVICE_AER)))
+	    (pcie_ports_dpc_native || host->native_aer))
 		services |= PCIE_PORT_SERVICE_DPC;
 
 	/* Enable bandwidth control if more than one speed is supported. */

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

* Re: [PATCH v3] drivers/pci: Decouple DPC from AER service
  2026-07-10 17:00   ` Bjorn Helgaas
@ 2026-07-11 13:54     ` Darshit Shah
  2026-07-11 16:08     ` Bjorn Helgaas
  1 sibling, 0 replies; 5+ messages in thread
From: Darshit Shah @ 2026-07-11 13:54 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: lukas, Jonthan.Cameron, bhelgaas, darnir, feng.tang, kbusch,
	kwilczynski, linux-kernel, linux-pci, nh-open-source, olof,
	sathyanarayanan.kuppuswamy, stable

* Bjorn Helgaas <helgaas@kernel.org> [260710 17:00]:
> On Thu, Dec 11, 2025 at 04:42:53PM +0000, Darshit Shah wrote:
> > According to PCIe r7.0, sec. 6.2.11, "Implementation Note: Determination
> > of DPC Control", it is recommended that the Operating System link the
> > enablement of Downstream Port Containment (DPC) to the enablement of
> > Advanced Error Reporting (AER).
> > 
> > However, AER is advertised only on Root Port (RP) or Root Complex Event
> > Collector (RCEC) devices. On the other hand, DPC may be advertised on
> > any PCIe device in the hierarchy. In fact, since the main usecase of DPC
> > is for the switch upstream of an endpoint device to trigger a signal to
> > the host-bridge, it is imperative that it be supported on non-RP,
> > non-RCEC devices.
> > 
> > Previously portdrv has interpreted the spec to mean that the AER service
> > must be available on the same device in order for DPC to be available.
> > This is not what the implementation note meant to imply. If the firmware
> > hands Linux control of AER via _OSC on the host bridge upstream of the
> > device, then Linux should be allowed to assume control of DPC on the device.
> > 
> > The comment above this check alludes to this, by saying:
> >   > With dpc-native, allow Linux to use DPC even if it doesn't have
> >   > permission to use AER.
> > 
> > However, permission to use AER is negotiated at the host bridge, not
> > per-device. So we should not link DPC to enabling AER at the device.
> > Instead, DPC should be enabled if the OS has control of AER for the
> > host bridge that is upstream of the device in question, or if dpc-native
> > was set on the command line.
> > 
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Darshit Shah <darnshah@amazon.de>
> > Reviewed-by: Lukas Wunner <lukas@wunner.de>
> > Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
> 
> Sorry for the delay in picking this up.  Thanks for doing this; I
> think it's the right thing.  I think the commit log is not completely
> accurate in terms on which devices advertise AER and DPC, so I propose
> the following.  I also reordered the || operands to make the patch
> easier to read.  Your thoughts?
> 
Thanks. I think the commit log is more succint and accurate now. I'm okay with it.

> 
> commit 97ca178c899d ("PCI/DPC: Allow DPC on all Downstream Ports when OS controls AER")
> Author: Darshit Shah <darnshah@amazon.de>
> Date:   Thu Dec 11 16:42:53 2025 +0000
> 
>     PCI/DPC: Allow DPC on all Downstream Ports when OS controls AER
>     
>     PCIe r7.0, sec 6.2.11, "Implementation Note: Determination of DPC Control",
>     recommends that "... operating systems always link control of DPC to the
>     control of Advanced Error Reporting."
>     
>     Any PCIe device may advertise AER, but only Root Ports and Root Complex
>     Event Collectors can generate AER interrupts, so the AER driver only binds
>     to RPs and RCECs.
>     
>     Any Root Port or Switch Downstream Port may advertise Downstream Port
>     Containment (DPC), but previously the DPC driver was limited to devices the
>     AER driver could bind to, i.e., only RPs that advertised AER.
>     
>     Since any Port with DPC can generate DPC interrupts, allow the DPC driver
>     to bind to such a Port as long as the OS controls AER, regardless of
>     whether the AER driver binds to it.
>     
>     Signed-off-by: Darshit Shah <darnshah@amazon.de>
>     [bhelgaas: commit log, reorder || operands to simplify patch]
>     Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
>     Reviewed-by: Lukas Wunner <lukas@wunner.de>
>     Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
>     Cc: stable@vger.kernel.org
>     Link: https://patch.msgid.link/20251211164257.81655-1-darnshah@amazon.de
> 
> 
> diff --git a/drivers/pci/pcie/portdrv.c b/drivers/pci/pcie/portdrv.c
> index 2d6aa488fe7b..65f502602dee 100644
> --- a/drivers/pci/pcie/portdrv.c
> +++ b/drivers/pci/pcie/portdrv.c
> @@ -264,7 +264,7 @@ static int get_port_device_capability(struct pci_dev *dev)
>  	 */
>  	if (pci_find_ext_capability(dev, PCI_EXT_CAP_ID_DPC) &&
>  	    pci_aer_available() &&
> -	    (pcie_ports_dpc_native || (services & PCIE_PORT_SERVICE_AER)))
> +	    (pcie_ports_dpc_native || host->native_aer))
>  		services |= PCIE_PORT_SERVICE_DPC;
>  
>  	/* Enable bandwidth control if more than one speed is supported. */

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

* Re: [PATCH v3] drivers/pci: Decouple DPC from AER service
  2026-07-10 17:00   ` Bjorn Helgaas
  2026-07-11 13:54     ` Darshit Shah
@ 2026-07-11 16:08     ` Bjorn Helgaas
  1 sibling, 0 replies; 5+ messages in thread
From: Bjorn Helgaas @ 2026-07-11 16:08 UTC (permalink / raw)
  To: Darshit Shah
  Cc: lukas, Jonthan.Cameron, bhelgaas, darnir, feng.tang, kbusch,
	kwilczynski, linux-kernel, linux-pci, nh-open-source, olof,
	sathyanarayanan.kuppuswamy, stable

On Fri, Jul 10, 2026 at 12:00:57PM -0500, Bjorn Helgaas wrote:
> On Thu, Dec 11, 2025 at 04:42:53PM +0000, Darshit Shah wrote:
> > According to PCIe r7.0, sec. 6.2.11, "Implementation Note: Determination
> > of DPC Control", it is recommended that the Operating System link the
> > enablement of Downstream Port Containment (DPC) to the enablement of
> > Advanced Error Reporting (AER).
> > 
> > However, AER is advertised only on Root Port (RP) or Root Complex Event
> > Collector (RCEC) devices. On the other hand, DPC may be advertised on
> > any PCIe device in the hierarchy. In fact, since the main usecase of DPC
> > is for the switch upstream of an endpoint device to trigger a signal to
> > the host-bridge, it is imperative that it be supported on non-RP,
> > non-RCEC devices.
> > 
> > Previously portdrv has interpreted the spec to mean that the AER service
> > must be available on the same device in order for DPC to be available.
> > This is not what the implementation note meant to imply. If the firmware
> > hands Linux control of AER via _OSC on the host bridge upstream of the
> > device, then Linux should be allowed to assume control of DPC on the device.
> > 
> > The comment above this check alludes to this, by saying:
> >   > With dpc-native, allow Linux to use DPC even if it doesn't have
> >   > permission to use AER.
> > 
> > However, permission to use AER is negotiated at the host bridge, not
> > per-device. So we should not link DPC to enabling AER at the device.
> > Instead, DPC should be enabled if the OS has control of AER for the
> > host bridge that is upstream of the device in question, or if dpc-native
> > was set on the command line.
> > 
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Darshit Shah <darnshah@amazon.de>
> > Reviewed-by: Lukas Wunner <lukas@wunner.de>
> > Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
> 
> Sorry for the delay in picking this up.  Thanks for doing this; I
> think it's the right thing.  I think the commit log is not completely
> accurate in terms on which devices advertise AER and DPC, so I propose
> the following.  I also reordered the || operands to make the patch
> easier to read.  Your thoughts?

Path below applied to pci/dpc for v7.3, thanks, Darshit!

I'm actually a little surprised that this wasn't an issue earlier.  I
guess DPC hasn't really been exercised on switches.

> commit 97ca178c899d ("PCI/DPC: Allow DPC on all Downstream Ports when OS controls AER")
> Author: Darshit Shah <darnshah@amazon.de>
> Date:   Thu Dec 11 16:42:53 2025 +0000
> 
>     PCI/DPC: Allow DPC on all Downstream Ports when OS controls AER
>     
>     PCIe r7.0, sec 6.2.11, "Implementation Note: Determination of DPC Control",
>     recommends that "... operating systems always link control of DPC to the
>     control of Advanced Error Reporting."
>     
>     Any PCIe device may advertise AER, but only Root Ports and Root Complex
>     Event Collectors can generate AER interrupts, so the AER driver only binds
>     to RPs and RCECs.
>     
>     Any Root Port or Switch Downstream Port may advertise Downstream Port
>     Containment (DPC), but previously the DPC driver was limited to devices the
>     AER driver could bind to, i.e., only RPs that advertised AER.
>     
>     Since any Port with DPC can generate DPC interrupts, allow the DPC driver
>     to bind to such a Port as long as the OS controls AER, regardless of
>     whether the AER driver binds to it.
>     
>     Signed-off-by: Darshit Shah <darnshah@amazon.de>
>     [bhelgaas: commit log, reorder || operands to simplify patch]
>     Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
>     Reviewed-by: Lukas Wunner <lukas@wunner.de>
>     Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
>     Cc: stable@vger.kernel.org
>     Link: https://patch.msgid.link/20251211164257.81655-1-darnshah@amazon.de
> 
> 
> diff --git a/drivers/pci/pcie/portdrv.c b/drivers/pci/pcie/portdrv.c
> index 2d6aa488fe7b..65f502602dee 100644
> --- a/drivers/pci/pcie/portdrv.c
> +++ b/drivers/pci/pcie/portdrv.c
> @@ -264,7 +264,7 @@ static int get_port_device_capability(struct pci_dev *dev)
>  	 */
>  	if (pci_find_ext_capability(dev, PCI_EXT_CAP_ID_DPC) &&
>  	    pci_aer_available() &&
> -	    (pcie_ports_dpc_native || (services & PCIE_PORT_SERVICE_AER)))
> +	    (pcie_ports_dpc_native || host->native_aer))
>  		services |= PCIE_PORT_SERVICE_DPC;
>  
>  	/* Enable bandwidth control if more than one speed is supported. */

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

end of thread, other threads:[~2026-07-11 16:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <aTfTiBy1GoJIFqtJ@wunner.de>
2025-12-11 16:42 ` [PATCH v3] drivers/pci: Decouple DPC from AER service Darshit Shah
2026-02-28 23:59   ` Darshit Shah
2026-07-10 17:00   ` Bjorn Helgaas
2026-07-11 13:54     ` Darshit Shah
2026-07-11 16:08     ` Bjorn Helgaas

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