Re: [PATCH v2 1/2] PCI/MSI: Skip MSI-X restoration when configuration is inaccessible

From: Farhan Ali

Date: Fri Nov 06 2026 - 13:36:07 EST



On 11/6/2026 3:18 AM, Richard Cheng wrote:
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>

Just curious, why are we limiting this to only MSI-X and not MSI? I think MSI restoration will fail as well since the config space is not accessible.

---
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;
+ }

We have a helper function pci_dev_config_accessible() that does the same check, so might be appropriate to use (of course we would have to make the function global rather than static).

And maybe the check should be moved up before any config space access in this function?

Thanks

Farhan


pci_write_config_word(dev, PCI_COMMAND, cmd | PCI_COMMAND_MEMORY);
write_msg = arch_restore_msi_irqs(dev);