From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48914) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a3Zxx-00074A-7s for qemu-devel@nongnu.org; Mon, 30 Nov 2015 20:42:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a3Zxw-0001An-4t for qemu-devel@nongnu.org; Mon, 30 Nov 2015 20:42:49 -0500 Date: Tue, 1 Dec 2015 12:06:43 +1100 From: David Gibson Message-ID: <20151201010643.GF31343@voom.redhat.com> References: <1448024079-20808-1-git-send-email-bharata@linux.vnet.ibm.com> <1448024079-20808-8-git-send-email-bharata@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="FeAIMMcddNRN4P4/" Content-Disposition: inline In-Reply-To: <1448024079-20808-8-git-send-email-bharata@linux.vnet.ibm.com> Subject: Re: [Qemu-devel] [PATCH v5 07/10] spapr: Enable CPU hotplug for pseries-2.5 and add CPU DRC DT entries List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Bharata B Rao 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 --FeAIMMcddNRN4P4/ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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. >=20 > Signed-off-by: Bharata B Rao > --- > hw/ppc/spapr.c | 23 +++++++++++++++++++++++ > include/hw/ppc/spapr.h | 1 + > 2 files changed, 24 insertions(+) >=20 > 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 *sp= apr, > _FDT(spapr_drc_populate_dt(fdt, 0, NULL, SPAPR_DR_CONNECTOR_TYPE= _LMB)); > } > =20 > + if (smc->dr_cpu_enabled) { > + int offset =3D fdt_path_offset(fdt, "/cpus"); > + ret =3D 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 properti= es\n"); > + exit(1); > + } > + } > + > _FDT((fdt_pack(fdt))); > =20 > 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 =3D false; > char *filename; > + int smt =3D kvmppc_smt_threads(); > + int smp_max_cores =3D 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? > =20 > msi_supported =3D true; > =20 > @@ -1793,6 +1805,15 @@ static void ppc_spapr_init(MachineState *machine) > spapr_validate_node_memory(machine); > } > =20 > + if (smc->dr_cpu_enabled) { > + for (i =3D 0; i < smp_max_cores; i++) { > + sPAPRDRConnector *drc =3D > + 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 =3D=3D NULL) { > machine->cpu_model =3D kvm_enabled() ? "host" : "POWER7"; > @@ -2277,6 +2298,7 @@ static void spapr_machine_class_init(ObjectClass *o= c, void *data) > mc->cpu_index_to_socket_id =3D spapr_cpu_index_to_socket_id; > =20 > smc->dr_lmb_enabled =3D false; > + smc->dr_cpu_enabled =3D false; > fwc->get_dev_path =3D spapr_get_fw_dev_path; > nc->nmi_monitor_handler =3D spapr_nmi; > } > @@ -2443,6 +2465,7 @@ static void spapr_machine_2_5_class_init(ObjectClas= s *oc, void *data) > mc->alias =3D "pseries"; > mc->is_default =3D 1; > smc->dr_lmb_enabled =3D true; > + smc->dr_cpu_enabled =3D true; > } Given when we are, this will need to move to 2.6, obviously. > static const TypeInfo spapr_machine_2_5_info =3D { > diff --git a/include/hw/ppc/spapr.h b/include/hw/ppc/spapr.h > index 5baa906..716d7ad 100644 > --- a/include/hw/ppc/spapr.h > +++ b/include/hw/ppc/spapr.h > @@ -36,6 +36,7 @@ struct sPAPRMachineClass { > =20 > /*< public >*/ > bool dr_lmb_enabled; /* enable dynamic-reconfig/hotplug of LMBs */ > + bool dr_cpu_enabled; /* enable dynamic-reconfig/hotplug of CPUs */ > }; > =20 > /** --=20 David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson --FeAIMMcddNRN4P4/ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJWXPKjAAoJEGw4ysog2bOSOXAQANx6qcRqsMuJUB5DRvdJbTE2 qAK2avZhq9BncSkHEaKRfvwSR/kZp6Ewc1tnb16Vs+lfL8pIm4DzPWSm5hUIr+Aj Q8GNroZF4QsAy/1912BCZ3TuAQMvEL/PTHBT61Xz/XIGquxXIfDKFBabM+jcKNgN IJjlZKs2Fj6rditSLdXaD6cdTPf4gl2EAghKob1vBlbzPFSdvLRclAkNO+bQJlYa dJsxKEVDAXp/QC/7zOMv/ASGmJSPZg5xpe9pQhWjMlE3SwwN3FJ1PpLLmGwah0p5 y8V6GRnT+ZRGPsXREpXEZcf90LbJwv0ng2N+HzxBm65SAU6FgshJG07zMsm2q8l3 14L2hHaFaKdwSNIH0sb2lfM47NDnBO4wxZTz2UsfERaPt0bBp/hjYwyVYN0k1oom U8nSpIuMzgEcEtPb45B+WWiBsoFaT12tW/MkypmV00r/iRbFPX5x12x4cOnBlie5 zzqHfQ3rkhcOfPfz6qpJKoqSJNxHb7KMK2x+XhiBx08DJl+nEDNXigULPPodkslQ SBakzZMBhQBQSFDirjtVNIwncUCPjUcFjKN8Nqsv4Mg8R2PndR2dOXA3YnHPPpH5 cDwJ/juuTPHRENjd2VQYXcHenG2PL+Qwb7L3RlAKWDv/bar6/+bA42Ldxa+9whUf vuSFKGB4Dju+TcKPU6U5 =4Ct6 -----END PGP SIGNATURE----- --FeAIMMcddNRN4P4/--