qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Graf <agraf@suse.de>
To: "Gabriel L. Somlo" <gsomlo@gmail.com>
Cc: pbonzini@redhat.com, qemu-devel@nongnu.org, afaerber@suse.de,
	mst@redhat.com
Subject: Re: [Qemu-devel] [PATCH v3] apic: bump emulated lapic version to 0x14 on pc machines >= 2.1
Date: Thu, 01 May 2014 20:52:32 +0200	[thread overview]
Message-ID: <536297F0.6050702@suse.de> (raw)
In-Reply-To: <20140501172226.GC16023@ERROL.INI.CMU.EDU>


On 01.05.14 19:22, Gabriel L. Somlo wrote:
> On Wed, Apr 30, 2014 at 09:44:32PM +0200, Alexander Graf wrote:
>>> diff --git a/hw/intc/apic.c b/hw/intc/apic.c
>>> index 2f40cba..4480bc4 100644
>>> --- a/hw/intc/apic.c
>>> +++ b/hw/intc/apic.c
>>> @@ -32,6 +32,8 @@
>>>   #define SYNC_TO_VAPIC                   0x2
>>>   #define SYNC_ISR_IRR_TO_VAPIC           0x4
>>> +uint8_t apic_version = 0x14;
>> Is there any way to make this a qdev/qom device property rather than
>> a global?
> If there is, and anyone with a better understanding of qom/qdev
> has an example I could follow, that would be much appreciated!
>
> As far as I could comprehend it since I started looking at it last
> night, the apic_class_init() functions run before pci_init() in
> pc_[q35|piix].c knows which machine type we have, but the
> apic_realize() functions (which appear to be the actual apic
> "constructors") run after that.
>
> The obvious alternative to having one global apic version would be
> to add a field to APICCommonClass or APICCommonState, and then somehow
> modify the default (set in apic_class_init()) from pci_init()
> according to the machine version; After that, each apic may refer to
> its private data member "version" when needed.
>
> So, is qom/qdev basically boiling down to a set of macros that can
> translate something like "qom_set_property(apic_instance, version, 0x14);"
> into "apic_instance.version = 0x14;" ?

With qdev we basically had an array of constructor parameters in the 
qdev definition. You could set these from the outside between create and 
init, basically:

   dev = dev_create()
   set_prop(dev, "foo", bar);
   dev_init(dev)

which semantically translated to

   dev = new dev(foo = bar);

The way to do this with QOM is similar, but I keep forgetting the 
details. I'm sure you'll easily find out :).


Alex

  reply	other threads:[~2014-05-01 18:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20140430194108.GB16023@ERROL.INI.CMU.EDU>
     [not found] ` <536152A0.6010104@suse.de>
2014-05-01 17:22   ` [Qemu-devel] [PATCH v3] apic: bump emulated lapic version to 0x14 on pc machines >= 2.1 Gabriel L. Somlo
2014-05-01 18:52     ` Alexander Graf [this message]
2014-05-01 21:43       ` Don Slutz
2014-05-02 14:23         ` Gabriel L. Somlo
2014-05-02 14:26           ` Paolo Bonzini
2014-05-02 17:13             ` Gabriel L. Somlo

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=536297F0.6050702@suse.de \
    --to=agraf@suse.de \
    --cc=afaerber@suse.de \
    --cc=gsomlo@gmail.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --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).