*/
#include "qemu/osdep.h"
+#include "qemu/units.h"
#include "qapi/error.h"
#include "qemu-version.h"
#include "qemu/cutils.h"
const char *mem_path = NULL;
int mem_prealloc = 0; /* force preallocation of physical target memory */
bool enable_mlock = false;
+bool enable_cpu_pm = false;
int nb_nics;
NICInfo nd_table[MAX_NICS];
int autostart;
},
};
+static QemuOptsList qemu_overcommit_opts = {
+ .name = "overcommit",
+ .head = QTAILQ_HEAD_INITIALIZER(qemu_overcommit_opts.head),
+ .desc = {
+ {
+ .name = "mem-lock",
+ .type = QEMU_OPT_BOOL,
+ },
+ {
+ .name = "cpu-pm",
+ .type = QEMU_OPT_BOOL,
+ },
+ { /* end of list */ }
+ },
+};
+
static QemuOptsList qemu_msg_opts = {
.name = "msg",
.head = QTAILQ_HEAD_INITIALIZER(qemu_msg_opts.head),
} else {
qemu_devices_reset();
}
- if (reason) {
+ if (reason != SHUTDOWN_CAUSE_SUBSYSTEM_RESET) {
qapi_event_send_reset(shutdown_caused_by_guest(reason),
&error_abort);
}
void qemu_system_reset_request(ShutdownCause reason)
{
- if (no_reboot) {
+ if (no_reboot && reason != SHUTDOWN_CAUSE_SUBSYSTEM_RESET) {
shutdown_requested = reason;
} else {
reset_requested = reason;
}
}
-static int balloon_parse(const char *arg)
-{
- QemuOpts *opts;
-
- warn_report("This option is deprecated. "
- "Use '--device virtio-balloon' to enable the balloon device.");
-
- if (strcmp(arg, "none") == 0) {
- return 0;
- }
-
- if (!strncmp(arg, "virtio", 6)) {
- if (arg[6] == ',') {
- /* have params -> parse them */
- opts = qemu_opts_parse_noisily(qemu_find_opts("device"), arg + 7,
- false);
- if (!opts)
- return -1;
- } else {
- /* create empty opts */
- opts = qemu_opts_create(qemu_find_opts("device"), NULL, 0,
- &error_abort);
- }
- qemu_opt_set(opts, "driver", "virtio-balloon", &error_abort);
- return 0;
- }
-
- return -1;
-}
-
char *qemu_find_file(int type, const char *name)
{
int i;
if (mc->alias) {
printf("%-20s %s (alias of %s)\n", mc->alias, mc->desc, mc->name);
}
- printf("%-20s %s%s\n", mc->name, mc->desc,
- mc->is_default ? " (default)" : "");
+ printf("%-20s %s%s%s\n", mc->name, mc->desc,
+ mc->is_default ? " (default)" : "",
+ mc->deprecation_reason ? " (deprecated)" : "");
}
}
if (g_ascii_isdigit(mem_str[strlen(mem_str) - 1])) {
uint64_t overflow_check = sz;
- sz <<= 20;
- if ((sz >> 20) != overflow_check) {
+ sz *= MiB;
+ if (sz / MiB != overflow_check) {
error_report("too large 'size' option value");
exit(EXIT_FAILURE);
}
qemu_add_opts(&qemu_object_opts);
qemu_add_opts(&qemu_tpmdev_opts);
qemu_add_opts(&qemu_realtime_opts);
+ qemu_add_opts(&qemu_overcommit_opts);
qemu_add_opts(&qemu_msg_opts);
qemu_add_opts(&qemu_name_opts);
qemu_add_opts(&qemu_numa_opts);
popt = lookup_opt(argc, argv, &optarg, &optind);
switch (popt->index) {
- case QEMU_OPTION_nodefconfig:
case QEMU_OPTION_nouserconfig:
userconfig = false;
break;
qemu_opts_parse_noisily(olist, "accel=kvm", false);
break;
case QEMU_OPTION_enable_hax:
+ warn_report("Option is deprecated, use '-accel hax' instead");
olist = qemu_find_opts("machine");
qemu_opts_parse_noisily(olist, "accel=hax", false);
break;
case QEMU_OPTION_no_hpet:
no_hpet = 1;
break;
- case QEMU_OPTION_balloon:
- if (balloon_parse(optarg) < 0) {
- error_report("unknown -balloon argument %s", optarg);
- exit(1);
- }
- break;
case QEMU_OPTION_no_reboot:
no_reboot = 1;
break;
if (!opts) {
exit(1);
}
- enable_mlock = qemu_opt_get_bool(opts, "mlock", true);
+ /* Don't override the -overcommit option if set */
+ enable_mlock = enable_mlock ||
+ qemu_opt_get_bool(opts, "mlock", true);
+ break;
+ case QEMU_OPTION_overcommit:
+ opts = qemu_opts_parse_noisily(qemu_find_opts("overcommit"),
+ optarg, false);
+ if (!opts) {
+ exit(1);
+ }
+ /* Don't override the -realtime option if set */
+ enable_mlock = enable_mlock ||
+ qemu_opt_get_bool(opts, "mem-lock", false);
+ enable_cpu_pm = qemu_opt_get_bool(opts, "cpu-pm", false);
break;
case QEMU_OPTION_msg:
opts = qemu_opts_parse_noisily(qemu_find_opts("msg"), optarg,
exit(1);
}
break;
- case QEMU_OPTION_nodefconfig:
+ case QEMU_OPTION_enable_sync_profile:
+ qsp_enable();
+ break;
case QEMU_OPTION_nouserconfig:
/* Nothing to be parsed here. Especially, do not error out below. */
break;
configure_accelerator(current_machine);
+ if (!qtest_enabled() && machine_class->deprecation_reason) {
+ error_report("Machine type '%s' is deprecated: %s",
+ machine_class->name, machine_class->deprecation_reason);
+ }
+
/*
* Register all the global properties, including accel properties,
* machine properties, and user-specified ones.
* (2) CONFIG_SLIRP not set, in which case the implicit "-net nic"
* sets up a nic that isn't connected to anything.
*/
- if (!default_net) {
+ if (!default_net && (!qtest_enabled() || has_defaults)) {
net_check_clients();
}
-
if (boot_once) {
qemu_boot_set(boot_once, &error_fatal);
qemu_register_reset(restore_boot_order, g_strdup(boot_order));