#include "qemu-version.h"
#include "qemu/cutils.h"
#include "qemu/help_option.h"
+#include "qemu/uuid.h"
#ifdef CONFIG_SECCOMP
#include "sysemu/seccomp.h"
#include "crypto/init.h"
#include "sysemu/replay.h"
#include "qapi/qmp/qerror.h"
+#include "sysemu/iothread.h"
#define MAX_VIRTIO_CONSOLES 1
#define MAX_SCLP_CONSOLES 1
int icount_align_option;
-/* The bytes in qemu_uuid[] are in the order specified by RFC4122, _not_ in the
+/* The bytes in qemu_uuid are in the order specified by RFC4122, _not_ in the
* little-endian "wire format" described in the SMBIOS 2.6 specification.
*/
-uint8_t qemu_uuid[16];
+QemuUUID qemu_uuid;
bool qemu_uuid_set;
static NotifierList exit_notifiers =
},
};
+#ifdef CONFIG_LIBISCSI
+static QemuOptsList qemu_iscsi_opts = {
+ .name = "iscsi",
+ .head = QTAILQ_HEAD_INITIALIZER(qemu_iscsi_opts.head),
+ .desc = {
+ {
+ .name = "user",
+ .type = QEMU_OPT_STRING,
+ .help = "username for CHAP authentication to target",
+ },{
+ .name = "password",
+ .type = QEMU_OPT_STRING,
+ .help = "password for CHAP authentication to target",
+ },{
+ .name = "password-secret",
+ .type = QEMU_OPT_STRING,
+ .help = "ID of the secret providing password for CHAP "
+ "authentication to target",
+ },{
+ .name = "header-digest",
+ .type = QEMU_OPT_STRING,
+ .help = "HeaderDigest setting. "
+ "{CRC32C|CRC32C-NONE|NONE-CRC32C|NONE}",
+ },{
+ .name = "initiator-name",
+ .type = QEMU_OPT_STRING,
+ .help = "Initiator iqn name to use when connecting",
+ },{
+ .name = "timeout",
+ .type = QEMU_OPT_NUMBER,
+ .help = "Request timeout in seconds (default 0 = no timeout)",
+ },
+ { /* end of list */ }
+ },
+};
+#endif
+
/**
* Get machine options
*
if (runstate_is_running()) {
qapi_event_send_stop(&error_abort);
} else {
+ replay_enable_events();
cpu_enable_ticks();
runstate_set(RUN_STATE_RUNNING);
vm_state_notify(1, RUN_STATE_RUNNING);
*/
error_report("terminating on signal %d", shutdown_signal);
} else {
- error_report("terminating on signal %d from pid " FMT_pid,
- shutdown_signal, shutdown_pid);
+ char *shutdown_cmd = qemu_get_pid_name(shutdown_pid);
+
+ error_report("terminating on signal %d from pid " FMT_pid " (%s)",
+ shutdown_signal, shutdown_pid,
+ shutdown_cmd ? shutdown_cmd : "<unknown process>");
+ g_free(shutdown_cmd);
}
shutdown_signal = -1;
}
static void version(void)
{
- printf("QEMU emulator version " QEMU_VERSION QEMU_PKGVERSION ", Copyright (c) 2003-2008 Fabrice Bellard\n");
+ printf("QEMU emulator version " QEMU_VERSION QEMU_PKGVERSION "\n"
+ QEMU_COPYRIGHT "\n");
}
static void help(int exitcode)
{
Error *local_err = NULL;
- qemu_chr_new_from_opts(opts, NULL, &local_err);
+ qemu_chr_new_from_opts(opts, &local_err);
if (local_err) {
error_report_err(local_err);
return -1;
exit(1);
}
- qemu_chr_fe_claim_no_fail(chr);
monitor_init(chr, flags);
return 0;
}
exit(1);
}
snprintf(label, sizeof(label), "serial%d", index);
- serial_hds[index] = qemu_chr_new(label, devname, NULL);
+ serial_hds[index] = qemu_chr_new(label, devname);
if (!serial_hds[index]) {
error_report("could not connect serial device"
" to character backend '%s'", devname);
exit(1);
}
snprintf(label, sizeof(label), "parallel%d", index);
- parallel_hds[index] = qemu_chr_new(label, devname, NULL);
+ parallel_hds[index] = qemu_chr_new(label, devname);
if (!parallel_hds[index]) {
error_report("could not connect parallel device"
" to character backend '%s'", devname);
qemu_opt_set(dev_opts, "driver", "virtconsole", &error_abort);
snprintf(label, sizeof(label), "virtcon%d", index);
- virtcon_hds[index] = qemu_chr_new(label, devname, NULL);
+ virtcon_hds[index] = qemu_chr_new(label, devname);
if (!virtcon_hds[index]) {
error_report("could not connect virtio console"
" to character backend '%s'", devname);
qemu_opt_set(dev_opts, "driver", "sclpconsole", &error_abort);
snprintf(label, sizeof(label), "sclpcon%d", index);
- sclp_hds[index] = qemu_chr_new(label, devname, NULL);
+ sclp_hds[index] = qemu_chr_new(label, devname);
if (!sclp_hds[index]) {
error_report("could not connect sclp console"
" to character backend '%s'", devname);
{
QemuOpts *opts;
- if (!qemu_chr_new("debugcon", devname, NULL)) {
+ if (!qemu_chr_new("debugcon", devname)) {
exit(1);
}
opts = qemu_opts_create(qemu_find_opts("device"), "debugcon", 1, NULL);
{
Object *obj = OBJECT(opaque);
Error *local_err = NULL;
- char *c, *qom_name;
+ char *p, *qom_name;
if (strcmp(name, "type") == 0) {
return 0;
}
qom_name = g_strdup(name);
- c = qom_name;
- while (*c++) {
- if (*c == '_') {
- *c = '-';
+ for (p = qom_name; *p; p++) {
+ if (*p == '_') {
+ *p = '-';
}
}
if (g_str_equal(type, "filter-buffer") ||
g_str_equal(type, "filter-dump") ||
g_str_equal(type, "filter-mirror") ||
- g_str_equal(type, "filter-redirector")) {
+ g_str_equal(type, "filter-redirector") ||
+ g_str_equal(type, "colo-compare") ||
+ g_str_equal(type, "filter-rewriter")) {
+ return false;
+ }
+
+ /* Memory allocation by backends needs to be done
+ * after configure_accelerator() (due to the tcg_enabled()
+ * checks at memory_region_init_*()).
+ *
+ * Also, allocation of large amounts of memory may delay
+ * chardev initialization for too long, and trigger timeouts
+ * on software that waits for a monitor socket to be created
+ * (e.g. libvirt).
+ */
+ if (g_str_has_prefix(type, "memory-backend-")) {
return false;
}
g->property = qemu_opt_get(opts, "property");
g->value = qemu_opt_get(opts, "value");
g->user_provided = true;
+ g->errp = &error_fatal;
qdev_prop_register_global(g);
return 0;
}
Error *err = NULL;
bool list_data_dirs = false;
+ module_call_init(MODULE_INIT_TRACE);
+
+ qemu_init_cpu_list();
qemu_init_cpu_loop();
qemu_mutex_lock_iothread();
qemu_init_exec_dir(argv[0]);
module_call_init(MODULE_INIT_QOM);
+ module_call_init(MODULE_INIT_QAPI);
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_drive_opts(&bdrv_runtime_opts);
qemu_add_opts(&qemu_chardev_opts);
qemu_add_opts(&qemu_device_opts);
qemu_add_opts(&qemu_netdev_opts);
qemu_add_opts(&qemu_icount_opts);
qemu_add_opts(&qemu_semihosting_config_opts);
qemu_add_opts(&qemu_fw_cfg_opts);
+#ifdef CONFIG_LIBISCSI
+ qemu_add_opts(&qemu_iscsi_opts);
+#endif
module_call_init(MODULE_INIT_OPTS);
runstate_init();
cursor_hide = 0;
break;
case QEMU_OPTION_uuid:
- if(qemu_uuid_parse(optarg, qemu_uuid) < 0) {
+ if (qemu_uuid_parse(optarg, &qemu_uuid) < 0) {
error_report("failed to parse UUID string: wrong format");
exit(1);
}
}
object_property_add_child(object_get_root(), "machine",
OBJECT(current_machine), &error_abort);
+
+ if (machine_class->minimum_page_bits) {
+ if (!set_preferred_target_page_bits(machine_class->minimum_page_bits)) {
+ /* This would be a board error: specifying a minimum smaller than
+ * a target's compile-time fixed setting.
+ */
+ g_assert_not_reached();
+ }
+ }
+
cpu_exec_init_all();
if (machine_class->hw_version) {
exit(1);
}
- if (!linux_boot && qemu_opt_get(machine_opts, "dtb")) {
- error_report("-dtb only allowed with -kernel option");
- exit(1);
- }
-
if (semihosting_enabled() && !semihosting_get_argc() && kernel_filename) {
/* fall back to the -kernel/-append */
semihosting_arg_fallback(kernel_filename, kernel_cmdline);
qemu_opts_del(icount_opts);
}
- /* clean up network at qemu process termination */
- atexit(&net_cleanup);
-
if (default_net) {
QemuOptsList *net = qemu_find_opts("net");
qemu_opts_set(net, NULL, "type", "nic", &error_abort);
main_loop();
replay_disable_events();
+ iothread_stop_all();
bdrv_close_all();
pause_all_vcpus();
res_free();
-#ifdef CONFIG_TPM
- tpm_cleanup();
-#endif
+
+ /* vhost-user must be cleaned up before chardevs. */
+ net_cleanup();
+ audio_cleanup();
+ monitor_cleanup();
+ qemu_chr_cleanup();
return 0;
}