aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGavin Shan <shangw@linux.vnet.ibm.com>2013-09-05 21:00:01 -0400
committerBenjamin Herrenschmidt <benh@kernel.crashing.org>2013-10-11 01:54:00 -0400
commitff6bdcd967f6f5ca870a42a744acc8788faaa1d2 (patch)
treef26d68a9175bb4901bf235dd6be88cd738f57170
parent20bb842b9b0e26a5768b62ee639e64a2ecaada8c (diff)
powerpc/powernv: Support inbound error injection
For now, we only support outbound error injection. Actually, the hardware supports injecting inbound errors as well. The patch enables to inject inbound errors. Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
-rw-r--r--arch/powerpc/platforms/powernv/eeh-ioda.c59
1 files changed, 50 insertions, 9 deletions
diff --git a/arch/powerpc/platforms/powernv/eeh-ioda.c b/arch/powerpc/platforms/powernv/eeh-ioda.c
index 799ccaa07b80..34e0583106cf 100644
--- a/arch/powerpc/platforms/powernv/eeh-ioda.c
+++ b/arch/powerpc/platforms/powernv/eeh-ioda.c
@@ -59,26 +59,60 @@ static struct notifier_block ioda_eeh_nb = {
59}; 59};
60 60
61#ifdef CONFIG_DEBUG_FS 61#ifdef CONFIG_DEBUG_FS
62static int ioda_eeh_dbgfs_set(void *data, u64 val) 62static int ioda_eeh_dbgfs_set(void *data, int offset, u64 val)
63{ 63{
64 struct pci_controller *hose = data; 64 struct pci_controller *hose = data;
65 struct pnv_phb *phb = hose->private_data; 65 struct pnv_phb *phb = hose->private_data;
66 66
67 out_be64(phb->regs + 0xD10, val); 67 out_be64(phb->regs + offset, val);
68 return 0; 68 return 0;
69} 69}
70 70
71static int ioda_eeh_dbgfs_get(void *data, u64 *val) 71static int ioda_eeh_dbgfs_get(void *data, int offset, u64 *val)
72{ 72{
73 struct pci_controller *hose = data; 73 struct pci_controller *hose = data;
74 struct pnv_phb *phb = hose->private_data; 74 struct pnv_phb *phb = hose->private_data;
75 75
76 *val = in_be64(phb->regs + 0xD10); 76 *val = in_be64(phb->regs + offset);
77 return 0; 77 return 0;
78} 78}
79 79
80DEFINE_SIMPLE_ATTRIBUTE(ioda_eeh_dbgfs_ops, ioda_eeh_dbgfs_get, 80static int ioda_eeh_outb_dbgfs_set(void *data, u64 val)
81 ioda_eeh_dbgfs_set, "0x%llx\n"); 81{
82 return ioda_eeh_dbgfs_set(data, 0xD10, val);
83}
84
85static int ioda_eeh_outb_dbgfs_get(void *data, u64 *val)
86{
87 return ioda_eeh_dbgfs_get(data, 0xD10, val);
88}
89
90static int ioda_eeh_inbA_dbgfs_set(void *data, u64 val)
91{
92 return ioda_eeh_dbgfs_set(data, 0xD90, val);
93}
94
95static int ioda_eeh_inbA_dbgfs_get(void *data, u64 *val)
96{
97 return ioda_eeh_dbgfs_get(data, 0xD90, val);
98}
99
100static int ioda_eeh_inbB_dbgfs_set(void *data, u64 val)
101{
102 return ioda_eeh_dbgfs_set(data, 0xE10, val);
103}
104
105static int ioda_eeh_inbB_dbgfs_get(void *data, u64 *val)
106{
107 return ioda_eeh_dbgfs_get(data, 0xE10, val);
108}
109
110DEFINE_SIMPLE_ATTRIBUTE(ioda_eeh_outb_dbgfs_ops, ioda_eeh_outb_dbgfs_get,
111 ioda_eeh_outb_dbgfs_set, "0x%llx\n");
112DEFINE_SIMPLE_ATTRIBUTE(ioda_eeh_inbA_dbgfs_ops, ioda_eeh_inbA_dbgfs_get,
113 ioda_eeh_inbA_dbgfs_set, "0x%llx\n");
114DEFINE_SIMPLE_ATTRIBUTE(ioda_eeh_inbB_dbgfs_ops, ioda_eeh_inbB_dbgfs_get,
115 ioda_eeh_inbB_dbgfs_set, "0x%llx\n");
82#endif /* CONFIG_DEBUG_FS */ 116#endif /* CONFIG_DEBUG_FS */
83 117
84/** 118/**
@@ -116,10 +150,17 @@ static int ioda_eeh_post_init(struct pci_controller *hose)
116 } 150 }
117 151
118#ifdef CONFIG_DEBUG_FS 152#ifdef CONFIG_DEBUG_FS
119 if (phb->dbgfs) 153 if (phb->dbgfs) {
120 debugfs_create_file("err_injct", 0600, 154 debugfs_create_file("err_injct_outbound", 0600,
155 phb->dbgfs, hose,
156 &ioda_eeh_outb_dbgfs_ops);
157 debugfs_create_file("err_injct_inboundA", 0600,
121 phb->dbgfs, hose, 158 phb->dbgfs, hose,
122 &ioda_eeh_dbgfs_ops); 159 &ioda_eeh_inbA_dbgfs_ops);
160 debugfs_create_file("err_injct_inboundB", 0600,
161 phb->dbgfs, hose,
162 &ioda_eeh_inbB_dbgfs_ops);
163 }
123#endif 164#endif
124 165
125 phb->eeh_state |= PNV_EEH_STATE_ENABLED; 166 phb->eeh_state |= PNV_EEH_STATE_ENABLED;