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>
This commit is contained in:
parent
ab0115e10c
commit
1de81d2832
|
@ -1529,3 +1529,9 @@ void qdev_property_add_str(DeviceState *dev, const char *name,
|
||||||
qdev_property_release_str,
|
qdev_property_release_str,
|
||||||
prop, errp);
|
prop, errp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void qdev_machine_init(void)
|
||||||
|
{
|
||||||
|
qdev_get_peripheral_anon();
|
||||||
|
qdev_get_peripheral();
|
||||||
|
}
|
||||||
|
|
|
@ -616,4 +616,12 @@ void qdev_property_add_str(DeviceState *dev, const char *name,
|
||||||
*/
|
*/
|
||||||
char *qdev_get_type(DeviceState *dev, Error **errp);
|
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
|
#endif
|
||||||
|
|
2
vl.c
2
vl.c
|
@ -3335,6 +3335,8 @@ int main(int argc, char **argv, char **envp)
|
||||||
}
|
}
|
||||||
qemu_add_globals();
|
qemu_add_globals();
|
||||||
|
|
||||||
|
qdev_machine_init();
|
||||||
|
|
||||||
machine->init(ram_size, boot_devices,
|
machine->init(ram_size, boot_devices,
|
||||||
kernel_filename, kernel_cmdline, initrd_filename, cpu_model);
|
kernel_filename, kernel_cmdline, initrd_filename, cpu_model);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue