From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35441) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YaxFf-0006v0-0O for qemu-devel@nongnu.org; Wed, 25 Mar 2015 22:10:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YaxFP-0003a7-TY for qemu-devel@nongnu.org; Wed, 25 Mar 2015 22:10:30 -0400 Date: Thu, 26 Mar 2015 12:54:02 +1100 From: David Gibson Message-ID: <20150326015402.GM28039@voom.redhat.com> References: <1427117764-23008-1-git-send-email-bharata@linux.vnet.ibm.com> <1427117764-23008-12-git-send-email-bharata@linux.vnet.ibm.com> <20150325023902.GV25043@voom.fritz.box> <20150325083310.GC32581@in.ibm.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="RNRUMt0ZF5Yaq/Aq" Content-Disposition: inline In-Reply-To: <20150325083310.GC32581@in.ibm.com> Subject: Re: [Qemu-devel] [RFC PATCH v2 11/23] ppc: Create sockets and cores for CPUs List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Bharata B Rao Cc: mdroth@linux.vnet.ibm.com, agraf@suse.de, qemu-devel@nongnu.org, qemu-ppc@nongnu.org, tyreld@linux.vnet.ibm.com, nfont@linux.vnet.ibm.com, imammedo@redhat.com, afaerber@suse.de --RNRUMt0ZF5Yaq/Aq Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Mar 25, 2015 at 02:03:10PM +0530, Bharata B Rao wrote: > On Wed, Mar 25, 2015 at 01:39:02PM +1100, David Gibson wrote: > > On Mon, Mar 23, 2015 at 07:05:52PM +0530, Bharata B Rao wrote: > > > ppc machine init functions create individual CPU threads. Change this > > > for sPAPR by switching to socket creation. CPUs are created recursive= ly > > > by socket and core instance init routines. > > >=20 > > > TODO: Switching to socket level CPU creation is done only for sPAPR > > > target now. > > >=20 > > > Signed-off-by: Bharata B Rao > > > --- > > > hw/ppc/cpu-core.c | 17 +++++++++++++++++ > > > hw/ppc/cpu-socket.c | 15 +++++++++++++++ > > > hw/ppc/spapr.c | 15 ++++++++------- > > > target-ppc/cpu.h | 1 + > > > target-ppc/translate_init.c | 46 +++++++++++++++++++++++++++++++++++= ++++++++++ > > > 5 files changed, 87 insertions(+), 7 deletions(-) > > >=20 > > > diff --git a/hw/ppc/cpu-core.c b/hw/ppc/cpu-core.c > > > index ed0481f..f60646d 100644 > > > --- a/hw/ppc/cpu-core.c > > > +++ b/hw/ppc/cpu-core.c > > > @@ -7,6 +7,8 @@ > > > =20 > > > #include "hw/qdev.h" > > > #include "hw/ppc/cpu-core.h" > > > +#include "hw/boards.h" > > > +#include > > > =20 > > > static int ppc_cpu_core_realize_child(Object *child, void *opaque) > > > { > > > @@ -32,10 +34,25 @@ static void ppc_cpu_core_class_init(ObjectClass *= oc, void *data) > > > dc->realize =3D ppc_cpu_core_realize; > > > } > > > =20 > > > +static void ppc_cpu_core_instance_init(Object *obj) > > > +{ > > > + int i; > > > + PowerPCCPU *cpu =3D NULL; > > > + MachineState *machine =3D MACHINE(qdev_get_machine()); > > > + > > > + for (i =3D 0; i < smp_threads; i++) { > > > + cpu =3D POWERPC_CPU(cpu_ppc_create(TYPE_POWERPC_CPU, machine= ->cpu_model)); > > > + object_property_add_child(obj, "thread[*]", OBJECT(cpu), &er= ror_abort); > > > + object_unref(OBJECT(cpu)); > > > + } > > > +} > > > + > > > static const TypeInfo ppc_cpu_core_type_info =3D { > > > .name =3D TYPE_POWERPC_CPU_CORE, > > > .parent =3D TYPE_DEVICE, > > > .class_init =3D ppc_cpu_core_class_init, > > > + .instance_init =3D ppc_cpu_core_instance_init, > > > + .instance_size =3D sizeof(PowerPCCPUCore), > >=20 > > The PowerPCCPUCore structure isn't defined in this patch (I assume it > > already existed), which suggests that setting the instance_size should > > have already been in an earlier patch. >=20 > PowerPCCPUCore is already defined, but I put the instance_size here > since I needed instance_init only here. I thought it is better to > have instance_init and instance_size populated together. Hm, yes, it does make sense to declare instance_init and instance_size together. It also makes sense to declare instance_size and the associated type together. Maybe folding this together with patch 8/23 would make sense? > > > }; > > > =20 > > > static void ppc_cpu_core_register_types(void) > > > diff --git a/hw/ppc/cpu-socket.c b/hw/ppc/cpu-socket.c > > > index 602a060..f901336 100644 > > > --- a/hw/ppc/cpu-socket.c > > > +++ b/hw/ppc/cpu-socket.c > > > @@ -8,6 +8,7 @@ > > > #include "hw/qdev.h" > > > #include "hw/ppc/cpu-socket.h" > > > #include "sysemu/cpus.h" > > > +#include "cpu.h" > > > =20 > > > static int ppc_cpu_socket_realize_child(Object *child, void *opaque) > > > { > > > @@ -33,10 +34,24 @@ static void ppc_cpu_socket_class_init(ObjectClass= *oc, void *data) > > > dc->realize =3D ppc_cpu_socket_realize; > > > } > > > =20 > > > +static void ppc_cpu_socket_instance_init(Object *obj) > > > +{ > > > + int i; > > > + Object *core; > > > + > > > + for (i =3D 0; i < smp_cores; i++) { > > > + core =3D object_new(TYPE_POWERPC_CPU_CORE); > > > + object_property_add_child(obj, "core[*]", core, &error_abort= ); > > > + object_unref(core); > > > + } > > > +} > > > + > > > static const TypeInfo ppc_cpu_socket_type_info =3D { > > > .name =3D TYPE_POWERPC_CPU_SOCKET, > > > .parent =3D TYPE_CPU_SOCKET, > > > .class_init =3D ppc_cpu_socket_class_init, > > > + .instance_init =3D ppc_cpu_socket_instance_init, > > > + .instance_size =3D sizeof(PowerPCCPUSocket), > >=20 > > Likewise for PowerPCCPUSocket. > > > =20 > > > +/* > > > + * This is essentially same as cpu_generic_init() but without a set > > > + * realize call. > > > + */ > >=20 > > In which case it would probably make more sense to have this be a > > generic function, and implement cpu_generic_init() in terms of it. >=20 > Actually multiple people are touching that part of the code, I so I > figured it will be a bit easier for now to contain the changes within ppc. > But yes, eventually we should do what you are suggesting. Ok. --=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 --RNRUMt0ZF5Yaq/Aq Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJVE2a6AAoJEGw4ysog2bOSye4QAJ+WX5qYjlzrCovzDynEn4Yf EHAKIW58F0zV0D9nH92/G1ufB8WDHXaU85LTQOtlsITYqSZ0LOT5YPk5+nosRN+z GEdx9R0SoFV6Sw3QFHFktkOjH3hG09xfdgHsQoEzL3oc9MwJWZIgpg5nEqDrp2YD yzld3t9osUPJe7yzcqkx80Eidn5pErAr1uCpPXOxt3v4zkRSZCYBXSZp0ANQxK4a xXPtusuoGPFKyBt6ATAZnxye6VkX3ZMCZb75SNHQJNngwmj91jf276ee+qcOty25 5aV6Pnq0Tmtdu7mu/A7lsMnkOi/pXiA4uel8iuGjN6KuAZ2hwwRF6scQRM2zIBUf Xdy9T1q4y9GghPN7ZeWqF3OcQ5//SFyNQn9wN1F/dBQy2CFUNu5rniGhTu3Q+fAB NJlAAPgodZWQyp+6mVxJP3sVfGvIdGB9GWVA+cRdb5wVbOFxNOTZKFJPaCIE0zw6 7uo6FPatrUrvJtkVCDdUpNT4OSltKy7i3cQUMdA1UCEFV+hwJHJH7F6OTI2EGMRM 6KEHEmoOSifnFtWsrex5KsIEIIYrmvia31h3pb2kUtsL7CW4qrOp2gggCFCHxXD4 Fe6ZJY0VY3JHnumLvqlmohNB795fo7mtxFYi2aXEKdgtpL5uI9Xf/8//VEeYr4EJ idVYoUVuh+caFI5Y8u4y =ql0d -----END PGP SIGNATURE----- --RNRUMt0ZF5Yaq/Aq--