aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/genwqe/card_utils.c
diff options
context:
space:
mode:
authorKleber Sacilotto de Souza <klebers@linux.vnet.ibm.com>2014-06-04 09:57:51 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-07-09 17:14:27 -0400
commitfb145456fa4f4311f90703aeee058bab3b274bf8 (patch)
tree980ae85a3c35b8b574dddeaf96bf84d41dbb83d3 /drivers/misc/genwqe/card_utils.c
parentc1f732ad767e37bd1d41043cbdefc0874b4d05e5 (diff)
GenWQE: Add support for EEH error recovery
This patch implements the callbacks and functions necessary to have EEH recovery support. It adds a config option to enable or disable explicit calls to trigger platform specific mechanisms on error recovery paths. This option is enabled by default only on PPC64 systems and can be overritten via debugfs. If this option is enabled, on the error recovery path the driver will call pci_channel_offline() to check for error condition and issue non-raw MMIO reads to trigger early EEH detection in case of hardware failures. This is necessary since the driver MMIO helper funtions use raw accessors. Signed-off-by: Kleber Sacilotto de Souza <klebers@linux.vnet.ibm.com> Acked-by: Frank Haverkamp <haver@linux.vnet.ibm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/genwqe/card_utils.c')
-rw-r--r--drivers/misc/genwqe/card_utils.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/misc/genwqe/card_utils.c b/drivers/misc/genwqe/card_utils.c
index 62cc6bb3f62e..4a500582eef0 100644
--- a/drivers/misc/genwqe/card_utils.c
+++ b/drivers/misc/genwqe/card_utils.c
@@ -53,12 +53,17 @@
53 */ 53 */
54int __genwqe_writeq(struct genwqe_dev *cd, u64 byte_offs, u64 val) 54int __genwqe_writeq(struct genwqe_dev *cd, u64 byte_offs, u64 val)
55{ 55{
56 struct pci_dev *pci_dev = cd->pci_dev;
57
56 if (cd->err_inject & GENWQE_INJECT_HARDWARE_FAILURE) 58 if (cd->err_inject & GENWQE_INJECT_HARDWARE_FAILURE)
57 return -EIO; 59 return -EIO;
58 60
59 if (cd->mmio == NULL) 61 if (cd->mmio == NULL)
60 return -EIO; 62 return -EIO;
61 63
64 if (pci_channel_offline(pci_dev))
65 return -EIO;
66
62 __raw_writeq((__force u64)cpu_to_be64(val), cd->mmio + byte_offs); 67 __raw_writeq((__force u64)cpu_to_be64(val), cd->mmio + byte_offs);
63 return 0; 68 return 0;
64} 69}
@@ -99,12 +104,17 @@ u64 __genwqe_readq(struct genwqe_dev *cd, u64 byte_offs)
99 */ 104 */
100int __genwqe_writel(struct genwqe_dev *cd, u64 byte_offs, u32 val) 105int __genwqe_writel(struct genwqe_dev *cd, u64 byte_offs, u32 val)
101{ 106{
107 struct pci_dev *pci_dev = cd->pci_dev;
108
102 if (cd->err_inject & GENWQE_INJECT_HARDWARE_FAILURE) 109 if (cd->err_inject & GENWQE_INJECT_HARDWARE_FAILURE)
103 return -EIO; 110 return -EIO;
104 111
105 if (cd->mmio == NULL) 112 if (cd->mmio == NULL)
106 return -EIO; 113 return -EIO;
107 114
115 if (pci_channel_offline(pci_dev))
116 return -EIO;
117
108 __raw_writel((__force u32)cpu_to_be32(val), cd->mmio + byte_offs); 118 __raw_writel((__force u32)cpu_to_be32(val), cd->mmio + byte_offs);
109 return 0; 119 return 0;
110} 120}