[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 20/29] vl: separate qemu_apply_machine_options
From: |
Paolo Bonzini |
Subject: |
[PATCH 20/29] vl: separate qemu_apply_machine_options |
Date: |
Tue, 27 Oct 2020 14:21:35 -0400 |
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
softmmu/vl.c | 66 +++++++++++++++++++++++++++++-----------------------
1 file changed, 37 insertions(+), 29 deletions(-)
diff --git a/softmmu/vl.c b/softmmu/vl.c
index 38ad3cc895..9a3c92387e 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -2700,6 +2700,41 @@ static bool object_create_early(const char *type,
QemuOpts *opts)
return true;
}
+static void qemu_apply_machine_options(void)
+{
+ MachineClass *machine_class = MACHINE_GET_CLASS(current_machine);
+ QemuOpts *machine_opts = qemu_get_machine_opts();
+ QemuOpts *opts;
+
+ qemu_opt_foreach(machine_opts, machine_set_property, current_machine,
+ &error_fatal);
+ current_machine->ram_size = ram_size;
+ current_machine->maxram_size = maxram_size;
+ current_machine->ram_slots = ram_slots;
+
+ opts = qemu_opts_find(qemu_find_opts("boot-opts"), NULL);
+ if (opts) {
+ boot_order = qemu_opt_get(opts, "order");
+ if (boot_order) {
+ validate_bootdevices(boot_order, &error_fatal);
+ }
+
+ boot_once = qemu_opt_get(opts, "once");
+ if (boot_once) {
+ validate_bootdevices(boot_once, &error_fatal);
+ }
+
+ boot_menu = qemu_opt_get_bool(opts, "menu", boot_menu);
+ boot_strict = qemu_opt_get_bool(opts, "strict", false);
+ }
+
+ if (!boot_order) {
+ boot_order = machine_class->default_boot_order;
+ }
+
+ current_machine->boot_order = boot_order;
+}
+
static void qemu_create_early_backends(void)
{
MachineClass *machine_class = MACHINE_GET_CLASS(current_machine);
@@ -3455,7 +3490,7 @@ static void qemu_machine_creation_done(void)
void qemu_init(int argc, char **argv, char **envp)
{
- QemuOpts *opts, *machine_opts;
+ QemuOpts *opts;
QemuOpts *icount_opts = NULL, *accel_opts = NULL;
QemuOptsList *olist;
int optind;
@@ -4397,12 +4432,7 @@ void qemu_init(int argc, char **argv, char **envp)
qemu_create_default_devices();
qemu_create_early_backends();
- machine_opts = qemu_get_machine_opts();
- qemu_opt_foreach(machine_opts, machine_set_property, current_machine,
- &error_fatal);
- current_machine->ram_size = ram_size;
- current_machine->maxram_size = maxram_size;
- current_machine->ram_slots = ram_slots;
+ qemu_apply_machine_options();
/*
* Note: uses machine properties such as kernel-irqchip, must run
@@ -4438,30 +4468,8 @@ void qemu_init(int argc, char **argv, char **envp)
*/
migration_object_init();
- opts = qemu_opts_find(qemu_find_opts("boot-opts"), NULL);
- if (opts) {
- boot_order = qemu_opt_get(opts, "order");
- if (boot_order) {
- validate_bootdevices(boot_order, &error_fatal);
- }
-
- boot_once = qemu_opt_get(opts, "once");
- if (boot_once) {
- validate_bootdevices(boot_once, &error_fatal);
- }
-
- boot_menu = qemu_opt_get_bool(opts, "menu", boot_menu);
- boot_strict = qemu_opt_get_bool(opts, "strict", false);
- }
-
- if (!boot_order) {
- boot_order = machine_class->default_boot_order;
- }
-
qemu_create_late_backends();
- current_machine->boot_order = boot_order;
-
/* parse features once if machine provides default cpu_type */
current_machine->cpu_type = machine_class->default_cpu_type;
if (cpu_option) {
--
2.26.2
- [PATCH 10/29] vl: preconfig and loadvm are mutually exclusive, (continued)
- [PATCH 10/29] vl: preconfig and loadvm are mutually exclusive, Paolo Bonzini, 2020/10/27
- [PATCH 13/29] vl: load plugins as late as possible, Paolo Bonzini, 2020/10/27
- [PATCH 03/29] vl: extract validation of -smp to machine.c, Paolo Bonzini, 2020/10/27
- [PATCH 09/29] vl: extract various command line validation snippets to a new function, Paolo Bonzini, 2020/10/27
- [PATCH 11/29] vl: extract various command line desugaring snippets to a new function, Paolo Bonzini, 2020/10/27
- [PATCH 01/29] trace: remove argument from trace_init_file, Paolo Bonzini, 2020/10/27
- [PATCH 08/29] vl: move prelaunch part of qemu_init to new functions, Paolo Bonzini, 2020/10/27
- [PATCH 15/29] vl: extract default devices to separate functions, Paolo Bonzini, 2020/10/27
- [PATCH 23/29] vl: move -global check earlier, Paolo Bonzini, 2020/10/27
- [PATCH 16/29] vl: move CHECKPOINT_INIT after preconfig, Paolo Bonzini, 2020/10/27
- [PATCH 20/29] vl: separate qemu_apply_machine_options,
Paolo Bonzini <=
- [PATCH 22/29] vl: initialize displays before preconfig loop, Paolo Bonzini, 2020/10/27
- [PATCH 12/29] vl: create "-net nic -net user" default earlier, Paolo Bonzini, 2020/10/27
- [PATCH 21/29] vl: separate qemu_resolve_machine_memdev, Paolo Bonzini, 2020/10/27
- [PATCH 24/29] migration, vl: start migration via qmp_migrate_incoming, Paolo Bonzini, 2020/10/27
- [PATCH 14/29] vl: move semihosting command line fallback to qemu_finish_machine_init, Paolo Bonzini, 2020/10/27
- [PATCH 29/29] vl: allow -incoming defer with -preconfig, Paolo Bonzini, 2020/10/27
- [PATCH 28/29] vl: remove separate preconfig main_loop, Paolo Bonzini, 2020/10/27
- [PATCH 18/29] vl: separate qemu_create_late_backends, Paolo Bonzini, 2020/10/27
- [PATCH 26/29] hmp: introduce cmd_available, Paolo Bonzini, 2020/10/27
- [PATCH 25/29] vl: start VM via qmp_cont, Paolo Bonzini, 2020/10/27