Skip to content

Commit

Permalink
powerpc/eeh: Move EEH initialization around
Browse files Browse the repository at this point in the history
Currently, we have 3 phases for EEH initialization on pSeries platform.
All of them are done through builtin functions: platform initialization,
EEH device creation, and EEH subsystem enablement. All of them are done
no later than ppc_md.setup_arch. That means that the slab/slub isn't ready
yet, so we have to allocate memory chunks on basis of PAGE_SIZE for those
dynamically created EEH devices. That's pretty expensive.

In order to utilize slab/slub for memory allocation, we have to move the EEH
initialization functions around, but all of them should be called after slab
is ready.

Signed-off-by: Gavin Shan <shangw@linux.vnet.ibm.com>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
  • Loading branch information
Gavin Shan authored and Benjamin Herrenschmidt committed Sep 9, 2012
1 parent 407821a commit 35e5cfe
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 26 deletions.
16 changes: 0 additions & 16 deletions arch/powerpc/include/asm/eeh.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,6 @@ extern int eeh_subsystem_enabled;

void * __devinit eeh_dev_init(struct device_node *dn, void *data);
void __devinit eeh_dev_phb_init_dynamic(struct pci_controller *phb);
void __init eeh_dev_phb_init(void);
void __init eeh_init(void);
#ifdef CONFIG_PPC_PSERIES
int __init eeh_pseries_init(void);
#endif
int __init eeh_ops_register(struct eeh_ops *ops);
int __exit eeh_ops_unregister(const char *name);
unsigned long eeh_check_failure(const volatile void __iomem *token,
Expand Down Expand Up @@ -156,17 +151,6 @@ static inline void *eeh_dev_init(struct device_node *dn, void *data)

static inline void eeh_dev_phb_init_dynamic(struct pci_controller *phb) { }

static inline void eeh_dev_phb_init(void) { }

static inline void eeh_init(void) { }

#ifdef CONFIG_PPC_PSERIES
static inline int eeh_pseries_init(void)
{
return 0;
}
#endif /* CONFIG_PPC_PSERIES */

static inline unsigned long eeh_check_failure(const volatile void __iomem *token, unsigned long val)
{
return val;
Expand Down
3 changes: 0 additions & 3 deletions arch/powerpc/kernel/rtas_pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -275,9 +275,6 @@ void __init find_and_init_phbs(void)
of_node_put(root);
pci_devs_phb_init();

/* Create EEH devices for all PHBs */
eeh_dev_phb_init();

/*
* PCI_PROBE_ONLY and PCI_REASSIGN_ALL_BUS can be set via properties
* in chosen.
Expand Down
10 changes: 7 additions & 3 deletions arch/powerpc/platforms/pseries/eeh.c
Original file line number Diff line number Diff line change
Expand Up @@ -982,7 +982,7 @@ int __exit eeh_ops_unregister(const char *name)
* Even if force-off is set, the EEH hardware is still enabled, so that
* newer systems can boot.
*/
void __init eeh_init(void)
static int __init eeh_init(void)
{
struct pci_controller *hose, *tmp;
struct device_node *phb;
Expand All @@ -992,11 +992,11 @@ void __init eeh_init(void)
if (!eeh_ops) {
pr_warning("%s: Platform EEH operation not found\n",
__func__);
return;
return -EEXIST;
} else if ((ret = eeh_ops->init())) {
pr_warning("%s: Failed to call platform init function (%d)\n",
__func__, ret);
return;
return ret;
}

raw_spin_lock_init(&confirm_error_lock);
Expand All @@ -1011,8 +1011,12 @@ void __init eeh_init(void)
printk(KERN_INFO "EEH: PCI Enhanced I/O Error Handling Enabled\n");
else
printk(KERN_WARNING "EEH: No capable adapters found\n");

return ret;
}

core_initcall_sync(eeh_init);

/**
* eeh_add_device_early - Enable EEH for the indicated device_node
* @dn: device node for which to set up EEH
Expand Down
6 changes: 5 additions & 1 deletion arch/powerpc/platforms/pseries/eeh_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,14 @@ void __devinit eeh_dev_phb_init_dynamic(struct pci_controller *phb)
* Scan all the existing PHBs and create EEH devices for their OF
* nodes and their children OF nodes
*/
void __init eeh_dev_phb_init(void)
static int __init eeh_dev_phb_init(void)
{
struct pci_controller *phb, *tmp;

list_for_each_entry_safe(phb, tmp, &hose_list, list_node)
eeh_dev_phb_init_dynamic(phb);

return 0;
}

core_initcall(eeh_dev_phb_init);
4 changes: 3 additions & 1 deletion arch/powerpc/platforms/pseries/eeh_pseries.c
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,9 @@ static struct eeh_ops pseries_eeh_ops = {
* EEH initialization on pseries platform. This function should be
* called before any EEH related functions.
*/
int __init eeh_pseries_init(void)
static int __init eeh_pseries_init(void)
{
return eeh_ops_register(&pseries_eeh_ops);
}

early_initcall(eeh_pseries_init);
2 changes: 0 additions & 2 deletions arch/powerpc/platforms/pseries/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -388,10 +388,8 @@ static void __init pSeries_setup_arch(void)

/* Find and initialize PCI host bridges */
init_pci_config_tokens();
eeh_pseries_init();
find_and_init_phbs();
pSeries_reconfig_notifier_register(&pci_dn_reconfig_nb);
eeh_init();

pSeries_nvram_init();

Expand Down

0 comments on commit 35e5cfe

Please sign in to comment.