[PATCH 3/4] PCI: Skip state restoration when configuration is inaccessible

From: Richard Cheng

Date: Mon Sep 28 2026 - 22:04:43 EST


pci_dev_restore() restores state even when the device is inaccessible.
MSI-X restoration can then issue MMIO accesses that trigger DPC.

Check configuration accessibility before restoring state. Keep driver
reset callbacks and reset return values unchanged.

Signed-off-by: Richard Cheng <icheng@xxxxxxxxxx>
---
drivers/pci/pci.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index d59a374a350d..9a343f8b5429 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -5127,7 +5127,9 @@ static void pci_dev_restore(struct pci_dev *dev)
const struct pci_error_handlers *err_handler =
dev->driver ? dev->driver->err_handler : NULL;

- pci_restore_state(dev);
+ /* MSI-X restoration may access device MMIO. */
+ if (pci_dev_config_accessible(dev, "restore state"))
+ pci_restore_state(dev);

/*
* dev->driver->err_handler->reset_done() is protected against
--
2.43.0