From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796512906; b=lnTQoA6c15Bm0XYwwd/n7TIQ93CGavLS/d6xX6aq/9c0cMPFv3507U9yzp031DRN7hWh nCMGCxZyggL1SipScCdC2HWtFN4QdI7hd4trzTowL7DPjjC/T7Z3Du/4nY9+1+0PziMC5 ySpiFd/a3eVva9yGAjynKZlp+9vj8F4MzCMZKSXZKbvQ+C5Cfn/gSJd+CgTaBN/Y97f5c 8EDYdt4VpXbmAaeVgS0DReL7kfiOW/skTaX6FBYvilzkLc+vp7SV/uH2NMBgINZQfqngN ahKmjUSb560IFiUD5wua8sLNERFZE7F6mkvfD/h2+Zx5k58aCHlUOIfkhQLCDuBUzcw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796512906; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=cj4O8t4Efd1Jyu1yXEauFalIQUwCac+uDLZ4aIxkRfI=; b=D/pK2/GQWt5uqo/PYnJGT95d+4vVcrSn/pZl28AwnmMkf8u9zZE7Ia6mnhKdidR5PXur DRHq/s7LD0k1iZfKlUlkADzs5d5SKYcb+pJb/IzR8oyO/KLo5bpWYOqwkbYP529Zlu3x8 GKmXBCr5+Dl2UHAfloieVfW7IDYxAmEBkM6vjFfVoePvTMs7YhH5ofY7ferH/yBtv+oTN ASDUVSDbevNmv9SbHzDXAHZsB6ecYs7tBr0ElFBLzSqGQY4kZrdB7ApjT+4ZTncBRzk3R anuNBu+Y0VxUApF5IzAh0ij2/P+iNxFKghTujN9EaT4R/XGFD41rmg3PA2rMR95AF2Q== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=kTvIuTrn; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 49747606A31F; Sat, 5 Dec 2026 23:21:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=kTvIuTrn Received: by smtp.kernel.org (Postfix) with ESMTPSA id D25F71F0092B; Sat, 5 Dec 2026 23:21:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796512906; bh=cj4O8t4Efd1Jyu1yXEauFalIQUwCac+uDLZ4aIxkRfI=; h=Date:From:To:Cc:Subject:In-Reply-To; b=kTvIuTrno+qleV/HLTeB2sfHP3+QkoPHMbVvfEjcwCmMn42/H9KETyPyjW6uVe2jq jDZoHHQtmD70A9YQfOLW1GPden38YfP2YrCbHbTlBmAReZDSAHTEAbR0rzppWZUu+M VY6PYMAl0rOHYw1XG6+SOVbha0WrZ/O+lGhaZK5lilh3uBG2BkpbvpVBR36cjghvEI e3AN1Detvzd6solDv/99H/rmW1XkdfqNHxRiDWaX0hSceUxyglrGfA4xnuFOh5r6Ye 9J5HpzXnlpjBZ1p/lltEugAnVARWNMv3ZYxtLvNN6bmdH83hHAydLTmqWlweE5howg qeYT15HK6QGDw== Date: Sat, 5 Dec 2026 17:21:44 -0600 From: Bjorn Helgaas To: Anthony Pighin Cc: Bjorn Helgaas , linux-pci@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org, Mario Limonciello , Yazen Ghannam , David Laight , stable@vger.kernel.org, Lukas Wunner , Kuppuswamy Sathyanarayanan Subject: Re: [PATCH v3 1/2] x86/PCI: Work around AMD erratum #1146 on Family 17h root ports Message-ID: <20261205232144.GA1152559@bhelgaas> X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20261203145647.707695-2-anthony.pighin@nokia.com> [+cc Lukas, Sathya] On Thu, Dec 03, 2026 at 09:56:46AM -0500, Anthony Pighin wrote: > 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. By "processor may mishandle", I guess you mean Linux doesn't have the code required to recover from it? Or is there another erratum in how the CPU itself executes whatever the SysError causes? > 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. I guess this config read would be to a device *below* the root port? It should be perfectly fine to do config accesses to a root port even if the link is down. > 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 affected 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. Maybe this is a clue that the DPC state saved across suspend *should* include this register? And also the mask and severity registers, as pci_save_aer_state() does? > Link: https://docs.amd.com/v/u/en-US/55449-PUB-1.21 > Cc: stable@vger.kernel.org > Signed-off-by: Anthony Pighin > --- > arch/x86/pci/fixup.c | 24 ++++++++++++++++++++++++ > 1 file changed, 24 insertions(+) > > diff --git a/arch/x86/pci/fixup.c b/arch/x86/pci/fixup.c > index 795d81c7a4de..d8ea0e5292ae 100644 > --- a/arch/x86/pci/fixup.c > +++ b/arch/x86/pci/fixup.c > @@ -1180,3 +1180,27 @@ static void quirk_tuxeo_rp_d3(struct pci_dev *pdev) > } > DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, 0x1502, quirk_tuxeo_rp_d3); > #endif /* CONFIG_SUSPEND */ > + > +/* > + * 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. > + */ I think it's good to have the background here. We can always dig out the commit log later, but it's a bit of a headache to do it. > +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"); We never write PCI_EXP_DPC_RP_PIO_SYSERROR anywhere else, so I guess we currently run with the default value or whatever firmware put there? This quirk will disable SysError generation on RP PIO errors regardless of whether CONFIG_PCIE_DPC is set, and regardless of whether firmware has granted DPC ownership to the OS. Is that what we want? If not, I think checking dev->dpc_cap would do this only if CONFIG_PCIE_DPC is set and the OS owns DPC. I think sashiko is right that we should read/modify/write to preserve the RsvdP bits in the register. It would also be nice to complain only once at boot-time instead of every resume. If we save/restore the register across suspend, that should take care of that part and remove the need for the DECLARE_PCI_FIXUP_RESUME_EARLY(), right? > +} > +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); > -- > 2.43.0 >