From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:51836) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rcls1-0002dO-PN for qemu-devel@nongnu.org; Mon, 19 Dec 2011 17:39:47 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rcls0-0000vW-OU for qemu-devel@nongnu.org; Mon, 19 Dec 2011 17:39:45 -0500 Received: from cpe-70-123-132-139.austin.res.rr.com ([70.123.132.139]:37720 helo=localhost6.localdomain6) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rcls0-0000vP-Bq for qemu-devel@nongnu.org; Mon, 19 Dec 2011 17:39:44 -0500 From: Anthony Liguori Date: Mon, 19 Dec 2011 16:39:40 -0600 Message-Id: <1324334380-25278-1-git-send-email-aliguori@us.ibm.com> Subject: [Qemu-devel] [PATCH] qdev: fix hotplug when no -device is specified List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org 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 --- 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