Skip to content

Commit c44e4cc

Browse files
Sam Bobroffmpe
authored andcommitted
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
1 parent b905f8c commit c44e4cc

5 files changed

Lines changed: 14 additions & 59 deletions

File tree

‎arch/powerpc/include/asm/eeh.h‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -269,13 +269,12 @@ struct pci_bus *eeh_pe_bus_get(struct eeh_pe *pe);
269269

270270
struct eeh_dev *eeh_dev_init(struct pci_dn *pdn);
271271
void eeh_dev_phb_init_dynamic(struct pci_controller *phb);
272-
void eeh_probe_devices(void);
272+
void eeh_show_enabled(void);
273273
int __init eeh_ops_register(struct eeh_ops *ops);
274274
int __exit eeh_ops_unregister(const char *name);
275275
int eeh_check_failure(const volatile void __iomem *token);
276276
int eeh_dev_check_failure(struct eeh_dev *edev);
277277
void eeh_addr_cache_init(void);
278-
void eeh_addr_cache_build(void);
279278
void eeh_add_device_early(struct pci_dn *);
280279
void eeh_add_device_tree_early(struct pci_dn *);
281280
void eeh_add_device_late(struct pci_dev *);
@@ -317,7 +316,7 @@ static inline bool eeh_enabled(void)
317316
return false;
318317
}
319318

320-
static inline void eeh_probe_devices(void) { }
319+
static inline void eeh_show_enabled(void) { }
321320

322321
static inline void *eeh_dev_init(struct pci_dn *pdn, void *data)
323322
{
@@ -335,8 +334,6 @@ static inline int eeh_check_failure(const volatile void __iomem *token)
335334

336335
static inline void eeh_addr_cache_init(void) { }
337336

338-
static inline void eeh_addr_cache_build(void) { }
339-
340337
static inline void eeh_add_device_early(struct pci_dn *pdn) { }
341338

342339
static inline void eeh_add_device_tree_early(struct pci_dn *pdn) { }

‎arch/powerpc/kernel/eeh.c‎

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,16 @@ static int __init eeh_setup(char *str)
150150
}
151151
__setup("eeh=", eeh_setup);
152152

153+
void 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+
153163
/*
154164
* This routine captures assorted PCI configuration space data
155165
* for the indicated PCI device, and puts them into a buffer
@@ -1063,23 +1073,6 @@ static struct notifier_block eeh_reboot_nb = {
10631073
.notifier_call = eeh_reboot_notifier,
10641074
};
10651075

1066-
void 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-
10831076
/**
10841077
* eeh_init - EEH initialization
10851078
*

‎arch/powerpc/kernel/eeh_cache.c‎

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -268,38 +268,6 @@ void eeh_addr_cache_init(void)
268268
spin_lock_init(&pci_io_addr_cache_root.piar_lock);
269269
}
270270

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-
*/
280-
void 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-
303271
static int eeh_addr_cache_show(struct seq_file *s, void *v)
304272
{
305273
struct pci_io_addr_range *piar;

‎arch/powerpc/platforms/powernv/eeh-powernv.c‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,9 +229,7 @@ int pnv_eeh_post_init(void)
229229
struct pnv_phb *phb;
230230
int ret = 0;
231231

232-
/* Probe devices & build address cache */
233-
eeh_probe_devices();
234-
eeh_addr_cache_build();
232+
eeh_show_enabled();
235233

236234
/* Register OPAL event notifier */
237235
eeh_event_irq = opal_event_request(ilog2(OPAL_EVENT_PCI_ERROR));

‎arch/powerpc/platforms/pseries/pci.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,7 @@ void __init pSeries_final_fixup(void)
229229

230230
pSeries_request_regions();
231231

232-
eeh_probe_devices();
233-
eeh_addr_cache_build();
232+
eeh_show_enabled();
234233

235234
#ifdef CONFIG_PCI_IOV
236235
ppc_md.pcibios_sriov_enable = pseries_pcibios_sriov_enable;

0 commit comments

Comments
 (0)