Igor recently suggested that instead of failing in spapr_drc_attach() at plug time we should rather check that the DRC is attachable at pre-plug time. This allows to error out before the hot-plugged device is even realized and to come up with simpler plug callbacks.
sPAPR currently supports hotplug of PCI devices, PHBs, CPU cores, PC-DIMM/NVDIMM memory and TPM proxy devices. Some of these already do sanity checks at pre-plug that are sufficient to ensure the DRC are attachables. Some others don't even have a pre-plug handler. This series adds the missing pieces so that all failing conditions are caught at pre-plug time instead of plug time for all devices. Greg Kurz (9): spapr: Do PCI device hotplug sanity checks at pre-plug only spapr: Do NVDIMM/PC-DIMM device hotplug sanity checks at pre-plug only spapr: Fix pre-2.10 dummy ICP hack spapr: Set compat mode in spapr_reset_vcpu() spapr: Simplify error path of spapr_core_plug() spapr: Make PHB placement functions and spapr_pre_plug_phb() return status spapr: Do PHB hoplug sanity check at pre-plug spapr: Do TPM proxy hotplug sanity checks at pre-plug spapr: spapr_drc_attach() cannot fail include/hw/ppc/spapr.h | 2 +- include/hw/ppc/spapr_drc.h | 8 +- include/hw/ppc/spapr_nvdimm.h | 2 +- hw/ppc/spapr.c | 157 ++++++++++++++++------------------ hw/ppc/spapr_cpu_core.c | 13 +++ hw/ppc/spapr_drc.c | 8 +- hw/ppc/spapr_nvdimm.c | 11 +-- hw/ppc/spapr_pci.c | 43 +++++++--- 8 files changed, 138 insertions(+), 106 deletions(-) -- 2.26.2