From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:54516) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S7QbR-00052P-2P for qemu-devel@nongnu.org; Tue, 13 Mar 2012 08:13:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S7QbO-0007ON-Sb for qemu-devel@nongnu.org; Tue, 13 Mar 2012 08:13:20 -0400 Received: from cantor2.suse.de ([195.135.220.15]:60948 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S7QbO-0007OF-JB for qemu-devel@nongnu.org; Tue, 13 Mar 2012 08:13:18 -0400 Message-ID: <4F5F39DD.5040308@suse.de> Date: Tue, 13 Mar 2012 13:13:17 +0100 From: =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= MIME-Version: 1.0 References: <1330893156-26569-1-git-send-email-afaerber@suse.de> <1331346496-10736-1-git-send-email-afaerber@suse.de> <1331346496-10736-45-git-send-email-afaerber@suse.de> <4F5DC41F.10903@redhat.com> In-Reply-To: <4F5DC41F.10903@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH RFC v4 44/44] qom: Introduce CPU class List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Igor Mammedov Cc: Paolo Bonzini , qemu-devel@nongnu.org, Anthony Liguori Am 12.03.2012 10:38, schrieb Igor Mammedov: > On 03/10/2012 03:28 AM, Andreas F=C3=A4rber wrote: >> Reintroduce CPUState as QOM object: It's abstract and derived directly >> from TYPE_OBJECT for compatibility with the user emulators. >> The identifier CPUState avoids conflicts between CPU() and the struct. >> >> Introduce $(qom-twice-y) to build it separately for system and for use= r >> emulators. >> >> Prepare a virtual reset method, (re)introduce cpu_reset() as wrapper. >> >> Signed-off-by: Andreas F=C3=A4rber >> Cc: Anthony Liguori >> --- >> Makefile.objs | 3 ++ >> configure | 1 + >> include/qemu/cpu.h | 75 >> ++++++++++++++++++++++++++++++++++++++++++++++++++++ >> qom/Makefile | 1 + >> qom/cpu.c | 58 ++++++++++++++++++++++++++++++++++++++++ >> 5 files changed, 138 insertions(+), 0 deletions(-) >> create mode 100644 include/qemu/cpu.h >> create mode 100644 qom/cpu.c >> diff --git a/include/qemu/cpu.h b/include/qemu/cpu.h >> new file mode 100644 >> index 0000000..4291279 >> --- /dev/null >> +++ b/include/qemu/cpu.h >> +/** >> + * CPUClass: >> + * @reset: Callback to reset the #CPU to its initial state. >> + * >> + * Represents a CPU family or model. >> + */ >> +typedef struct CPUClass { >> + /*< private>*/ >> + ObjectClass parent_class; >> + /*< public>*/ >> + >> + void (*reset)(CPUState *cpu); > Why not use Object* as argument here? In SysBusDeviceClass etc. we use the specific object type, too. Obviously my CPU is the first "new" QOM type, so we can go different ways if we want to. As long as it's a CPU-specific mechanism, using the specific type avoids some casts. > It will be easier to generalize later qdev code and not make special > case when > adding cpus. I never heard anyone wanting to generalize reset so far. I don't think it belongs into Object at least. Maybe DeviceState. Anthony? Paolo? > BTW how we are going to generalize qdev and make its infrastructure > available > to other types except of DEVICE_TYPE. > Maybe we should introduce some (abstract) base class (or interface) for > basic > device that will define methods like reset, realize, unrealize and use > it in > qdev code instead of DEVICE_TYPE? I thought Anthony wanted to do realize/unrealize and "realized" property in Object. For SH4 I worked around that with my own sh7750_realize() function. This series is taking much too long to move forward (the QOM "steam" seems to be gone?) and I'm worried that introducing much more basic infrastructure will make review and applying even slower, cf. object_class_foreach_ordered()/_get_list(). Thanks for reviewing so far, Andreas --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=C3=BCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=C3=B6rffer; HRB 16746 AG N=C3=BC= rnberg