]> Git Repo - qemu.git/commitdiff
qdev: fix hotplug when no -device is specified
authorAnthony Liguori <[email protected]>
Mon, 19 Dec 2011 22:37:46 +0000 (16:37 -0600)
committerAnthony Liguori <[email protected]>
Mon, 19 Dec 2011 22:39:16 +0000 (16:39 -0600)
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 <[email protected]>
hw/qdev.c
hw/qdev.h
vl.c

index 0465632dff5afddc79b32fea77f71bc3e99ca3bb..d0cf66de565f1d5860d1fcdb00db9bcd3098bad1 100644 (file)
--- 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();
+}
index d5896be40e8bc0a40d655c2da63ca95e2afd4437..2abb7673890ab2a9462135528180d4f30b624d48 100644 (file)
--- 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 da69f94dd165491c2c1b45fd20d75edd5dc2a3ae..78b790c91941de82d083fce6a8da0cf03a688197 100644 (file)
--- 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);
 
This page took 0.037278 seconds and 4 git commands to generate.