On 26/07/17 04:01, Greg Kurz wrote: > From: Michael Roth <mdr...@linux.vnet.ibm.com> > > The 'dr_phb_enabled' field of that class can be set as > part of machine-specific init code, and is then propagated > to sPAPREnvironment to conditionally enable creation of DRC > objects and device-tree description to facilitate hotplug > of PHBs. > > Since we can't migrate this state to older machine types, > default the option to true and disable it for older machine > types. > > Signed-off-by: Michael Roth <mdr...@linux.vnet.ibm.com> > Signed-off-by: Greg Kurz <gr...@kaod.org> > --- > Changes since RFC: > - rebased against ppc-for-2.10 > - updated changelog and title > - set default to true and disable for 2.10 and older > --- > hw/ppc/spapr.c | 6 ++++++ > include/hw/ppc/spapr.h | 3 +++ > 2 files changed, 9 insertions(+) > > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c > index 277daa4f9645..8dc505343c0f 100644 > --- a/hw/ppc/spapr.c > +++ b/hw/ppc/spapr.c > @@ -2382,6 +2382,8 @@ static void ppc_spapr_init(MachineState *machine) > /* We always have at least the nvram device on VIO */ > spapr_create_nvram(spapr); > > + spapr->dr_phb_enabled = smc->dr_phb_enabled; > + > /* Set up PCI */ > spapr_pci_rtas_init(); > > @@ -3482,6 +3484,7 @@ static void spapr_machine_class_init(ObjectClass *oc, > void *data) > * in which LMBs are represented and hot-added > */ > mc->numa_mem_align_shift = 28; > + smc->dr_phb_enabled = true; > } > > static const TypeInfo spapr_machine_info = { > @@ -3558,8 +3561,11 @@ static void > spapr_machine_2_10_instance_options(MachineState *machine) > > static void spapr_machine_2_10_class_options(MachineClass *mc) > { > + sPAPRMachineClass *smc = SPAPR_MACHINE_CLASS(mc); > + > spapr_machine_2_11_class_options(mc); > SET_MACHINE_COMPAT(mc, SPAPR_COMPAT_2_10); > + smc->dr_phb_enabled = false; > } > > DEFINE_SPAPR_MACHINE(2_10, "2.10", false); > diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h > index 2a303a705c17..8004d9c2ab2c 100644 > --- a/include/hw/ppc/spapr.h > +++ b/include/hw/ppc/spapr.h > @@ -59,6 +59,7 @@ struct sPAPRMachineClass { > > /*< public >*/ > bool dr_lmb_enabled; /* enable dynamic-reconfig/hotplug of LMBs */ > + bool dr_phb_enabled; /* enable dynamic-reconfig/hotplug of PHBs */ > bool use_ohci_by_default; /* use USB-OHCI instead of XHCI */ > const char *tcg_default_cpu; /* which (TCG) CPU to simulate by default */ > bool pre_2_10_has_unused_icps; > @@ -122,6 +123,8 @@ struct sPAPRMachineState { > * occurs during the unplug process. */ > QTAILQ_HEAD(, sPAPRDIMMState) pending_dimm_unplugs; > > + bool dr_phb_enabled; /* hotplug / dynamic-reconfiguration of PHBs */
The one in the class seems sufficient unless we are going to allow disabling this via the command line. > + > /*< public >*/ > char *kvm_type; > MemoryHotplugState hotplug_memory; > > -- Alexey