Linux PCI subsystem development
 help / color / mirror / Atom feed
* [PATCH] PCI/DPC: Use DPC if platform grants DPC control but not AER control
@ 2026-12-03 18:49 Mario Limonciello
  2026-12-03 19:01 ` Kuppuswamy Sathyanarayanan
  2026-12-03 19:20 ` sashiko-bot
  0 siblings, 2 replies; 3+ messages in thread
From: Mario Limonciello @ 2026-12-03 18:49 UTC (permalink / raw)
  To: Sourabh Jain, Oliver O'Halloran, Bjorn Helgaas,
	Kuppuswamy Sathyanarayanan
  Cc: linuxppc-dev, linux-pci, Mario Limonciello

PCIe r7.0, sec 6.2.11, "Implementation Note: Determination of DPC Control",
recommends that operating systems link control of DPC to control of AER.
Accordingly, since commit eed85ff4c0da ("PCI/DPC: Enable DPC only if AER
is available"), the DPC driver only binds to a Port if the OS controls AER
or the user specified "pcie_ports=dpc-native".

At the time, Linux did not negotiate DPC control with the platform at all.
Commit ac1c8e35a326 ("PCI/DPC: Add Error Disconnect Recover (EDR)
support") added a request for DPC control via _OSC, independent of AER
control, and recorded the result in host->native_dpc.  But it didn't
update portdrv or the DPC driver to use host->native_dpc, so if the
platform grants DPC control while retaining AER control, we own DPC but
never use it.  Nobody enables DPC, and errors below the Port are not
contained.

Some platforms grant DPC control without AER control and have no HEST or
other firmware-first error handling, e.g.:

  acpi PNP0A08:00: _OSC: platform does not support [SHPCHotplug AER]
  acpi PNP0A08:00: _OSC: OS now controls [PCIeHotplug PME PCIeCapability LTR DPC]
  acpi PNP0A08:00: OS native features: SHPCHotplug- PCIeHotplug+ PME+ AER- DPC+ LTR+

Treat a platform grant of DPC control like "pcie_ports=dpc-native" and use
DPC if host->native_dpc is set, even if the OS doesn't control AER.

When handling a DPC event, the DPC driver reads and clears AER status in the
DPC Port.  That's the same thing we already do in the EDR path, where
firmware has retained control of both AER and DPC, so it's not a new
intrusion on firmware-owned AER registers.

This has no effect on non-ACPI systems, where native_aer and native_dpc are
both initialized from the same default.

Fixes: ac1c8e35a326 ("PCI/DPC: Add Error Disconnect Recover (EDR) support")
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
---
 drivers/pci/pcie/dpc.c     | 4 +++-
 drivers/pci/pcie/portdrv.c | 6 +++---
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/pci/pcie/dpc.c b/drivers/pci/pcie/dpc.c
index 2b779bd1d861b..8218e57ca861d 100644
--- a/drivers/pci/pcie/dpc.c
+++ b/drivers/pci/pcie/dpc.c
@@ -473,11 +473,13 @@ static void dpc_disable(struct pcie_device *dev)
 static int dpc_probe(struct pcie_device *dev)
 {
 	struct pci_dev *pdev = dev->port;
+	struct pci_host_bridge *host = pci_find_host_bridge(pdev->bus);
 	struct device *device = &dev->device;
 	int status;
 	u16 cap;
 
-	if (!pcie_aer_is_native(pdev) && !pcie_ports_dpc_native)
+	if (!pcie_aer_is_native(pdev) && !host->native_dpc &&
+	    !pcie_ports_dpc_native)
 		return -ENOTSUPP;
 
 	status = devm_request_threaded_irq(device, dev->irq, dpc_irq,
diff --git a/drivers/pci/pcie/portdrv.c b/drivers/pci/pcie/portdrv.c
index 32fc623dd4108..ffd695f8aff9a 100644
--- a/drivers/pci/pcie/portdrv.c
+++ b/drivers/pci/pcie/portdrv.c
@@ -259,12 +259,12 @@ static int get_port_device_capability(struct pci_dev *dev)
 	}
 
 	/*
-	 * With dpc-native, allow Linux to use DPC even if it doesn't have
-	 * permission to use AER.
+	 * Use DPC if we control AER, if the platform granted us control of
+	 * DPC, or if the user specified "pcie_ports=dpc-native".
 	 */
 	if (pci_find_ext_capability(dev, PCI_EXT_CAP_ID_DPC) &&
 	    pci_aer_available() &&
-	    (pcie_ports_dpc_native || host->native_aer))
+	    (pcie_ports_dpc_native || host->native_aer || host->native_dpc))
 		services |= PCIE_PORT_SERVICE_DPC;
 
 	/* Enable bandwidth control if more than one speed is supported. */

---
base-commit: fe6ff8d5d675c01793b9f051d16055dd4aa75244
change-id: 20261203-superm1-pci-dpc-515ab9d3f25c

Best regards,
--  
Mario Limonciello <mario.limonciello@amd.com>


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

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

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-03 18:49 [PATCH] PCI/DPC: Use DPC if platform grants DPC control but not AER control Mario Limonciello
2026-12-03 19:01 ` Kuppuswamy Sathyanarayanan
2026-12-03 19:20 ` sashiko-bot

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