LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Shanker Donthineni <sdonthineni@nvidia.com>
To: Bjorn Helgaas <bhelgaas@google.com>
Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
	Shanker Donthineni <sdonthineni@nvidia.com>,
	Alex Williamson <alex.williamson@redhat.com>,
	Oliver O'Halloran <oohall@gmail.com>,
	linuxppc-dev@lists.ozlabs.org
Subject: [PATCH] PCI/AER: Continue AER recovery of device with NO_BUS_RESET set
Date: Sat, 21 Aug 2021 08:30:58 -0500	[thread overview]
Message-ID: <20210821133058.31583-1-sdonthineni@nvidia.com> (raw)

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

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


             reply	other threads:[~2021-08-22  2:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-21 13:30 Shanker Donthineni [this message]
2021-08-21 15:26 ` [PATCH] PCI/AER: Continue AER recovery of device with NO_BUS_RESET set Shanker R Donthineni

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=20210821133058.31583-1-sdonthineni@nvidia.com \
    --to=sdonthineni@nvidia.com \
    --cc=alex.williamson@redhat.com \
    --cc=bhelgaas@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=oohall@gmail.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