From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:56188) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TgGGq-0003mV-SL for qemu-devel@nongnu.org; Wed, 05 Dec 2012 09:48:25 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TgGGk-0000Dv-Qo for qemu-devel@nongnu.org; Wed, 05 Dec 2012 09:48:20 -0500 Received: from cantor2.suse.de ([195.135.220.15]:44398 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TgGGk-0000Dq-GM for qemu-devel@nongnu.org; Wed, 05 Dec 2012 09:48:14 -0500 Message-ID: <50BF5EAA.1070500@suse.de> Date: Wed, 05 Dec 2012 15:48:10 +0100 From: =?ISO-8859-15?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <1354627180-25704-1-git-send-email-ehabkost@redhat.com> <1354627180-25704-9-git-send-email-ehabkost@redhat.com> In-Reply-To: <1354627180-25704-9-git-send-email-ehabkost@redhat.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [RFC 8/8] qom: make CPU a child of DeviceState List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eduardo Habkost Cc: Igor Mammedov , qemu-devel@nongnu.org, Anthony Liguori , Paolo Bonzini Am 04.12.2012 14:19, schrieb Eduardo Habkost: > From: Igor Mammedov >=20 > Signed-off-by: Igor Mammedov > [ehabkost: change CPU type declaration to hae TYPE_DEVICE as parent] > Signed-off-by: Eduardo Habkost > --- > Yes, there is "changelog" data before the "---" mark, but I believe tha= t > in this case they are important to indicate authorship and the scope of > the Signed-off-by lines (so they need to get into the git commit > message). > --- > include/qemu/cpu.h | 6 +++--- > qom/cpu.c | 3 ++- > 2 files changed, 5 insertions(+), 4 deletions(-) >=20 > diff --git a/include/qemu/cpu.h b/include/qemu/cpu.h > index 61b7698..bc004fd 100644 > --- a/include/qemu/cpu.h > +++ b/include/qemu/cpu.h > @@ -20,7 +20,7 @@ > #ifndef QEMU_CPU_H > #define QEMU_CPU_H > =20 > -#include "qemu/object.h" > +#include "hw/qdev-core.h" > #include "qemu-thread.h" > =20 > /** > @@ -46,7 +46,7 @@ typedef struct CPUState CPUState; > */ > typedef struct CPUClass { > /*< private >*/ > - ObjectClass parent_class; > + DeviceClass parent_class; > /*< public >*/ > =20 > void (*reset)(CPUState *cpu); > @@ -62,7 +62,7 @@ typedef struct CPUClass { > */ > struct CPUState { > /*< private >*/ > - Object parent_obj; > + DeviceState parent_obj; > /*< public >*/ > =20 > struct QemuThread *thread; > diff --git a/qom/cpu.c b/qom/cpu.c > index 5b36046..f59db7d 100644 > --- a/qom/cpu.c > +++ b/qom/cpu.c > @@ -20,6 +20,7 @@ > =20 > #include "qemu/cpu.h" > #include "qemu-common.h" > +#include "hw/qdev-core.h" > =20 > void cpu_reset(CPUState *cpu) > { > @@ -43,7 +44,7 @@ static void cpu_class_init(ObjectClass *klass, void *= data) > =20 > static TypeInfo cpu_type_info =3D { > .name =3D TYPE_CPU, > - .parent =3D TYPE_OBJECT, > + .parent =3D TYPE_DEVICE, > .instance_size =3D sizeof(CPUState), > .abstract =3D true, > .class_size =3D sizeof(CPUClass), This makes the CPU a device, allowing the user to specify it with -device. My preference would be to disable that at first[1] by setting DeviceClass::no_user =3D 1. Have you tested what happens if someone tries to hotplug a CPU device? It may be the first device without bus... [1] Anthony's and my idea was to handle hotplug at a higher level than CPUState - X86Socket containing X86Core containing X86Thread or so. This would require me (or someone) to refactor CPU_COMMON's numa_node (also used in sPAPR), nr_cores, nr_threads (also used in mips/Malta) - in a non-trivial way. We may need to go from CPU*State to CPUState (possible so far) to Core to Socket, for which object_get_parent() would be helpful. So far Object::parent is declared private. Are we targetting to do this is two steps, using CPUState at first? Or has one of you been investigating how involved this redesign would be? Regards, Andreas --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 16746 AG N=FCrnbe= rg