[PATCH] PCI: Save the Root Port state before a platform-specific reset

From: lirongqing

Date: Tue Nov 10 2026 - 00:37:16 EST


From: Li RongQing <lirongqing@xxxxxxxxx>

pcibios_reset_secondary_bus() restores the Root Port after
host->reset_root_port() without ever saving it. pci_bus_reset() only locks
the devices below the bridge, so the bridge itself is not in the saved set
either. Save the Root Port before the platform reset.

Fixes: 3fc686d550f6 ("PCI/ERR: Add support for resetting the Root Ports in a platform-specific way")
Signed-off-by: Li RongQing <lirongqing@xxxxxxxxx>
---
drivers/pci/pci.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index ddb86dd..eaccd89 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -4929,6 +4929,7 @@ void __weak pcibios_reset_secondary_bus(struct pci_dev *dev)
int ret;

if (pci_is_root_bus(dev->bus) && host->reset_root_port) {
+ pci_save_state(dev);
ret = host->reset_root_port(host, dev);
if (ret)
pci_err(dev, "Failed to reset Root Port: %d\n", ret);
--
2.9.4