From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60209) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a40Hh-0007kB-GN for qemu-devel@nongnu.org; Wed, 02 Dec 2015 00:48:58 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a40He-00076q-8o for qemu-devel@nongnu.org; Wed, 02 Dec 2015 00:48:57 -0500 Received: from e23smtp08.au.ibm.com ([202.81.31.141]:42663) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a40Hd-00075u-MX for qemu-devel@nongnu.org; Wed, 02 Dec 2015 00:48:54 -0500 Received: from localhost by e23smtp08.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 2 Dec 2015 15:48:51 +1000 Date: Wed, 2 Dec 2015 11:17:41 +0530 From: Bharata B Rao Message-ID: <20151202054741.GA21491@in.ibm.com> References: <1448024079-20808-1-git-send-email-bharata@linux.vnet.ibm.com> <1448024079-20808-8-git-send-email-bharata@linux.vnet.ibm.com> <20151201010643.GF31343@voom.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20151201010643.GF31343@voom.redhat.com> Subject: Re: [Qemu-devel] [PATCH v5 07/10] spapr: Enable CPU hotplug for pseries-2.5 and add CPU DRC DT entries Reply-To: bharata@linux.vnet.ibm.com List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: David Gibson Cc: mdroth@linux.vnet.ibm.com, aik@ozlabs.ru, agraf@suse.de, qemu-devel@nongnu.org, pbonzini@redhat.com, qemu-ppc@nongnu.org, tyreld@linux.vnet.ibm.com, nfont@linux.vnet.ibm.com, imammedo@redhat.com, afaerber@suse.de On Tue, Dec 01, 2015 at 12:06:43PM +1100, David Gibson wrote: > On Fri, Nov 20, 2015 at 06:24:36PM +0530, Bharata B Rao wrote: > > Start supporting CPU hotplug from pseries-2.5 onwards. Add CPU > > DRC (Dynamic Resource Connector) device tree entries. > > > > Signed-off-by: Bharata B Rao > > --- > > hw/ppc/spapr.c | 23 +++++++++++++++++++++++ > > include/hw/ppc/spapr.h | 1 + > > 2 files changed, 24 insertions(+) > > > > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c > > index 030ee35..814b0a6 100644 > > --- a/hw/ppc/spapr.c > > +++ b/hw/ppc/spapr.c > > @@ -973,6 +973,16 @@ static void spapr_finalize_fdt(sPAPRMachineState *spapr, > > _FDT(spapr_drc_populate_dt(fdt, 0, NULL, SPAPR_DR_CONNECTOR_TYPE_LMB)); > > } > > > > + if (smc->dr_cpu_enabled) { > > + int offset = fdt_path_offset(fdt, "/cpus"); > > + ret = spapr_drc_populate_dt(fdt, offset, NULL, > > + SPAPR_DR_CONNECTOR_TYPE_CPU); > > + if (ret < 0) { > > + fprintf(stderr, "Couldn't set up CPU DR device tree properties\n"); > > + exit(1); > > + } > > + } > > + > > _FDT((fdt_pack(fdt))); > > > > if (fdt_totalsize(fdt) > FDT_MAX_SIZE) { > > @@ -1727,6 +1737,8 @@ static void ppc_spapr_init(MachineState *machine) > > long load_limit, fw_size; > > bool kernel_le = false; > > char *filename; > > + int smt = kvmppc_smt_threads(); > > + int smp_max_cores = DIV_ROUND_UP(max_cpus, smp_threads); > > > Given your earlier patch to disallow partially filled cores, a > DIV_ROUND_UP should be the same as a straight divide, yes? Yes, will change. > > > > > msi_supported = true; > > > > @@ -1793,6 +1805,15 @@ static void ppc_spapr_init(MachineState *machine) > > spapr_validate_node_memory(machine); > > } > > > > + if (smc->dr_cpu_enabled) { > > + for (i = 0; i < smp_max_cores; i++) { > > + sPAPRDRConnector *drc = > > + spapr_dr_connector_new(OBJECT(spapr), > > + SPAPR_DR_CONNECTOR_TYPE_CPU, i * smt); > > + qemu_register_reset(spapr_drc_reset, drc); > > + } > > + } > > + > > /* init CPUs */ > > if (machine->cpu_model == NULL) { > > machine->cpu_model = kvm_enabled() ? "host" : "POWER7"; > > @@ -2277,6 +2298,7 @@ static void spapr_machine_class_init(ObjectClass *oc, void *data) > > mc->cpu_index_to_socket_id = spapr_cpu_index_to_socket_id; > > > > smc->dr_lmb_enabled = false; > > + smc->dr_cpu_enabled = false; > > fwc->get_dev_path = spapr_get_fw_dev_path; > > nc->nmi_monitor_handler = spapr_nmi; > > } > > @@ -2443,6 +2465,7 @@ static void spapr_machine_2_5_class_init(ObjectClass *oc, void *data) > > mc->alias = "pseries"; > > mc->is_default = 1; > > smc->dr_lmb_enabled = true; > > + smc->dr_cpu_enabled = true; > > } > > Given when we are, this will need to move to 2.6, obviously. Yes, will move to 2.6 machine type in the next iteration. Regards, Bharata.