Re: [PATCH v23 4/5] PCI: Fail FLR when config space is inaccessible
Farhan Ali <[email protected]>
| Newsgroups | org.kernel.vger.linux-s390,org.kernel.vger.linux-kernel,org.kernel.vger.linux-pci |
|---|---|
| Message-ID | <[email protected]> |
On 8/12/2026 3:34 PM, Bjorn Helgaas wrote: > On Wed, Aug 05, 2026 at 09:55:17AM -0700, Farhan Ali wrote: >> If a device is in an error state, then it's config space may not be >> accssible. Add additional check to validate if a device's config space is >> accessible before doing an FLR reset. >> >> Reviewed-by: Benjamin Block <[email protected]> >> Reviewed-by: Niklas Schnelle <[email protected]> >> Signed-off-by: Farhan Ali <[email protected]> >> --- >> drivers/pci/pci.c | 3 +++ >> 1 file changed, 3 insertions(+) >> >> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c >> index e8d7de77241a..9a9d021301c4 100644 >> --- a/drivers/pci/pci.c >> +++ b/drivers/pci/pci.c >> @@ -4384,6 +4384,9 @@ int pcie_flr(struct pci_dev *dev) >> { >> int ret; >> >> + if (!pci_dev_config_accessible(dev, "FLR")) >> + return -ENOTTY; > I'm not really keen on this racy check to begin with (though I know I > acked it earlier :)), and also a little hesitant about doing it only > here and not in a more generic place, since several of the reset > methods are susceptible to the same issue. > > But I guess in your use case, FLR is the typical method used and maybe > we can worry about the others later. Yeah, I was also hesitant adding it to the other reset methods as I don't have hardware to test it. One reason to have the pci_dev_config_accessible() function was to be able to use it in other reset methods if needed. Thanks for reviewing and merging the changes! Thanks Farhan > >> if (!pci_wait_for_pending_transaction(dev)) >> pci_err(dev, "timed out waiting for pending transaction; performing function level reset anyway\n"); >> >> -- >> 2.43.0 >>