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=1796552160; b=g7En/LFE9IP4CEphSb9r59OkmUy1uoUTt3hgOCZbfsWWpXXFjodzLHNdo161fN0X1KMm UsfFZ4sy2cEcZXyUAZrhW4hpUTgDVhY2OtqMBe0NBFBkcAS1W4UiNEEoeKQPJIp0bAM96 qjDR5wgX8cWcPpQtoRR79UWAA0dmUPPBkr2wWaETQwDQgzKpjGkxQclFeCARM4iwAkIoa TaUVGQmr+OCP6pXri71dA9PxAw32W4Rv66EFUMqaAV4zGy7WgSpbtjxiFuOVNM4QxAjHG LqR9yJatWeoWcbfUIZ0jmoaCrHuKCE5ze488jIQLvClR8id5d8PoF19vm9Boo0vNP/w== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796552160; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=OHsbgCtuv95Smm4yV+k+PY2h/+pb1aehk7Aua+eXp0I=; b=5Uz3FuJUXL0xyhanuUPtV11b6OxH/0+sl+/QqEJzk4JwShDs1rDWMBXstVvKO1dfFSn0 pv/LK8fABWtGtCrtUrUH9zpzzocs5Qj0HJOHxft+13QoBlh4/c52Iunfj9mBMHXxCXpIt do/ntL0I/c1GikiQwNnkw4njxCyh0lm4N/EbKD2+N7ypX/NTUo6UMtHFs3KnEyEFfFlrF OhtcIR7jVl3M95zH/kGuj+yRpPVg09NfzK7dUumqxqJYZPw1Qg/Xgsw7D1Qo47Keph+g6 ZG5bNYbMAds/qizfDM9x3YMqa+acO2p7kuc/HyOQa4vDxma/OzvDurYbeWY5M+VD9/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=bWykRPRc; 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 CE252606A31F for ; Sun, 6 Dec 2026 10:16:00 +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=bWykRPRc Received: by smtp.kernel.org (Postfix) with ESMTPSA id 988261F00A07; Sun, 6 Dec 2026 10:16:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796552160; bh=OHsbgCtuv95Smm4yV+k+PY2h/+pb1aehk7Aua+eXp0I=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=bWykRPRctseIsEMIX/+YpjP+MYlHVO2Gt8YozDocT3TdE5SXiSKwgnvofVnYWZIs0 FLufsM0nIYeOFpQzKfG2uFTGfJEPXDzeO2A4SSYeRpcYQdwuK3SnIPx4RmSwT/JYz0 YAw3IcprRLRD+Prh7wIDY337wNW4EdCepm9ApPwyx+YhTJ5S6BTtX6zwvwmahbmVvp rRLieqWgQTPSYeC6QJbCgcx36ilMxZWeP9GlugYv/oCd6QZGAFZVq/AIdbfB5VF4Lw ffaR3WeBCQlEcbcf9pUj2s+UQvMqd9OmaExnaTNyTUxh98iKfjlVeuEerfxNtSZS8j P7J2xgZZYfr3A== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v2 1/3] PCI: Save Root Port state before resetting it with reset_root_port() Reply-To: sashiko-reviews@lists.linux.dev To: "Rosen Penev" Cc: linux-pci@vger.kernel.org In-Reply-To: <20261206094043.971494-2-rosenp@gmail.com> References: <20261206094043.971494-1-rosenp@gmail.com> <20261206094043.971494-2-rosenp@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Sun, 06 Dec 2026 10:16:00 +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 2 potential issues to consider: - [Medium] PCI: pcibios_reset_secondary_bus() saves disabled AER IRQs in aer_root_reset() - [Medium] PCI: PCI_ROOT_PORT_RESET_FAILED not coordinated with PCI PM suspend/resume -- commit 3776a7bbc2b39db00bec4a17b5f8dc535b61e321 Author: Rosen Penev PCI: Save Root Port state before resetting it with reset_root_port() This commit saves the Root Port's config space before calling host->reset_root_port() in pcibios_reset_secondary_bus(), and tracks failed resets with PCI_ROOT_PORT_RESET_FAILED so a retry does not overwrite the previously saved state. > diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c > index e2607cc84ff1c..66ed89142a655 100644 > --- a/drivers/pci/pci.c > +++ b/drivers/pci/pci.c > @@ -5100,11 +5100,23 @@ void __weak pcibios_reset_secondary_bus(struct pc= i_dev *dev) > int ret; > =20 > if (pci_is_root_bus(dev->bus) && host->reset_root_port) { > + /* > + * The state saved when the port was enumerated or probed may > + * predate changes made since, e.g. memory decoding enabled > + * once a device below the port was enabled. After a failed > + * reset, keep the state saved before it instead: the port may > + * be left with reset defaults or with its clocks off. > + */ > + if (!test_bit(PCI_ROOT_PORT_RESET_FAILED, &dev->priv_flags)) > + pci_save_state(dev); [Severity: Medium] Can pci_save_state() here capture disabled AER interrupts when called from aer_root_reset()? aer_root_reset() calls aer_disable_irq() to clear ROOT_PORT_INTR_ON_MESG_MA= SK in PCI_ERR_ROOT_COMMAND before calling pci_bus_error_reset(), and only re-enables it afterward. pci_save_state() -> pci_save_aer_state() saves that cleared register value. If host->reset_root_port() fails, PCI_ROOT_PORT_RESET_FAILED keeps that saved state while aer_root_reset() re-enables AER interrupts in hardware. A later successful non-AER reset (such as pci_reset_function()) then skips pci_save_state() and restores it, leaving AER interrupts disabled. > ret =3D host->reset_root_port(host, dev); > - if (ret) > + if (ret) { > + set_bit(PCI_ROOT_PORT_RESET_FAILED, &dev->priv_flags); > pci_err(dev, "Failed to reset Root Port: %d\n", ret); > - else > + } else { > + clear_bit(PCI_ROOT_PORT_RESET_FAILED, &dev->priv_flags); > pci_restore_state(dev); > + } [Severity: Medium] Should PCI_ROOT_PORT_RESET_FAILED also be coordinated with PCI PM suspend and resume paths? pci_pm_runtime_suspend() and pci_pm_suspend() clear state_saved and call pci_save_state() without checking this flag. If host->reset_root_port() left the port with clocks off, those config-space reads can abort; if it left reset defaults, they overwrite the saved state a retry will restore. Conversely, this flag is only cleared when a later reset succeeds. If reset_root_port() fails before touching hardware (such as qcom_pcie_reset_root_port() timing out on flush completion) or the port recovers via system suspend/resume, the flag stays set. The next reset then skips pci_save_state() and restores stale config space, clobbering newer bridge settings such as memory decoding and bus mastering for downstream devices. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261206094043.9714= 94-1-rosenp@gmail.com?part=3D1