[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 22/22] vl: separate qemu_create_late_backends
From: |
Paolo Bonzini |
Subject: |
[PATCH 22/22] vl: separate qemu_create_late_backends |
Date: |
Wed, 21 Oct 2020 16:57:16 -0400 |
"Late" backends are created after the machine.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
softmmu/vl.c | 64 ++++++++++++++++++++++++++--------------------------
1 file changed, 32 insertions(+), 32 deletions(-)
diff --git a/softmmu/vl.c b/softmmu/vl.c
index 866df5bb7c..f36ec16cad 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -2751,11 +2751,41 @@ static void qemu_create_early_backends(void)
* The remainder of object creation happens after the
* creation of chardev, fsdev, net clients and device data types.
*/
-static bool object_create_delayed(const char *type, QemuOpts *opts)
+static bool object_create_late(const char *type, QemuOpts *opts)
{
return !object_create_early(type, opts);
}
+static void qemu_create_late_backends(void)
+{
+ if (qtest_chrdev) {
+ qtest_server_init(qtest_chrdev, qtest_log, &error_fatal);
+ }
+
+ net_init_clients(&error_fatal);
+
+ qemu_opts_foreach(qemu_find_opts("object"),
+ user_creatable_add_opts_foreach,
+ object_create_late, &error_fatal);
+
+ if (tpm_init() < 0) {
+ exit(1);
+ }
+
+ qemu_opts_foreach(qemu_find_opts("mon"),
+ mon_init_func, NULL, &error_fatal);
+
+ /* now chardevs have been created we may have semihosting to connect */
+ qemu_semihosting_connect_chardevs();
+ qemu_semihosting_console_init();
+
+ if (foreach_device_config(DEV_SERIAL, serial_parse) < 0)
+ exit(1);
+ if (foreach_device_config(DEV_PARALLEL, parallel_parse) < 0)
+ exit(1);
+ if (foreach_device_config(DEV_DEBUGCON, debugcon_parse) < 0)
+ exit(1);
+}
static bool set_memory_options(uint64_t *ram_slots, ram_addr_t *maxram_size,
MachineClass *mc)
@@ -3372,7 +3402,6 @@ void qemu_init(int argc, char **argv, char **envp)
ram_addr_t maxram_size;
uint64_t ram_slots = 0;
FILE *vmstate_dump_file = NULL;
- Error *err = NULL;
bool have_custom_ram_size;
qemu_add_opts(&qemu_drive_opts);
@@ -4385,10 +4414,6 @@ void qemu_init(int argc, char **argv, char **envp)
*/
migration_object_init();
- if (qtest_chrdev) {
- qtest_server_init(qtest_chrdev, qtest_log, &error_fatal);
- }
-
opts = qemu_opts_find(qemu_find_opts("boot-opts"), NULL);
if (opts) {
boot_order = qemu_opt_get(opts, "order");
@@ -4409,32 +4434,7 @@ void qemu_init(int argc, char **argv, char **envp)
boot_order = machine_class->default_boot_order;
}
- if (net_init_clients(&err) < 0) {
- error_report_err(err);
- exit(1);
- }
-
- qemu_opts_foreach(qemu_find_opts("object"),
- user_creatable_add_opts_foreach,
- object_create_delayed, &error_fatal);
-
- if (tpm_init() < 0) {
- exit(1);
- }
-
- qemu_opts_foreach(qemu_find_opts("mon"),
- mon_init_func, NULL, &error_fatal);
-
- /* now chardevs have been created we may have semihosting to connect */
- qemu_semihosting_connect_chardevs();
- qemu_semihosting_console_init();
-
- if (foreach_device_config(DEV_SERIAL, serial_parse) < 0)
- exit(1);
- if (foreach_device_config(DEV_PARALLEL, parallel_parse) < 0)
- exit(1);
- if (foreach_device_config(DEV_DEBUGCON, debugcon_parse) < 0)
- exit(1);
+ qemu_create_late_backends();
current_machine->boot_order = boot_order;
--
2.26.2
- [PATCH 06/22] vl: remove bogus check, (continued)
- [PATCH 06/22] vl: remove bogus check, Paolo Bonzini, 2020/10/21
- [PATCH 15/22] vl: extract various command line desugaring snippets to a new function, Paolo Bonzini, 2020/10/21
- [PATCH 08/22] vl: split various early command line options to a separate function, Paolo Bonzini, 2020/10/21
- [PATCH 05/22] vl: extract validation of -smp to machine.c, Paolo Bonzini, 2020/10/21
- [PATCH 01/22] semihosting: fix order of initialization functions, Paolo Bonzini, 2020/10/21
- [PATCH 11/22] vl: move prelaunch part of qemu_init to a new function, Paolo Bonzini, 2020/10/21
- [PATCH 19/22] vl: extract default devices to separate functions, Paolo Bonzini, 2020/10/21
- [PATCH 18/22] vl: move semihosting command line fallback to qemu_finish_machine_init, Paolo Bonzini, 2020/10/21
- [PATCH 20/22] vl: move CHECKPOINT_INIT after preconfig, Paolo Bonzini, 2020/10/21
- [PATCH 22/22] vl: separate qemu_create_late_backends,
Paolo Bonzini <=
- [PATCH 10/22] vl: extract qemu_init_subsystems, Paolo Bonzini, 2020/10/21
- [PATCH 14/22] vl: preconfig and loadvm are mutually exclusive, Paolo Bonzini, 2020/10/21
- [PATCH 17/22] vl: load plugins as late as possible, Paolo Bonzini, 2020/10/21
- [PATCH 13/22] vl: extract various command line validation snippets to a new function, Paolo Bonzini, 2020/10/21
- [PATCH 16/22] vl: create "-net nic -net user" default earlier, Paolo Bonzini, 2020/10/21
- [PATCH 09/22] vl: move various initialization routines out of qemu_init, Paolo Bonzini, 2020/10/21
- [PATCH 12/22] vl: move bios_name out of softmmu/vl.c, Paolo Bonzini, 2020/10/21
- [PATCH 21/22] vl: separate qemu_create_early_backends, Paolo Bonzini, 2020/10/21