[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 11/29] vl: extract various command line desugaring snippets to a
From: |
Paolo Bonzini |
Subject: |
[PATCH 11/29] vl: extract various command line desugaring snippets to a new function |
Date: |
Tue, 27 Oct 2020 14:21:26 -0400 |
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
softmmu/vl.c | 40 ++++++++++++++++++++++------------------
1 file changed, 22 insertions(+), 18 deletions(-)
diff --git a/softmmu/vl.c b/softmmu/vl.c
index c2a5ee61f9..6749109b29 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -126,6 +126,7 @@ static const char *boot_once;
static const char *incoming;
static const char *loadvm;
enum vga_retrace_method vga_retrace_method = VGA_RETRACE_DUMB;
+int mem_prealloc; /* force preallocation of physical target memory */
int display_opengl;
const char* keyboard_layout = NULL;
ram_addr_t ram_size;
@@ -159,7 +160,7 @@ int fd_bootchk = 1;
static int no_reboot;
int no_shutdown = 0;
int graphic_rotate = 0;
-const char *watchdog;
+static const char *watchdog;
QEMUOptionRom option_rom[MAX_OPTION_ROMS];
int nb_option_roms;
int old_param = 0;
@@ -2910,6 +2911,25 @@ static void qemu_validate_options(void)
#endif
}
+static void qemu_process_sugar_options(void)
+{
+ if (mem_prealloc) {
+ char *val;
+
+ val = g_strdup_printf("%d",
+ (uint32_t)
qemu_opt_get_number(qemu_find_opts_singleton("smp-opts"), "cpus", 1));
+ object_register_sugar_prop("memory-backend", "prealloc-threads", val);
+ g_free(val);
+ object_register_sugar_prop("memory-backend", "prealloc", "on");
+ }
+
+ if (watchdog) {
+ int i = select_watchdog(watchdog);
+ if (i > 0)
+ exit (i == 1 ? 1 : 0);
+ }
+}
+
static void qemu_process_early_options(void)
{
char **dirs;
@@ -3174,7 +3194,6 @@ static void qemu_machine_creation_done(void)
void qemu_init(int argc, char **argv, char **envp)
{
- int i;
int snapshot = 0;
QemuOpts *opts, *machine_opts;
QemuOpts *icount_opts = NULL, *accel_opts = NULL;
@@ -3193,7 +3212,6 @@ void qemu_init(int argc, char **argv, char **envp)
bool have_custom_ram_size;
BlockdevOptionsQueue bdo_queue = QSIMPLEQ_HEAD_INITIALIZER(bdo_queue);
QemuPluginList plugin_list = QTAILQ_HEAD_INITIALIZER(plugin_list);
- int mem_prealloc = 0; /* force preallocation of physical target memory */
qemu_add_opts(&qemu_drive_opts);
qemu_add_drive_opts(&qemu_legacy_drive_opts);
@@ -4104,6 +4122,7 @@ void qemu_init(int argc, char **argv, char **envp)
loc_set_none();
qemu_validate_options();
+ qemu_process_sugar_options();
/* These options affect everything else and should be processed
* before daemonizing.
@@ -4155,15 +4174,6 @@ void qemu_init(int argc, char **argv, char **envp)
machine_smp_parse(current_machine,
qemu_opts_find(qemu_find_opts("smp-opts"), NULL), &error_fatal);
- if (mem_prealloc) {
- char *val;
-
- val = g_strdup_printf("%d", current_machine->smp.cpus);
- object_register_sugar_prop("memory-backend", "prealloc-threads", val);
- g_free(val);
- object_register_sugar_prop("memory-backend", "prealloc", "on");
- }
-
/*
* Get the default machine options from the machine if it is not already
* specified either by the configuration file or by the command line.
@@ -4422,12 +4432,6 @@ void qemu_init(int argc, char **argv, char **envp)
select_vgahw(machine_class, vga_model);
}
- if (watchdog) {
- i = select_watchdog(watchdog);
- if (i > 0)
- exit (i == 1 ? 1 : 0);
- }
-
/* This checkpoint is required by replay to separate prior clock
reading from the other reads, because timer polling functions query
clock values from the log. */
--
2.26.2
- [RFC PATCH v2 00/37] cleanup qemu_init and make sense of command line processing, Paolo Bonzini, 2020/10/27
- [PATCH 05/29] vl: split various early command line options to a separate function, Paolo Bonzini, 2020/10/27
- [PATCH 04/29] vl: remove bogus check, Paolo Bonzini, 2020/10/27
- [PATCH 06/29] vl: move various initialization routines out of qemu_init, Paolo Bonzini, 2020/10/27
- [PATCH 02/29] semihosting: fix order of initialization functions, Paolo Bonzini, 2020/10/27
- [PATCH 07/29] vl: extract qemu_init_subsystems, Paolo Bonzini, 2020/10/27
- [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 <=
- [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, 2020/10/27
- [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