X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=vl.c;h=8d5d874e6853746be878923d8b650b70df93e3d2;hb=60aad298cb6de52f2716b2e82e1353ea9de95fd6;hp=f94ec9ca174f619d9edd5fd1baa468a5cd14b739;hpb=21a885a7e2a0f532f7653a2607efddbd83504430;p=qemu.git diff --git a/vl.c b/vl.c index f94ec9ca1..8d5d874e6 100644 --- a/vl.c +++ b/vl.c @@ -196,7 +196,7 @@ NICInfo nd_table[MAX_NICS]; int autostart; static int rtc_utc = 1; static int rtc_date_offset = -1; /* -1 means no change */ -QEMUClock *rtc_clock; +QEMUClockType rtc_clock; int vga_interface_type = VGA_NONE; static int full_screen = 0; static int no_frame = 0; @@ -254,6 +254,7 @@ uint64_t node_mem[MAX_NODES]; unsigned long *node_cpumask[MAX_NODES]; uint8_t qemu_uuid[16]; +bool qemu_uuid_set; static QEMUBootSetHandler *boot_set_handler; static void *boot_set_opaque; @@ -409,7 +410,7 @@ static QemuOptsList qemu_machine_opts = { .help = "Dump current dtb to a file and quit", }, { .name = "phandle_start", - .type = QEMU_OPT_STRING, + .type = QEMU_OPT_NUMBER, .help = "The first phandle ID we may generate dynamically", }, { .name = "dt_compatible", @@ -434,9 +435,10 @@ static QemuOptsList qemu_machine_opts = { static QemuOptsList qemu_boot_opts = { .name = "boot-opts", + .implied_opt_name = "order", + .merge_lists = true, .head = QTAILQ_HEAD_INITIALIZER(qemu_boot_opts.head), .desc = { - /* the three names below are not used now */ { .name = "order", .type = QEMU_OPT_STRING, @@ -445,8 +447,7 @@ static QemuOptsList qemu_boot_opts = { .type = QEMU_OPT_STRING, }, { .name = "menu", - .type = QEMU_OPT_STRING, - /* following are really used */ + .type = QEMU_OPT_BOOL, }, { .name = "splash", .type = QEMU_OPT_STRING, @@ -516,6 +517,37 @@ static QemuOptsList qemu_realtime_opts = { }, }; +static QemuOptsList qemu_msg_opts = { + .name = "msg", + .head = QTAILQ_HEAD_INITIALIZER(qemu_msg_opts.head), + .desc = { + { + .name = "timestamp", + .type = QEMU_OPT_BOOL, + }, + { /* end of list */ } + }, +}; + +/** + * Get machine options + * + * Returns: machine options (never null). + */ +QemuOpts *qemu_get_machine_opts(void) +{ + QemuOptsList *list; + QemuOpts *opts; + + list = qemu_find_opts("machine"); + assert(list); + opts = qemu_opts_find(list, NULL); + if (!opts) { + opts = qemu_opts_create_nofail(list); + } + return opts; +} + const char *qemu_get_vm_name(void) { return qemu_name; @@ -606,9 +638,8 @@ static const RunStateTransition runstate_transitions_def[] = { { RUN_STATE_WATCHDOG, RUN_STATE_RUNNING }, { RUN_STATE_WATCHDOG, RUN_STATE_FINISH_MIGRATE }, - { RUN_STATE_GUEST_PANICKED, RUN_STATE_PAUSED }, + { RUN_STATE_GUEST_PANICKED, RUN_STATE_RUNNING }, { RUN_STATE_GUEST_PANICKED, RUN_STATE_FINISH_MIGRATE }, - { RUN_STATE_GUEST_PANICKED, RUN_STATE_DEBUG }, { RUN_STATE_MAX, RUN_STATE_MAX }, }; @@ -654,8 +685,7 @@ int runstate_is_running(void) bool runstate_needs_reset(void) { return runstate_check(RUN_STATE_INTERNAL_ERROR) || - runstate_check(RUN_STATE_SHUTDOWN) || - runstate_check(RUN_STATE_GUEST_PANICKED); + runstate_check(RUN_STATE_SHUTDOWN); } StatusInfo *qmp_query_status(Error **errp) @@ -774,11 +804,11 @@ static void configure_rtc(QemuOpts *opts) value = qemu_opt_get(opts, "clock"); if (value) { if (!strcmp(value, "host")) { - rtc_clock = host_clock; + rtc_clock = QEMU_CLOCK_HOST; } else if (!strcmp(value, "rt")) { - rtc_clock = rt_clock; + rtc_clock = QEMU_CLOCK_REALTIME; } else if (!strcmp(value, "vm")) { - rtc_clock = vm_clock; + rtc_clock = QEMU_CLOCK_VIRTUAL; } else { fprintf(stderr, "qemu: invalid option value '%s'\n", value); exit(1); @@ -812,45 +842,6 @@ static int nb_hcis; static int cur_hci; static struct HCIInfo *hci_table[MAX_NICS]; -static struct bt_vlan_s { - struct bt_scatternet_s net; - int id; - struct bt_vlan_s *next; -} *first_bt_vlan; - -/* find or alloc a new bluetooth "VLAN" */ -static struct bt_scatternet_s *qemu_find_bt_vlan(int id) -{ - struct bt_vlan_s **pvlan, *vlan; - for (vlan = first_bt_vlan; vlan != NULL; vlan = vlan->next) { - if (vlan->id == id) - return &vlan->net; - } - vlan = g_malloc0(sizeof(struct bt_vlan_s)); - vlan->id = id; - pvlan = &first_bt_vlan; - while (*pvlan != NULL) - pvlan = &(*pvlan)->next; - *pvlan = vlan; - return &vlan->net; -} - -static void null_hci_send(struct HCIInfo *hci, const uint8_t *data, int len) -{ -} - -static int null_hci_addr_set(struct HCIInfo *hci, const uint8_t *bd_addr) -{ - return -ENOTSUP; -} - -static struct HCIInfo null_hci = { - .cmd_send = null_hci_send, - .sco_send = null_hci_send, - .acl_send = null_hci_send, - .bdaddr_set = null_hci_addr_set, -}; - struct HCIInfo *qemu_next_hci(void) { if (cur_hci == nb_hcis) @@ -859,36 +850,6 @@ struct HCIInfo *qemu_next_hci(void) return hci_table[cur_hci++]; } -static struct HCIInfo *hci_init(const char *str) -{ - char *endp; - struct bt_scatternet_s *vlan = 0; - - if (!strcmp(str, "null")) - /* null */ - return &null_hci; - else if (!strncmp(str, "host", 4) && (str[4] == '\0' || str[4] == ':')) - /* host[:hciN] */ - return bt_host_hci(str[4] ? str + 5 : "hci0"); - else if (!strncmp(str, "hci", 3)) { - /* hci[,vlan=n] */ - if (str[3]) { - if (!strncmp(str + 3, ",vlan=", 6)) { - vlan = qemu_find_bt_vlan(strtol(str + 9, &endp, 0)); - if (*endp) - vlan = 0; - } - } else - vlan = qemu_find_bt_vlan(0); - if (vlan) - return bt_new_hci(vlan); - } - - fprintf(stderr, "qemu: Unknown bluetooth HCI `%s'.\n", str); - - return 0; -} - static int bt_hci_parse(const char *str) { struct HCIInfo *hci; @@ -1017,15 +978,9 @@ static int parse_sandbox(QemuOpts *opts, void *opaque) return 0; } -/*********QEMU USB setting******/ bool usb_enabled(bool default_usb) { - QemuOpts *mach_opts; - mach_opts = qemu_opts_find(qemu_find_opts("machine"), 0); - if (mach_opts) { - return qemu_opt_get_bool(mach_opts, "usb", default_usb); - } - return default_usb; + return qemu_opt_get_bool(qemu_get_machine_opts(), "usb", default_usb); } #ifndef _WIN32 @@ -1149,15 +1104,15 @@ void qemu_register_boot_set(QEMUBootSetHandler *func, void *opaque) boot_set_opaque = opaque; } -int qemu_boot_set(const char *boot_devices) +int qemu_boot_set(const char *boot_order) { if (!boot_set_handler) { return -EINVAL; } - return boot_set_handler(boot_set_opaque, boot_devices); + return boot_set_handler(boot_set_opaque, boot_order); } -static void validate_bootdevices(char *devices) +static void validate_bootdevices(const char *devices) { /* We just do some generic consistency checks */ const char *p; @@ -1185,9 +1140,9 @@ static void validate_bootdevices(char *devices) } } -static void restore_boot_devices(void *opaque) +static void restore_boot_order(void *opaque) { - char *standard_boot_devices = opaque; + char *normal_boot_order = opaque; static int first = 1; /* Restore boot order and remove ourselves after the first boot */ @@ -1196,10 +1151,10 @@ static void restore_boot_devices(void *opaque) return; } - qemu_boot_set(standard_boot_devices); + qemu_boot_set(normal_boot_order); - qemu_unregister_reset(restore_boot_devices, standard_boot_devices); - g_free(standard_boot_devices); + qemu_unregister_reset(restore_boot_order, normal_boot_order); + g_free(normal_boot_order); } void add_boot_device_path(int32_t bootindex, DeviceState *dev, @@ -1401,48 +1356,79 @@ static void numa_add(const char *optarg) } } -static void smp_parse(const char *optarg) +static QemuOptsList qemu_smp_opts = { + .name = "smp-opts", + .implied_opt_name = "cpus", + .merge_lists = true, + .head = QTAILQ_HEAD_INITIALIZER(qemu_smp_opts.head), + .desc = { + { + .name = "cpus", + .type = QEMU_OPT_NUMBER, + }, { + .name = "sockets", + .type = QEMU_OPT_NUMBER, + }, { + .name = "cores", + .type = QEMU_OPT_NUMBER, + }, { + .name = "threads", + .type = QEMU_OPT_NUMBER, + }, { + .name = "maxcpus", + .type = QEMU_OPT_NUMBER, + }, + { /*End of list */ } + }, +}; + +static void smp_parse(QemuOpts *opts) { - int smp, sockets = 0, threads = 0, cores = 0; - char *endptr; - char option[128]; + if (opts) { - smp = strtoul(optarg, &endptr, 10); - if (endptr != optarg) { - if (*endptr == ',') { - endptr++; - } - } - if (get_param_value(option, 128, "sockets", endptr) != 0) - sockets = strtoull(option, NULL, 10); - if (get_param_value(option, 128, "cores", endptr) != 0) - cores = strtoull(option, NULL, 10); - if (get_param_value(option, 128, "threads", endptr) != 0) - threads = strtoull(option, NULL, 10); - if (get_param_value(option, 128, "maxcpus", endptr) != 0) - max_cpus = strtoull(option, NULL, 10); - - /* compute missing values, prefer sockets over cores over threads */ - if (smp == 0 || sockets == 0) { - sockets = sockets > 0 ? sockets : 1; - cores = cores > 0 ? cores : 1; - threads = threads > 0 ? threads : 1; - if (smp == 0) { - smp = cores * threads * sockets; - } - } else { - if (cores == 0) { + unsigned cpus = qemu_opt_get_number(opts, "cpus", 0); + unsigned sockets = qemu_opt_get_number(opts, "sockets", 0); + unsigned cores = qemu_opt_get_number(opts, "cores", 0); + unsigned threads = qemu_opt_get_number(opts, "threads", 0); + + /* compute missing values, prefer sockets over cores over threads */ + if (cpus == 0 || sockets == 0) { + sockets = sockets > 0 ? sockets : 1; + cores = cores > 0 ? cores : 1; threads = threads > 0 ? threads : 1; - cores = smp / (sockets * threads); + if (cpus == 0) { + cpus = cores * threads * sockets; + } } else { - threads = smp / (cores * sockets); + if (cores == 0) { + threads = threads > 0 ? threads : 1; + cores = cpus / (sockets * threads); + } else { + threads = cpus / (cores * sockets); + } } + + max_cpus = qemu_opt_get_number(opts, "maxcpus", 0); + + smp_cpus = cpus; + smp_cores = cores > 0 ? cores : 1; + smp_threads = threads > 0 ? threads : 1; + } - smp_cpus = smp; - smp_cores = cores > 0 ? cores : 1; - smp_threads = threads > 0 ? threads : 1; - if (max_cpus == 0) + + if (max_cpus == 0) { max_cpus = smp_cpus; + } + + if (max_cpus > 255) { + fprintf(stderr, "Unsupported number of maxcpus\n"); + exit(1); + } + if (max_cpus < smp_cpus) { + fprintf(stderr, "maxcpus must be equal to or greater than smp\n"); + exit(1); + } + } static void configure_realtime(QemuOpts *opts) @@ -1459,13 +1445,21 @@ static void configure_realtime(QemuOpts *opts) } } + +static void configure_msg(QemuOpts *opts) +{ + enable_timestamp_msg = qemu_opt_get_bool(opts, "timestamp", true); +} + /***********************************************************/ /* USB devices */ static int usb_device_add(const char *devname) { - const char *p; USBDevice *dev = NULL; +#ifndef CONFIG_LINUX + const char *p; +#endif if (!usb_enabled(false)) { return -1; @@ -1481,15 +1475,8 @@ static int usb_device_add(const char *devname) /* only the linux version is qdev-ified, usb-bsd still needs this */ if (strstart(devname, "host:", &p)) { dev = usb_host_device_open(usb_bus_find(-1), p); - } else -#endif - if (!strcmp(devname, "bt") || strstart(devname, "bt:", &p)) { - dev = usb_bt_init(usb_bus_find(-1), - devname[2] ? hci_init(p) - : bt_new_hci(qemu_find_bt_vlan(0))); - } else { - return -1; } +#endif if (!dev) return -1; @@ -1730,14 +1717,14 @@ static pid_t shutdown_pid; static int powerdown_requested; static int debug_requested; static int suspend_requested; -static int wakeup_requested; +static WakeupReason wakeup_reason; static NotifierList powerdown_notifiers = NOTIFIER_LIST_INITIALIZER(powerdown_notifiers); static NotifierList suspend_notifiers = NOTIFIER_LIST_INITIALIZER(suspend_notifiers); static NotifierList wakeup_notifiers = NOTIFIER_LIST_INITIALIZER(wakeup_notifiers); -static uint32_t wakeup_reason_mask = ~0; +static uint32_t wakeup_reason_mask = ~(1 << QEMU_WAKEUP_REASON_NONE); static RunState vmstop_requested = RUN_STATE_MAX; int qemu_shutdown_requested_get(void) @@ -1787,11 +1774,9 @@ static int qemu_suspend_requested(void) return r; } -static int qemu_wakeup_requested(void) +static WakeupReason qemu_wakeup_requested(void) { - int r = wakeup_requested; - wakeup_requested = 0; - return r; + return wakeup_reason; } static int qemu_powerdown_requested(void) @@ -1908,8 +1893,7 @@ void qemu_system_wakeup_request(WakeupReason reason) return; } runstate_set(RUN_STATE_RUNNING); - notifier_list_notify(&wakeup_notifiers, &reason); - wakeup_requested = 1; + wakeup_reason = reason; qemu_notify_event(); } @@ -2001,6 +1985,8 @@ static bool main_loop_should_exit(void) pause_all_vcpus(); cpu_synchronize_all_states(); qemu_system_reset(VMRESET_SILENT); + notifier_list_notify(&wakeup_notifiers, &wakeup_reason); + wakeup_reason = QEMU_WAKEUP_REASON_NONE; resume_all_vcpus(); monitor_protocol_event(QEVENT_WAKEUP, NULL); } @@ -2331,7 +2317,7 @@ static int chardev_init_func(QemuOpts *opts, void *opaque) qemu_chr_new_from_opts(opts, NULL, &local_err); if (error_is_set(&local_err)) { - fprintf(stderr, "%s\n", error_get_pretty(local_err)); + error_report("%s", error_get_pretty(local_err)); error_free(local_err); return -1; } @@ -2641,17 +2627,13 @@ static struct { static int configure_accelerator(void) { - const char *p = NULL; + const char *p; char buf[10]; int i, ret; bool accel_initialised = false; bool init_failed = false; - QemuOptsList *list = qemu_find_opts("machine"); - if (!QTAILQ_EMPTY(&list->head)) { - p = qemu_opt_get(QTAILQ_FIRST(&list->head), "accel"); - } - + p = qemu_opt_get(qemu_get_machine_opts(), "accel"); if (p == NULL) { /* Use the default "accelerator", tcg */ p = "tcg"; @@ -2841,7 +2823,7 @@ int main(int argc, char **argv, char **envp) const char *icount_option = NULL; const char *initrd_filename; const char *kernel_filename, *kernel_cmdline; - char boot_devices[33] = ""; + const char *boot_order; DisplayState *ds; int cyls, heads, secs, translation; QemuOpts *hda_opts = NULL, *opts, *machine_opts; @@ -2885,6 +2867,9 @@ int main(int argc, char **argv, char **envp) module_call_init(MODULE_INIT_QOM); qemu_add_opts(&qemu_drive_opts); + qemu_add_drive_opts(&qemu_legacy_drive_opts); + qemu_add_drive_opts(&qemu_common_drive_opts); + qemu_add_drive_opts(&qemu_drive_opts); qemu_add_opts(&qemu_chardev_opts); qemu_add_opts(&qemu_device_opts); qemu_add_opts(&qemu_netdev_opts); @@ -2895,17 +2880,19 @@ int main(int argc, char **argv, char **envp) qemu_add_opts(&qemu_trace_opts); qemu_add_opts(&qemu_option_rom_opts); qemu_add_opts(&qemu_machine_opts); + qemu_add_opts(&qemu_smp_opts); qemu_add_opts(&qemu_boot_opts); qemu_add_opts(&qemu_sandbox_opts); qemu_add_opts(&qemu_add_fd_opts); qemu_add_opts(&qemu_object_opts); qemu_add_opts(&qemu_tpmdev_opts); qemu_add_opts(&qemu_realtime_opts); + qemu_add_opts(&qemu_msg_opts); runstate_init(); init_clocks(); - rtc_clock = host_clock; + rtc_clock = QEMU_CLOCK_HOST; qemu_cache_utils_init(envp); @@ -3131,71 +3118,9 @@ int main(int argc, char **argv, char **envp) drive_add(IF_DEFAULT, 2, optarg, CDROM_OPTS); break; case QEMU_OPTION_boot: - { - static const char * const params[] = { - "order", "once", "menu", - "splash", "splash-time", - "reboot-timeout", "strict", NULL - }; - char buf[sizeof(boot_devices)]; - char *standard_boot_devices; - int legacy = 0; - - if (!strchr(optarg, '=')) { - legacy = 1; - pstrcpy(buf, sizeof(buf), optarg); - } else if (check_params(buf, sizeof(buf), params, optarg) < 0) { - fprintf(stderr, - "qemu: unknown boot parameter '%s' in '%s'\n", - buf, optarg); - exit(1); - } - - if (legacy || - get_param_value(buf, sizeof(buf), "order", optarg)) { - validate_bootdevices(buf); - pstrcpy(boot_devices, sizeof(boot_devices), buf); - } - if (!legacy) { - if (get_param_value(buf, sizeof(buf), - "once", optarg)) { - validate_bootdevices(buf); - standard_boot_devices = g_strdup(boot_devices); - pstrcpy(boot_devices, sizeof(boot_devices), buf); - qemu_register_reset(restore_boot_devices, - standard_boot_devices); - } - if (get_param_value(buf, sizeof(buf), - "menu", optarg)) { - if (!strcmp(buf, "on")) { - boot_menu = 1; - } else if (!strcmp(buf, "off")) { - boot_menu = 0; - } else { - fprintf(stderr, - "qemu: invalid option value '%s'\n", - buf); - exit(1); - } - } - if (get_param_value(buf, sizeof(buf), - "strict", optarg)) { - if (!strcmp(buf, "on")) { - boot_strict = true; - } else if (!strcmp(buf, "off")) { - boot_strict = false; - } else { - fprintf(stderr, - "qemu: invalid option value '%s'\n", - buf); - exit(1); - } - } - if (!qemu_opts_parse(qemu_find_opts("boot-opts"), - optarg, 0)) { - exit(1); - } - } + opts = qemu_opts_parse(qemu_find_opts("boot-opts"), optarg, 1); + if (!opts) { + exit(1); } break; case QEMU_OPTION_fda: @@ -3534,12 +3459,11 @@ int main(int argc, char **argv, char **envp) case QEMU_OPTION_no_quit: no_quit = 1; break; -#ifdef CONFIG_SDL case QEMU_OPTION_sdl: +#ifdef CONFIG_SDL display_type = DT_SDL; break; #else - case QEMU_OPTION_sdl: fprintf(stderr, "SDL support is disabled\n"); exit(1); #endif @@ -3568,7 +3492,8 @@ int main(int argc, char **argv, char **envp) do_acpitable_option(opts); break; case QEMU_OPTION_smbios: - do_smbios_option(optarg); + opts = qemu_opts_parse(qemu_find_opts("smbios"), optarg, 0); + do_smbios_option(opts); break; case QEMU_OPTION_enable_kvm: olist = qemu_find_opts("machine"); @@ -3624,18 +3549,7 @@ int main(int argc, char **argv, char **envp) } break; case QEMU_OPTION_smp: - smp_parse(optarg); - if (smp_cpus < 1) { - fprintf(stderr, "Invalid number of CPUs\n"); - exit(1); - } - if (max_cpus < smp_cpus) { - fprintf(stderr, "maxcpus must be equal to or greater than " - "smp\n"); - exit(1); - } - if (max_cpus > 255) { - fprintf(stderr, "Unsupported number of maxcpus\n"); + if (!qemu_opts_parse(qemu_find_opts("smp-opts"), optarg, 1)) { exit(1); } break; @@ -3675,6 +3589,7 @@ int main(int argc, char **argv, char **envp) " Wrong format.\n"); exit(1); } + qemu_uuid_set = true; break; case QEMU_OPTION_option_rom: if (nb_option_roms >= MAX_OPTION_ROMS) { @@ -3728,7 +3643,9 @@ int main(int argc, char **argv, char **envp) old_param = 1; break; case QEMU_OPTION_clock: - configure_alarms(optarg); + /* Clock options no longer exist. Keep this option for + * backward compatibility. + */ break; case QEMU_OPTION_startdate: configure_rtc_date_offset(optarg, 1); @@ -3871,6 +3788,13 @@ int main(int argc, char **argv, char **envp) } configure_realtime(opts); break; + case QEMU_OPTION_msg: + opts = qemu_opts_parse(qemu_find_opts("msg"), optarg, 0); + if (!opts) { + exit(1); + } + configure_msg(opts); + break; default: os_parse_cmd_args(popt->index, optarg); } @@ -3959,12 +3883,7 @@ int main(int argc, char **argv, char **envp) data_dir[data_dir_idx++] = CONFIG_QEMU_DATADIR; } - /* - * Default to max_cpus = smp_cpus, in case the user doesn't - * specify a max_cpus value. - */ - if (!max_cpus) - max_cpus = smp_cpus; + smp_parse(qemu_opts_find(qemu_find_opts("smp-opts"), NULL)); machine->max_cpus = machine->max_cpus ?: 1; /* Default to UP */ if (smp_cpus > machine->max_cpus) { @@ -4127,13 +4046,32 @@ int main(int argc, char **argv, char **envp) qtest_init(); } - machine_opts = qemu_opts_find(qemu_find_opts("machine"), 0); - if (machine_opts) { - kernel_filename = qemu_opt_get(machine_opts, "kernel"); - initrd_filename = qemu_opt_get(machine_opts, "initrd"); - kernel_cmdline = qemu_opt_get(machine_opts, "append"); - } else { - kernel_filename = initrd_filename = kernel_cmdline = NULL; + machine_opts = qemu_get_machine_opts(); + kernel_filename = qemu_opt_get(machine_opts, "kernel"); + initrd_filename = qemu_opt_get(machine_opts, "initrd"); + kernel_cmdline = qemu_opt_get(machine_opts, "append"); + + boot_order = machine->default_boot_order; + opts = qemu_opts_find(qemu_find_opts("boot-opts"), NULL); + if (opts) { + char *normal_boot_order; + const char *order, *once; + + order = qemu_opt_get(opts, "order"); + if (order) { + validate_bootdevices(order); + boot_order = order; + } + + once = qemu_opt_get(opts, "once"); + if (once) { + validate_bootdevices(once); + normal_boot_order = g_strdup(boot_order); + boot_order = once; + qemu_register_reset(restore_boot_order, normal_boot_order); + } + + boot_menu = qemu_opt_get_bool(opts, "menu", boot_menu); } if (!kernel_cmdline) { @@ -4152,7 +4090,7 @@ int main(int argc, char **argv, char **envp) exit(1); } - if (!linux_boot && machine_opts && qemu_opt_get(machine_opts, "dtb")) { + if (!linux_boot && qemu_opt_get(machine_opts, "dtb")) { fprintf(stderr, "-dtb only allowed with -kernel option\n"); exit(1); } @@ -4300,9 +4238,7 @@ int main(int argc, char **argv, char **envp) qdev_machine_init(); QEMUMachineInitArgs args = { .ram_size = ram_size, - .boot_device = (boot_devices[0] == '\0') ? - machine->boot_order : - boot_devices, + .boot_order = boot_order, .kernel_filename = kernel_filename, .kernel_cmdline = kernel_cmdline, .initrd_filename = initrd_filename, @@ -4334,6 +4270,7 @@ int main(int argc, char **argv, char **envp) /* init local displays */ switch (display_type) { case DT_NOGRAPHIC: + (void)ds; /* avoid warning if no display is configured */ break; #if defined(CONFIG_CURSES) case DT_CURSES: @@ -4368,8 +4305,8 @@ int main(int argc, char **argv, char **envp) vnc_display_init(ds); vnc_display_open(ds, vnc_display, &local_err); if (local_err != NULL) { - fprintf(stderr, "Failed to start VNC server on `%s': %s\n", - vnc_display, error_get_pretty(local_err)); + error_report("Failed to start VNC server on `%s': %s", + vnc_display, error_get_pretty(local_err)); error_free(local_err); exit(1); } @@ -4380,8 +4317,8 @@ int main(int argc, char **argv, char **envp) } #endif #ifdef CONFIG_SPICE - if (using_spice && !qxl_enabled) { - qemu_spice_display_init(ds); + if (using_spice) { + qemu_spice_display_init(); } #endif @@ -4401,6 +4338,9 @@ int main(int argc, char **argv, char **envp) qemu_register_reset(qbus_reset_all_fn, sysbus_get_default()); qemu_run_machine_init_done_notifiers(); + /* Done notifiers can load ROMs */ + rom_load_done(); + qemu_system_reset(VMRESET_SILENT); if (loadvm) { if (load_vmstate(loadvm) < 0) { @@ -4412,7 +4352,8 @@ int main(int argc, char **argv, char **envp) Error *local_err = NULL; qemu_start_incoming_migration(incoming, &local_err); if (local_err) { - fprintf(stderr, "-incoming %s: %s\n", incoming, error_get_pretty(local_err)); + error_report("-incoming %s: %s", incoming, + error_get_pretty(local_err)); error_free(local_err); exit(1); }