aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/powerpc/include/asm/eeh.h32
-rw-r--r--arch/powerpc/kernel/eeh.c20
-rw-r--r--arch/powerpc/kernel/eeh_cache.c2
-rw-r--r--arch/powerpc/platforms/powernv/eeh-powernv.c6
-rw-r--r--arch/powerpc/platforms/powernv/pci-ioda.c1
-rw-r--r--arch/powerpc/platforms/pseries/eeh_pseries.c4
6 files changed, 27 insertions, 38 deletions
diff --git a/arch/powerpc/include/asm/eeh.h b/arch/powerpc/include/asm/eeh.h
index 6e4789418233..ca8aada95069 100644
--- a/arch/powerpc/include/asm/eeh.h
+++ b/arch/powerpc/include/asm/eeh.h
@@ -206,36 +206,28 @@ extern int eeh_subsystem_flags;
206extern struct eeh_ops *eeh_ops; 206extern struct eeh_ops *eeh_ops;
207extern raw_spinlock_t confirm_error_lock; 207extern raw_spinlock_t confirm_error_lock;
208 208
209static inline bool eeh_enabled(void) 209static inline void eeh_add_flag(int flag)
210{ 210{
211 if ((eeh_subsystem_flags & EEH_FORCE_DISABLED) || 211 eeh_subsystem_flags |= flag;
212 !(eeh_subsystem_flags & EEH_ENABLED))
213 return false;
214
215 return true;
216} 212}
217 213
218static inline void eeh_set_enable(bool mode) 214static inline void eeh_clear_flag(int flag)
219{ 215{
220 if (mode) 216 eeh_subsystem_flags &= ~flag;
221 eeh_subsystem_flags |= EEH_ENABLED;
222 else
223 eeh_subsystem_flags &= ~EEH_ENABLED;
224} 217}
225 218
226static inline void eeh_probe_mode_set(int flag) 219static inline bool eeh_has_flag(int flag)
227{ 220{
228 eeh_subsystem_flags |= flag; 221 return !!(eeh_subsystem_flags & flag);
229} 222}
230 223
231static inline int eeh_probe_mode_devtree(void) 224static inline bool eeh_enabled(void)
232{ 225{
233 return (eeh_subsystem_flags & EEH_PROBE_MODE_DEVTREE); 226 if (eeh_has_flag(EEH_FORCE_DISABLED) ||
234} 227 !eeh_has_flag(EEH_ENABLED))
228 return false;
235 229
236static inline int eeh_probe_mode_dev(void) 230 return true;
237{
238 return (eeh_subsystem_flags & EEH_PROBE_MODE_DEV);
239} 231}
240 232
241static inline void eeh_serialize_lock(unsigned long *flags) 233static inline void eeh_serialize_lock(unsigned long *flags)
@@ -314,8 +306,6 @@ static inline bool eeh_enabled(void)
314 return false; 306 return false;
315} 307}
316 308
317static inline void eeh_set_enable(bool mode) { }
318
319static inline int eeh_init(void) 309static inline int eeh_init(void)
320{ 310{
321 return 0; 311 return 0;
diff --git a/arch/powerpc/kernel/eeh.c b/arch/powerpc/kernel/eeh.c
index 4de2103a30c7..65a163fb7b6c 100644
--- a/arch/powerpc/kernel/eeh.c
+++ b/arch/powerpc/kernel/eeh.c
@@ -142,7 +142,7 @@ static struct eeh_stats eeh_stats;
142static int __init eeh_setup(char *str) 142static int __init eeh_setup(char *str)
143{ 143{
144 if (!strcmp(str, "off")) 144 if (!strcmp(str, "off"))
145 eeh_subsystem_flags |= EEH_FORCE_DISABLED; 145 eeh_add_flag(EEH_FORCE_DISABLED);
146 146
147 return 1; 147 return 1;
148} 148}
@@ -252,7 +252,7 @@ void eeh_slot_error_detail(struct eeh_pe *pe, int severity)
252 * 0xFF's is always returned from PCI config space. 252 * 0xFF's is always returned from PCI config space.
253 */ 253 */
254 if (!(pe->type & EEH_PE_PHB)) { 254 if (!(pe->type & EEH_PE_PHB)) {
255 if (eeh_probe_mode_devtree()) 255 if (eeh_has_flag(EEH_PROBE_MODE_DEVTREE))
256 eeh_pci_enable(pe, EEH_OPT_THAW_MMIO); 256 eeh_pci_enable(pe, EEH_OPT_THAW_MMIO);
257 eeh_ops->configure_bridge(pe); 257 eeh_ops->configure_bridge(pe);
258 eeh_pe_restore_bars(pe); 258 eeh_pe_restore_bars(pe);
@@ -303,7 +303,7 @@ static int eeh_phb_check_failure(struct eeh_pe *pe)
303 unsigned long flags; 303 unsigned long flags;
304 int ret; 304 int ret;
305 305
306 if (!eeh_probe_mode_dev()) 306 if (!eeh_has_flag(EEH_PROBE_MODE_DEV))
307 return -EPERM; 307 return -EPERM;
308 308
309 /* Find the PHB PE */ 309 /* Find the PHB PE */
@@ -801,7 +801,7 @@ int __exit eeh_ops_unregister(const char *name)
801static int eeh_reboot_notifier(struct notifier_block *nb, 801static int eeh_reboot_notifier(struct notifier_block *nb,
802 unsigned long action, void *unused) 802 unsigned long action, void *unused)
803{ 803{
804 eeh_set_enable(false); 804 eeh_clear_flag(EEH_ENABLED);
805 return NOTIFY_DONE; 805 return NOTIFY_DONE;
806} 806}
807 807
@@ -865,13 +865,13 @@ int eeh_init(void)
865 return ret; 865 return ret;
866 866
867 /* Enable EEH for all adapters */ 867 /* Enable EEH for all adapters */
868 if (eeh_probe_mode_devtree()) { 868 if (eeh_has_flag(EEH_PROBE_MODE_DEVTREE)) {
869 list_for_each_entry_safe(hose, tmp, 869 list_for_each_entry_safe(hose, tmp,
870 &hose_list, list_node) { 870 &hose_list, list_node) {
871 phb = hose->dn; 871 phb = hose->dn;
872 traverse_pci_devices(phb, eeh_ops->of_probe, NULL); 872 traverse_pci_devices(phb, eeh_ops->of_probe, NULL);
873 } 873 }
874 } else if (eeh_probe_mode_dev()) { 874 } else if (eeh_has_flag(EEH_PROBE_MODE_DEV)) {
875 list_for_each_entry_safe(hose, tmp, 875 list_for_each_entry_safe(hose, tmp,
876 &hose_list, list_node) 876 &hose_list, list_node)
877 pci_walk_bus(hose->bus, eeh_ops->dev_probe, NULL); 877 pci_walk_bus(hose->bus, eeh_ops->dev_probe, NULL);
@@ -923,7 +923,7 @@ void eeh_add_device_early(struct device_node *dn)
923 * would delay the probe until late stage because 923 * would delay the probe until late stage because
924 * the PCI device isn't available this moment. 924 * the PCI device isn't available this moment.
925 */ 925 */
926 if (!eeh_probe_mode_devtree()) 926 if (!eeh_has_flag(EEH_PROBE_MODE_DEVTREE))
927 return; 927 return;
928 928
929 if (!of_node_to_eeh_dev(dn)) 929 if (!of_node_to_eeh_dev(dn))
@@ -1009,7 +1009,7 @@ void eeh_add_device_late(struct pci_dev *dev)
1009 * We have to do the EEH probe here because the PCI device 1009 * We have to do the EEH probe here because the PCI device
1010 * hasn't been created yet in the early stage. 1010 * hasn't been created yet in the early stage.
1011 */ 1011 */
1012 if (eeh_probe_mode_dev()) 1012 if (eeh_has_flag(EEH_PROBE_MODE_DEV))
1013 eeh_ops->dev_probe(dev, NULL); 1013 eeh_ops->dev_probe(dev, NULL);
1014 1014
1015 eeh_addr_cache_insert_dev(dev); 1015 eeh_addr_cache_insert_dev(dev);
@@ -1430,9 +1430,9 @@ static const struct file_operations proc_eeh_operations = {
1430static int eeh_enable_dbgfs_set(void *data, u64 val) 1430static int eeh_enable_dbgfs_set(void *data, u64 val)
1431{ 1431{
1432 if (val) 1432 if (val)
1433 eeh_subsystem_flags &= ~EEH_FORCE_DISABLED; 1433 eeh_clear_flag(EEH_FORCE_DISABLED);
1434 else 1434 else
1435 eeh_subsystem_flags |= EEH_FORCE_DISABLED; 1435 eeh_add_flag(EEH_FORCE_DISABLED);
1436 1436
1437 /* Notify the backend */ 1437 /* Notify the backend */
1438 if (eeh_ops->post_init) 1438 if (eeh_ops->post_init)
diff --git a/arch/powerpc/kernel/eeh_cache.c b/arch/powerpc/kernel/eeh_cache.c
index e8c9fd546a5c..3639bee5d9ce 100644
--- a/arch/powerpc/kernel/eeh_cache.c
+++ b/arch/powerpc/kernel/eeh_cache.c
@@ -189,7 +189,7 @@ static void __eeh_addr_cache_insert_dev(struct pci_dev *dev)
189 } 189 }
190 190
191 /* Skip any devices for which EEH is not enabled. */ 191 /* Skip any devices for which EEH is not enabled. */
192 if (!eeh_probe_mode_dev() && !edev->pe) { 192 if (!edev->pe) {
193#ifdef DEBUG 193#ifdef DEBUG
194 pr_info("PCI: skip building address cache for=%s - %s\n", 194 pr_info("PCI: skip building address cache for=%s - %s\n",
195 pci_name(dev), dn->full_name); 195 pci_name(dev), dn->full_name);
diff --git a/arch/powerpc/platforms/powernv/eeh-powernv.c b/arch/powerpc/platforms/powernv/eeh-powernv.c
index c3a5c2f63c3d..996d8844cbdf 100644
--- a/arch/powerpc/platforms/powernv/eeh-powernv.c
+++ b/arch/powerpc/platforms/powernv/eeh-powernv.c
@@ -51,8 +51,8 @@ static int powernv_eeh_init(void)
51 return -EINVAL; 51 return -EINVAL;
52 } 52 }
53 53
54 /* Set EEH probe mode */ 54 /* Set probe mode */
55 eeh_probe_mode_set(EEH_PROBE_MODE_DEV); 55 eeh_add_flag(EEH_PROBE_MODE_DEV);
56 56
57 return 0; 57 return 0;
58} 58}
@@ -164,7 +164,7 @@ static int powernv_eeh_dev_probe(struct pci_dev *dev, void *flag)
164 * Enable EEH explicitly so that we will do EEH check 164 * Enable EEH explicitly so that we will do EEH check
165 * while accessing I/O stuff 165 * while accessing I/O stuff
166 */ 166 */
167 eeh_set_enable(true); 167 eeh_add_flag(EEH_ENABLED);
168 168
169 /* Save memory bars */ 169 /* Save memory bars */
170 eeh_save_bars(edev); 170 eeh_save_bars(edev);
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
index 035db476be0e..0701f90ac625 100644
--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -1157,7 +1157,6 @@ static void pnv_pci_ioda_fixup(void)
1157 pnv_pci_ioda_create_dbgfs(); 1157 pnv_pci_ioda_create_dbgfs();
1158 1158
1159#ifdef CONFIG_EEH 1159#ifdef CONFIG_EEH
1160 eeh_probe_mode_set(EEH_PROBE_MODE_DEV);
1161 eeh_init(); 1160 eeh_init();
1162 eeh_addr_cache_build(); 1161 eeh_addr_cache_build();
1163#endif 1162#endif
diff --git a/arch/powerpc/platforms/pseries/eeh_pseries.c b/arch/powerpc/platforms/pseries/eeh_pseries.c
index 476a5d8b0b36..ba94b5b8d58c 100644
--- a/arch/powerpc/platforms/pseries/eeh_pseries.c
+++ b/arch/powerpc/platforms/pseries/eeh_pseries.c
@@ -128,7 +128,7 @@ static int pseries_eeh_init(void)
128 } 128 }
129 129
130 /* Set EEH probe mode */ 130 /* Set EEH probe mode */
131 eeh_probe_mode_set(EEH_PROBE_MODE_DEVTREE); 131 eeh_add_flag(EEH_PROBE_MODE_DEVTREE);
132 132
133 return 0; 133 return 0;
134} 134}
@@ -297,7 +297,7 @@ static void *pseries_eeh_of_probe(struct device_node *dn, void *flag)
297 enable = 1; 297 enable = 1;
298 298
299 if (enable) { 299 if (enable) {
300 eeh_set_enable(true); 300 eeh_add_flag(EEH_ENABLED);
301 eeh_add_to_parent_pe(edev); 301 eeh_add_to_parent_pe(edev);
302 302
303 pr_debug("%s: EEH enabled on %s PHB#%d-PE#%x, config addr#%x\n", 303 pr_debug("%s: EEH enabled on %s PHB#%d-PE#%x, config addr#%x\n",