mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Farhan Ali <alifm@linux.ibm.com>
To: Richard Cheng <icheng@nvidia.com>,
	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,
	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: Fri, 6 Nov 2026 10:30:50 -0800	[thread overview]
Message-ID: <0a003a9e-573b-4c4d-b0a7-f88bc11818f4@linux.ibm.com> (raw)
In-Reply-To: <20261106111829.55823-2-icheng@nvidia.com>


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.

> ---
>   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);

  reply	other threads:[~2026-11-06 18:31 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 ` [PATCH v2 1/2] PCI/MSI: Skip MSI-X restoration when configuration is inaccessible Richard Cheng
2026-11-06 18:30   ` Farhan Ali [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=0a003a9e-573b-4c4d-b0a7-f88bc11818f4@linux.ibm.com \
    --to=alifm@linux.ibm.com \
    --cc=18255117159@163.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=icheng@nvidia.com \
    --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®