Linux PCI subsystem development
 help / color / mirror / Atom feed
* [PATCH] PCI/DPC: Document spec update on Surprise Down errors
@ 2026-12-02 12:04 Lukas Wunner
  2026-12-02 12:06 ` sashiko-bot
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Lukas Wunner @ 2026-12-02 12:04 UTC (permalink / raw)
  To: Bjorn Helgaas, linux-pci
  Cc: Smita Koralahalli, Yazen Ghannam, Sathyanarayanan Kuppuswamy,
	Keith Busch, Maciej Grochowski, Sizhe Liu, Yicong Yang,
	Sourabh Jain, Oliver OHalloran, linuxppc-dev

When PCIe r1.1 introduced hotplug support in 2005, sec 3.2.1 was amended
to state that a transition from DL_Active to DL_Inactive must not cause a
Surprise Down error on hotplug ports capable of surprise removal.

But when PCIe r3.1 introduced DPC support in 2014, sec 6.7.6 was added
which states that:

   "Async removal may result in a transition from DL_Active to DL_Down in
    the Downstream Port. This transition may result in a Surprise Down
    error."

I raised this contradiction with our representative at the PCISIG Protocol
Working Group.  He noted that DL_Down is likewise nonsensical because it
is a Status Output, not a State (sec 3.2).  The PWG recently approved the
following new language for sec 6.7.6 as erratum B157, which will appear in
the next revision, either r7.1.1 or r7.2:

   "Async removal may result in a transition from DL_Active to DL_Inactive
    in the Downstream Port.  Error handling for this transition is defined
    in Section 3.2.1."

Commit 2ae8fbbe1cd4 ("PCI/DPC: Ignore Surprise Down error on hot removal")
changed the DPC driver to handle Surprise Down errors per the old language
in sec 6.7.6.  This was needed for AMD Epyc systems.  No Intel system is
affected.

Document the spec update in the code comment introduced by the commit to
make it clear that the old spec language should not be followed by new
hardware implementations.

The functionality introduced by the commit might still be useful beyond
systems which adhere to the legacy behavior of sec 6.7.6:  Sec 3.2.1 does
allow Surprise Down errors on non-surprise-capable hotplug ports.  pciehp
binds to such ports and handles removal on Surprise Down.  It makes sense
for the DPC driver not to interfere with pciehp in such cases.

Fixes: 2ae8fbbe1cd4 ("PCI/DPC: Ignore Surprise Down error on hot removal")
Signed-off-by: Lukas Wunner <lukas@wunner.de>
Cc: stable@vger.kernel.org # v6.9+
---
 drivers/pci/pcie/dpc.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/pcie/dpc.c b/drivers/pci/pcie/dpc.c
index e030811..5538dde 100644
--- a/drivers/pci/pcie/dpc.c
+++ b/drivers/pci/pcie/dpc.c
@@ -374,8 +374,10 @@ static irqreturn_t dpc_handler(int irq, void *context)
 	struct pci_dev *pdev = context;
 
 	/*
-	 * According to PCIe r6.0 sec 6.7.6, errors are an expected side effect
-	 * of async removal and should be ignored by software.
+	 * From PCIe r3.1 to r7.1, sec 6.7.6 allowed Surprise Down errors as
+	 * a side effect of async removal which should be ignored by software.
+	 * Newer revisions point to sec 3.2.1 instead, whereby Surprise Down
+	 * errors are blocked on hotplug ports capable of surprise removal.
 	 */
 	if (dpc_is_surprise_removal(pdev)) {
 		dpc_handle_surprise_removal(pdev);
-- 
2.53.0


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

* Re: [PATCH] PCI/DPC: Document spec update on Surprise Down errors
  2026-12-02 12:04 [PATCH] PCI/DPC: Document spec update on Surprise Down errors Lukas Wunner
@ 2026-12-02 12:06 ` sashiko-bot
  2026-12-02 16:19 ` Kuppuswamy Sathyanarayanan
  2026-12-02 20:26 ` Yazen Ghannam
  2 siblings, 0 replies; 5+ messages in thread
From: sashiko-bot @ 2026-12-02 12:06 UTC (permalink / raw)
  To: Lukas Wunner, linux-pci

> When PCIe r1.1 introduced hotplug support in 2005, sec 3.2.1 was amended
> to state that a transition from DL_Active to DL_Inactive must not cause a
> Surprise Down error on hotplug ports capable of surprise removal.
> 
> But when PCIe r3.1 introduced DPC support in 2014, sec 6.7.6 was added
> which states that:
> 
>    "Async removal may result in a transition from DL_Active to DL_Down in
>     the Downstream Port. This transition may result in a Surprise Down
>     error."
> 
> I raised this contradiction with our representative at the PCISIG Protocol
> Working Group.  He noted that DL_Down is likewise nonsensical because it
> is a Status Output, not a State (sec 3.2).  The PWG recently approved the
> following new language for sec 6.7.6 as erratum B157, which will appear in
> [ ... ]
> binds to such ports and handles removal on Surprise Down.  It makes sense
> for the DPC driver not to interfere with pciehp in such cases.
> 
> Fixes: 2ae8fbbe1cd4 ("PCI/DPC: Ignore Surprise Down error on hot removal")
> Signed-off-by: Lukas Wunner <lukas@wunner.de>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/b52d25c02c4268d2f832b74c1abbcb20a01691f3.1796212287.git.lukas@wunner.de?part=1

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

* Re: [PATCH] PCI/DPC: Document spec update on Surprise Down errors
  2026-12-02 12:04 [PATCH] PCI/DPC: Document spec update on Surprise Down errors Lukas Wunner
  2026-12-02 12:06 ` sashiko-bot
@ 2026-12-02 16:19 ` Kuppuswamy Sathyanarayanan
  2026-12-02 20:26 ` Yazen Ghannam
  2 siblings, 0 replies; 5+ messages in thread
From: Kuppuswamy Sathyanarayanan @ 2026-12-02 16:19 UTC (permalink / raw)
  To: Lukas Wunner, Bjorn Helgaas, linux-pci
  Cc: Smita Koralahalli, Yazen Ghannam, Keith Busch, Maciej Grochowski,
	Sizhe Liu, Yicong Yang, Sourabh Jain, Oliver OHalloran,
	linuxppc-dev



On 12/2/26 04:04, Lukas Wunner wrote:
> When PCIe r1.1 introduced hotplug support in 2005, sec 3.2.1 was amended
> to state that a transition from DL_Active to DL_Inactive must not cause a
> Surprise Down error on hotplug ports capable of surprise removal.
> 
> But when PCIe r3.1 introduced DPC support in 2014, sec 6.7.6 was added
> which states that:
> 
>    "Async removal may result in a transition from DL_Active to DL_Down in
>     the Downstream Port. This transition may result in a Surprise Down
>     error."
> 
> I raised this contradiction with our representative at the PCISIG Protocol
> Working Group.  He noted that DL_Down is likewise nonsensical because it
> is a Status Output, not a State (sec 3.2).  The PWG recently approved the
> following new language for sec 6.7.6 as erratum B157, which will appear in
> the next revision, either r7.1.1 or r7.2:
> 
>    "Async removal may result in a transition from DL_Active to DL_Inactive
>     in the Downstream Port.  Error handling for this transition is defined
>     in Section 3.2.1."
> 
> Commit 2ae8fbbe1cd4 ("PCI/DPC: Ignore Surprise Down error on hot removal")
> changed the DPC driver to handle Surprise Down errors per the old language
> in sec 6.7.6.  This was needed for AMD Epyc systems.  No Intel system is
> affected.
> 
> Document the spec update in the code comment introduced by the commit to
> make it clear that the old spec language should not be followed by new
> hardware implementations.
> 
> The functionality introduced by the commit might still be useful beyond
> systems which adhere to the legacy behavior of sec 6.7.6:  Sec 3.2.1 does
> allow Surprise Down errors on non-surprise-capable hotplug ports.  pciehp
> binds to such ports and handles removal on Surprise Down.  It makes sense
> for the DPC driver not to interfere with pciehp in such cases.
> 
> Fixes: 2ae8fbbe1cd4 ("PCI/DPC: Ignore Surprise Down error on hot removal")
> Signed-off-by: Lukas Wunner <lukas@wunner.de>
> Cc: stable@vger.kernel.org # v6.9+
> ---

Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>


>  drivers/pci/pcie/dpc.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pci/pcie/dpc.c b/drivers/pci/pcie/dpc.c
> index e030811..5538dde 100644
> --- a/drivers/pci/pcie/dpc.c
> +++ b/drivers/pci/pcie/dpc.c
> @@ -374,8 +374,10 @@ static irqreturn_t dpc_handler(int irq, void *context)
>  	struct pci_dev *pdev = context;
>  
>  	/*
> -	 * According to PCIe r6.0 sec 6.7.6, errors are an expected side effect
> -	 * of async removal and should be ignored by software.
> +	 * From PCIe r3.1 to r7.1, sec 6.7.6 allowed Surprise Down errors as
> +	 * a side effect of async removal which should be ignored by software.
> +	 * Newer revisions point to sec 3.2.1 instead, whereby Surprise Down
> +	 * errors are blocked on hotplug ports capable of surprise removal.
>  	 */
>  	if (dpc_is_surprise_removal(pdev)) {
>  		dpc_handle_surprise_removal(pdev);

-- 
Sathyanarayanan Kuppuswamy
Linux Kernel Developer


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

* Re: [PATCH] PCI/DPC: Document spec update on Surprise Down errors
  2026-12-02 12:04 [PATCH] PCI/DPC: Document spec update on Surprise Down errors Lukas Wunner
  2026-12-02 12:06 ` sashiko-bot
  2026-12-02 16:19 ` Kuppuswamy Sathyanarayanan
@ 2026-12-02 20:26 ` Yazen Ghannam
  2026-12-03  8:56   ` Lukas Wunner
  2 siblings, 1 reply; 5+ messages in thread
From: Yazen Ghannam @ 2026-12-02 20:26 UTC (permalink / raw)
  To: Lukas Wunner
  Cc: Bjorn Helgaas, linux-pci, Smita Koralahalli,
	Sathyanarayanan Kuppuswamy, Keith Busch, Maciej Grochowski,
	Sizhe Liu, Yicong Yang, Sourabh Jain, Oliver OHalloran,
	linuxppc-dev

On Wed, Dec 02, 2026 at 01:04:00PM +0100, Lukas Wunner wrote:
> When PCIe r1.1 introduced hotplug support in 2005, sec 3.2.1 was amended
> to state that a transition from DL_Active to DL_Inactive must not cause a
> Surprise Down error on hotplug ports capable of surprise removal.
> 
> But when PCIe r3.1 introduced DPC support in 2014, sec 6.7.6 was added
> which states that:
> 
>    "Async removal may result in a transition from DL_Active to DL_Down in
>     the Downstream Port. This transition may result in a Surprise Down
>     error."
> 
> I raised this contradiction with our representative at the PCISIG Protocol
> Working Group.  He noted that DL_Down is likewise nonsensical because it
> is a Status Output, not a State (sec 3.2).  The PWG recently approved the
> following new language for sec 6.7.6 as erratum B157, which will appear in
> the next revision, either r7.1.1 or r7.2:
> 
>    "Async removal may result in a transition from DL_Active to DL_Inactive
>     in the Downstream Port.  Error handling for this transition is defined
>     in Section 3.2.1."
> 
> Commit 2ae8fbbe1cd4 ("PCI/DPC: Ignore Surprise Down error on hot removal")
> changed the DPC driver to handle Surprise Down errors per the old language
> in sec 6.7.6.  This was needed for AMD Epyc systems.  No Intel system is
> affected.
> 
> Document the spec update in the code comment introduced by the commit to
> make it clear that the old spec language should not be followed by new
> hardware implementations.
> 
> The functionality introduced by the commit might still be useful beyond
> systems which adhere to the legacy behavior of sec 6.7.6:  Sec 3.2.1 does
> allow Surprise Down errors on non-surprise-capable hotplug ports.  pciehp
> binds to such ports and handles removal on Surprise Down.  It makes sense
> for the DPC driver not to interfere with pciehp in such cases.
> 
> Fixes: 2ae8fbbe1cd4 ("PCI/DPC: Ignore Surprise Down error on hot removal")
> Signed-off-by: Lukas Wunner <lukas@wunner.de>
> Cc: stable@vger.kernel.org # v6.9+
> ---
>  drivers/pci/pcie/dpc.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pci/pcie/dpc.c b/drivers/pci/pcie/dpc.c
> index e030811..5538dde 100644
> --- a/drivers/pci/pcie/dpc.c
> +++ b/drivers/pci/pcie/dpc.c
> @@ -374,8 +374,10 @@ static irqreturn_t dpc_handler(int irq, void *context)
>  	struct pci_dev *pdev = context;
>  
>  	/*
> -	 * According to PCIe r6.0 sec 6.7.6, errors are an expected side effect
> -	 * of async removal and should be ignored by software.
> +	 * From PCIe r3.1 to r7.1, sec 6.7.6 allowed Surprise Down errors as
> +	 * a side effect of async removal which should be ignored by software.
> +	 * Newer revisions point to sec 3.2.1 instead, whereby Surprise Down
> +	 * errors are blocked on hotplug ports capable of surprise removal.
>  	 */
>  	if (dpc_is_surprise_removal(pdev)) {
>  		dpc_handle_surprise_removal(pdev);
> -- 
>

Why does a code comment change need to be backported as a fix?

Also, the original comment was correct until a recent spec change. So
this isn't a fix but rather just an update. And the spec change isn't
published yet either.

Maybe it would be better to just stop including spec citations in code
comments and just leave them for commit messages. Any thoughts?

Thanks,
Yazen

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

* Re: [PATCH] PCI/DPC: Document spec update on Surprise Down errors
  2026-12-02 20:26 ` Yazen Ghannam
@ 2026-12-03  8:56   ` Lukas Wunner
  0 siblings, 0 replies; 5+ messages in thread
From: Lukas Wunner @ 2026-12-03  8:56 UTC (permalink / raw)
  To: Yazen Ghannam
  Cc: Bjorn Helgaas, linux-pci, Smita Koralahalli,
	Sathyanarayanan Kuppuswamy, Keith Busch, Maciej Grochowski,
	Sizhe Liu, Yicong Yang, Sourabh Jain, Oliver OHalloran,
	linuxppc-dev

On Wed, Dec 02, 2026 at 03:26:12PM -0500, Yazen Ghannam wrote:
> On Wed, Dec 02, 2026 at 01:04:00PM +0100, Lukas Wunner wrote:
> > The PWG recently approved the
> > following new language for sec 6.7.6 as erratum B157, which will appear in
> > the next revision, either r7.1.1 or r7.2:
> > 
> >    "Async removal may result in a transition from DL_Active to DL_Inactive
> >     in the Downstream Port.  Error handling for this transition is defined
> >     in Section 3.2.1."
[...]
> > Document the spec update in the code comment introduced by the commit to
> > make it clear that the old spec language should not be followed by new
> > hardware implementations.
[...]
> > Fixes: 2ae8fbbe1cd4 ("PCI/DPC: Ignore Surprise Down error on hot removal")
> > Signed-off-by: Lukas Wunner <lukas@wunner.de>
> > Cc: stable@vger.kernel.org # v6.9+
> 
> Why does a code comment change need to be backported as a fix?

It doesn't have to be, I don't mind if the Fixes and Cc tag are stripped
if/when the patch is applied.

One motivation for the stable designation is that I've seen silicon
validation engineers use older kernels.  If they see the old code
comment, they'll probably go "this is fine" when observing the
legacy behavior of sec 6.7.6.  Not a strong argument I guess. :)

Another motivation was that I expected sashiko to flag a missing
stable designation.  Not a strong argument either. :)

Thanks,

Lukas

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

end of thread, other threads:[~2026-12-03  8:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-02 12:04 [PATCH] PCI/DPC: Document spec update on Surprise Down errors Lukas Wunner
2026-12-02 12:06 ` sashiko-bot
2026-12-02 16:19 ` Kuppuswamy Sathyanarayanan
2026-12-02 20:26 ` Yazen Ghannam
2026-12-03  8:56   ` Lukas Wunner

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