From: Richard Cheng <icheng@nvidia.com>
To: bhelgaas@google.com, dave@stgolabs.net, jic23@kernel.org,
dave.jiang@intel.com, alison.schofield@intel.com,
vishal.l.verma@intel.com, benjamin.cheatham@amd.com
Cc: iweiny@kernel.org, ming.li@zohomail.com, icheng@nvidia.com,
linux-cxl@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-pci@vger.kernel.org, tglx@kernel.org,
wangruikang@iscas.ac.cn, vidyas@nvidia.com,
lihaoxiang@isrc.iscas.ac.cn, xiangzao@linux.alibaba.com,
shawn.lin@rock-chips.com, alifm@linux.ibm.com,
18255117159@163.com
Subject: [PATCH v2 1/2] PCI/MSI: Skip MSI-X restoration when configuration is inaccessible
Date: Fri, 6 Nov 2026 19:18:28 +0800 [thread overview]
Message-ID: <20261106111829.55823-2-icheng@nvidia.com> (raw)
In-Reply-To: <20261106111829.55823-1-icheng@nvidia.com>
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@nvidia.com>
---
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
next prev parent reply other threads:[~2026-11-06 11:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-06 11:18 [PATCH v2 0/2] PCI/CXL: Guard MMIO accesses during reset recovery Richard Cheng
2026-11-06 11:18 ` Richard Cheng [this message]
2026-11-06 18:30 ` [PATCH v2 1/2] PCI/MSI: Skip MSI-X restoration when configuration is inaccessible Farhan Ali
2026-11-06 11:18 ` [PATCH v2 2/2] cxl/pci: Guard decoder accesses after reset Richard Cheng
2026-11-06 11:22 ` [PATCH v2 0/2] PCI/CXL: Guard MMIO accesses during reset recovery Richard Cheng
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=20261106111829.55823-2-icheng@nvidia.com \
--to=icheng@nvidia.com \
--cc=18255117159@163.com \
--cc=alifm@linux.ibm.com \
--cc=alison.schofield@intel.com \
--cc=benjamin.cheatham@amd.com \
--cc=bhelgaas@google.com \
--cc=dave.jiang@intel.com \
--cc=dave@stgolabs.net \
--cc=iweiny@kernel.org \
--cc=jic23@kernel.org \
--cc=lihaoxiang@isrc.iscas.ac.cn \
--cc=linux-cxl@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=ming.li@zohomail.com \
--cc=shawn.lin@rock-chips.com \
--cc=tglx@kernel.org \
--cc=vidyas@nvidia.com \
--cc=vishal.l.verma@intel.com \
--cc=wangruikang@iscas.ac.cn \
--cc=xiangzao@linux.alibaba.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®