Linux PCI subsystem development
 help / color / mirror / Atom feed
From: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
To: Mario Limonciello <mario.limonciello@amd.com>,
	Sourabh Jain <sourabhjain@linux.ibm.com>,
	Oliver O'Halloran <oohall@gmail.com>,
	Bjorn Helgaas <bhelgaas@google.com>
Cc: linuxppc-dev@lists.ozlabs.org, linux-pci@vger.kernel.org
Subject: Re: [PATCH] PCI/DPC: Use DPC if platform grants DPC control but not AER control
Date: Thu, 3 Dec 2026 11:01:00 -0800	[thread overview]
Message-ID: <baa5733f-ceaf-4478-ae28-41b78ff93f34@linux.intel.com> (raw)
In-Reply-To: <20261203-superm1-pci-dpc-v1-1-6e5dcd5b5fe9@amd.com>

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.kuppuswamy@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 <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>

-- 
Sathyanarayanan Kuppuswamy
Linux Kernel Developer


  reply	other threads:[~2026-12-03 19:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2026-12-03 19:20 ` sashiko-bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=baa5733f-ceaf-4478-ae28-41b78ff93f34@linux.intel.com \
    --to=sathyanarayanan.kuppuswamy@linux.intel.com \
    --cc=bhelgaas@google.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mario.limonciello@amd.com \
    --cc=oohall@gmail.com \
    --cc=sourabhjain@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox