From: Rosen Penev <rosenp@gmail.com>
To: linux-pci@vger.kernel.org
Cc: Bjorn Helgaas <bhelgaas@google.com>,
Manivannan Sadhasivam <manivannan.sadhasivam@oss.qualcomm.com>,
Frank Li <Frank.Li@nxp.com>
Subject: [PATCH] PCI: Save Root Port state before resetting it with reset_root_port()
Date: Thu, 3 Dec 2026 22:01:50 -0800 [thread overview]
Message-ID: <20261204060150.1239223-1-rosenp@gmail.com> (raw)
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.
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 | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index e2607cc84ff1..50e8e248058a 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;
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 = host->reset_root_port(host, dev);
if (ret)
pci_err(dev, "Failed to reset Root Port: %d\n", ret);
--
2.56.1
next reply other threads:[~2026-12-04 6:01 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-04 6:01 Rosen Penev [this message]
2026-12-04 6:35 ` [PATCH] PCI: Save Root Port state before resetting it with reset_root_port() sashiko-bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261204060150.1239223-1-rosenp@gmail.com \
--to=rosenp@gmail.com \
--cc=Frank.Li@nxp.com \
--cc=bhelgaas@google.com \
--cc=linux-pci@vger.kernel.org \
--cc=manivannan.sadhasivam@oss.qualcomm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.