qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Cc: Paolo Bonzini <pbonzini@redhat.com>
Subject: [Qemu-devel] [PULL v2 04/11] macio: move DBDMA_init from instance_init to realize
Date: Thu,  8 Oct 2015 15:02:04 +0200	[thread overview]
Message-ID: <1444309331-17927-5-git-send-email-armbru@redhat.com> (raw)
In-Reply-To: <1444309331-17927-1-git-send-email-armbru@redhat.com>

From: Paolo Bonzini <pbonzini@redhat.com>

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 <armbru@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <1443689999-12182-4-git-send-email-armbru@redhat.com>
---
 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

  parent reply	other threads:[~2015-10-08 13:02 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-08 13:02 [Qemu-devel] [PULL v2 00/11] Fix device introspection regressions Markus Armbruster
2015-10-08 13:02 ` [Qemu-devel] [PULL v2 01/11] virtio-input: Fix device introspection on non-Linux hosts Markus Armbruster
2015-10-08 13:02 ` [Qemu-devel] [PULL v2 02/11] memory: allow destroying a non-empty MemoryRegion Markus Armbruster
2015-10-08 13:02 ` [Qemu-devel] [PULL v2 03/11] hw: do not pass NULL to memory_region_init from instance_init Markus Armbruster
2015-10-08 13:02 ` Markus Armbruster [this message]
2015-10-08 13:02 ` [Qemu-devel] [PULL v2 05/11] tests: Fix how qom-test is run Markus Armbruster
2015-10-08 13:02 ` [Qemu-devel] [PULL v2 06/11] libqtest: Clean up unused QTestState member sigact_old Markus Armbruster
2015-10-08 13:02 ` [Qemu-devel] [PULL v2 07/11] libqtest: New hmp() & friends Markus Armbruster
2015-10-08 13:02 ` [Qemu-devel] [PULL v2 08/11] device-introspect-test: New, covering device introspection Markus Armbruster
2015-10-08 13:02 ` [Qemu-devel] [PULL v2 09/11] qmp: Fix device-list-properties not to crash for abstract device Markus Armbruster
2015-10-08 13:02 ` [Qemu-devel] [PULL v2 10/11] qdev: Protect device-list-properties against broken devices Markus Armbruster
2015-10-08 13:02 ` [Qemu-devel] [PULL v2 11/11] Revert "qdev: Use qdev_get_device_class() for -device <type>, help" Markus Armbruster
2015-10-08 14:33 ` [Qemu-devel] [PULL v2 00/11] Fix device introspection regressions Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1444309331-17927-5-git-send-email-armbru@redhat.com \
    --to=armbru@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).