From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57281) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZhZig-0001n8-La for qemu-devel@nongnu.org; Thu, 01 Oct 2015 05:00:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZhZid-0002l4-DR for qemu-devel@nongnu.org; Thu, 01 Oct 2015 05:00:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:42041) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZhZic-0002ii-Ul for qemu-devel@nongnu.org; Thu, 01 Oct 2015 05:00:03 -0400 From: Markus Armbruster Date: Thu, 1 Oct 2015 10:59:52 +0200 Message-Id: <1443689999-12182-4-git-send-email-armbru@redhat.com> In-Reply-To: <1443689999-12182-1-git-send-email-armbru@redhat.com> References: <1443689999-12182-1-git-send-email-armbru@redhat.com> Subject: [Qemu-devel] [PATCH v5 03/10] macio: move DBDMA_init from instance_init to realize List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: thuth@redhat.com, ehabkost@redhat.com, stefanha@redhat.com, pbonzini@redhat.com, afaerber@suse.de From: Paolo Bonzini 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 Message-Id: <1443530263-32340-4-git-send-email-pbonzini@redhat.com> Reviewed-by: Thomas Huth Signed-off-by: Markus Armbruster --- 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 = { -- 2.4.3