From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50954) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VCFbH-0001br-Cd for qemu-devel@nongnu.org; Wed, 21 Aug 2013 17:06:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VCFbC-0002wl-GX for qemu-devel@nongnu.org; Wed, 21 Aug 2013 17:05:55 -0400 Received: from mail-lb0-f174.google.com ([209.85.217.174]:60507) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VCFbC-0002wf-98 for qemu-devel@nongnu.org; Wed, 21 Aug 2013 17:05:50 -0400 Received: by mail-lb0-f174.google.com with SMTP id w20so1043783lbh.33 for ; Wed, 21 Aug 2013 14:05:49 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <1377012076-7035-12-git-send-email-afaerber@suse.de> References: <1377012076-7035-1-git-send-email-afaerber@suse.de> <1377012076-7035-12-git-send-email-afaerber@suse.de> From: Peter Maydell Date: Wed, 21 Aug 2013 22:05:29 +0100 Message-ID: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v3 11/24] cpu/a15mpcore: Embed GICState List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?Q?Andreas_F=C3=A4rber?= Cc: =?UTF-8?Q?Andreas_F=C3=A4rber?= , QEMU Developers , Paul Brook On 20 August 2013 16:21, Andreas F=C3=A4rber wrote: > From: Andreas F=C3=A4rber > > This covers both emulated and KVM GIC. > @@ -35,40 +36,48 @@ typedef struct A15MPPrivState { > uint32_t num_cpu; > uint32_t num_irq; > MemoryRegion container; > - DeviceState *gic; > + > + GICState gic; > } A15MPPrivState; > static void a15mp_priv_initfn(Object *obj) > { > SysBusDevice *sbd =3D SYS_BUS_DEVICE(obj); > A15MPPrivState *s =3D A15MPCORE_PRIV(obj); > + DeviceState *gicdev; > + const char *gictype =3D "arm_gic"; > + > + if (kvm_irqchip_in_kernel()) { > + gictype =3D "kvm-arm-gic"; > + } > > memory_region_init(&s->container, obj, "a15mp-priv-container", 0x800= 0); > sysbus_init_mmio(sbd, &s->container); > + > + object_initialize(&s->gic, gictype); > + gicdev =3D DEVICE(&s->gic); > + qdev_set_parent_bus(gicdev, sysbus_get_default()); > + qdev_prop_set_uint32(gicdev, "revision", 2); So this is basically assuming that kvm-arm-gic and arm-gic both have an instance struct of exactly the same size, even though they're different classes (they happen to be so at the moment, because neither adds extra state beyond that needed by common base class). Is that really a good idea? (If it ever becomes not true we get silent memory corruption here...) -- PMM