From: Farhan Ali <alifm@linux.ibm.com>
To: Niklas Schnelle <schnelle@linux.ibm.com>,
Thomas Gleixner <tglx@kernel.org>,
linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-pci@vger.kernel.org
Cc: helgaas@kernel.org, alex@shazbot.org, mjrosato@linux.ibm.com
Subject: Re: [PATCH v20 4/4] PCI/MSI: Enable memory decoding before restoring MSI-X messages
Date: Tue, 23 Jun 2026 09:36:39 -0700 [thread overview]
Message-ID: <730608ca-4a3f-4dd2-ab3e-4b83716a97d1@linux.ibm.com> (raw)
In-Reply-To: <087b5cafd04d2fee89f3a4a941d425e967d1ee72.camel@linux.ibm.com>
On 6/23/2026 4:28 AM, Niklas Schnelle wrote:
> On Mon, 2026-06-22 at 13:49 -0700, Farhan Ali wrote:
>> On 6/22/2026 1:29 PM, Thomas Gleixner wrote:
>>> On Mon, Jun 22 2026 at 10:18, Farhan Ali wrote:
>>>> The current MSI-X restoration path assumes the Command register Memory bit
>>>> is enabled when writing MSI-X messages. But its possible the last saved and
>>>> restored state of device may not have the Memory bit enabled, even if a
>>>> device driver later enables Memory bit and MSI-X. Attempting to access
>>>> Memory space without Memory bit enabled can lead to Unsupported Request
>>>> (UR) from the device. Fix this by enabling Memory bit and restore
>>>> it afterwards.
>>>>
>>>> Signed-off-by: Farhan Ali <alifm@linux.ibm.com>
>>>> ---
>>>>
> --- 8< ---
>>>> @@ -882,6 +883,8 @@ void __pci_restore_msix_state(struct pci_dev *dev)
>>>> pci_intx_for_msi(dev, 0);
>>>> pci_msix_clear_and_set_ctrl(dev, 0,
>>>> PCI_MSIX_FLAGS_ENABLE | PCI_MSIX_FLAGS_MASKALL);
>>>> + pci_read_config_word(dev, PCI_COMMAND, &cmd);
>>>> + pci_write_config_word(dev, PCI_COMMAND, cmd | PCI_COMMAND_MEMORY);
>>> Can we please have a comment there which explains this? Three month down
>>> the road this will results in head scratching otherwise.
>>>
>>> I agree with Niklas that this wants a Fixes and a Cc:stable tag.
>>>
>>> Other than that:
>>>
>>> Reviewed-by: Thomas Gleixner <tglx@kernel.org>
>>>
>>> Thanks,
>>>
>>> tglx
>>>
>> I can add a comment, how about something like below?
>>
>> "The restored device state may not have Memory decoding enabled in
>> Command register. Since the MSI-X was enabled for the device, enable
>> Memory decoding before restoring MSI-X"
> Missing "the" before "Command register" other than that this sounds
> good to me and I agree with Thomas that a comment makes sense here.
>
>> For the Fixes tag, do you have a suggestion for a commit? This behavior
>> has been present since 41017f0cac92 ("[PATCH] PCI: MSI(X) save/restore
>> for suspend/resume" which introduced these restore functions. So should
>> be Fixes against 41017f0cac92?
> I'm not sure but my guess would be that for suspend/resume this isn't
> an issue since the suspend part would save the state with Memory Space
> enabled. So it wouldn't be broken in this original use-case. I think
> the problem only occurs in case restore is done for error recovery.
> Might it make sense to have the Fixes tag point to a2f1e22390ac
> ("PCI/ERR: Ensure error recoverability at all times") even though that
> only helps to expose the issue?
>
> Thanks,
> Niklas
Yeah, commit a2f1e22390ac ("PCI/ERR: Ensure error recoverability at all
times") exposes this issue. I am okay if we want Fixes tag to point to
this change, unless someone objects. I will also add a note in the
commit message to specify a2f1e22390ac exposes this issue.
Thanks
Farhan
next prev parent reply other threads:[~2026-06-23 16:36 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-22 17:18 [PATCH v20 0/4] [PCI] Error recovery for vfio-pci devices on s390x Farhan Ali
2026-06-22 17:18 ` [PATCH v20 1/4] PCI: Allow per function PCI slots to fix slot reset on s390 Farhan Ali
2026-06-22 17:18 ` [PATCH v20 2/4] PCI: Avoid saving config space state if inaccessible Farhan Ali
2026-06-22 17:18 ` [PATCH v20 3/4] PCI: Fail FLR when config space is inaccessible Farhan Ali
2026-06-22 17:18 ` [PATCH v20 4/4] PCI/MSI: Enable memory decoding before restoring MSI-X messages Farhan Ali
2026-06-22 18:54 ` Niklas Schnelle
2026-06-22 20:22 ` Farhan Ali
2026-06-22 20:29 ` Thomas Gleixner
2026-06-22 20:49 ` Farhan Ali
2026-06-23 11:28 ` Niklas Schnelle
2026-06-23 16:36 ` Farhan Ali [this message]
2026-06-23 23:14 ` Alex Williamson
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=730608ca-4a3f-4dd2-ab3e-4b83716a97d1@linux.ibm.com \
--to=alifm@linux.ibm.com \
--cc=alex@shazbot.org \
--cc=helgaas@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=mjrosato@linux.ibm.com \
--cc=schnelle@linux.ibm.com \
--cc=tglx@kernel.org \
/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
Powered by JetHome