From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:32936) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YEP01-0007iu-7l for qemu-devel@nongnu.org; Thu, 22 Jan 2015 16:09:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YEOzy-0000Ps-0U for qemu-devel@nongnu.org; Thu, 22 Jan 2015 16:09:09 -0500 Received: from e31.co.us.ibm.com ([32.97.110.149]:40123) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YEOzx-0000PV-PO for qemu-devel@nongnu.org; Thu, 22 Jan 2015 16:09:05 -0500 Received: from /spool/local by e31.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 22 Jan 2015 14:09:04 -0700 Received: from b03cxnp08025.gho.boulder.ibm.com (b03cxnp08025.gho.boulder.ibm.com [9.17.130.17]) by d03dlp01.boulder.ibm.com (Postfix) with ESMTP id 510EF1FF0027 for ; Thu, 22 Jan 2015 14:00:13 -0700 (MST) Received: from d03av04.boulder.ibm.com (d03av04.boulder.ibm.com [9.17.195.170]) by b03cxnp08025.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t0ML99dQ31522846 for ; Thu, 22 Jan 2015 14:09:09 -0700 Received: from d03av04.boulder.ibm.com (loopback [127.0.0.1]) by d03av04.boulder.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t0ML90Kf017165 for ; Thu, 22 Jan 2015 14:09:00 -0700 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Michael Roth In-Reply-To: <1420697420-16053-2-git-send-email-bharata@linux.vnet.ibm.com> References: <1420697420-16053-1-git-send-email-bharata@linux.vnet.ibm.com> <1420697420-16053-2-git-send-email-bharata@linux.vnet.ibm.com> Message-ID: <20150122210859.30063.31730@loki> Date: Thu, 22 Jan 2015 15:08:59 -0600 Subject: Re: [Qemu-devel] [RFC PATCH v1 01/13] spapr: enable PHB/CPU/LMB hotplug for pseries-2.3 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Bharata B Rao , qemu-devel@nongnu.org Cc: imammedo@redhat.com, agraf@suse.de Quoting Bharata B Rao (2015-01-08 00:10:08) > From: Michael Roth > = > Introduce an sPAPRMachineClass sub-class of MachineClass to > handle sPAPR-specific machine configuration properties. > = > The 'dr_phb[cpu,lmb]_enabled' field of that class can be set as > part of machine-specific init code, and is then propagated > to sPAPREnvironment to conditional enable creation of DRC > objects and device-tree description to facilitate hotplug > of PHBs/CPUs/LMBs. > = > Since we can't migrate this state to older machine types, > default the option to false and only enable it for new > machine types. > = > Signed-off-by: Michael Roth > Signed-off-by: Bharata B Rao > [Added CPU and LMB bits] Reviewed-by: Michael Roth > --- > hw/ppc/spapr.c | 32 ++++++++++++++++++++++++++++++++ > include/hw/ppc/spapr.h | 3 +++ > 2 files changed, 35 insertions(+) > = > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c > index 9eb0a94..71e7052 100644 > --- a/hw/ppc/spapr.c > +++ b/hw/ppc/spapr.c > @@ -89,11 +89,29 @@ > = > #define HTAB_SIZE(spapr) (1ULL << ((spapr)->htab_shift)) > = > +typedef struct sPAPRMachineClass sPAPRMachineClass; > typedef struct sPAPRMachineState sPAPRMachineState; > = > #define TYPE_SPAPR_MACHINE "spapr-machine" > #define SPAPR_MACHINE(obj) \ > OBJECT_CHECK(sPAPRMachineState, (obj), TYPE_SPAPR_MACHINE) > +#define SPAPR_MACHINE_GET_CLASS(obj) \ > + OBJECT_GET_CLASS(sPAPRMachineClass, obj, TYPE_SPAPR_MACHINE) > +#define SPAPR_MACHINE_CLASS(klass) \ > + OBJECT_CLASS_CHECK(sPAPRMachineClass, klass, TYPE_SPAPR_MACHINE) > + > +/** > + * sPAPRMachineClass: > + */ > +struct sPAPRMachineClass { > + /*< private >*/ > + MachineClass parent_class; > + > + /*< public >*/ > + bool dr_phb_enabled; /* enable dynamic-reconfig/hotplug of PHBs */ > + bool dr_cpu_enabled; /* enable dynamic-reconfig/hotplug of CPUs */ > + bool dr_lmb_enabled; /* enable dynamic-reconfig/hotplug of LMBs */ > +}; > = > /** > * sPAPRMachineState: > @@ -1343,6 +1361,7 @@ static SaveVMHandlers savevm_htab_handlers =3D { > /* pSeries LPAR / sPAPR hardware init */ > static void ppc_spapr_init(MachineState *machine) > { > + sPAPRMachineClass *smc =3D SPAPR_MACHINE_GET_CLASS(machine); > ram_addr_t ram_size =3D machine->ram_size; > const char *cpu_model =3D machine->cpu_model; > const char *kernel_filename =3D machine->kernel_filename; > @@ -1503,6 +1522,10 @@ 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 =3D smc->dr_phb_enabled; > + spapr->dr_cpu_enabled =3D smc->dr_cpu_enabled; > + spapr->dr_lmb_enabled =3D smc->dr_lmb_enabled; > + > /* Set up PCI */ > spapr_pci_rtas_init(); > = > @@ -1722,6 +1745,7 @@ static void spapr_nmi(NMIState *n, int cpu_index, E= rror **errp) > static void spapr_machine_class_init(ObjectClass *oc, void *data) > { > MachineClass *mc =3D MACHINE_CLASS(oc); > + sPAPRMachineClass *smc =3D SPAPR_MACHINE_CLASS(oc); > FWPathProviderClass *fwc =3D FW_PATH_PROVIDER_CLASS(oc); > NMIClass *nc =3D NMI_CLASS(oc); > = > @@ -1733,6 +1757,9 @@ static void spapr_machine_class_init(ObjectClass *o= c, void *data) > mc->default_boot_order =3D NULL; > mc->kvm_type =3D spapr_kvm_type; > mc->has_dynamic_sysbus =3D true; > + smc->dr_phb_enabled =3D false; > + smc->dr_cpu_enabled =3D false; > + smc->dr_lmb_enabled =3D false; > = > fwc->get_dev_path =3D spapr_get_fw_dev_path; > nc->nmi_monitor_handler =3D spapr_nmi; > @@ -1744,6 +1771,7 @@ static const TypeInfo spapr_machine_info =3D { > .abstract =3D true, > .instance_size =3D sizeof(sPAPRMachineState), > .instance_init =3D spapr_machine_initfn, > + .class_size =3D sizeof(sPAPRMachineClass), > .class_init =3D spapr_machine_class_init, > .interfaces =3D (InterfaceInfo[]) { > { TYPE_FW_PATH_PROVIDER }, > @@ -1788,11 +1816,15 @@ static const TypeInfo spapr_machine_2_2_info =3D { > static void spapr_machine_2_3_class_init(ObjectClass *oc, void *data) > { > MachineClass *mc =3D MACHINE_CLASS(oc); > + sPAPRMachineClass *smc =3D SPAPR_MACHINE_CLASS(oc); > = > mc->name =3D "pseries-2.3"; > mc->desc =3D "pSeries Logical Partition (PAPR compliant) v2.3"; > mc->alias =3D "pseries"; > mc->is_default =3D 1; > + smc->dr_phb_enabled =3D true; > + smc->dr_cpu_enabled =3D true; > + smc->dr_lmb_enabled =3D true; > } > = > static const TypeInfo spapr_machine_2_3_info =3D { > diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h > index 973193d..b1a0838 100644 > --- a/include/hw/ppc/spapr.h > +++ b/include/hw/ppc/spapr.h > @@ -30,6 +30,9 @@ typedef struct sPAPREnvironment { > uint64_t rtc_offset; > struct PPCTimebase tb; > bool has_graphics; > + bool dr_phb_enabled; /* hotplug / dynamic-reconfiguration of PHBs */ > + bool dr_cpu_enabled; /* hotplug / dynamic-reconfiguration of CPUs */ > + bool dr_lmb_enabled; /* hotplug / dynamic-reconfiguration of LMBs */ > = > uint32_t check_exception_irq; > Notifier epow_notifier; > -- = > 2.1.0