From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40507) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UotPb-0001Qk-4J for qemu-devel@nongnu.org; Tue, 18 Jun 2013 06:45:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UotPU-0000LW-NU for qemu-devel@nongnu.org; Tue, 18 Jun 2013 06:45:19 -0400 Received: from mx1.redhat.com ([209.132.183.28]:4945) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UotPU-0000LK-Cv for qemu-devel@nongnu.org; Tue, 18 Jun 2013 06:45:12 -0400 Date: Tue, 18 Jun 2013 13:45:55 +0300 From: "Michael S. Tsirkin" Message-ID: <20130618104555.GC26536@redhat.com> References: <20130618102320.GC26066@redhat.com> <51C03959.2070100@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <51C03959.2070100@suse.de> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [RFC PATCH v1 0/7] QOM Super class access List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Andreas =?iso-8859-1?Q?F=E4rber?= Cc: peter.maydell@linaro.org, Peter Crosthwaite , qemu-devel@nongnu.org, aliguori@us.ibm.com, pbonzini@redhat.com, edgar.iglesias@gmail.com On Tue, Jun 18, 2013 at 12:41:29PM +0200, Andreas F=E4rber wrote: > Am 18.06.2013 12:23, schrieb Michael S. Tsirkin: > > On Tue, Jun 18, 2013 at 07:43:11PM +1000, peter.crosthwaite@xilinx.co= m wrote: > >> From: Peter Crosthwaite > >> > >> > >> This series enables QOM super class access and demostrates some usag= es. > >> Replaces the save->override->call via FooClass technique, to reduce > >> some of the boiler plate in recently fully QOMified devices. > >> > >> Applied the change to ARM CPU, MB CPU and some of Andreas's recently > >> QOMified i386 devices, all which have the save->override->call issue. > >> ARMCPU I've done a brief test on and seems to work. > >> > >> ARM CPU was particularly difficult, as it has 3 layers of heirachy, > >> where a non-concrete class (TYPE_ARM_CPU) need to super class itself > >> (to TYPE_CPU). This sees the need for super-classers to specify thei= r > >> expected base class level. See patches for illustration. > >> > >> The main future work to the series is to apply the change pattern to > >> the reset of the tree > >=20 > > Looks good to me overall. > > Some nits: > > - Super is an immediate parent in java and python. > > - One of the design points of QOM is that it let > > you ignore which class is a parent and which is a child. > > All casts look the same. > >=20 > > So, why do we need the new APIs with _SUPER? > > What's wrong with simple > > object_class_by_name() > > and casting to that? >=20 > I guess the idea was to avoid open-coding that multiple times, but I > think I would then prefer something more local like >=20 > #define ARM_CPU_SUPER_CLASS() \ > object_class_get_parent(object_class_by_name(TYPE_ARM_CPU)) s/SUPER_CLASS/PARENT_CLASS/ Super class also confusingly means "very good". > and then use >=20 > DEVICE_CLASS(ARM_CPU_SUPER_CLASS()) > or > CPU_CLASS(ARM_CPU_SUPER_CLASS()) >=20 > as needed. What do you think? >=20 > Andreas >=20 > --=20 > SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany > GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 16746 AG N=FCrn= berg