[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 069/113] vl: separate qemu_apply_machine_options
From: |
Paolo Bonzini |
Subject: |
[PULL 069/113] vl: separate qemu_apply_machine_options |
Date: |
Wed, 2 Dec 2020 03:08:05 -0500 |
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
softmmu/vl.c | 81 +++++++++++++++++++++++++++++-----------------------
1 file changed, 45 insertions(+), 36 deletions(-)
diff --git a/softmmu/vl.c b/softmmu/vl.c
index 5af52454ee..acf09b2040 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -2704,6 +2704,49 @@ 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;
+
+ if (semihosting_enabled() && !semihosting_get_argc()) {
+ const char *kernel_filename = qemu_opt_get(machine_opts, "kernel");
+ const char *kernel_cmdline = qemu_opt_get(machine_opts, "append") ?:
"";
+ /* fall back to the -kernel/-append */
+ semihosting_arg_fallback(kernel_filename, kernel_cmdline);
+ }
+
+}
+
static void qemu_create_early_backends(void)
{
MachineClass *machine_class = MACHINE_GET_CLASS(current_machine);
@@ -3448,7 +3491,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;
@@ -4387,12 +4430,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
@@ -4428,37 +4466,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;
- }
-
- if (semihosting_enabled() && !semihosting_get_argc()) {
- const char *kernel_filename = qemu_opt_get(machine_opts, "kernel");
- const char *kernel_cmdline = qemu_opt_get(machine_opts, "append");
- /* fall back to the -kernel/-append */
- semihosting_arg_fallback(kernel_filename, kernel_cmdline);
- }
-
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
- [PULL 070/113] vl: separate qemu_resolve_machine_memdev, (continued)
- [PULL 070/113] vl: separate qemu_resolve_machine_memdev, Paolo Bonzini, 2020/12/02
- [PULL 066/113] vl: separate qemu_create_early_backends, Paolo Bonzini, 2020/12/02
- [PULL 076/113] vl: extract softmmu/datadir.c, Paolo Bonzini, 2020/12/02
- [PULL 080/113] vl: clean up -boot variables, Paolo Bonzini, 2020/12/02
- [PULL 074/113] vl: start VM via qmp_cont, Paolo Bonzini, 2020/12/02
- [PULL 084/113] kernel-doc: add support for ____cacheline_aligned_in_smp attribute, Paolo Bonzini, 2020/12/02
- [PULL 086/113] scripts: kernel-doc: proper handle @foo->bar(), Paolo Bonzini, 2020/12/02
- [PULL 088/113] scripts: kernel-doc: accept blank lines on parameter description, Paolo Bonzini, 2020/12/02
- [PULL 090/113] scripts/kernel-doc: parse __ETHTOOL_DECLARE_LINK_MODE_MASK, Paolo Bonzini, 2020/12/02
- [PULL 087/113] scripts: kernel-doc: accept negation like !@var, Paolo Bonzini, 2020/12/02
- [PULL 069/113] vl: separate qemu_apply_machine_options,
Paolo Bonzini <=
- [PULL 051/113] treewide: do not use short-form boolean options, Paolo Bonzini, 2020/12/02
- [PULL 056/113] vl: extract qemu_init_subsystems, Paolo Bonzini, 2020/12/02
- [PULL 060/113] vl: extract various command line desugaring snippets to a new function, Paolo Bonzini, 2020/12/02
- [PULL 061/113] qemu-option: restrict qemu_opts_set to merge-lists QemuOpts, Paolo Bonzini, 2020/12/02
- [PULL 067/113] vl: separate qemu_create_late_backends, Paolo Bonzini, 2020/12/02
- [PULL 072/113] vl: move -global check earlier, Paolo Bonzini, 2020/12/02
- [PULL 073/113] migration, vl: start migration via qmp_migrate_incoming, Paolo Bonzini, 2020/12/02
- [PULL 068/113] vl: separate qemu_create_machine, Paolo Bonzini, 2020/12/02
- [PULL 079/113] vl: remove serial_max_hds, Paolo Bonzini, 2020/12/02
- [PULL 075/113] hmp: introduce cmd_available, Paolo Bonzini, 2020/12/02