Hi,

On 12/3/26 10:49, Mario Limonciello wrote:
> 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.


pci/next already does this with two commits from this series:

  
https://lore.kernel.org/r/20261118181718.3907441-1-sathyanarayanan.kuppusw...@linux.intel.com/

  db6bf75c52c3 ("PCI/DPC: Reinstate support for AER-incapable ports")
  removes the pcie_aer_is_native() check from dpc_probe().

  b7e91bf93854 ("PCI/portdrv: Bind DPC service based on
  host_bridge->native_dpc") binds the DPC service based only on
  host->native_dpc. "pcie_ports=native" and "pcie_ports=dpc-native"
  are already folded into the _OSC mask, so they are reflected in
  native_dpc.

So on pci/next, a platform that reports "AER- DPC+" should already get
the DPC service.

Can you test your use case it with pci/next kernel?

> 
> 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 <[email protected]>
> ---
>  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 <[email protected]>

-- 
Sathyanarayanan Kuppuswamy
Linux Kernel Developer


Reply via email to