qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v3] apic: bump emulated lapic version to 0x14 on


From: Don Slutz
Subject: Re: [Qemu-devel] [PATCH v3] apic: bump emulated lapic version to 0x14 on pc machines >= 2.1
Date: Thu, 01 May 2014 17:43:23 -0400
User-agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0

On 05/01/14 14:52, Alexander Graf wrote:

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 :).



It looks like

http://permalink.gmane.org/gmane.comp.emulators.qemu/268337

(which is a reply to a change I am working on that is in the same place)

Hope this helps.
    -Don Slutz

Alex






reply via email to

[Prev in Thread] Current Thread [Next in Thread]