From: Darshit Shah <darnshah@amazon.de>
To: <lukas@wunner.de>
Cc: <Jonthan.Cameron@huawei.com>, <bhelgaas@google.com>,
<darnir@gnu.org>, <darnshah@amazon.de>,
<feng.tang@linux.alibaba.com>, <kwilczynski@kernel.org>,
<linux-kernel@vger.kernel.org>, <linux-pci@vger.kernel.org>,
<nh-open-source@amazon.com>,
<sathyanarayanan.kuppuswamy@linux.intel.com>
Subject: [PATCH v2 0/1] Re: [PATCH] drivers/pci: Allow attaching AER to non-RP devices that support MSI
Date: Mon, 8 Dec 2025 11:25:44 +0000 [thread overview]
Message-ID: <20251208112545.21315-1-darnshah@amazon.de> (raw)
In-Reply-To: <aSnWyePbCKPvjpKq@wunner.de>
On 28.11.25 18:07, Lukas Wunner wrote:
> On Fri, Nov 28, 2025 at 12:20:53PM +0000, Darshit Shah wrote:
>> Previously portdrv tried to prevent non-Root Port (RP) and non-Root
>> Complex Event Collector (RCEC) devices from enabling AER capability.
>> This was done because some switches enable AER but do not support MSI.
>
> The AER driver only binds to RPs and RCECs, see aer_probe():
>
> if ((pci_pcie_type(port) != PCI_EXP_TYPE_RC_EC) &&
> (pci_pcie_type(port) != PCI_EXP_TYPE_ROOT_PORT))
> return -ENODEV;
>
> So there's no point in adding PCIE_PORT_SERVICE_AER to "services"
> for other port types (as your patch does).
I agree that adding PCIE_PORT_SERVICE_AER to "services" for switches is
not useful.
>
>> However, it is possible to have switches upstream of an endpoint that
>> support MSI and AER. Without AER capability being enabled on such
>> a switch, portdrv will refuse to enable the DPC capability as well,
>> preventing a PCIe error on an endpoint from being handled by the switch.
>
> I assume you're referring to this clause in get_port_device_capability():
>
> if (pci_find_ext_capability(dev, PCI_EXT_CAP_ID_DPC) &&
> pci_aer_available() &&
> (pcie_ports_dpc_native || (services & PCIE_PORT_SERVICE_AER)))
> services |= PCIE_PORT_SERVICE_DPC;
>
> Presumably on your system, BIOS doesn't grant AER handling to the OS
> upon _OSC negotiation? Is there a BIOS knob to change that?
On my system, BIOS does grant AER handling to the OS with _OSC negotiation.
2025-12-06 23:15:40.172000 kern INFO [ 0.590601] acpi PNP0A08:00: _OSC: OS supports [ExtendedConfig ASPM ClockPM Segments MSI HPX-Type3]
2025-12-06 23:15:40.172000 kern INFO [ 0.590607] acpi PNP0A08:00: _OSC: platform does not support [LTR]
2025-12-06 23:15:40.172000 kern INFO [ 0.590610] acpi PNP0A08:00: _OSC: OS now controls [PME AER PCIeCapability]
> Alternatively, does passing "pcie_ports=dpc-native" fix the issue?
> If it does, why do you need the patch instead of using the command line
> option?
Given that my firmware correctly negotiates and hands over control of AER
to Linux, we should not need to use a quirk to enable DPC support.
What seems to be happening instead is that portdrv has misinterpreted the
Implementation Note in PCIe r5.0 6.2.10 that states:
"It is recommended that platform firmware and operating systems always link
the control of DPC to the control of Advanced Error Reporting"
This does not mean that AER is working on each PCIe device that wants to enable
DPC. Rather that the OS is considered to have control over DPC, if it also has
control over AER for the host bridge upstream of the device.
Thus, I claim that the following checks are incorrect:
if (pci_find_ext_capability(dev, PCI_EXT_CAP_ID_DPC) &&
pci_aer_available() &&
(pcie_ports_dpc_native || (services & PCIE_PORT_SERVICE_AER)))
services |= PCIE_PORT_SERVICE_DPC;
PCIE_PORT_SERVICE_AER will only ever be enabled on RP and RCEC devices.
However, PCIE_PORT_SERVICE_DPC should be allowed on non-RP devices. In fact,
that is exactly where it is needed, since the switch upstream of an endpoint
device is required to generate the DPC signal. A fixed version of this check
would instead look like:
if (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;
That is, we should allow binding PCIE_PORT_SERVICE_DPC to a device, if:
* The device advertises the DPC capability
* AER has not been disabled for Linux through the command line
* Linux has control of AER (and DPC) for the host bridge above the device
* _OR_ `pcie_ports=dpc-native` was used on the command line
Coming next is an updated patch based on this.
--
2.47.3
Amazon Web Services Development Center Germany GmbH
Tamara-Danz-Str. 13
10243 Berlin
Geschaeftsfuehrung: Christian Schlaeger, Christof Hellmis
Eingetragen am Amtsgericht Charlottenburg unter HRB 257764 B
Sitz: Berlin
Ust-ID: DE 365 538 597
next prev parent reply other threads:[~2025-12-08 11:25 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-28 12:20 [PATCH] drivers/pci: Allow attaching AER to non-RP devices that support MSI Darshit Shah
2025-11-28 17:07 ` Lukas Wunner
2025-12-08 11:25 ` Darshit Shah [this message]
2025-12-08 11:25 ` [PATCH v2 1/1] drivers/pci: Decouple DPC from AER service Darshit Shah
2025-12-09 7:45 ` Lukas Wunner
2025-12-11 16:42 ` [PATCH v3] " Darshit Shah
2026-02-28 23:59 ` Darshit Shah
2025-12-09 15:29 ` [PATCH v2 1/1] " Sathyanarayanan Kuppuswamy
2025-12-09 0:30 ` [PATCH] drivers/pci: Allow attaching AER to non-RP devices that support MSI Bjorn Helgaas
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=20251208112545.21315-1-darnshah@amazon.de \
--to=darnshah@amazon.de \
--cc=Jonthan.Cameron@huawei.com \
--cc=bhelgaas@google.com \
--cc=darnir@gnu.org \
--cc=feng.tang@linux.alibaba.com \
--cc=kwilczynski@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lukas@wunner.de \
--cc=nh-open-source@amazon.com \
--cc=sathyanarayanan.kuppuswamy@linux.intel.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