aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2011-12-19 16:37:46 -0600
committerAnthony Liguori <aliguori@us.ibm.com>2011-12-19 16:39:16 -0600
commit1de81d2832e210dda43a101e4163a17bc4d9c71d (patch)
tree04a50235fae13760bc71d652d6fe15d8d6f043f5 /hw
parentab0115e10ca2221a7844ac5fd18842976eec3b2b (diff)
qdev: fix hotplug when no -device is specified
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>
Diffstat (limited to 'hw')
-rw-r--r--hw/qdev.c6
-rw-r--r--hw/qdev.h8
2 files changed, 14 insertions, 0 deletions
diff --git a/hw/qdev.c b/hw/qdev.c
index 0465632dff..d0cf66de56 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 d5896be40e..2abb767389 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