Skip to contentSkip to conversation

powerpc/powernv: Rework EEH initialization on powernv

PATCH In review Benjamin Herrenschmidt 3 participants 3 messages Sep 7, 2017 – Sep 27, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 2/2 powerpc/powernv: Rework EEH initialization on powernv

Remove the post_init callback which is only used by powernv, we can just call it explicitly from the powernv code.

This partially kills the ability to "disable" eeh at runtime via debugfs as this was calling that same callback again, but this is both unused and broken in several ways. If we want to revive it, we need to create a dedicated enable/disable callback on the backend that does the right thing.

Let the bulk of eeh initialize normally at core_initcall() like it does on pseries by removing the hack in eeh_init() that delays it.

Instead we make sure our eeh->probe cleanly bails out of the PEs haven't been created yet and we force a re-probe where we used to call eeh_init() again.

---
 arch/powerpc/include/asm/eeh.h               |  8 ++---
 arch/powerpc/kernel/eeh.c                    | 46 +++++++++------------------
 arch/powerpc/platforms/powernv/eeh-powernv.c | 47 +++++++++++++++-------------
 arch/powerpc/platforms/powernv/pci-ioda.c    |  3 +-
 arch/powerpc/platforms/powernv/pci.h         |  1 +
 5 files changed, 43 insertions(+), 62 deletions(-)
arch/powerpc/include/asm/eeh.h +2 -6
index 8e37b71674f4..f44271b3beaf 100644
@@ -202,7 +202,6 @@ enum {
 struct eeh_ops {
 	char *name;
 	int (*init)(void);
-	int (*post_init)(void);
 	void* (*probe)(struct pci_dn *pdn, void *data);
 	int (*set_option)(struct eeh_pe *pe, int option);
 	int (*get_pe_addr)(struct eeh_pe *pe);
@@ -276,7 +275,7 @@ struct pci_bus *eeh_pe_bus_get(struct eeh_pe *pe);
 
 struct eeh_dev *eeh_dev_init(struct pci_dn *pdn);
 void eeh_dev_phb_init_dynamic(struct pci_controller *phb);
-int eeh_init(void);
+void eeh_probe_devices(void);
 int __init eeh_ops_register(struct eeh_ops *ops);
 int __exit eeh_ops_unregister(const char *name);
 int eeh_check_failure(const volatile void __iomem *token);
@@ -322,10 +321,7 @@ static inline bool eeh_enabled(void)
         return false;
 }
 
-static inline int eeh_init(void)
-{
-	return 0;
-}
+static inline void eeh_probe_devices(void) { }
 
 static inline void *eeh_dev_init(struct pci_dn *pdn, void *data)
 {
arch/powerpc/kernel/eeh.c +14 -32

74 lines not on this page · raw message

arch/powerpc/platforms/powernv/eeh-powernv.c +25 -22

90 lines not on this page · raw message

arch/powerpc/platforms/powernv/pci-ioda.c +1 -2
index b900eb1d5e17..24e52fa0c8b7 100644
@@ -3294,8 +3294,7 @@ static void pnv_pci_ioda_fixup(void)
 	pnv_pci_ioda_create_dbgfs();
 
 #ifdef CONFIG_EEH
-	eeh_init();
-	eeh_addr_cache_build();
+	pnv_eeh_post_init();
 #endif
 }
 
arch/powerpc/platforms/powernv/pci.h +1 -0
index f16bc403ec03..31f5f99be39a 100644
@@ -229,6 +229,7 @@ extern void pnv_teardown_msi_irqs(struct pci_dev *pdev);
 extern struct pnv_ioda_pe *pnv_ioda_get_pe(struct pci_dev *dev);
 extern void pnv_set_msi_irq_chip(struct pnv_phb *phb, unsigned int virq);
 extern bool pnv_pci_enable_device_hook(struct pci_dev *dev);
+extern int pnv_eeh_post_init(void);
 
 extern void pe_level_printk(const struct pnv_ioda_pe *pe, const char *level,
 			    const char *fmt, ...);
Acked-by on v1 2/2
#1 lore raw
Quoted 15 lines · Benjamin Herrenschmidt

Remove the post_init callback which is only used by powernv, we can just call it explicitly from the powernv code.

This partially kills the ability to "disable" eeh at runtime via debugfs as this was calling that same callback again, but this is both unused and broken in several ways. If we want to revive it, we need to create a dedicated enable/disable callback on the backend that does the right thing.

Let the bulk of eeh initialize normally at core_initcall() like it does on pseries by removing the hack in eeh_init() that delays it.

Quoted 5 lines

Instead we make sure our eeh->probe cleanly bails out of the PEs haven't been created yet and we force a re-probe where we used to call eeh_init() again.

#2 lore raw
In reply to Benjamin Herrenschmidt
Quoted 15 lines · Benjamin Herrenschmidt

Remove the post_init callback which is only used by powernv, we can just call it explicitly from the powernv code.

This partially kills the ability to "disable" eeh at runtime via debugfs as this was calling that same callback again, but this is both unused and broken in several ways. If we want to revive it, we need to create a dedicated enable/disable callback on the backend that does the right thing.

Let the bulk of eeh initialize normally at core_initcall() like it does on pseries by removing the hack in eeh_init() that delays it.

Quoted 6 lines

Instead we make sure our eeh->probe cleanly bails out of the PEs haven't been created yet and we force a re-probe where we used to call eeh_init() again.

Patch 2 applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/b9fde58db7e5738cacb740b0ec5479

cheers