From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48383) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZhCpD-0005bC-TG for qemu-devel@nongnu.org; Wed, 30 Sep 2015 04:33:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZhCpB-0007sW-6N for qemu-devel@nongnu.org; Wed, 30 Sep 2015 04:33:19 -0400 References: <1443530263-32340-1-git-send-email-pbonzini@redhat.com> <1443530263-32340-4-git-send-email-pbonzini@redhat.com> From: Thomas Huth Message-ID: <560B9E48.4000208@redhat.com> Date: Wed, 30 Sep 2015 10:33:12 +0200 MIME-Version: 1.0 In-Reply-To: <1443530263-32340-4-git-send-email-pbonzini@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 3/3] macio: move DBDMA_init from instance_init to realize List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini , qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, mark.cave-ayland@ilande.co.uk, agraf@suse.de, armbru@redhat.com, blauwirbel@gmail.com, qemu-ppc@nongnu.org On 29/09/15 14:37, Paolo Bonzini wrote: > DBDMA_init is not idempotent, and calling it from instance_init > breaks a simple object_new/object_unref pair. Work around this, > pending qdev-ification of DBDMA, by moving the call to realize. > > Reported-by: Markus Armbruster > Signed-off-by: Paolo Bonzini > --- > hw/misc/macio/macio.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/hw/misc/macio/macio.c b/hw/misc/macio/macio.c > index 2548d96..c661f86 100644 > --- a/hw/misc/macio/macio.c > +++ b/hw/misc/macio/macio.c > @@ -131,6 +131,10 @@ static void macio_common_realize(PCIDevice *d, Error **errp) > MacIOState *s = MACIO(d); > SysBusDevice *sysbus_dev; > Error *err = NULL; > + MemoryRegion *dbdma_mem; > + > + s->dbdma = DBDMA_init(&dbdma_mem); > + memory_region_add_subregion(&s->bar, 0x08000, dbdma_mem); > > object_property_set_bool(OBJECT(&s->cuda), true, "realized", &err); > if (err) { > @@ -328,16 +332,12 @@ static void macio_newworld_init(Object *obj) > static void macio_instance_init(Object *obj) > { > MacIOState *s = MACIO(obj); > - MemoryRegion *dbdma_mem; > > memory_region_init(&s->bar, obj, "macio", 0x80000); > > object_initialize(&s->cuda, sizeof(s->cuda), TYPE_CUDA); > qdev_set_parent_bus(DEVICE(&s->cuda), sysbus_get_default()); > object_property_add_child(obj, "cuda", OBJECT(&s->cuda), NULL); > - > - s->dbdma = DBDMA_init(&dbdma_mem); > - memory_region_add_subregion(&s->bar, 0x08000, dbdma_mem); > } > > static const VMStateDescription vmstate_macio_oldworld = { Reviewed-by: Thomas Huth