]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - queue-5.10/pci-err-clear-aer-status-only-when-we-control-aer.patch
Fixes for 5.10
[thirdparty/kernel/stable-queue.git] / queue-5.10 / pci-err-clear-aer-status-only-when-we-control-aer.patch
CommitLineData
b7ca0ba0
SL
1From b0274acf92b62e6bfe6b8a6d67b18e36fe5622eb Mon Sep 17 00:00:00 2001
2From: Sasha Levin <sashal@kernel.org>
3Date: Tue, 24 Nov 2020 10:55:30 -0600
4Subject: PCI/ERR: Clear AER status only when we control AER
5
6From: Sean V Kelley <sean.v.kelley@intel.com>
7
8[ Upstream commit aa344bc8b727b47b4350b59d8166216a3f351e55 ]
9
10In some cases a bridge may not exist as the hardware controlling may be
11handled only by firmware and so is not visible to the OS. This scenario is
12also possible in future use cases involving non-native use of RCECs by
13firmware. In this scenario, we expect the platform to retain control of the
14bridge and to clear error status itself.
15
16Clear error status only when the OS has native control of AER.
17
18Signed-off-by: Sean V Kelley <sean.v.kelley@intel.com>
19Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
20Stable-dep-of: 002bf2fbc00e ("PCI/AER: Block runtime suspend when handling errors")
21Signed-off-by: Sasha Levin <sashal@kernel.org>
22---
23 drivers/pci/pcie/err.c | 13 +++++++++++--
24 1 file changed, 11 insertions(+), 2 deletions(-)
25
26diff --git a/drivers/pci/pcie/err.c b/drivers/pci/pcie/err.c
27index 984aa023c753f..a806dfd94586c 100644
28--- a/drivers/pci/pcie/err.c
29+++ b/drivers/pci/pcie/err.c
30@@ -176,6 +176,7 @@ pci_ers_result_t pcie_do_recovery(struct pci_dev *dev,
31 int type = pci_pcie_type(dev);
32 struct pci_dev *bridge;
33 pci_ers_result_t status = PCI_ERS_RESULT_CAN_RECOVER;
34+ struct pci_host_bridge *host = pci_find_host_bridge(dev->bus);
35
36 /*
37 * If the error was detected by a Root Port, Downstream Port, or
38@@ -227,9 +228,17 @@ pci_ers_result_t pcie_do_recovery(struct pci_dev *dev,
39 pci_dbg(bridge, "broadcast resume message\n");
40 pci_walk_bridge(bridge, report_resume, &status);
41
42- if (pcie_aer_is_native(bridge))
43+ /*
44+ * If we have native control of AER, clear error status in the Root
45+ * Port or Downstream Port that signaled the error. If the
46+ * platform retained control of AER, it is responsible for clearing
47+ * this status. In that case, the signaling device may not even be
48+ * visible to the OS.
49+ */
50+ if (host->native_aer || pcie_ports_native) {
51 pcie_clear_device_status(bridge);
52- pci_aer_clear_nonfatal_status(bridge);
53+ pci_aer_clear_nonfatal_status(bridge);
54+ }
55 pci_info(bridge, "device recovery successful\n");
56 return status;
57
58--
592.43.0
60