qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] qdev: fix hotplug when no -device is specified
@ 2011-12-19 22:39 Anthony Liguori
  2012-01-13 10:02 ` Markus Armbruster
  0 siblings, 1 reply; 2+ messages in thread
From: Anthony Liguori @ 2011-12-19 22:39 UTC (permalink / raw)
  To: qemu-devel; +Cc: Anthony Liguori

The peripheral[-anon] containers are initialized lazily but since they sit on
sysbus, they can not be created after realize.  This was causing an abort() to
occur during hotplug if no -device option was used.

This was spotted by qemu-test::device-add.sh

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
 hw/qdev.c |    6 ++++++
 hw/qdev.h |    8 ++++++++
 vl.c      |    2 ++
 3 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/hw/qdev.c b/hw/qdev.c
index 0465632..d0cf66d 100644
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -1529,3 +1529,9 @@ void qdev_property_add_str(DeviceState *dev, const char *name,
                       qdev_property_release_str,
                       prop, errp);
 }
+
+void qdev_machine_init(void)
+{
+    qdev_get_peripheral_anon();
+    qdev_get_peripheral();
+}
diff --git a/hw/qdev.h b/hw/qdev.h
index d5896be..2abb767 100644
--- a/hw/qdev.h
+++ b/hw/qdev.h
@@ -616,4 +616,12 @@ void qdev_property_add_str(DeviceState *dev, const char *name,
  */
 char *qdev_get_type(DeviceState *dev, Error **errp);
 
+/**
+ * @qdev_machine_init
+ *
+ * Initialize platform devices before machine init.  This is a hack until full
+ * support for composition is added.
+ */
+void qdev_machine_init(void);
+
 #endif
diff --git a/vl.c b/vl.c
index da69f94..78b790c 100644
--- a/vl.c
+++ b/vl.c
@@ -3335,6 +3335,8 @@ int main(int argc, char **argv, char **envp)
     }
     qemu_add_globals();
 
+    qdev_machine_init();
+
     machine->init(ram_size, boot_devices,
                   kernel_filename, kernel_cmdline, initrd_filename, cpu_model);
 
-- 
1.7.4.1

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-01-13 10:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-19 22:39 [Qemu-devel] [PATCH] qdev: fix hotplug when no -device is specified Anthony Liguori
2012-01-13 10:02 ` Markus Armbruster

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).