From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40288) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b9nFZ-00088G-1d for qemu-devel@nongnu.org; Mon, 06 Jun 2016 01:38:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b9nFT-0004z3-Ph for qemu-devel@nongnu.org; Mon, 06 Jun 2016 01:38:56 -0400 Date: Mon, 6 Jun 2016 15:37:29 +1000 From: David Gibson Message-ID: <20160606053729.GK9226@voom.fritz.box> References: <1463024905-28401-1-git-send-email-bharata@linux.vnet.ibm.com> <1463024905-28401-16-git-send-email-bharata@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Qo8f1a4rgWw9S/zY" Content-Disposition: inline In-Reply-To: <1463024905-28401-16-git-send-email-bharata@linux.vnet.ibm.com> Subject: Re: [Qemu-devel] [for-2.7 PATCH v3 15/15] spapr: implement query-hotpluggable-cpus callback List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Bharata B Rao Cc: qemu-devel@nongnu.org, qemu-ppc@nongnu.org, afaerber@suse.de, imammedo@redhat.com, armbru@redhat.com, thuth@redhat.com, aik@ozlabs.ru, agraf@suse.de, pbonzini@redhat.com, ehabkost@redhat.com, pkrempa@redhat.com, mdroth@linux.vnet.ibm.com, eblake@redhat.com, mjrosato@linux.vnet.ibm.com, borntraeger@de.ibm.com --Qo8f1a4rgWw9S/zY Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, May 12, 2016 at 09:18:25AM +0530, Bharata B Rao wrote: > From: Igor Mammedov >=20 > It returns a list of present/possible to hotplug CPU > objects with a list of properties to use with > device_add. >=20 > in spapr case returned list would looks like: > -> { "execute": "query-hotpluggable-cpus" } > <- {"return": [ > { "props": { "core": 8 }, "type": "POWER8-spapr-cpu-core", > "vcpus-count": 2 }, > { "props": { "core": 0 }, "type": "POWER8-spapr-cpu-core", > "vcpus-count": 2, > "qom-path": "/machine/unattached/device[0]"} > ]}' >=20 > TODO: > add 'node' property for core <-> numa node mapping >=20 > Signed-off-by: Igor Mammedov > Signed-off-by: Bharata B Rao > --- > hw/ppc/spapr.c | 34 ++++++++++++++++++++++++++++++++++ > 1 file changed, 34 insertions(+) >=20 > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c > index a8cd74d..ae95580 100644 > --- a/hw/ppc/spapr.c > +++ b/hw/ppc/spapr.c > @@ -66,6 +66,7 @@ > #include "hw/compat.h" > #include "qemu/cutils.h" > #include "hw/ppc/spapr_cpu_core.h" > +#include "qmp-commands.h" > =20 > #include > =20 > @@ -2391,6 +2392,38 @@ static unsigned spapr_cpu_index_to_socket_id(unsig= ned cpu_index) > return cpu_index / smp_threads / smp_cores; > } > =20 > +static HotpluggableCPUList *spapr_query_hotpluggable_cpus(MachineState *= machine) > +{ > + int i; > + HotpluggableCPUList *head =3D NULL; > + sPAPRMachineState *spapr =3D SPAPR_MACHINE(machine); > + int spapr_max_cores =3D max_cpus / smp_threads; > + int smt =3D kvmppc_smt_threads(); > + > + for (i =3D 0; i < spapr_max_cores; i++) { > + HotpluggableCPUList *list_item =3D g_new0(typeof(*list_item), 1); > + HotpluggableCPU *cpu_item =3D g_new0(typeof(*cpu_item), 1); > + CpuInstanceProperties *cpu_props =3D g_new0(typeof(*cpu_props), = 1); > + > + cpu_item->type =3D spapr_get_cpu_core_type(machine->cpu_model); > + cpu_item->vcpus_count =3D smp_threads; > + cpu_props->has_core =3D true; > + cpu_props->core =3D i * smt; I'm thinking we should probably use the existing vcpu_dt_id logic here, to make sure we don't change things if we ever alter that. > + /* TODO: add 'has_node/node' here to describe > + to which node core belongs */ > + > + cpu_item->props =3D cpu_props; > + if (spapr->cores[i]) { > + cpu_item->has_qom_path =3D true; > + cpu_item->qom_path =3D object_get_canonical_path(spapr->core= s[i]); > + } > + list_item->value =3D cpu_item; > + list_item->next =3D head; > + head =3D list_item; > + } > + return head; > +} > + > static void spapr_machine_class_init(ObjectClass *oc, void *data) > { > MachineClass *mc =3D MACHINE_CLASS(oc); > @@ -2421,6 +2454,7 @@ static void spapr_machine_class_init(ObjectClass *o= c, void *data) > hc->plug =3D spapr_machine_device_plug; > hc->unplug =3D spapr_machine_device_unplug; > mc->cpu_index_to_socket_id =3D spapr_cpu_index_to_socket_id; > + mc->query_hotpluggable_cpus =3D spapr_query_hotpluggable_cpus; > =20 > smc->dr_lmb_enabled =3D true; > smc->dr_cpu_enabled =3D true; --=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 --Qo8f1a4rgWw9S/zY Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJXVQwZAAoJEGw4ysog2bOS5mQP/jxsTa1r81jSJnHxYhe7b5J/ TE5doGq+quVFCFfHnwi+81+pTG4IVIlN7q0sGypo7JYo3zsnBocDJ+kKt2u9LhyP XrvXdA8nUVimfTRVYagQ9esuRmGDhUDiNDPzkPWYWip9dL0PgC3XiTcdV+toOQAB ngaZO5aixABcWpO5Oy6mq9Bj+aATNlSwef2pf7xGBHdb/wD07ivAYFybyUE5uv6H Zj2haGcA+22fyPAZhuew1Im68RNmFgP5sii0ZkiK631LZa342B2oailrB8b3R+yi 9O0dQ7XqYZ/ZfVg2TorzIXsIygKEmM86uHqVE/2QKGr3QMFXQqobn5koU7EUNuoW e+VgAQdjRwsU7QdrfHa4/zQ3k68FQwj42qNt0gLpN5xns2yhiipB6QSlGysNEVRo h0dW4wsMXSDjQPU+feZPRN1YmREEaRgogB9SUUYnXCdlrNAYtRdC1mZ452nbERhj +JCOkO8Oymi5kHE+da3w6w/Wru+JjNUOriOGXAT8gl5eEa40Tp7P9/ARaRJ+I5x3 e3uHaocpiWdqwNbuc8mccdFzou2jCb0LokOEQVrftJFuvgOMrtxXO+F7gTeHHgYS n+QHzaf5FziBBTSlb4f7uKq/AWj1EMZeEmai08UmiHQe6yn27BEtTYK0wvfYgRqP ZeBWWOnxJJncoR+XyOOK =B15f -----END PGP SIGNATURE----- --Qo8f1a4rgWw9S/zY--