Skip to content

Commit a4b4f61

Browse files
oohalmpe
authored andcommitted
powerpc/eeh: Do early EEH init only when required
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: Sam Bobroff <[email protected]> Signed-off-by: Oliver O'Halloran <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 2d0953f commit a4b4f61

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

arch/powerpc/kernel/pci-hotplug.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,6 @@ void pci_hp_add_devices(struct pci_bus *bus)
112112
struct pci_controller *phb;
113113
struct device_node *dn = pci_bus_to_OF_node(bus);
114114

115-
eeh_add_device_tree_early(PCI_DN(dn));
116-
117115
phb = pci_bus_to_host(bus);
118116

119117
mode = PCI_PROBE_NORMAL;

drivers/pci/hotplug/rpaphp_core.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,8 @@ static int enable_slot(struct hotplug_slot *hotplug_slot)
493493
return retval;
494494

495495
if (state == PRESENT) {
496+
eeh_add_device_tree_early(PCI_DN(slot->dn));
497+
496498
pci_lock_rescan_remove();
497499
pci_hp_add_devices(slot->bus);
498500
pci_unlock_rescan_remove();

drivers/pci/hotplug/rpaphp_pci.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,10 @@ int rpaphp_enable_slot(struct slot *slot)
9595
return -EINVAL;
9696
}
9797

98-
if (list_empty(&bus->devices))
98+
if (list_empty(&bus->devices)) {
99+
eeh_add_device_tree_early(PCI_DN(slot->dn));
99100
pci_hp_add_devices(bus);
101+
}
100102

101103
if (!list_empty(&bus->devices)) {
102104
slot->state = CONFIGURED;

0 commit comments

Comments
 (0)