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
  2026-12-02 16:19 ` Kuppuswamy Sathyanarayanan
  0 siblings, 2 replies; 3+ 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] 3+ messages in thread

end of thread, other threads:[~2026-12-02 16:19 UTC | newest]

Thread overview: 3+ 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

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