]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.9.30/cxl-route-eeh-events-to-all-drivers-in-cxl_pci_error_detected.patch
Linux 4.14.95
[thirdparty/kernel/stable-queue.git] / releases / 4.9.30 / cxl-route-eeh-events-to-all-drivers-in-cxl_pci_error_detected.patch
1 From 4f58f0bf155e87dda31a3088b1e107fa9dd79f0e Mon Sep 17 00:00:00 2001
2 From: Vaibhav Jain <vaibhav@linux.vnet.ibm.com>
3 Date: Thu, 27 Apr 2017 10:58:22 +0530
4 Subject: cxl: Route eeh events to all drivers in cxl_pci_error_detected()
5
6 From: Vaibhav Jain <vaibhav@linux.vnet.ibm.com>
7
8 commit 4f58f0bf155e87dda31a3088b1e107fa9dd79f0e upstream.
9
10 Fix a boundary condition where in some cases an eeh event that results
11 in card reset isn't passed on to a driver attached to the virtual PCI
12 device associated with a slice. This will happen in case when a slice
13 attached device driver returns a value other than
14 PCI_ERS_RESULT_NEED_RESET from the eeh error_detected() callback. This
15 would result in an early return from cxl_pci_error_detected() and
16 other drivers attached to other AFUs on the card wont be notified.
17
18 The patch fixes this by making sure that all slice attached
19 device-drivers are notified and the return values from
20 error_detected() callback are aggregated in a scheme where request for
21 'disconnect' trumps all and 'none' trumps 'need_reset'.
22
23 Fixes: 9e8df8a21963 ("cxl: EEH support")
24 Signed-off-by: Vaibhav Jain <vaibhav@linux.vnet.ibm.com>
25 Reviewed-by: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
26 Acked-by: Frederic Barrat <fbarrat@linux.vnet.ibm.com>
27 Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
28 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
29
30 ---
31 drivers/misc/cxl/pci.c | 15 +++++++++------
32 1 file changed, 9 insertions(+), 6 deletions(-)
33
34 --- a/drivers/misc/cxl/pci.c
35 +++ b/drivers/misc/cxl/pci.c
36 @@ -1779,7 +1779,7 @@ static pci_ers_result_t cxl_pci_error_de
37 {
38 struct cxl *adapter = pci_get_drvdata(pdev);
39 struct cxl_afu *afu;
40 - pci_ers_result_t result = PCI_ERS_RESULT_NEED_RESET;
41 + pci_ers_result_t result = PCI_ERS_RESULT_NEED_RESET, afu_result;
42 int i;
43
44 /* At this point, we could still have an interrupt pending.
45 @@ -1884,15 +1884,18 @@ static pci_ers_result_t cxl_pci_error_de
46 for (i = 0; i < adapter->slices; i++) {
47 afu = adapter->afu[i];
48
49 - result = cxl_vphb_error_detected(afu, state);
50 -
51 - /* Only continue if everyone agrees on NEED_RESET */
52 - if (result != PCI_ERS_RESULT_NEED_RESET)
53 - return result;
54 + afu_result = cxl_vphb_error_detected(afu, state);
55
56 cxl_context_detach_all(afu);
57 cxl_ops->afu_deactivate_mode(afu, afu->current_mode);
58 pci_deconfigure_afu(afu);
59 +
60 + /* Disconnect trumps all, NONE trumps NEED_RESET */
61 + if (afu_result == PCI_ERS_RESULT_DISCONNECT)
62 + result = PCI_ERS_RESULT_DISCONNECT;
63 + else if ((afu_result == PCI_ERS_RESULT_NONE) &&
64 + (result == PCI_ERS_RESULT_NEED_RESET))
65 + result = PCI_ERS_RESULT_NONE;
66 }
67
68 /* should take the context lock here */