From: Richard Cheng <icheng@nvidia.com>
To: Farhan Ali <alifm@linux.ibm.com>
Cc: 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,
iweiny@kernel.org, ming.li@zohomail.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, 18255117159@163.com
Subject: Re: [PATCH v2 1/2] PCI/MSI: Skip MSI-X restoration when configuration is inaccessible
Date: Mon, 16 Nov 2026 14:17:36 +0800 [thread overview]
Message-ID: <avqfAyIy7ytRBe8b@MWDK4CY14F> (raw)
In-Reply-To: <0a003a9e-573b-4c4d-b0a7-f88bc11818f4@linux.ibm.com>
On Fri, Nov 06, 2026 at 10:30:50AM +0800, Farhan Ali wrote:
>
> 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@nvidia.com>
>
> 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.
>
Hi Farhan,
The orginal intention was to keep the change small, and the failure I hit
was DPC triggered by the MSI-X table writes, which are MMIO, I didn't
expect MSI to cause the same error since it's programmed entirely in
config space, so I left it alone.
But I think you're right, the MSI restoration is equally pointless when
config space is inaccessible, and it ends up writing back values derived
from all-ones reads. I'll cover both MSI and MSI-X in v3.
> > ---
> > 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).
>
Agree, I'll make it non-static in v3.
> And maybe the check should be moved up before any config space access in
> this function?
>
> Thanks
>
> Farhan
>
Yes, will do, this will be covered in v3.
Thanks for the review.
Best regards,
Richard Cheng.
>
> > pci_write_config_word(dev, PCI_COMMAND, cmd | PCI_COMMAND_MEMORY);
> > write_msg = arch_restore_msi_irqs(dev);
next prev parent reply other threads:[~2026-11-16 6:17 UTC|newest]
Thread overview: 6+ 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 ` [PATCH v2 1/2] PCI/MSI: Skip MSI-X restoration when configuration is inaccessible Richard Cheng
2026-11-06 18:30 ` Farhan Ali
2026-11-16 6:17 ` Richard Cheng [this message]
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=avqfAyIy7ytRBe8b@MWDK4CY14F \
--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®