From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36580) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WfylU-00030E-Qz for qemu-devel@nongnu.org; Thu, 01 May 2014 17:43:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WfylP-0004jT-6J for qemu-devel@nongnu.org; Thu, 01 May 2014 17:43:36 -0400 Received: from fldsmtpe04.verizon.com ([140.108.26.143]:46422) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WfylO-0004jF-VD for qemu-devel@nongnu.org; Thu, 01 May 2014 17:43:31 -0400 From: Don Slutz Message-ID: <5362BFFB.8090809@terremark.com> Date: Thu, 01 May 2014 17:43:23 -0400 MIME-Version: 1.0 References: <20140430194108.GB16023@ERROL.INI.CMU.EDU> <536152A0.6010104@suse.de> <20140501172226.GC16023@ERROL.INI.CMU.EDU> <536297F0.6050702@suse.de> In-Reply-To: <536297F0.6050702@suse.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v3] apic: bump emulated lapic version to 0x14 on pc machines >= 2.1 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexander Graf , "Gabriel L. Somlo" Cc: pbonzini@redhat.com, mst@redhat.com, qemu-devel@nongnu.org, afaerber@suse.de 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 > >