AMD Family 17h Models 00h-0Fh processors are affected by erratum #1146, "PCIe DPC RP PIO Error Reporting May Not Function Correctly". The RP PIO SysError register in the DPC Extended Capability has inverted enable bits, so its zero reset value enables System Error reporting of RP PIO errors on every root port, and the processor may mishandle such a System Error. No fix is planned. The documented workaround is to program bits [18:0] of the register to 0x7_0707. With the register at zero, a config read to a root port whose link is down (e.g. after Link Disable or during an endpoint reset) completes with an RP PIO error that is escalated even when all RP PIO errors are masked. When that coincides with MMIO to an endpoint behind another root port of the same PCIe controller, the system takes a data fabric sync flood and resets. With the workaround, the same reads return all-ones and are logged by AER as Advisory Non-Fatal errors. Apply the workaround to root ports that implement the DPC RP Extensions, at enumeration and on resume, since the DPC state saved across suspend does not include this register. Link: https://docs.amd.com/v/u/en-US/55449-PUB-1.21 Cc: stable@vger.kernel.org Signed-off-by: Anthony Pighin --- drivers/pci/quirks.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 7f1f47ea2ee4..9b7512776870 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -6550,6 +6550,30 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0xa73f, dpc_log_size); DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, 0xa76e, dpc_log_size); #endif +/* + * AMD erratum #1146 (Family 17h Models 00h-0Fh Revision Guide 55449). The + * DPC RP PIO SysError register has inverted enable bits, so its zero reset + * value escalates Root Port PIO errors to a System Error that the processor + * may mishandle. Write the documented value to disable the escalation. + */ +static void quirk_amd_dpc_rp_pio_syserror(struct pci_dev *dev) +{ + u16 dpc, val; + + dpc = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_DPC); + if (!dpc) + return; + + pci_read_config_word(dev, dpc + PCI_EXP_DPC_CAP, &val); + if (!(val & PCI_EXP_DPC_CAP_RP_EXT)) + return; + + pci_write_config_dword(dev, dpc + PCI_EXP_DPC_RP_PIO_SYSERROR, 0x00070707); + pci_info(dev, "AMD erratum #1146: disable DPC RP PIO System Error escalation\n"); +} +DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, 0x1453, quirk_amd_dpc_rp_pio_syserror); +DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_AMD, 0x1453, quirk_amd_dpc_rp_pio_syserror); + /* * For a PCI device with multiple downstream devices, its driver may use * a flattened device tree to describe the downstream devices. -- 2.43.0