Hi all, This patch set adds support for EEH recovery of hot plugged devices on pSeries machines. Specifically, devices discovered by PCI rescanning using /sys/bus/pci/rescan, which includes devices hotplugged by QEMU's device_add command. (pSeries doesn't currently use slot power control for hotplugging.)
As a side effect this also provides EEH support for devices removed by /sys/bus/pci/devices/*/remove and re-discovered by writing to /sys/bus/pci/rescan, on all platforms. The approach I've taken is to use the fact that the existing pcibios_bus_add_device() platform hooks (which are used to set up EEH on Virtual Function devices (VFs)) are actually called for all devices, so I've widened their scope and made other adjustments necessary to allow them to work for hotplugged and boot-time devices as well. Because some of the changes are in generic PowerPC code, it's possible that I've disturbed something for another PowerPC platform. I've tried to minimize this by leaving that code alone as much as possible and so there are a few cases where eeh_add_device_{early,late}() or eeh_add_sysfs_files() is called more than once. I think these can be looked at later, as duplicate calls are not harmful. The patch "Convert PNV_PHB_FLAG_EEH" isn't strictly necessary and I'm not sure if it's better to keep it, because it simplifies the code or drop it, because we may need a separate flag per PHB later on. Thoughts anyone? The first patch is a rework of the pcibios_init reordering patch I posted earlier, which I've included here because it's necessary for this set. I have done some testing for PowerNV on Power9 using a modified pnv_php module and some testing on pSeries with slot power control using a modified rpaphp module, and the EEH-related parts seem to work. Cheers, Sam. Sam Bobroff (8): powerpc/64: Adjust order in pcibios_init() powerpc/eeh: Clear stale EEH_DEV_NO_HANDLER flag powerpc/eeh: Convert PNV_PHB_FLAG_EEH to global flag powerpc/eeh: Improve debug messages around device addition powerpc/eeh: Add eeh_show_enabled() powerpc/eeh: Initialize EEH address cache earlier powerpc/eeh: EEH for pSeries hot plug powerpc/eeh: Remove eeh_probe_devices() and eeh_addr_cache_build() arch/powerpc/include/asm/eeh.h | 19 +++-- arch/powerpc/kernel/eeh.c | 33 ++++----- arch/powerpc/kernel/eeh_cache.c | 29 +------- arch/powerpc/kernel/eeh_driver.c | 4 ++ arch/powerpc/kernel/of_platform.c | 3 +- arch/powerpc/kernel/pci-common.c | 4 -- arch/powerpc/kernel/pci_32.c | 4 ++ arch/powerpc/kernel/pci_64.c | 12 +++- arch/powerpc/platforms/powernv/eeh-powernv.c | 41 +++++------ arch/powerpc/platforms/powernv/pci.c | 7 +- arch/powerpc/platforms/powernv/pci.h | 2 - arch/powerpc/platforms/pseries/eeh_pseries.c | 75 +++++++++++--------- arch/powerpc/platforms/pseries/pci.c | 7 +- 13 files changed, 122 insertions(+), 118 deletions(-) -- 2.19.0.2.gcad72f5712