Re: [PATCH v23 4/5] PCI: Fail FLR when config space is inaccessible

From: Bjorn Helgaas

Date: Wed Aug 12 2026 - 18:35:05 EST


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 <bblock@xxxxxxxxxxxxx>
> Reviewed-by: Niklas Schnelle <schnelle@xxxxxxxxxxxxx>
> Signed-off-by: Farhan Ali <alifm@xxxxxxxxxxxxx>
> ---
> 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.

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