qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Andreas Färber" <afaerber@suse.de>
To: "Michael S. Tsirkin" <mst@redhat.com>,
	Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Cc: peter.maydell@linaro.org, edgar.iglesias@gmail.com,
	aliguori@us.ibm.com, qemu-devel@nongnu.org, pbonzini@redhat.com
Subject: Re: [Qemu-devel] [RFC PATCH v1 0/7]  QOM Super class access
Date: Tue, 18 Jun 2013 12:41:29 +0200	[thread overview]
Message-ID: <51C03959.2070100@suse.de> (raw)
In-Reply-To: <20130618102320.GC26066@redhat.com>

Am 18.06.2013 12:23, schrieb Michael S. Tsirkin:
> On Tue, Jun 18, 2013 at 07:43:11PM +1000, peter.crosthwaite@xilinx.com wrote:
>> From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
>>
>>
>> This series enables QOM super class access and demostrates some usages.
>> 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 their
>> 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
> 
> 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.
> 
> So, why do we need the new APIs with _SUPER?
> What's wrong with simple
> 	object_class_by_name()
> and casting to that?

I guess the idea was to avoid open-coding that multiple times, but I
think I would then prefer something more local like

#define ARM_CPU_SUPER_CLASS() \
  object_class_get_parent(object_class_by_name(TYPE_ARM_CPU))

and then use

DEVICE_CLASS(ARM_CPU_SUPER_CLASS())
or
CPU_CLASS(ARM_CPU_SUPER_CLASS())

as needed. What do you think?

Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

  parent reply	other threads:[~2013-06-18 10:41 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-18  9:43 [Qemu-devel] [RFC PATCH v1 0/7] QOM Super class access peter.crosthwaite
2013-06-18  9:44 ` [Qemu-devel] [RFC PATCH v1 1/7] target-arm/cpu.c: delete un-needed instance/class sizes peter.crosthwaite
2013-06-18  9:58   ` Andreas Färber
2013-06-18  9:44 ` [Qemu-devel] [RFC PATCH v1 2/7] qom: Add super class accessor peter.crosthwaite
2013-06-18  9:45 ` [Qemu-devel] [RFC PATCH v1 3/7] qdev-core: Introduce DEVICE super class cast macros peter.crosthwaite
2013-06-18 10:12   ` Michael S. Tsirkin
2013-06-18  9:46 ` [Qemu-devel] [RFC PATCH v1 4/7] qom/cpu: Introduce CPU " peter.crosthwaite
2013-06-18  9:47 ` [Qemu-devel] [RFC PATCH v1 5/7] target-arm: Remove ARMCPUClass peter.crosthwaite
2013-06-18  9:47 ` [Qemu-devel] [RFC PATCH v1 6/7] target-microblaze: Remove MicroblazeCPUClass peter.crosthwaite
2013-06-18  9:48 ` [Qemu-devel] [RFC PATCH v1 7/7] i8254: Remove [KVM]PITClass peter.crosthwaite
2013-06-18 10:12 ` [Qemu-devel] [RFC PATCH v1 0/7] QOM Super class access Andreas Färber
2013-06-18 10:20   ` Peter Crosthwaite
2013-06-18 10:23 ` Michael S. Tsirkin
2013-06-18 10:35   ` Peter Crosthwaite
2013-06-18 10:39     ` Michael S. Tsirkin
2013-06-18 10:44       ` Peter Crosthwaite
2013-06-18 10:48         ` Michael S. Tsirkin
2013-06-18 10:45       ` Andreas Färber
2013-06-18 10:41   ` Andreas Färber [this message]
2013-06-18 10:45     ` Michael S. Tsirkin
2013-06-19  1:44     ` Hu Tao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51C03959.2070100@suse.de \
    --to=afaerber@suse.de \
    --cc=aliguori@us.ibm.com \
    --cc=edgar.iglesias@gmail.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.crosthwaite@xilinx.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).