Linux PCI subsystem development
 help / color / mirror / Atom feed
* [PATCH v2 0/3] PCI: mvebu: Reset Root Ports with PERST#
@ 2026-12-06  9:40 Rosen Penev
  2026-12-06  9:40 ` [PATCH v2 1/3] PCI: Save Root Port state before resetting it with reset_root_port() Rosen Penev
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Rosen Penev @ 2026-12-06  9:40 UTC (permalink / raw)
  To: Thomas Petazzoni, Pali Rohár, Lorenzo Pieralisi,
	Krzysztof Wilczyński, Manivannan Sadhasivam, Bjorn Helgaas,
	Frank Li
  Cc: Rob Herring, Manivannan Sadhasivam, linux-pci, linux-arm-kernel

Some devices don't reset fully on the in-band hot reset that a bus reset
of a Root Port triggers: the Marvell 88W8864 and 88W8964 Wi-Fi chips
only return to their boot ROM on PERST# or power-on, so once their
firmware has run the driver can't be bound to them again until the board
is rebooted. Patch 3 implements reset_root_port() in pci-mvebu to pulse
PERST# on ports that have a reset GPIO, and keeps the hot reset on the
others.

Patch 1 fixes the core side: pcibios_reset_secondary_bus() restores the
Root Port's config space after reset_root_port() without saving it
first, so it restores the state saved at enumeration, with memory
decoding and bus mastering off. Patch 2 exports
pci_reset_secondary_bus() for pci-mvebu's fallback, as the driver can be
a module.

Patches 1 and 3 were sent separately as v1. They are a series now
because patch 3 depends on patch 1.

Tested on a Linksys WRT3200ACM (two 88W8964 radios): unbinding and
binding mwlwifi again reloads the firmware of either radio. That test
was on v1; the changes since are compile-tested only (arm,
mvebu_v7_defconfig with PCI_MVEBU=m, W=1).

Changes in v2:
- Patch 1: don't save the Root Port's state again after a failed
  reset_root_port(), so a retry restores the state from before the
  failure instead of reset defaults, and doesn't read the config space
  of a controller left with its clocks off (review).
- New patch 2: export pci_reset_secondary_bus(), which pci-mvebu calls
  and which broke the PCI_MVEBU=m build (review).
- Patch 3: explain the state save/restore in the commit message.
- v1 of patch 1: https://lore.kernel.org/linux-pci/20261204060150.1239223-1-rosenp@gmail.com/
- v1 of patch 3: https://lore.kernel.org/linux-pci/20261204060752.1243189-1-rosenp@gmail.com/

Rosen Penev (3):
  PCI: Save Root Port state before resetting it with reset_root_port()
  PCI: Export pci_reset_secondary_bus()
  PCI: mvebu: Reset Root Ports with PERST#

 drivers/pci/controller/pci-mvebu.c | 56 ++++++++++++++++++++++++++----
 drivers/pci/pci.c                  | 17 +++++++--
 drivers/pci/pci.h                  |  1 +
 3 files changed, 66 insertions(+), 8 deletions(-)


base-commit: 29beb21c21ada7207692b2d69fc58dcd15dab6e9
-- 
2.56.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH v2 1/3] PCI: Save Root Port state before resetting it with reset_root_port()
  2026-12-06  9:40 [PATCH v2 0/3] PCI: mvebu: Reset Root Ports with PERST# Rosen Penev
@ 2026-12-06  9:40 ` Rosen Penev
  2026-12-06 10:16   ` sashiko-bot
  2026-12-06  9:40 ` [PATCH v2 2/3] PCI: Export pci_reset_secondary_bus() Rosen Penev
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: Rosen Penev @ 2026-12-06  9:40 UTC (permalink / raw)
  To: Thomas Petazzoni, Pali Rohár, Lorenzo Pieralisi,
	Krzysztof Wilczyński, Manivannan Sadhasivam, Bjorn Helgaas,
	Frank Li
  Cc: Rob Herring, Manivannan Sadhasivam, linux-pci, linux-arm-kernel

pcibios_reset_secondary_bus() restores the Root Port's config space after
host->reset_root_port(), but doesn't save it first, so it restores
whatever was saved last. For a Root Port that is the state saved when
portdrv probed it, before a device below it was enabled, which turns
memory decoding and bus mastering of the port off again: a function
reset of the device through its parent bus (e.g. pci_reset_function()
on a device whose only reset method is "bus") leaves the device
unreachable.

Save the Root Port's state right before resetting it. If a reset fails,
don't save again on the next attempt: the port may be left with reset
defaults (e.g. cleared bridge windows) that a successful retry would then
restore, or with its clocks off, where reading its config space can abort.
Keep the state saved before the failed reset instead.

Fixes: 3fc686d550f6 ("PCI/ERR: Add support for resetting the Root Ports in a platform-specific way")
Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 drivers/pci/pci.c | 16 ++++++++++++++--
 drivers/pci/pci.h |  1 +
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index e2607cc84ff1..66ed89142a65 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -5100,11 +5100,23 @@ void __weak pcibios_reset_secondary_bus(struct pci_dev *dev)
 	int ret;
 
 	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);
 		ret = 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);
+		}
 
 		return;
 	}
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index 202c52c0a83b..972ca609458b 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -825,6 +825,7 @@ static inline int pci_dev_set_disconnected(struct pci_dev *dev, void *unused)
 #define PCI_LINK_CHANGING 5
 #define PCI_LINK_LBMS_SEEN	6
 #define PCI_DEV_ALLOW_BINDING 7
+#define PCI_ROOT_PORT_RESET_FAILED 8
 
 static inline void pci_dev_assign_added(struct pci_dev *dev)
 {
-- 
2.56.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 2/3] PCI: Export pci_reset_secondary_bus()
  2026-12-06  9:40 [PATCH v2 0/3] PCI: mvebu: Reset Root Ports with PERST# Rosen Penev
  2026-12-06  9:40 ` [PATCH v2 1/3] PCI: Save Root Port state before resetting it with reset_root_port() Rosen Penev
@ 2026-12-06  9:40 ` Rosen Penev
  2026-12-06  9:40 ` [PATCH v2 3/3] PCI: mvebu: Reset Root Ports with PERST# Rosen Penev
  2026-12-06 10:16 ` [PATCH v2 0/3] " sashiko-bot
  3 siblings, 0 replies; 7+ messages in thread
From: Rosen Penev @ 2026-12-06  9:40 UTC (permalink / raw)
  To: Thomas Petazzoni, Pali Rohár, Lorenzo Pieralisi,
	Krzysztof Wilczyński, Manivannan Sadhasivam, Bjorn Helgaas,
	Frank Li
  Cc: Rob Herring, Manivannan Sadhasivam, linux-pci, linux-arm-kernel

A host bridge's reset_root_port() callback may only need a reset other
than the in-band hot reset for some of its Root Ports, and fall back to
pci_reset_secondary_bus() for the others. pci-mvebu, the next user, can
be built as a module, so export the function.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 drivers/pci/pci.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 66ed89142a65..99b1ded27e83 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -5093,6 +5093,7 @@ void pci_reset_secondary_bus(struct pci_dev *dev)
 	ctrl &= ~PCI_BRIDGE_CTL_BUS_RESET;
 	pci_write_config_word(dev, PCI_BRIDGE_CONTROL, ctrl);
 }
+EXPORT_SYMBOL_GPL(pci_reset_secondary_bus);
 
 void __weak pcibios_reset_secondary_bus(struct pci_dev *dev)
 {
-- 
2.56.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v2 3/3] PCI: mvebu: Reset Root Ports with PERST#
  2026-12-06  9:40 [PATCH v2 0/3] PCI: mvebu: Reset Root Ports with PERST# Rosen Penev
  2026-12-06  9:40 ` [PATCH v2 1/3] PCI: Save Root Port state before resetting it with reset_root_port() Rosen Penev
  2026-12-06  9:40 ` [PATCH v2 2/3] PCI: Export pci_reset_secondary_bus() Rosen Penev
@ 2026-12-06  9:40 ` Rosen Penev
  2026-12-06  9:58   ` sashiko-bot
  2026-12-06 10:16 ` [PATCH v2 0/3] " sashiko-bot
  3 siblings, 1 reply; 7+ messages in thread
From: Rosen Penev @ 2026-12-06  9:40 UTC (permalink / raw)
  To: Thomas Petazzoni, Pali Rohár, Lorenzo Pieralisi,
	Krzysztof Wilczyński, Manivannan Sadhasivam, Bjorn Helgaas,
	Frank Li
  Cc: Rob Herring, Manivannan Sadhasivam, linux-pci, linux-arm-kernel

A function reset of a device whose only reset method is "bus" ends up in
pcibios_reset_secondary_bus() on its Root Port. Without a
reset_root_port() callback, that triggers an in-band hot reset through
the emulated bridge (PCIE_CTRL_MASTER_HOT_RESET). Some devices don't
reset fully on a hot reset: the Marvell 88W8864 and 88W8964 Wi-Fi chips
only return to their boot ROM on PERST# or power-on, so once their
firmware has run, the driver can't be bound to them again until the
board is rebooted.

When the port has a reset GPIO, implement reset_root_port() by pulsing
PERST# instead: assert it for 1-2 ms (more than the 100 us Tperst
minimum), release it, wait the same time as at power-up (reset-delay-us,
by default PCI_PM_D3COLD_WAIT), and wait up to a second for the link to
come back. Ports without a reset GPIO keep the hot reset, through
pci_reset_secondary_bus().

With the callback registered, pcibios_reset_secondary_bus() also
restores the Root Port's config space after the reset, on every port.
It saves that state right before the reset, so this restores the
current PCI_COMMAND rather than the one saved at enumeration, which
has memory decoding and bus mastering off.

Factor the reset-delay-us lookup out of mvebu_pcie_powerup() so both
use the same delay.

Tested on a Linksys WRT3200ACM (two 88W8964 radios, PERST# on MPP45 and
MPP46): unbinding and binding mwlwifi again, with mwlwifi calling
pci_reset_function_locked() when the boot ROM doesn't answer, now
reloads the firmware of either radio.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 drivers/pci/controller/pci-mvebu.c | 56 ++++++++++++++++++++++++++----
 1 file changed, 50 insertions(+), 6 deletions(-)

diff --git a/drivers/pci/controller/pci-mvebu.c b/drivers/pci/controller/pci-mvebu.c
index 4e9544d61622..d5c874d6c2b3 100644
--- a/drivers/pci/controller/pci-mvebu.c
+++ b/drivers/pci/controller/pci-mvebu.c
@@ -14,6 +14,7 @@
 #include <linux/gpio/consumer.h>
 #include <linux/init.h>
 #include <linux/irqchip/chained_irq.h>
+#include <linux/iopoll.h>
 #include <linux/irqdomain.h>
 #include <linux/mbus.h>
 #include <linux/slab.h>
@@ -1358,6 +1359,16 @@ static int mvebu_pcie_parse_port(struct mvebu_pcie *pcie,
 	return ret;
 }
 
+/* Time to wait after releasing PERST# before the device is accessed. */
+static unsigned int mvebu_pcie_port_reset_delay_ms(struct mvebu_pcie_port *port)
+{
+	u32 reset_udelay = PCI_PM_D3COLD_WAIT * 1000;
+
+	of_property_read_u32(port->dn, "reset-delay-us", &reset_udelay);
+
+	return reset_udelay / 1000;
+}
+
 /*
  * Power up a PCIe port.  PCIe requires the refclk to be stable for 100µs
  * prior to releasing PERST.  See table 2-4 in section 2.6.2 AC Specifications
@@ -1372,15 +1383,10 @@ static int mvebu_pcie_powerup(struct mvebu_pcie_port *port)
 		return ret;
 
 	if (port->reset_gpio) {
-		u32 reset_udelay = PCI_PM_D3COLD_WAIT * 1000;
-
-		of_property_read_u32(port->dn, "reset-delay-us",
-				     &reset_udelay);
-
 		udelay(100);
 
 		gpiod_set_value_cansleep(port->reset_gpio, 0);
-		msleep(reset_udelay / 1000);
+		msleep(mvebu_pcie_port_reset_delay_ms(port));
 	}
 
 	return 0;
@@ -1397,6 +1403,43 @@ static void mvebu_pcie_powerdown(struct mvebu_pcie_port *port)
 	clk_disable_unprepare(port->clk);
 }
 
+/*
+ * Reset the device below a Root Port. The in-band hot reset that
+ * pci_reset_secondary_bus() triggers through the emulated bridge does not
+ * 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 = pci_host_bridge_priv(bridge);
+	struct mvebu_pcie_port *port;
+	bool up;
+	int ret;
+
+	port = 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 = 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;
+}
+
 /*
  * devm_of_pci_get_host_bridge_resources() only sets up translatable resources,
  * so we need extra resource setup parsing our special DT properties encoding
@@ -1622,6 +1665,7 @@ static int mvebu_pcie_probe(struct platform_device *pdev)
 	bridge->child_ops = &mvebu_pcie_child_ops;
 	bridge->align_resource = mvebu_pcie_align_resource;
 	bridge->map_irq = mvebu_pcie_map_irq;
+	bridge->reset_root_port = mvebu_pcie_reset_root_port;
 
 	return pci_host_probe(bridge);
 }
-- 
2.56.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 3/3] PCI: mvebu: Reset Root Ports with PERST#
  2026-12-06  9:40 ` [PATCH v2 3/3] PCI: mvebu: Reset Root Ports with PERST# Rosen Penev
@ 2026-12-06  9:58   ` sashiko-bot
  0 siblings, 0 replies; 7+ messages in thread
From: sashiko-bot @ 2026-12-06  9:58 UTC (permalink / raw)
  To: Rosen Penev; +Cc: linux-pci

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 <rosenp@gmail.com>

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);
>  }
>  
> +/*
> + * Reset the device below a Root Port. The in-band hot reset that
> + * pci_reset_secondary_bus() triggers through the emulated bridge does not
> + * 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 = pci_host_bridge_priv(bridge);
> +	struct mvebu_pcie_port *port;
> +	bool up;
> +	int ret;
> +
> +	port = 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 = 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 = 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().

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261206094043.971494-1-rosenp@gmail.com?part=3

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 1/3] PCI: Save Root Port state before resetting it with reset_root_port()
  2026-12-06  9:40 ` [PATCH v2 1/3] PCI: Save Root Port state before resetting it with reset_root_port() Rosen Penev
@ 2026-12-06 10:16   ` sashiko-bot
  0 siblings, 0 replies; 7+ messages in thread
From: sashiko-bot @ 2026-12-06 10:16 UTC (permalink / raw)
  To: Rosen Penev; +Cc: linux-pci

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 <rosenp@gmail.com>

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 pci_dev *dev)
>  	int ret;
>  
>  	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_MASK
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 = 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.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261206094043.971494-1-rosenp@gmail.com?part=1

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2 0/3] PCI: mvebu: Reset Root Ports with PERST#
  2026-12-06  9:40 [PATCH v2 0/3] PCI: mvebu: Reset Root Ports with PERST# Rosen Penev
                   ` (2 preceding siblings ...)
  2026-12-06  9:40 ` [PATCH v2 3/3] PCI: mvebu: Reset Root Ports with PERST# Rosen Penev
@ 2026-12-06 10:16 ` sashiko-bot
  3 siblings, 0 replies; 7+ messages in thread
From: sashiko-bot @ 2026-12-06 10:16 UTC (permalink / raw)
  To: Rosen Penev; +Cc: linux-pci

Sashiko has finished reviewing this 3-patch series:

- Patch 2: no issues found.
- Patch 1 ("PCI: Save Root Port state before resetting it with r..."): 2
  potential issues (2 Medium)
- Patch 3 ("PCI: mvebu: Reset Root Ports with PERST#"): 1 potential
  issue (1 Medium)

Detailed reviews have been sent as separate replies to patches 1 and 3.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261206094043.971494-1-rosenp@gmail.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-12-06 10:16 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-06  9:40 [PATCH v2 0/3] PCI: mvebu: Reset Root Ports with PERST# Rosen Penev
2026-12-06  9:40 ` [PATCH v2 1/3] PCI: Save Root Port state before resetting it with reset_root_port() Rosen Penev
2026-12-06 10:16   ` sashiko-bot
2026-12-06  9:40 ` [PATCH v2 2/3] PCI: Export pci_reset_secondary_bus() Rosen Penev
2026-12-06  9:40 ` [PATCH v2 3/3] PCI: mvebu: Reset Root Ports with PERST# Rosen Penev
2026-12-06  9:58   ` sashiko-bot
2026-12-06 10:16 ` [PATCH v2 0/3] " sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox