diff --cc vl.c index 2201e27,b7c7511..0000000 --- a/vl.c +++ b/vl.c @@@ -2671,7 -2601,34 +2671,34 @@@ static int machine_set_property(void *o return 0; } + + /* + * Initial object creation happens before all other + * QEMU data types are created. The majority of objects + * can be created at this point. The rng-egd object + * cannot be created here, as it depends on the chardev + * already existing. + */ + static bool object_create_initial(const char *type) + { + if (g_str_equal(type, "rng-egd")) { + return false; + } + return true; + } + + + /* + * The remainder of object creation happens after the + * creation of chardev, fsdev and device data types. + */ + static bool object_create_delayed(const char *type) + { + return !object_create_initial(type); + } + + -static int object_create(QemuOpts *opts, void *opaque) +static int object_create(void *opaque, QemuOpts *opts, Error **errp) { Error *err = NULL; char *type = NULL; @@@ -4114,14 -4062,16 +4145,20 @@@ int main(int argc, char **argv, char ** socket_init(); + if (qemu_opts_foreach(qemu_find_opts("object"), + object_create, - object_create_initial, 0) != 0) { ++ object_create_initial, NULL)) { + exit(1); + } + - if (qemu_opts_foreach(qemu_find_opts("chardev"), chardev_init_func, NULL, 1) != 0) + if (qemu_opts_foreach(qemu_find_opts("chardev"), + chardev_init_func, NULL, NULL)) { exit(1); + } + #ifdef CONFIG_VIRTFS - if (qemu_opts_foreach(qemu_find_opts("fsdev"), fsdev_init_func, NULL, 1) != 0) { + if (qemu_opts_foreach(qemu_find_opts("fsdev"), + fsdev_init_func, NULL, NULL)) { exit(1); } #endif @@@ -4137,7 -4087,8 +4174,8 @@@ } if (qemu_opts_foreach(qemu_find_opts("object"), - object_create, NULL, NULL)) { + object_create, - object_create_delayed, 0) != 0) { ++ object_create_delayed, NULL)) { exit(1); }