aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSam Bobroff <sbobroff@linux.ibm.com>2019-08-16 00:48:10 -0400
committerMichael Ellerman <mpe@ellerman.id.au>2019-08-22 09:12:46 -0400
commitc44e4ccadaca5884ac82b6dfffbd693bec3b583e (patch)
tree023b12b8ed92d5a06098b3fe172a7fb21626ce57
parentb905f8cdca7725e750a84f7188ea6821750124c3 (diff)
powerpc/eeh: Refactor around eeh_probe_devices()
Now that EEH support for all devices (on PowerNV and pSeries) is provided by the pcibios bus add device hooks, eeh_probe_devices() and eeh_addr_cache_build() are redundant and can be removed. Move the EEH enabled message into it's own function so that it can be called from multiple places. Note that previously on pSeries, useless EEH sysfs files were created for some devices that did not have EEH support and this change prevents them from being created. Signed-off-by: Sam Bobroff <sbobroff@linux.ibm.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/33b0a6339d5ac88693de092d6fba984f2a5add66.1565930772.git.sbobroff@linux.ibm.com
-rw-r--r--arch/powerpc/include/asm/eeh.h7
-rw-r--r--arch/powerpc/kernel/eeh.c27
-rw-r--r--arch/powerpc/kernel/eeh_cache.c32
-rw-r--r--arch/powerpc/platforms/powernv/eeh-powernv.c4
-rw-r--r--arch/powerpc/platforms/pseries/pci.c3
5 files changed, 14 insertions, 59 deletions
diff --git a/arch/powerpc/include/asm/eeh.h b/arch/powerpc/include/asm/eeh.h
index 33e797eb0e6a..1fc2b5e40822 100644
--- a/arch/powerpc/include/asm/eeh.h
+++ b/arch/powerpc/include/asm/eeh.h
@@ -269,13 +269,12 @@ struct pci_bus *eeh_pe_bus_get(struct eeh_pe *pe);
269 269
270struct eeh_dev *eeh_dev_init(struct pci_dn *pdn); 270struct eeh_dev *eeh_dev_init(struct pci_dn *pdn);
271void eeh_dev_phb_init_dynamic(struct pci_controller *phb); 271void eeh_dev_phb_init_dynamic(struct pci_controller *phb);
272void eeh_probe_devices(void); 272void eeh_show_enabled(void);
273int __init eeh_ops_register(struct eeh_ops *ops); 273int __init eeh_ops_register(struct eeh_ops *ops);
274int __exit eeh_ops_unregister(const char *name); 274int __exit eeh_ops_unregister(const char *name);
275int eeh_check_failure(const volatile void __iomem *token); 275int eeh_check_failure(const volatile void __iomem *token);
276int eeh_dev_check_failure(struct eeh_dev *edev); 276int eeh_dev_check_failure(struct eeh_dev *edev);
277void eeh_addr_cache_init(void); 277void eeh_addr_cache_init(void);
278void eeh_addr_cache_build(void);
279void eeh_add_device_early(struct pci_dn *); 278void eeh_add_device_early(struct pci_dn *);
280void eeh_add_device_tree_early(struct pci_dn *); 279void eeh_add_device_tree_early(struct pci_dn *);
281void eeh_add_device_late(struct pci_dev *); 280void eeh_add_device_late(struct pci_dev *);
@@ -317,7 +316,7 @@ static inline bool eeh_enabled(void)
317 return false; 316 return false;
318} 317}
319 318
320static inline void eeh_probe_devices(void) { } 319static inline void eeh_show_enabled(void) { }
321 320
322static inline void *eeh_dev_init(struct pci_dn *pdn, void *data) 321static inline void *eeh_dev_init(struct pci_dn *pdn, void *data)
323{ 322{
@@ -335,8 +334,6 @@ static inline int eeh_check_failure(const volatile void __iomem *token)
335 334
336static inline void eeh_addr_cache_init(void) { } 335static inline void eeh_addr_cache_init(void) { }
337 336
338static inline void eeh_addr_cache_build(void) { }
339
340static inline void eeh_add_device_early(struct pci_dn *pdn) { } 337static inline void eeh_add_device_early(struct pci_dn *pdn) { }
341 338
342static inline void eeh_add_device_tree_early(struct pci_dn *pdn) { } 339static inline void eeh_add_device_tree_early(struct pci_dn *pdn) { }
diff --git a/arch/powerpc/kernel/eeh.c b/arch/powerpc/kernel/eeh.c
index abf4c1bb1fab..fc975342e242 100644
--- a/arch/powerpc/kernel/eeh.c
+++ b/arch/powerpc/kernel/eeh.c
@@ -150,6 +150,16 @@ static int __init eeh_setup(char *str)
150} 150}
151__setup("eeh=", eeh_setup); 151__setup("eeh=", eeh_setup);
152 152
153void eeh_show_enabled(void)
154{
155 if (eeh_has_flag(EEH_FORCE_DISABLED))
156 pr_info("EEH: Recovery disabled by kernel parameter.\n");
157 else if (eeh_has_flag(EEH_ENABLED))
158 pr_info("EEH: Capable adapter found: recovery enabled.\n");
159 else
160 pr_info("EEH: No capable adapters found: recovery disabled.\n");
161}
162
153/* 163/*
154 * This routine captures assorted PCI configuration space data 164 * This routine captures assorted PCI configuration space data
155 * for the indicated PCI device, and puts them into a buffer 165 * for the indicated PCI device, and puts them into a buffer
@@ -1063,23 +1073,6 @@ static struct notifier_block eeh_reboot_nb = {
1063 .notifier_call = eeh_reboot_notifier, 1073 .notifier_call = eeh_reboot_notifier,
1064}; 1074};
1065 1075
1066void eeh_probe_devices(void)
1067{
1068 struct pci_controller *hose, *tmp;
1069 struct pci_dn *pdn;
1070
1071 /* Enable EEH for all adapters */
1072 list_for_each_entry_safe(hose, tmp, &hose_list, list_node) {
1073 pdn = hose->pci_data;
1074 traverse_pci_dn(pdn, eeh_ops->probe, NULL);
1075 }
1076 if (eeh_enabled())
1077 pr_info("EEH: PCI Enhanced I/O Error Handling Enabled\n");
1078 else
1079 pr_info("EEH: No capable adapters found\n");
1080
1081}
1082
1083/** 1076/**
1084 * eeh_init - EEH initialization 1077 * eeh_init - EEH initialization
1085 * 1078 *
diff --git a/arch/powerpc/kernel/eeh_cache.c b/arch/powerpc/kernel/eeh_cache.c
index 75f0d66dee4b..1e47cd04a1bd 100644
--- a/arch/powerpc/kernel/eeh_cache.c
+++ b/arch/powerpc/kernel/eeh_cache.c
@@ -268,38 +268,6 @@ void eeh_addr_cache_init(void)
268 spin_lock_init(&pci_io_addr_cache_root.piar_lock); 268 spin_lock_init(&pci_io_addr_cache_root.piar_lock);
269} 269}
270 270
271/**
272 * eeh_addr_cache_build - Build a cache of I/O addresses
273 *
274 * Build a cache of pci i/o addresses. This cache will be used to
275 * find the pci device that corresponds to a given address.
276 * This routine scans all pci busses to build the cache.
277 * Must be run late in boot process, after the pci controllers
278 * have been scanned for devices (after all device resources are known).
279 */
280void eeh_addr_cache_build(void)
281{
282 struct pci_dn *pdn;
283 struct eeh_dev *edev;
284 struct pci_dev *dev = NULL;
285
286 for_each_pci_dev(dev) {
287 pdn = pci_get_pdn_by_devfn(dev->bus, dev->devfn);
288 if (!pdn)
289 continue;
290
291 edev = pdn_to_eeh_dev(pdn);
292 if (!edev)
293 continue;
294
295 dev->dev.archdata.edev = edev;
296 edev->pdev = dev;
297
298 eeh_addr_cache_insert_dev(dev);
299 eeh_sysfs_add_device(dev);
300 }
301}
302
303static int eeh_addr_cache_show(struct seq_file *s, void *v) 271static int eeh_addr_cache_show(struct seq_file *s, void *v)
304{ 272{
305 struct pci_io_addr_range *piar; 273 struct pci_io_addr_range *piar;
diff --git a/arch/powerpc/platforms/powernv/eeh-powernv.c b/arch/powerpc/platforms/powernv/eeh-powernv.c
index 00c0b81fd61d..6ed9b6ccafcc 100644
--- a/arch/powerpc/platforms/powernv/eeh-powernv.c
+++ b/arch/powerpc/platforms/powernv/eeh-powernv.c
@@ -229,9 +229,7 @@ int pnv_eeh_post_init(void)
229 struct pnv_phb *phb; 229 struct pnv_phb *phb;
230 int ret = 0; 230 int ret = 0;
231 231
232 /* Probe devices & build address cache */ 232 eeh_show_enabled();
233 eeh_probe_devices();
234 eeh_addr_cache_build();
235 233
236 /* Register OPAL event notifier */ 234 /* Register OPAL event notifier */
237 eeh_event_irq = opal_event_request(ilog2(OPAL_EVENT_PCI_ERROR)); 235 eeh_event_irq = opal_event_request(ilog2(OPAL_EVENT_PCI_ERROR));
diff --git a/arch/powerpc/platforms/pseries/pci.c b/arch/powerpc/platforms/pseries/pci.c
index 1eae1d09980c..722830978639 100644
--- a/arch/powerpc/platforms/pseries/pci.c
+++ b/arch/powerpc/platforms/pseries/pci.c
@@ -229,8 +229,7 @@ void __init pSeries_final_fixup(void)
229 229
230 pSeries_request_regions(); 230 pSeries_request_regions();
231 231
232 eeh_probe_devices(); 232 eeh_show_enabled();
233 eeh_addr_cache_build();
234 233
235#ifdef CONFIG_PCI_IOV 234#ifdef CONFIG_PCI_IOV
236 ppc_md.pcibios_sriov_enable = pseries_pcibios_sriov_enable; 235 ppc_md.pcibios_sriov_enable = pseries_pcibios_sriov_enable;