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=1796325622; b=Ouhmyhh6pR3gapCRT29s7wNhB+aElh436aXkU/iCppxwi7izfHImsxr9/cQIh5+i3bZu oqeKkjmps4hicCSVNdrHmh6DOkk9bhSrxPzkazoirVMQ1Odi9kTUQrFEu6IV+jWtg8jNV qfP4uG0UpE2fiaaUz2r936F6uo4GvLr0WBMmeZ/8/U2FMgPgJHBV2FNnESuNkm7nDsJpq LXFaedIqA3CG6IrE0frxNBXtQTirdujOMBH9BkNVFb1v4Nz6VysOg5JuBbxQxVIO9eyIA qhpsa2BVYiWaGg6ggeETbpFEMj2ejuyvf4Hqfc8XVvt00/UjXmXucozzeSS8d/P8SOw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796325622; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=YsTsUzMUvhH2nL0JR4LI5uOSbqy4eapMRC2nEixxLWI=; b=gtTrgmTFnDtS2F4yJMbxb6NCQYlOFMAd17R5UsWJ+abSviw/twyMjEPlr1KCvIEOr5H2 RvsqnC3Dtn4FU0Umv/51XZzpcxgh5vMxu6JR9Vog5wvHT7B5xF3sdArTNixJE4/fq4BDK HwxLjl0UKFMcdo/I8rRGC07tiWIKKEeFZIoV24gnqatyWxihmYPWMWCiCTGj2jgZmOP7/ 5Z7A0wFN42nOu6yoAF9LrivR9XqHjsjVKnKsgLgtRgOdwUs6pESjqA/LHyOfMSY4KzTqz hrbgKc4k+/9TOub5T06tr26QIJhCVF0f6PLIMWDUCKNhXTHWlE/ET1kB+dKVNNTd4/Q== 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=Yc+s4mMX; 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 D7909606A6AB for ; Thu, 3 Dec 2026 19:20:22 +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=Yc+s4mMX Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9008A1F0092C; Thu, 3 Dec 2026 19:20:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796325622; bh=YsTsUzMUvhH2nL0JR4LI5uOSbqy4eapMRC2nEixxLWI=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=Yc+s4mMXnf/IJgbqROebeARWRSYAPWt9SzT7PcF/Wg0PAGoYVeuR4CcVDXWFW0qia xXt/MJEWxRp1r70hcMGjZTL4wXMib2BJs6ksRkC3h1mNEkJy08qBGR5PfylX/8L7la s2wHQbcr2mZOxU8sdXSsnYsXt8Jzyk76V3NQil7IyFm2KgaTrq5AFKTrzOVJfiUOv1 zYCGAPiN41izk8qU7qTaGjpKTZDtX713pABoWm/yfN3NEBRoi7ZJOdDxOk6W/GBdRc djw94OHDlL8t1lMl2UmuvH+sY3ZBux/aRRawO05FnCbJLGQQJ2puYx6Dvpc4KfLM5q eAG/2nN2E3cJQ== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH] PCI/DPC: Use DPC if platform grants DPC control but not AER control Reply-To: sashiko-reviews@lists.linux.dev To: "Mario Limonciello" Cc: linux-pci@vger.kernel.org In-Reply-To: <20261203-superm1-pci-dpc-v1-1-6e5dcd5b5fe9@amd.com> References: <20261203-superm1-pci-dpc-v1-1-6e5dcd5b5fe9@amd.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 03 Dec 2026 19:20:22 +0000 X-Mailing-List: linux-pci@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 4 potential issues to consider: - [Medium] PCI/DPC: AER status left uncleared when native_dpc set without native_aer - [Medium] PCI/DPC: dpc_probe() bypasses aer_cap check, causing wrong config header reads - [Medium] PCI/DPC: enabling DPC when !native_aer races with GHES recovery and FW AER - [Low] PCI/DPC: redundant pcie_ports_dpc_native check alongside host->native_dpc -- commit 7e9d77620762d00c0afd4d8efdb677a13fe25294 Author: Mario Limonciello PCI/DPC: Use DPC if platform grants DPC control but not AER control This commit enables the PCIe DPC port service and allows the DPC driver to bind when host->native_dpc is set, even if the OS does not control AER. > 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 =3D dev->port; > + struct pci_host_bridge *host =3D pci_find_host_bridge(pdev->bus); > struct device *device =3D &dev->device; > int status; > u16 cap; > =20 > - 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; [Severity: Medium] Does the DPC driver leave PCI_ERR_UNCOR_STATUS and PCI_EXP_DEVSTA uncleared when host->native_dpc is set without host->native_aer? On a PCI_EXP_DPC_STATUS_TRIGGER_RSN_UNCOR event, dpc_process_error() calls pci_aer_clear_nonfatal_status() and pci_aer_clear_fatal_status(), both of which return early without writing PCI_ERR_UNCOR_STATUS when !pcie_aer_is_native(dev). pcie_do_recovery() likewise skips pcie_clear_device_status() and pci_aer_clear_nonfatal_status() when host->native_aer is clear. Unlike edr_handle_event(), which explicitly calls pci_aer_raw_clear_status() and pcie_clear_device_status(), dpc_handler() never clears these sticky bits. As a result, the AER First Error Pointer and TLP Header Log stay latched to the first error, subsequent DPC events re-report stale status bits, and dpc_get_aer_uncorrect_severity() can misclassify a later non-fatal error as fatal if a stale fatal bit remains set. [Severity: Medium] Can checking host->native_dpc here allow dpc_probe() to bind to a port with pdev->aer_cap =3D=3D 0? Previously, pcie_aer_is_native() rejected ports with !dev->aer_cap. With host->native_dpc accepted directly in dpc_probe() and get_port_device_capability(), a port that advertises DPC without AER (or where pci_aer_init() failed to allocate dev->aer_info and cleared dev->aer_cap) will now bind the DPC driver. When a DPC interrupt fires on such a port, dpc_is_surprise_removal() reads pdev->aer_cap + PCI_ERR_UNCOR_STATUS (offset 0x04, PCI_COMMAND) and tests PCI_ERR_UNC_SURPDN (bit 5, which aliases PCI_COMMAND_VGA_PALETTE), potentially treating a fatal DPC error as a surprise removal and skipping pcie_do_recovery(). dpc_get_aer_uncorrect_severity() also reads standard PCI header offsets 0x04, 0x08, and 0x0c as AER registers without checking dev->aer_cap. [Severity: Medium] When firmware grants DPC control via _OSC while retaining AER control for APEI GHES firmware-first error handling, can binding native DPC race with GHES recovery? pcie_do_recovery() has no bridge-level serialization across phases, and pci_dev_set_io_state(dev, pci_channel_io_frozen) still returns true when error_state is already pci_channel_io_frozen: dpc_handler() (IRQ thread) aer_recover_work_func() (kworker) pcie_do_recovery(..., pcie_do_recovery(..., dpc_reset_link) aer_root_reset) report_frozen_detected() report_frozen_detected() pci_dev_set_io_state() -> true aer_root_reset() pci_bus_error_reset() link still disabled by DPC timeout -> DISCONNECT report_perm_failure_detected() dpc_reset_link() clear DPC_STATUS_TRIGGER report_slot_reset() report_resume() <-- races with perm failure teardown If aer_root_reset() runs while PCI_EXP_DPC_STATUS_TRIGGER still holds the link disabled, the secondary bus wait times out and broadcasts permanent failure to subordinate devices while dpc_handler() concurrently runs slot_reset() and resume(). In addition, on surprise removal dpc_handle_surprise_removal() unconditionally calls pci_aer_raw_clear_status() and pci_clear_surpdn_errors() outside any firmware-coordinated EDR/_OST window, which can clear firmware-owned AER status registers while firmware is reading them. > 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_de= v *dev) > } > =20 > /* > - * 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=3Ddpc-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 |=3D PCIE_PORT_SERVICE_DPC; [Severity: Low] Is the explicit pcie_ports_dpc_native check still needed here and in dpc_probe() now that host->native_dpc is checked? Since commit 4fe37866b0d9 ("PCI/ACPI: Centralize pcie_ports_native checking"), acpi_pci_root_create() folds pcie_ports_dpc_native into the _OSC control mask so host->native_dpc is already set whenever pcie_ports_dpc_native is true, and pci_init_host_bridge() sets native_dpc to 1 on non-ACPI systems when CONFIG_PCIEPORTBUS is enabled. (Keeping it would only matter if this patch is backported to stable trees lacking that commit.) --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261203-superm1-pc= i-dpc-v1-1-6e5dcd5b5fe9@amd.com?part=3D1