diff mbox series

PCI/AER: Continue AER recovery of device with NO_BUS_RESET set

Message ID 20210821133058.31583-1-sdonthineni@nvidia.com (mailing list archive)
State New, archived
Delegated to: Bjorn Helgaas
Headers show
Series PCI/AER: Continue AER recovery of device with NO_BUS_RESET set | expand

Commit Message

Shanker Donthineni Aug. 21, 2021, 1:30 p.m. UTC
In the current implementation, the AER FATAL and NONFTAL recovery will be
terminated for the device that exhibits NO_BUS_RESET quirk. The non-zero
return value from pci_bus_error_reset() is treated as an error condition
in aer_root_reset() which leads to return PCI_ERS_RESULT_DISCONNECT.

  aer_recover_work_func()
    pcie_do_recovery()
      report_frozen_detected()
      if (aer_root_reset() == PCI_ERS_RESULT_DISCONNECT)
         goto failed           # termimates here because of NO_BUS_RESET

      ...
      report_mmio_enabled()
      report_resume()
      pcie_clear_xxx_status()
      ...
      return 0
  failed:
      pci_uevent_ers(PCI_ERS_RESULT_DISCONNECT);

The return value -ENOTTY from pci_bus_error_reset() indicates SBR was
skipped but no real errors were encountered. This scenario could be
considered as a non-error case so that the PCI device driver gets the
opportunity to recover the device back to an operational state instead
of keeping it in the DISCONNECT state.

Signed-off-by: Shanker Donthineni <sdonthineni@nvidia.com>
---
 drivers/pci/pcie/aer.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Shanker Donthineni Aug. 21, 2021, 3:26 p.m. UTC | #1
On 8/21/21 8:30 AM, Shanker Donthineni wrote:
> External email: Use caution opening links or attachments
>
>
> In the current implementation, the AER FATAL and NONFTAL recovery will be
> terminated for the device that exhibits NO_BUS_RESET quirk. The non-zero

Correction, this problem happens only for AER_FATAL recovery case.

> return value from pci_bus_error_reset() is treated as an error condition
> in aer_root_reset() which leads to return PCI_ERS_RESULT_DISCONNECT.
>
>   aer_recover_work_func()
>     pcie_do_recovery()
>       report_frozen_detected()
>       if (aer_root_reset() == PCI_ERS_RESULT_DISCONNECT)
>          goto failed           # termimates here because of NO_BUS_RESET
>
>       ...
>       report_mmio_enabled()
>       report_resume()
>       pcie_clear_xxx_status()
>       ...
>       return 0
>   failed:
>       pci_uevent_ers(PCI_ERS_RESULT_DISCONNECT);
>
> The return value -ENOTTY from pci_bus_error_reset() indicates SBR was
> skipped but no real errors were encountered. This scenario could be
> considered as a non-error case so that the PCI device driver gets the
> opportunity to recover the device back to an operational state instead
> of keeping it in the DISCONNECT state.
>
> Signed-off-by: Shanker Donthineni <sdonthineni@nvidia.com>
> ---
>  drivers/pci/pcie/aer.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c
> index 9784fdcf30061..8cf6bd6a3376d 100644
> --- a/drivers/pci/pcie/aer.c
> +++ b/drivers/pci/pcie/aer.c
> @@ -1414,8 +1414,12 @@ static pci_ers_result_t aer_root_reset(struct pci_dev *dev)
>                         pci_info(dev, "not reset (no FLR support: %d)\n", rc);
>         } else {
>                 rc = pci_bus_error_reset(dev);
> -               pci_info(dev, "%s Port link has been reset (%d)\n",
> -                       pci_is_root_bus(dev->bus) ? "Root" : "Downstream", rc);
> +               pci_info(dev, "%s Port link has %sbeen reset (%d)\n",
> +                       pci_is_root_bus(dev->bus) ? "Root" : "Downstream",
> +                       rc == -ENOTTY ? "not " : "", rc);
> +
> +               if (rc == -ENOTTY)
> +                       rc = 0;
>         }
>
>         if ((host->native_aer || pcie_ports_native) && aer) {
> --
> 2.25.1
>
diff mbox series

Patch

diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c
index 9784fdcf30061..8cf6bd6a3376d 100644
--- a/drivers/pci/pcie/aer.c
+++ b/drivers/pci/pcie/aer.c
@@ -1414,8 +1414,12 @@  static pci_ers_result_t aer_root_reset(struct pci_dev *dev)
 			pci_info(dev, "not reset (no FLR support: %d)\n", rc);
 	} else {
 		rc = pci_bus_error_reset(dev);
-		pci_info(dev, "%s Port link has been reset (%d)\n",
-			pci_is_root_bus(dev->bus) ? "Root" : "Downstream", rc);
+		pci_info(dev, "%s Port link has %sbeen reset (%d)\n",
+			pci_is_root_bus(dev->bus) ? "Root" : "Downstream",
+			rc == -ENOTTY ? "not " : "", rc);
+
+		if (rc == -ENOTTY)
+			rc = 0;
 	}
 
 	if ((host->native_aer || pcie_ports_native) && aer) {