• Oliver O'Halloran's avatar
    powerpc/eeh: Do early EEH init only when required · a4b4f61d
    Oliver O'Halloran authored
    The pci hotplug helper (pci_hp_add_devices()) calls
    eeh_add_device_tree_early() to scan the device-tree for new PCI devices and
    do the early EEH probe before the device is scanned. This early probe is a
    no-op in a lot of cases because:
    
    a) The early init is only required to satisfy a PAPR requirement that EEH
       be configured before we start doing config accesses. On PowerNV it is
       a no-op.
    
    b) It's a no-op for devices that have already had their eeh_dev
       initialised.
    
    There are four callers of pci_hp_add_devices():
    
    1. arch/powerpc/kernel/eeh_driver.c
    	Here the hotplug helper is called when re-scanning pci_devs that
    	were removed during an EEH recovery pass. The EEH stat for each
    	removed device (the eeh_dev) is retained across a recovery pass
    	so the early init is a no-op in this case.
    
    2. drivers/pci/hotplug/pnv_php.c
    	This is also a no-op since the PowerNV hotplug driver is, suprisingly,
    	PowerNV specific.
    
    3. drivers/pci/hotplug/rpaphp_core.c
    4. drivers/pci/hotplug/rpaphp_pci.c
    	In these two cases new devices have been hotplugged and FW has
    	provided new DT nodes for each. These are the only two cases where
    	the EEH we might have new PCI device nodes in the DT so these are
    	the only two cases where the early EEH probe needs to be done.
    
    We can move the calls to eeh_add_device_tree_early() to the locations where
    it's needed and remove it from the generic path. This is preparation for
    making the early EEH probe pseries specific.
    Reviewed-by: default avatarSam Bobroff <sbobroff@linux.ibm.com>
    Signed-off-by: default avatarOliver O'Halloran <oohall@gmail.com>
    Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
    Link: https://lore.kernel.org/r/20200306073904.4737-3-oohall@gmail.com
    a4b4f61d
pci-hotplug.c 4.13 KB