PCI: Add boot options to disable DPC and AER recovery
Subsystems (4)
v3 cover PCI: Add boot options to disable DPC and AER recovery
On large modular systems with a complex PCIe topology, allow userspace to inspect uncorrectable AER errors before Linux attempts recovery and to opt out of Linux DPC and EDR support.
This series adds two PCI kernel boot options:
pci=noaer_recovery - Retain AER logging and correctable handling, but
skip uncorrectable AER recovery, including CXL RCH callbacks and recovery of GHES-reported errors.
pci=nodpc - Disable Linux DPC and EDR participation, including
ACPI negotiation and EDR's DPC-enabling _DSM call.
Firmware-owned DPC settings and firmware error recovery remain under firmware control. The two options can be selected independently.
Changes in v3:
- Patch 1: Check the recovery option before dispatching CXL RCH and ordinary PCIe errors, addressing the CXL callback bypass.
- Patch 1: Preserve current GHES cleanup and device-reference release.
- Patch 2: Add pci_dpc_available() and use it for DPC services, ACPI DPC/EDR negotiation, and EDR notifier installation/removal.
- Patch 2: Skip the entire EDR registration path before its enabling _DSM, and prevent native-port overrides from defeating nodpc.
- Clarify the Linux-only scope and rebase onto the PCI next branch.
v2: https://lore.kernel.org/linux-pci/[email protected]/
AER review: https://lore.kernel.org/linux-pci/[email protected]/
DPC review: https://lore.kernel.org/linux-pci/[email protected]/
Yury Murashka (2):
PCI: Add pci=noaer_recovery kernel boot option
PCI: Add pci=nodpc kernel boot option
.../admin-guide/kernel-parameters.txt | 9 +++++++ drivers/acpi/pci_root.c | 9 +++++-- drivers/pci/pci.c | 4 ++++ drivers/pci/pci.h | 4 ++++ drivers/pci/pcie/aer.c | 13 ++++++++-- drivers/pci/pcie/dpc.c | 24 ++++++++++++++++--- drivers/pci/pcie/edr.c | 5 +++- drivers/pci/pcie/portdrv.c | 3 ++- include/linux/pci.h | 6 +++++ 9 files changed, 68 insertions(+), 9 deletions(-)
base-commit: f4319f548f7d8cb595ac1c91bfd459876399eeb3
Signature · 1 line
2.51.0
PATCH v3 1/2 PCI: Add pci=noaer_recovery kernel boot option
On large modular systems with a complex PCIe topology, allow userspace to inspect uncorrectable AER errors before Linux attempts recovery.
Add pci=noaer_recovery to retain AER logging while skipping recovery for uncorrectable errors. Check the option before dispatching either CXL RCH internal errors or ordinary PCIe errors so CXL driver error callbacks cannot bypass it. Also skip recovery for errors reported through GHES, while retaining error logging and releasing error buffers and device references.
Correctable errors continue to be handled normally. Skipping recovery avoids its clearing of uncorrectable error status, but does not suppress Root Port interrupt acknowledgment or change firmware error handling. The option is AER-specific and does not disable DPC recovery.
---
Changes in v3:
- Check the option before both CXL RCH and ordinary PCIe error dispatch.
- Preserve logging, correctable handling, and current GHES cleanup.
- Clarify the AER-only scope and rebase onto PCI next.
v2: https://lore.kernel.org/linux-pci/[email protected]/
Review: https://lore.kernel.org/linux-pci/[email protected]/
Documentation/admin-guide/kernel-parameters.txt | 5 +++++ drivers/pci/pci.c | 2 ++ drivers/pci/pci.h | 2 ++ drivers/pci/pcie/aer.c | 13 +++++++++++-- 4 files changed, 20 insertions(+), 2 deletions(-)
Documentation/admin-guide/kernel-parameters.txt +5 -0
@@ -5118,6 +5118,11 @@ Kernel parameters noaer [PCIE] If the PCIEAER kernel config parameter is enabled, this kernel boot option can be used to disable the use of PCIE advanced error reporting. + noaer_recovery [PCIE] Disable Linux AER recovery for + uncorrectable errors, including CXL RCH errors, + while retaining AER logging. Correctable errors + are handled normally. Requires CONFIG_PCIEAER. + Does not disable DPC or firmware error recovery. nodomains [PCI] Disable support for multiple PCI root domains (aka PCI segments, in ACPI-speak). nommconf [X86] Disable use of MMCONFIG for PCI
drivers/pci/pci.c +2 -0
@@ -6840,6 +6840,8 @@ static int __init pci_setup(char *str) pcie_ats_disabled = true; }else if (!strcmp (str,"noaer" )) {pci_no_aer (); + }else if (!strcmp (str,"noaer_recovery" )) { +pci_no_aer_recovery (); }else if (!strcmp (str,"earlydump" )) { pci_early_dump = true; }else if (!strncmp (str,"realloc=" ,8 )) {
drivers/pci/pci.h +2 -0
@@ -1337,6 +1337,7 @@ static inline void of_pci_remove_host_bridge_node(struct pci_host_bridge *bridge#ifdef CONFIG_PCIEAER void pci_no_aer (void ); +void pci_no_aer_recovery (void );void pci_aer_init (struct pci_dev *dev);void pci_aer_exit (struct pci_dev *dev);extern const struct attribute_group aer_stats_attr_group;
@@ -1348,6 +1349,7 @@ void pci_save_aer_state(struct pci_dev *dev);void pci_restore_aer_state (struct pci_dev *dev);#else static inline void pci_no_aer (void ) { } +static inline void pci_no_aer_recovery (void ) { }static inline void pci_aer_init (struct pci_dev *d) { }static inline void pci_aer_exit (struct pci_dev *d) { }static inline void pci_aer_clear_fatal_status (struct pci_dev *dev) { }
drivers/pci/pcie/aer.c +11 -2
@@ -142,6 +142,7 @@ struct aer_info { PCI_ERR_ROOT_MULTI_UNCOR_RCV) static bool pcie_aer_disable; +static bool pcie_aer_recovery_disable;static pci_ers_result_t aer_root_reset (struct pci_dev *dev);void pci_no_aer (void )
@@ -149,6 +150,11 @@ void pci_no_aer(void) pcie_aer_disable = true; } +void pci_no_aer_recovery (void ) +{ + pcie_aer_recovery_disable = true; +} +bool pci_aer_available (void ) {return !pcie_aer_disable &&pci_msi_enabled ();
@@ -1338,6 +1344,9 @@ static void pci_aer_handle_error(struct pci_dev *dev, struct aer_err_info *info)static void handle_error_source (struct pci_dev *dev,struct aer_err_info *info) { +if (pcie_aer_recovery_disable && info->severity !=AER_CORRECTABLE ) +return ; +cxl_rch_handle_error (dev, info);pci_aer_handle_error (dev, info); }
@@ -1383,15 +1392,15 @@ static void aer_recover_work_func(struct work_struct *work)ghes_estatus_pool_region_free ((unsigned long )entry.regs,sizeof (struct aer_capability_regs )); -if (pdev) { +if (pdev && !pcie_aer_recovery_disable) {if (entry.severity ==AER_NONFATAL )pcie_do_recovery (pdev, pci_channel_io_normal, aer_root_reset);else if (entry.severity ==AER_FATAL )pcie_do_recovery (pdev, pci_channel_io_frozen, aer_root_reset); -pci_dev_put (pdev); } +pci_dev_put (pdev); } }
Signature · 1 line
2.51.0
[email protected]
AI reviewRe: [PATCH v3 1/2] PCI: Add pci=noaer_recovery kernel boot option
Sashiko has reviewed this patch and found no issues.
Quoted 10 lines
On large modular systems with a complex PCIe topology, allow userspace to inspect uncorrectable AER errors before Linux attempts recovery.
Add pci=noaer_recovery to retain AER logging while skipping recovery for uncorrectable errors. Check the option before dispatching either CXL RCH internal errors or ordinary PCIe errors so CXL driver error callbacks cannot bypass it. Also skip recovery for errors reported through GHES, while retaining error logging and releasing error buffers and device references.
Quoted 6 lines
Correctable errors continue to be handled normally. Skipping recovery avoids its clearing of uncorrectable error status, but does not suppress Root Port interrupt acknowledgment or change firmware error handling. The option is AER-specific and does not disable DPC recovery.
Signed-off-by Yury Murashka <[email protected]>
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
PATCH v3 2/2 PCI: Add pci=nodpc kernel boot option
In reply to Yury MurashkaAdd pci=nodpc to let Linux opt out of Downstream Port Containment (DPC) and Error Disconnect Recover (EDR) support on systems where userspace manages PCIe errors.
Skip DPC initialization, state operations, hotplug recovery checks, and port service registration when disabled. Expose pci_dpc_available() so ACPI negotiation and PCIe port service discovery honor the same policy. Do not advertise EDR support or request DPC control through _OSC, and prevent native-port overrides from reintroducing DPC ownership.
Skip EDR notifier installation before the DPC-enabling _DSM call. Merely skipping the native DPC driver would allow EDR to enable hardware DPC while the handler lacks the capability information needed to recover.
The option disables Linux participation in DPC and EDR; it does not turn off firmware-owned DPC hardware. AER reporting and recovery remain independent and can be controlled with their own boot options.
---
Changes in v3:
- Add pci_dpc_available() and use it for ACPI DPC/EDR negotiation.
- Skip EDR notifier registration and its DPC-enabling _DSM call.
- Gate DPC service discovery and prevent forced native DPC ownership.
- Clarify the firmware boundary and rebase onto PCI next.
v2: https://lore.kernel.org/linux-pci/[email protected]/
Review: https://lore.kernel.org/linux-pci/[email protected]/
.../admin-guide/kernel-parameters.txt | 4 ++++ drivers/acpi/pci_root.c | 9 +++++-- drivers/pci/pci.c | 2 ++ drivers/pci/pci.h | 2 ++ drivers/pci/pcie/dpc.c | 24 ++++++++++++++++--- drivers/pci/pcie/edr.c | 5 +++- drivers/pci/pcie/portdrv.c | 3 ++- include/linux/pci.h | 6 +++++ 8 files changed, 48 insertions(+), 7 deletions(-)
Documentation/admin-guide/kernel-parameters.txt +4 -0
@@ -5115,6 +5115,10 @@ Kernel parameters through ports 0xC000-0xCFFF). See http://wiki.osdev.org/PCI for more info on the configuration access mechanisms. + nodpc [PCIE] Disable Linux DPC and EDR support. Linux + neither requests DPC control from firmware nor + enables DPC through EDR. Firmware-owned DPC + settings are not changed. Requires CONFIG_PCIE_DPC. noaer [PCIE] If the PCIEAER kernel config parameter is enabled, this kernel boot option can be used to disable the use of PCIE advanced error reporting.
drivers/acpi/pci_root.c +7 -2
@@ -438,7 +438,7 @@ static u32 calculate_support(void) support |=OSC_PCI_ASPM_SUPPORT |OSC_PCI_CLOCK_PM_SUPPORT ;if (pci_msi_enabled ()) support |=OSC_PCI_MSI_SUPPORT ; -if (IS_ENABLED (CONFIG_PCIE_EDR )) +if (IS_ENABLED (CONFIG_PCIE_EDR ) &&pci_dpc_available ()) support |=OSC_PCI_EDR_SUPPORT ;return support;
@@ -517,7 +517,7 @@ static u32 calculate_control(void)* OSC_PCI_EXPRESS_DPC_CONTROL indicates the OS supports both DPC * and EDR. */ -if (IS_ENABLED (CONFIG_PCIE_DPC ) &&IS_ENABLED (CONFIG_PCIE_EDR )) +if (pci_dpc_available () &&IS_ENABLED (CONFIG_PCIE_EDR )) control |=OSC_PCI_EXPRESS_DPC_CONTROL ;return control;
@@ -1064,6 +1064,11 @@ struct pci_bus *acpi_pci_root_create(struct acpi_pci_root *root,else if (pcie_ports_dpc_native) override =OSC_PCI_EXPRESS_DPC_CONTROL & ~ctrl; +if (!pci_dpc_available ()) { + ctrl &= ~OSC_PCI_EXPRESS_DPC_CONTROL ; + override &= ~OSC_PCI_EXPRESS_DPC_CONTROL ; + } +if (override) { decode_osc_control(root, pcie_ports_native ? "OS forcing control (\"pcie_ports=native\") of" :
drivers/pci/pci.c +2 -0
@@ -6838,6 +6838,8 @@ static int __init pci_setup(char *str) }else if (!strncmp (str,"noats" ,5 )) {pr_info ("PCIe: ATS is disabled\n" ); pcie_ats_disabled = true; + }else if (!strcmp (str,"nodpc" )) { +pci_no_dpc (); }else if (!strcmp (str,"noaer" )) {pci_no_aer (); }else if (!strcmp (str,"noaer_recovery" )) {
drivers/pci/pci.h +2 -0
@@ -934,6 +934,7 @@ struct rcec_ea {#endif #ifdef CONFIG_PCIE_DPC +void pci_no_dpc (void );void pci_save_dpc_state (struct pci_dev *dev);void pci_restore_dpc_state (struct pci_dev *dev);void pci_dpc_init (struct pci_dev *pdev);
@@ -942,6 +943,7 @@ pci_ers_result_t dpc_reset_link(struct pci_dev *pdev);bool pci_dpc_recovered (struct pci_dev *pdev);unsigned int dpc_tlp_log_len (struct pci_dev *dev);#else +static inline void pci_no_dpc (void ) { }static inline void pci_save_dpc_state (struct pci_dev *dev) { }static inline void pci_restore_dpc_state (struct pci_dev *dev) { }static inline void pci_dpc_init (struct pci_dev *pdev) { }
drivers/pci/pcie/dpc.c +21 -3
@@ -43,12 +43,24 @@ static const char * const rp_pio_error_string[] = { "Memory Request Completion Timeout", /* Bit Position 18 */ }; +static bool pcie_dpc_disable; + +void pci_no_dpc (void ) +{ + pcie_dpc_disable = true; +} + +bool pci_dpc_available (void ) +{ +return !pcie_dpc_disable; +} +void pci_save_dpc_state (struct pci_dev *dev) {struct pci_cap_saved_state *save_state;u16 *cap; -if (!pci_is_pcie (dev)) +if (!pci_dpc_available () || !pci_is_pcie (dev))return ; save_state =pci_find_saved_ext_cap (dev,PCI_EXT_CAP_ID_DPC );
@@ -64,7 +76,7 @@ void pci_restore_dpc_state(struct pci_dev *dev)struct pci_cap_saved_state *save_state;u16 *cap; -if (!pci_is_pcie (dev)) +if (!pci_dpc_available () || !pci_is_pcie (dev))return ; save_state =pci_find_saved_ext_cap (dev,PCI_EXT_CAP_ID_DPC );
@@ -104,7 +116,7 @@ bool pci_dpc_recovered(struct pci_dev *pdev) {struct pci_host_bridge *host; -if (!pdev->dpc_cap) +if (!pci_dpc_available () || !pdev->dpc_cap)return false;/*
@@ -404,6 +416,9 @@ void pci_dpc_init(struct pci_dev *pdev) {u16 cap; +if (!pci_dpc_available ()) +return ; + pdev->dpc_cap =pci_find_ext_capability (pdev,PCI_EXT_CAP_ID_DPC );if (!pdev->dpc_cap)return ;
@@ -532,5 +547,8 @@ static struct pcie_port_service_driver dpcdriver = {int __init pcie_dpc_init (void ) { +if (!pci_dpc_available ()) +return 0 ; +return pcie_port_service_register (&dpcdriver); }
drivers/pci/pcie/edr.c +4 -1
@@ -223,6 +223,9 @@ void pci_acpi_add_edr_notifier(struct pci_dev *pdev)struct acpi_device *adev =ACPI_COMPANION (&pdev->dev);acpi_status status; +if (!pci_dpc_available ()) +return ; +if (!adev) {pci_dbg (pdev,"No valid ACPI node, skipping EDR init\n" );return ;
@@ -246,7 +249,7 @@ void pci_acpi_remove_edr_notifier(struct pci_dev *pdev) {struct acpi_device *adev =ACPI_COMPANION (&pdev->dev); -if (!adev) +if (!pci_dpc_available () || !adev)return ; acpi_remove_notify_handler(adev->handle, ACPI_SYSTEM_NOTIFY,
drivers/pci/pcie/portdrv.c +2 -1
@@ -262,7 +262,8 @@ 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. */ -if (pci_find_ext_capability (dev,PCI_EXT_CAP_ID_DPC ) && +if (pci_dpc_available () && +pci_find_ext_capability (dev,PCI_EXT_CAP_ID_DPC ) &&pci_aer_available () && (pcie_ports_dpc_native || host->native_aer)) services |=PCIE_PORT_SERVICE_DPC ;
include/linux/pci.h +6 -0
@@ -1984,6 +1984,12 @@ bool pci_aer_available(void);static inline bool pci_aer_available (void ) {return false; }#endif +#ifdef CONFIG_PCIE_DPC +bool pci_dpc_available (void ); +#else +static inline bool pci_dpc_available (void ) {return false; } +#endif +bool pci_ats_disabled (void );#define PCIE_PTM_CONTEXT_UPDATE_AUTO 0
Signature · 1 line
2.51.0
[email protected]
AI reviewRe: [PATCH v3 2/2] PCI: Add pci=nodpc kernel boot option
Sashiko has reviewed this patch and found no issues.
Quoted 14 lines
Add pci=nodpc to let Linux opt out of Downstream Port Containment (DPC) and Error Disconnect Recover (EDR) support on systems where userspace manages PCIe errors.
Skip DPC initialization, state operations, hotplug recovery checks, and port service registration when disabled. Expose
pci_dpc_available()so ACPI negotiation and PCIe port service discovery honor the same policy. Do not advertise EDR support or request DPC control through_OSC, and prevent native-port overrides from reintroducing DPC ownership.Skip EDR notifier installation before the DPC-enabling
_DSMcall. Merely skipping the native DPC driver would allow EDR to enable hardware DPC while the handler lacks the capability information needed to recover.
Quoted 5 lines
The option disables Linux participation in DPC and EDR; it does not turn off firmware-owned DPC hardware. AER reporting and recovery remain independent and can be controlled with their own boot options.
Signed-off-by Yury Murashka <[email protected]>
Sashiko has reviewed this patch and found no issues.
Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2