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

Bjorn Helgaas <[email protected]>
Newsgroups org.kernel.vger.linux-s390,org.kernel.vger.linux-kernel,org.kernel.vger.linux-pci
Message-ID <20260812223459.GA1087632@bhelgaas>
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.

>  	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
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.