mirror of
https://github.com/qemu/qemu.git
synced 2025-08-15 05:06:56 +00:00
vl: separate qemu_apply_machine_options
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
f5c9fcb82d
commit
7a84268dc9
81
softmmu/vl.c
81
softmmu/vl.c
@ -2704,6 +2704,49 @@ static bool object_create_early(const char *type, QemuOpts *opts)
|
|||||||
return true;
|
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)
|
static void qemu_create_early_backends(void)
|
||||||
{
|
{
|
||||||
MachineClass *machine_class = MACHINE_GET_CLASS(current_machine);
|
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)
|
void qemu_init(int argc, char **argv, char **envp)
|
||||||
{
|
{
|
||||||
QemuOpts *opts, *machine_opts;
|
QemuOpts *opts;
|
||||||
QemuOpts *icount_opts = NULL, *accel_opts = NULL;
|
QemuOpts *icount_opts = NULL, *accel_opts = NULL;
|
||||||
QemuOptsList *olist;
|
QemuOptsList *olist;
|
||||||
int optind;
|
int optind;
|
||||||
@ -4387,12 +4430,7 @@ void qemu_init(int argc, char **argv, char **envp)
|
|||||||
qemu_create_default_devices();
|
qemu_create_default_devices();
|
||||||
qemu_create_early_backends();
|
qemu_create_early_backends();
|
||||||
|
|
||||||
machine_opts = qemu_get_machine_opts();
|
qemu_apply_machine_options();
|
||||||
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;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Note: uses machine properties such as kernel-irqchip, must run
|
* 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();
|
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();
|
qemu_create_late_backends();
|
||||||
|
|
||||||
current_machine->boot_order = boot_order;
|
|
||||||
|
|
||||||
/* parse features once if machine provides default cpu_type */
|
/* parse features once if machine provides default cpu_type */
|
||||||
current_machine->cpu_type = machine_class->default_cpu_type;
|
current_machine->cpu_type = machine_class->default_cpu_type;
|
||||||
if (cpu_option) {
|
if (cpu_option) {
|
||||||
|
Loading…
Reference in New Issue
Block a user