[PATCH v2 1/2] PCI/MSI: Skip MSI-X restoration when configuration is inaccessible
From: Richard Cheng
Date: Fri Nov 06 2026 - 06:24:56 EST
PCI state restoration runs even when a reset fails. If the device's
configuration space remains inaccessible, MSI-X restoration can issue
table MMIO accesses that trigger additional errors, including DPC
containment.
Check the existing PCI Command register read and skip MSI-X restoration
if it fails or returns all ones. Preserve the existing handling of a
valid Command register with Memory Space Enable clear, which temporarily
enables memory decoding while restoring the MSI-X table.
Limit the change to MSI-X restoration. Leave other PCI state
restoration, driver reset callbacks, and reset return values unchanged.
Signed-off-by: Richard Cheng <icheng@xxxxxxxxxx>
---
drivers/pci/msi/msi.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/pci/msi/msi.c b/drivers/pci/msi/msi.c
index 8a0133a6a286..37de31f4cfb6 100644
--- a/drivers/pci/msi/msi.c
+++ b/drivers/pci/msi/msi.c
@@ -887,7 +887,11 @@ void __pci_restore_msix_state(struct pci_dev *dev)
* Since the MSI-X Table and PBA are in Memory Space, enable it
* while restoring them.
*/
- pci_read_config_word(dev, PCI_COMMAND, &cmd);
+ if (pci_read_config_word(dev, PCI_COMMAND, &cmd) ||
+ PCI_POSSIBLE_ERROR(cmd)) {
+ pci_warn(dev, "Device config space inaccessible; unable to restore MSI-X state\n");
+ return;
+ }
pci_write_config_word(dev, PCI_COMMAND, cmd | PCI_COMMAND_MEMORY);
write_msg = arch_restore_msi_irqs(dev);
--
2.43.0