#include "hw/boards.h"
#include "hw/usb.h"
#include "hw/pcmcia.h"
-#include "hw/pc.h"
-#include "hw/isa.h"
+#include "hw/i386/pc.h"
+#include "hw/isa/isa.h"
#include "hw/bt.h"
-#include "hw/watchdog.h"
-#include "hw/smbios.h"
-#include "hw/xen.h"
+#include "sysemu/watchdog.h"
+#include "hw/i386/smbios.h"
+#include "hw/xen/xen.h"
#include "hw/qdev.h"
#include "hw/loader.h"
#include "monitor/qdev.h"
-#include "bt/bt.h"
+#include "sysemu/bt.h"
#include "net/net.h"
#include "net/slirp.h"
#include "monitor/monitor.h"
#include "sysemu/sysemu.h"
#include "exec/gdbstub.h"
#include "qemu/timer.h"
-#include "char/char.h"
+#include "sysemu/char.h"
#include "qemu/cache-utils.h"
#include "sysemu/blockdev.h"
-#include "hw/block-common.h"
+#include "hw/block/block.h"
#include "migration/block.h"
-#include "tpm/tpm.h"
+#include "sysemu/tpm.h"
#include "sysemu/dma.h"
#include "audio/audio.h"
#include "migration/migration.h"
NOTIFIER_LIST_INITIALIZER(machine_init_done_notifiers);
static bool tcg_allowed = true;
-bool kvm_allowed;
bool xen_allowed;
uint32_t xen_domid;
enum xen_mode xen_mode = XEN_EMULATE;
.name = "tpmdev",
.implied_opt_name = "type",
.head = QTAILQ_HEAD_INITIALIZER(qemu_tpmdev_opts.head),
+ .desc = {
+ /* options are defined in the TPM backends */
+ { /* end of list */ }
+ },
+};
+
+static QemuOptsList qemu_realtime_opts = {
+ .name = "realtime",
+ .head = QTAILQ_HEAD_INITIALIZER(qemu_realtime_opts.head),
.desc = {
{
- .name = "type",
- .type = QEMU_OPT_STRING,
- .help = "Type of TPM backend",
- },
- {
- .name = "cancel-path",
- .type = QEMU_OPT_STRING,
- .help = "Sysfs file entry for canceling TPM commands",
- },
- {
- .name = "path",
- .type = QEMU_OPT_STRING,
- .help = "Path to TPM device on the host",
+ .name = "mlock",
+ .type = QEMU_OPT_BOOL,
},
{ /* end of list */ }
},
{ RUN_STATE_RUNNING, RUN_STATE_SAVE_VM },
{ RUN_STATE_RUNNING, RUN_STATE_SHUTDOWN },
{ RUN_STATE_RUNNING, RUN_STATE_WATCHDOG },
+ { RUN_STATE_RUNNING, RUN_STATE_GUEST_PANICKED },
{ RUN_STATE_SAVE_VM, RUN_STATE_RUNNING },
{ 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_FINISH_MIGRATE },
+
{ RUN_STATE_MAX, RUN_STATE_MAX },
};
return runstate_check(RUN_STATE_RUNNING);
}
+bool runstate_needs_reset(void)
+{
+ return runstate_check(RUN_STATE_INTERNAL_ERROR) ||
+ runstate_check(RUN_STATE_SHUTDOWN) ||
+ runstate_check(RUN_STATE_GUEST_PANICKED);
+}
+
StatusInfo *qmp_query_status(Error **errp)
{
StatusInfo *info = g_malloc0(sizeof(*info));
return info;
}
-int64_t qmp_query_cpu_max(Error **errp)
-{
- return current_machine->max_cpus;
-}
-
/***********************************************************/
/* real time host monotonic timer */
node = g_malloc0(sizeof(FWBootEntry));
node->bootindex = bootindex;
- node->suffix = suffix ? g_strdup(suffix) : NULL;
+ node->suffix = g_strdup(suffix);
node->dev = dev;
QTAILQ_FOREACH(i, &fw_boot_order, link) {
QTAILQ_INSERT_TAIL(&fw_boot_order, node, link);
}
+DeviceState *get_boot_device(uint32_t position)
+{
+ uint32_t counter = 0;
+ FWBootEntry *i = NULL;
+ DeviceState *res = NULL;
+
+ if (!QTAILQ_EMPTY(&fw_boot_order)) {
+ QTAILQ_FOREACH(i, &fw_boot_order, link) {
+ if (counter == position) {
+ res = i->dev;
+ break;
+ }
+ counter++;
+ }
+ }
+ return res;
+}
+
/*
* This function returns null terminated string that consist of new line
* separated device paths.
max_cpus = smp_cpus;
}
+static void configure_realtime(QemuOpts *opts)
+{
+ bool enable_mlock;
+
+ enable_mlock = qemu_opt_get_bool(opts, "mlock", true);
+
+ if (enable_mlock) {
+ if (os_mlock() < 0) {
+ fprintf(stderr, "qemu: locking memory failed\n");
+ exit(1);
+ }
+ }
+}
+
/***********************************************************/
/* USB devices */
}
info->name = g_strdup(m->name);
+ info->cpu_max = !m->max_cpus ? 1 : m->max_cpus;
entry = g_malloc0(sizeof(*entry));
entry->value = info;
/***********************************************************/
/* main execution loop */
-static void gui_update(void *opaque)
-{
- uint64_t interval = GUI_REFRESH_INTERVAL;
- DisplayState *ds = opaque;
- DisplayChangeListener *dcl;
-
- dpy_refresh(ds);
-
- QLIST_FOREACH(dcl, &ds->listeners, next) {
- if (dcl->gui_timer_interval &&
- dcl->gui_timer_interval < interval)
- interval = dcl->gui_timer_interval;
- }
- qemu_mod_timer(ds->gui_timer, interval + qemu_get_clock_ms(rt_clock));
-}
-
-void gui_setup_refresh(DisplayState *ds)
-{
- DisplayChangeListener *dcl;
- bool need_timer = false;
- bool have_gfx = false;
- bool have_text = false;
-
- QLIST_FOREACH(dcl, &ds->listeners, next) {
- if (dcl->ops->dpy_refresh != NULL) {
- need_timer = true;
- }
- if (dcl->ops->dpy_gfx_update != NULL) {
- have_gfx = true;
- }
- if (dcl->ops->dpy_text_update != NULL) {
- have_text = true;
- }
- }
-
- if (need_timer && ds->gui_timer == NULL) {
- ds->gui_timer = qemu_new_timer_ms(rt_clock, gui_update, ds);
- qemu_mod_timer(ds->gui_timer, qemu_get_clock_ms(rt_clock));
- }
- if (!need_timer && ds->gui_timer != NULL) {
- qemu_del_timer(ds->gui_timer);
- qemu_free_timer(ds->gui_timer);
- ds->gui_timer = NULL;
- }
-
- ds->have_gfx = have_gfx;
- ds->have_text = have_text;
-}
-
struct vm_change_state_entry {
VMChangeStateHandler *cb;
void *opaque;
cpu_synchronize_all_states();
qemu_system_reset(VMRESET_REPORT);
resume_all_vcpus();
- if (runstate_check(RUN_STATE_INTERNAL_ERROR) ||
- runstate_check(RUN_STATE_SHUTDOWN)) {
+ if (runstate_needs_reset()) {
runstate_set(RUN_STATE_PAUSED);
}
}
int64_t ti;
#endif
do {
- nonblocking = !kvm_enabled() && last_io > 0;
+ nonblocking = !kvm_enabled() && !xen_enabled() && last_io > 0;
#ifdef CONFIG_PROFILER
ti = profile_getclock();
#endif
qemu_opt_set(bus_opts, "driver", "virtio-serial-s390");
} else {
qemu_opt_set(bus_opts, "driver", "virtio-serial-pci");
- }
+ }
dev_opts = qemu_opts_create_nofail(device);
qemu_opt_set(dev_opts, "driver", "virtconsole");
}
static int debugcon_parse(const char *devname)
-{
+{
QemuOpts *opts;
if (!qemu_chr_new("debugcon", devname, NULL)) {
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);
runstate_init();
add_device_config(DEV_BT, optarg);
break;
case QEMU_OPTION_audio_help:
- if (!(audio_available())) {
- printf("Option %s not supported for this target\n", popt->name);
- exit(1);
- }
AUD_help ();
exit (0);
break;
case QEMU_OPTION_soundhw:
- if (!(audio_available())) {
- printf("Option %s not supported for this target\n", popt->name);
- exit(1);
- }
select_soundhw (optarg);
break;
case QEMU_OPTION_h:
break;
}
case QEMU_OPTION_monitor:
- monitor_parse(optarg, "readline");
default_monitor = 0;
+ if (strncmp(optarg, "none", 4)) {
+ monitor_parse(optarg, "readline");
+ }
break;
case QEMU_OPTION_qmp:
monitor_parse(optarg, "control");
break;
}
case QEMU_OPTION_acpitable:
- do_acpitable_option(optarg);
+ opts = qemu_opts_parse(qemu_find_opts("acpi"), optarg, 1);
+ g_assert(opts != NULL);
+ do_acpitable_option(opts);
break;
case QEMU_OPTION_smbios:
do_smbios_option(optarg);
}
p += 8;
os_set_proc_name(p);
- }
- }
+ }
+ }
break;
case QEMU_OPTION_prom_env:
if (nb_prom_envs >= MAX_PROM_ENVS) {
exit(1);
}
break;
+ case QEMU_OPTION_realtime:
+ opts = qemu_opts_parse(qemu_find_opts("realtime"), optarg, 0);
+ if (!opts) {
+ exit(1);
+ }
+ configure_realtime(opts);
+ break;
default:
os_parse_cmd_args(popt->index, optarg);
}
configure_accelerator();
+ if (!qtest_enabled() && qtest_chrdev) {
+ qtest_init();
+ }
+
machine_opts = qemu_opts_find(qemu_find_opts("machine"), 0);
if (machine_opts) {
kernel_filename = qemu_opt_get(machine_opts, "kernel");
.cpu_model = cpu_model };
machine->init(&args);
+ audio_init();
+
cpu_synchronize_all_post_init();
set_numa_modes();
net_check_clients();
- /* just use the first displaystate for the moment */
- ds = get_displaystate();
+ ds = init_displaystate();
/* init local displays */
switch (display_type) {
}
#endif
- /* display setup */
- text_consoles_set_display(ds);
-
if (foreach_device_config(DEV_GDB, gdbserver_start) < 0) {
exit(1);
}
os_setup_post();
- resume_all_vcpus();
main_loop();
bdrv_close_all();
pause_all_vcpus();