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=1796366153; b=G1fd8j5ttVfGkK2PRY9OM3yFc6u7j5BiQBj1w6KtRH1lwumHD/hyLUg777KwKdTJuSaR dtVg41jIxM5hjO1A5hjjkK8E4CH0cEJa07IIQp9CfCoAyb5PjO0S2s0C9s0pRApbO3oRb aa/SiSxD8F+/gNffSSttVX4JwXXEz4YcTu0rhzt7VHebIBBvmbBfoWLoFEyMhWAqOYnOl 3bbH+dw+7lYZXITmp9acvNPDHo38BoC5Lq0vsUZrGW1qBoRDdyhOEfXuPdG6lvTF6F9Lo Iiu5Ok48t8TRAb8HxAmGkAJED9nFNOXdZQzbZuZMqmtanA7TlnHojbQrK+m19rx84yA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796366153; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=43BsHsRHXZtwjKL/bnRZxUw1ijxlGkLjhYNqqyWOnS8=; b=LM6Mujq7RswYUSE9BZ9G5AwdyY/i6EcH6Pjhu7NL+iFGoN6v/Jf4YXcDbGuSFYb7823Q /hiVHwer9FdLtxkmQ3Q2g7tSepLjFMGDo/a3Hg2WLf3RBn7q9fU/VA1Eoa7kgFViZM6Aw kfhdhLD/9s/SSlwaqKmR6jVN+xk1dHvLlfcQrVV8ODEJYUII6fACeyFq9xWrGjrAaQEnN ntLUA92WhUKn0aRB4D0VFLYp+4WH44aesKitdx3FyTOB/UyiaKL8lk8ZNtOpjlSxQpdak IdbvIl4EtbZTy7m3K4YyP/869ifkJduYLMqpziOk2jOzEmjDKqMnFBayunR4AwF0Kdw== 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=Mua9EFF8; 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 3FC64606A322 for ; Fri, 4 Dec 2026 06:35:53 +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=Mua9EFF8 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0C99A1F000CE; Fri, 4 Dec 2026 06:35:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796366153; bh=43BsHsRHXZtwjKL/bnRZxUw1ijxlGkLjhYNqqyWOnS8=; h=From:Subject:Reply-To:To:In-Reply-To:References:Date; b=Mua9EFF8cmqI6RRNmtaMAa9Qzetm0soIlhlX9fV7FYSiVkNbslC7vGCheniRVmquC jO1CVbeu4mzN42scSgWdcHSwiJjjqRUx+WmgmkfXAtYDUPCmeq2AQXqiwiTFpITana iF9+erI5WkmtBvqN4KiHpr1EA0bHTv816oPN4e/Q2Qwnw5M0eZvAxBONB4N9HaUgf1 BYoomb0G/FOIvNqL22S6C+1+DgkVTZEnM7ikXGTV0B0LDZIIn7NQ4Yggr87kBpvav+ YUaJhCpVGJe7J7X2wgTCE+jKg7NnlJslldptkO6bLVE/f/20v6LXfR3znF7nmDs1h5 9fIh7/baEECKA== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH] PCI: Save Root Port state before resetting it with reset_root_port() Reply-To: sashiko-reviews@lists.linux.dev To: "Rosen Penev" , linux-pci@vger.kernel.org In-Reply-To: <20261204060150.1239223-1-rosenp@gmail.com> References: <20261204060150.1239223-1-rosenp@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Dec 2026 06:35:52 +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 1 potential issue to consider: - [Medium] pci: retry after failed reset_root_port() clobbers saved Root Port state -- commit 77ceb3990e3d801d01b81aa8059b11a31337a68a Author: Rosen Penev PCI: Save Root Port state before resetting it with reset_root_port() This commit calls pci_save_state() on the Root Port before invoking host->reset_root_port() in pcibios_reset_secondary_bus(). > diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c > index e2607cc84ff1c..50e8e248058a8 100644 > --- a/drivers/pci/pci.c > +++ b/drivers/pci/pci.c > @@ -5100,6 +5100,12 @@ void __weak pcibios_reset_secondary_bus(struct pci= _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. > + */ > + pci_save_state(dev); > ret =3D host->reset_root_port(host, dev); > if (ret) > pci_err(dev, "Failed to reset Root Port: %d\n", ret); [Severity: Medium] Can a retry after a failed host->reset_root_port() clobber the Root Port's saved config space? When host->reset_root_port() fails, pcibios_reset_secondary_bus() skips pci_restore_state(). In qcom_pcie_reset_root_port(), if dw_pcie_wait_for_link() returns -ETIMEDOUT or -EIO after dw_pcie_setup_rc(), the hardware is left with bare reset defaults such as zeroed bridge windows. A later reset attempt then calls pci_save_state() and overwrites the valid saved state with those defaults, so even a successful retry restores broken state and leaves downstream devices unreachable. If host->reset_root_port() fails with clocks disabled or reset asserted, as on error paths in rockchip_pcie_rc_reset_root_port(), a retry's pci_save_state() also reads unclocked DBI registers, risking an external abort or bus hang. Skipping pci_save_state() when a prior reset_root_port() failed would keep the last valid saved state and avoid touching an unclocked controller. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261204060150.1239= 223-1-rosenp@gmail.com?part=3D1