From: Farhan Ali <alifm@linux.ibm.com>
To: Alex Williamson <alex.williamson@redhat.com>
Cc: linux-s390@vger.kernel.org, kvm@vger.kernel.org,
linux-kernel@vger.kernel.org, helgaas@kernel.org,
schnelle@linux.ibm.com, mjrosato@linux.ibm.com
Subject: Re: [PATCH v2 2/9] PCI: Add additional checks for flr and pm reset
Date: Mon, 25 Aug 2025 15:28:08 -0700 [thread overview]
Message-ID: <042deeb6-864d-4f66-9031-4a4ba3214c94@linux.ibm.com> (raw)
In-Reply-To: <20250825155420.2ace4847.alex.williamson@redhat.com>
On 8/25/2025 2:54 PM, Alex Williamson wrote:
> On Mon, 25 Aug 2025 10:12:19 -0700
> Farhan Ali <alifm@linux.ibm.com> wrote:
>
>> If a device is in an error state, then any reads of device registers can
>> return error value. Add addtional checks to validate if a device is in an
>> error state before doing an flr or pm reset.
> I think the thing we see in practice for a device that's wedged and
> returning -1 from config space is that the FLR will timeout waiting for
> a pending transaction. So this should fix that, but should we log
> something?
I guess it makes sense to add a warn log.
>
> I'm assuming AF FLR is not needed here because we don't cache the
> offset and therefore won't find the capability when we search the chain
> for it.
Yes, based on my understanding of the when we search for the capability
offset, we would return 0 if the config space read returns a -1
(https://elixir.bootlin.com/linux/v6.16.3/source/drivers/pci/pci.c#L441).
>
>> Signed-off-by: Farhan Ali <alifm@linux.ibm.com>
>> ---
>> drivers/pci/pci.c | 7 +++++++
>> 1 file changed, 7 insertions(+)
>>
>> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
>> index 0dd95d782022..a07bdb287cf3 100644
>> --- a/drivers/pci/pci.c
>> +++ b/drivers/pci/pci.c
>> @@ -4560,12 +4560,17 @@ EXPORT_SYMBOL_GPL(pcie_flr);
>> */
>> int pcie_reset_flr(struct pci_dev *dev, bool probe)
>> {
>> + u32 reg;
>> +
>> if (dev->dev_flags & PCI_DEV_FLAGS_NO_FLR_RESET)
>> return -ENOTTY;
>>
>> if (!(dev->devcap & PCI_EXP_DEVCAP_FLR))
>> return -ENOTTY;
>>
>> + if (pcie_capability_read_dword(dev, PCI_EXP_DEVCAP, ®))
>> + return -ENOTTY;
>> +
>> if (probe)
>> return 0;
>>
>> @@ -4640,6 +4645,8 @@ static int pci_pm_reset(struct pci_dev *dev, bool probe)
>> return -ENOTTY;
>>
>> pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &csr);
>> + if (PCI_POSSIBLE_ERROR(csr))
>> + return -ENOTTY;
> Doesn't this turn out to be redundant to the test below?
Yup, I guess i was being extra cautious. Will remove the check.
Thanks
Farhan
>> if (csr & PCI_PM_CTRL_NO_SOFT_RESET)
>> return -ENOTTY;
>>
> Thanks,
> Alex
>
next prev parent reply other threads:[~2025-08-25 22:28 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-25 17:12 [PATCH v2 0/9] Error recovery for vfio-pci devices on s390x Farhan Ali
2025-08-25 17:12 ` [PATCH v2 1/9] PCI: Avoid restoring error values in config space Farhan Ali
2025-08-25 21:35 ` Alex Williamson
2025-08-25 22:13 ` Farhan Ali
2025-08-26 15:48 ` Alex Williamson
2025-08-25 17:12 ` [PATCH v2 2/9] PCI: Add additional checks for flr and pm reset Farhan Ali
2025-08-25 21:54 ` Alex Williamson
2025-08-25 22:28 ` Farhan Ali [this message]
2025-08-25 17:12 ` [PATCH v2 3/9] PCI: Allow per function PCI slots for hypervisor isolated functions Farhan Ali
2025-08-27 7:50 ` Niklas Schnelle
2025-08-25 17:12 ` [PATCH v2 4/9] s390/pci: Restore airq unconditionally for the zPCI device Farhan Ali
2025-08-27 13:27 ` Niklas Schnelle
2025-08-25 17:12 ` [PATCH v2 5/9] s390/pci: Update the logic for detecting passthrough device Farhan Ali
2025-08-25 17:12 ` [PATCH v2 6/9] s390/pci: Store PCI error information for passthrough devices Farhan Ali
2025-08-25 17:12 ` [PATCH v2 7/9] vfio-pci/zdev: Add a device feature for error information Farhan Ali
2025-08-25 17:12 ` [PATCH v2 8/9] vfio: Add a reset_done callback for vfio-pci driver Farhan Ali
2025-08-25 17:12 ` [PATCH v2 9/9] vfio: Remove the pcie check for VFIO_PCI_ERR_IRQ_INDEX Farhan Ali
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=042deeb6-864d-4f66-9031-4a4ba3214c94@linux.ibm.com \
--to=alifm@linux.ibm.com \
--cc=alex.williamson@redhat.com \
--cc=helgaas@kernel.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=mjrosato@linux.ibm.com \
--cc=schnelle@linux.ibm.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;
as well as URLs for NNTP newsgroup(s).