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=1796551108; b=nRkzwl4wOpPqn+29hUacPbYDJnQ/TfOBlQpqEZvd/ju0gAMYs7ULXK8c77VqHb7j0sZ2 OvkDJPs81nj9f1UXh6eN3zyLn3MFU2G1j46nZ/6XNoZIiAOvNdk2hIsVtyxGlpvuDH2ax DpNcDGBl9tQYlay2+R9iX72BPQgoT93Np6QTGn6pzENFyE86UhJQEvY/PB0D1TKycf7Sv 3fBJR3jYZtgkFp5t4nUNxm5/HADYzrdB1F9oDGr3+Acbchla8+He57Ha0EbLyhMKDPBQE SmuYW8yj23vgvmcwvSM5POIxzRp5Fz5UJ7ZpfHOe1oY7m7djAzvUofXWKw8AVniKOEQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796551108; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=xqSyIAZ8Lgb6A3XpDXhxdo6cSBt36LbLeH2oAY+mWVQ=; b=C98JNO82miShxu+aOHkPbN9V1ufh6RMIyKM9yiQ1rvxKxUdB7Sf3oR17S2GXq+tSKEz+ tEmniPKzqRVx85sHnh6h8GujwtWMxWpmYsqYseCKtTTfdpfCmFGVhKT9yRZd2k9HDcKax KQqCKPpr5zB6R+pHFfATYfaaC5sz3pbMxm8gC/jTzw7hKfucah+6dDuXICMNWdMcEZ5+p xh5pkd0CnhF7nCF09PcUpRlCQn6eSimJvlXkMMb/4ldoS+H0pqNhtM2HdO03TztRnaGxQ 3CRQ2JFKQ2UipF8rHzNh7QCyVg61ADajC1aM2vikx0d/OLRQYVHDuTIwdelmlzdy+mQ== 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=SNJJLeO7; 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 DC667606A31F for ; Sun, 6 Dec 2026 09:58:28 +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=SNJJLeO7 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7227D1F0092B; Sun, 6 Dec 2026 09:58:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796551108; bh=xqSyIAZ8Lgb6A3XpDXhxdo6cSBt36LbLeH2oAY+mWVQ=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=SNJJLeO7rX7/CZ8N5pREwz0J8l7+HikSGueiMijnBY0SCaOUU4/AouuHrSLwhhJN8 Sy4bUVGB9ISoaSGDbqCkWuswSMLEFz2H5dX3DmrXU+1DdRky2iXDAt7z7xapoxtzVm GSEGSwsHTrd8hsEg1aWjTGXfrk128pUp85xSflrPNOxLcDSI8dHCoQATIJwA34/D+w CojAWrxDkWTTEjKnIfghMCI+bSVos9v0/i1S5jkzRQfjdiqf+5Kia/gH0HioHxwjks 5wbXEWc5SjjiJzlYYD63iX2yZgizAtMc4ptffo6COsjXz75ehwIgfuHUDcQyCjbA2w XO13gVzF9sgCQ== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v2 3/3] PCI: mvebu: Reset Root Ports with PERST# Reply-To: sashiko-reviews@lists.linux.dev To: "Rosen Penev" Cc: linux-pci@vger.kernel.org In-Reply-To: <20261206094043.971494-4-rosenp@gmail.com> References: <20261206094043.971494-1-rosenp@gmail.com> <20261206094043.971494-4-rosenp@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Sun, 06 Dec 2026 09:58:28 +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: mvebu: mvebu_pcie_reset_root_port() latches reset failure on link down -- commit 9255153a273b69b64e256ee53888f19e0a4c1920 Author: Rosen Penev PCI: mvebu: Reset Root Ports with PERST# This commit implements reset_root_port() for pci-mvebu so Root Ports with a reset GPIO pulse PERST# instead of triggering an in-band hot reset, and factors out the reset-delay-us lookup from mvebu_pcie_powerup(). > diff --git a/drivers/pci/controller/pci-mvebu.c b/drivers/pci/controller/= pci-mvebu.c > index 4e9544d616226..d5c874d6c2b3a 100644 > --- a/drivers/pci/controller/pci-mvebu.c > +++ b/drivers/pci/controller/pci-mvebu.c [ ... ] > @@ -1397,6 +1403,43 @@ static void mvebu_pcie_powerdown(struct mvebu_pcie= _port *port) > clk_disable_unprepare(port->clk); > } > =20 > +/* > + * Reset the device below a Root Port. The in-band hot reset that > + * pci_reset_secondary_bus() triggers through the emulated bridge does n= ot > + * reset every device (some only return to their boot ROM on PERST#), so > + * pulse PERST# when the port has a reset GPIO. > + */ > +static int mvebu_pcie_reset_root_port(struct pci_host_bridge *bridge, > + struct pci_dev *dev) > +{ > + struct mvebu_pcie *pcie =3D pci_host_bridge_priv(bridge); > + struct mvebu_pcie_port *port; > + bool up; > + int ret; > + > + port =3D mvebu_pcie_find_port(pcie, dev->bus, dev->devfn); > + if (!port) > + return -ENODEV; > + > + if (!port->reset_gpio) { > + pci_reset_secondary_bus(dev); > + return 0; > + } > + > + gpiod_set_value_cansleep(port->reset_gpio, 1); > + /* PERST# must stay asserted for at least 100 us (Tperst) */ > + usleep_range(1000, 2000); > + gpiod_set_value_cansleep(port->reset_gpio, 0); > + msleep(mvebu_pcie_port_reset_delay_ms(port)); > + > + ret =3D read_poll_timeout(mvebu_pcie_link_up, up, up, 1000, > + USEC_PER_SEC, false, port); > + if (ret) > + dev_warn(&dev->dev, "link down after PERST#\n"); > + > + return ret; > +} [Severity: Medium] Should mvebu_pcie_reset_root_port() return -ETIMEDOUT when the downstream link does not come up? pcibios_reset_secondary_bus() treats any non-zero return from host->reset_root_port() as a Root Port reset failure: drivers/pci/pci.c:pcibios_reset_secondary_bus() { ... if (!test_bit(PCI_ROOT_PORT_RESET_FAILED, &dev->priv_flags)) pci_save_state(dev); ret =3D host->reset_root_port(host, dev); if (ret) { set_bit(PCI_ROOT_PORT_RESET_FAILED, &dev->priv_flags); pci_err(dev, "Failed to reset Root Port: %d\n", ret); } else { clear_bit(PCI_ROOT_PORT_RESET_FAILED, &dev->priv_flags); pci_restore_state(dev); } ... } If an empty Root Port with a reset GPIO is reset (for example via sysfs reset_subordinate), read_poll_timeout() returns -ETIMEDOUT and latches PCI_ROOT_PORT_RESET_FAILED while pci_bridge_wait_for_secondary_bus() still returns 0. When a device is later inserted or rescanned behind that port and reset again, pcibios_reset_secondary_bus() skips pci_save_state(dev) and restores the stale empty-slot config space via pci_restore_state(dev). That clears PCI_COMMAND_MEMORY and PCI_COMMAND_MASTER and causes mvebu_pcie_handle_membase_change() to delete active MBus decode windows, leaving the downstream device unreachable. Returning 0 on link-wait timeout, like rockchip_pcie_rc_reset_root_port() and qcom_pcie_reset_root_port(), lets pcibios_reset_secondary_bus() restore Root Port state and leaves downstream readiness checks to pci_bridge_wait_for_secondary_bus(). --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/20261206094043.9714= 94-1-rosenp@gmail.com?part=3D3