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: Gabriel L. Somlo
Subject: Re: [Qemu-devel] [PATCH v3] apic: bump emulated lapic version to 0x14 on pc machines >= 2.1
Date: Thu, 1 May 2014 13:22:27 -0400
User-agent: Mutt/1.5.21 (2010-09-15)

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;" ?

I'll keep digging, but in case anyone more experienced can tell us
why this WON'T work, I'd appreciate being put out of my misery and
allowed to go back to using the global :) :)

Thanks,
--Gabriel



reply via email to

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