Received: from eggs.gnu.org ([2001:4830:134:3::10]:48153) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1apTqm-0007lD-FH for qemu-devel@nongnu.org; Mon, 11 Apr 2016 00:53:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1apTqg-0003SC-P1 for qemu-devel@nongnu.org; Mon, 11 Apr 2016 00:53:24 -0400 Date: Mon, 11 Apr 2016 14:54:24 +1000 From: David Gibson Message-ID: <20160411145424.0f3f0c58@voom.fritz.box> In-Reply-To: <1460114996-236486-3-git-send-email-imammedo@redhat.com> References: <1460114996-236486-1-git-send-email-imammedo@redhat.com> <1460114996-236486-3-git-send-email-imammedo@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; boundary="Sig_/6FVVmcfD0Yl_26Be1niZS7t"; protocol="application/pgp-signature" Subject: Re: [Qemu-devel] [PATCH for-2.7 v6 2/2] spapr: implement query-hotpluggable-cpus callback List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Igor Mammedov Cc: qemu-devel@nongnu.org, mjrosato@linux.vnet.ibm.com, thuth@redhat.com, pkrempa@redhat.com, ehabkost@redhat.com, aik@ozlabs.ru, armbru@redhat.com, agraf@suse.de, borntraeger@de.ibm.com, qemu-ppc@nongnu.org, bharata@linux.vnet.ibm.com, pbonzini@redhat.com, mdroth@linux.vnet.ibm.com, afaerber@suse.de --Sig_/6FVVmcfD0Yl_26Be1niZS7t Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Fri, 8 Apr 2016 13:29:56 +0200 Igor Mammedov wrote: > 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" } =20 > <- {"return": [ > { "props": { "core": 1 }, "type": "spapr-cpu-core", > "vcpus-count": 2 }, > { "props": { "core": 0 }, "type": "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 > --- > it's only compile tested > v2: > - s/qmp_query_hotpluggable_cpus/MachineClass->query_hotpluggable_cpus/ c= allback > --- > hw/ppc/spapr.c | 33 +++++++++++++++++++++++++++++++++ > 1 file changed, 33 insertions(+) >=20 > diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c > index 760a42f..c38995e 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 > @@ -2382,6 +2383,37 @@ 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; > + > + 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 g_strdup(TYPE_SPAPR_CPU_CORE); So, Bharata's latest core stuff is (as suggested by you and others) moving to using different derived types, rather than a cpu_model property, so this will need to change a bit. > + cpu_item->vcpus_count =3D smp_threads; > + cpu_props->has_core =3D true; > + cpu_props->core =3D i; > + /* 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); > @@ -2412,6 +2444,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 > 1.8.3.1 >=20 --=20 David Gibson Senior Software Engineer, Virtualization, Red Hat --Sig_/6FVVmcfD0Yl_26Be1niZS7t Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJXCy4AAAoJEGw4ysog2bOSmysP/jDkwIx+aQXRidKqU0KIeK2g Dii2V+gHXFx00IYYgZwnPLOd3EQiHgrA35HOI0M+tb2UewTvFy8bUyv8qggZBFbb 8BB2JRIV1YF0GT5RCZR3x1hOKlTU5fZjc81NTlO8CdydtKSuV+XYjIG3MmlxTLyo /tWZx+PGRNFDbeKbUHScvLymNN+psBUGPLpFDnKGMPOUJqJ2HOmxIm2p8B/Vb852 v9PDhrSYIswqOXW2WYfkOrAzUr3y1PAOIPWPxc+bvSANzvvvjoQ5Eq6NmAjOEhJn z8umA/R9Pdu5lZPsGF7lYOMPlDlqxo9g8QArAcURhhGndm0uD6NHYXnqnaHx4HYP fdaNjZDyAaIIxIUVFAS7keJStrYf+809QNNw65epJRHI52YdHI7GTT9wqjnvKhWv XtdNuY5WFsTbmkPYfKQbsVlQcqz60qYHX8JktYuzZ/nInvoP4uFJ9LPMAyf64gue TMKJHfgnrTQpGu9hALbjRkBwnCWBDeLYkkEX/O+wFuyQq3X/P4nDzoEOFZslGLnr fWlktdvNYI7DBx+A+d9X4UsCRU9ExyO+VqTTV0DCcu36HRp7zvbZF17XYLfXQHuE 5xb0eAjyDGv+CfycAoBBBO7K4gu7zXmvqANGQYixPJ4e6SV4/ZARkBODEjvn0Ajg tsCAhDHv3y5W7vrcF06o =TdpN -----END PGP SIGNATURE----- --Sig_/6FVVmcfD0Yl_26Be1niZS7t--