#include "qemu/osdep.h"
#include "qemu-common.h"
#include "qemu/units.h"
+#include "hw/boards.h"
#include "hw/qdev-properties.h"
#include "qapi/error.h"
#include "qemu-version.h"
#include "sysemu/runstate.h"
#include "sysemu/seccomp.h"
#include "sysemu/tcg.h"
+#include "sysemu/xen.h"
#include "qemu/error-report.h"
#include "qemu/sockets.h"
Chardev *parallel_hds[MAX_PARALLEL_PORTS];
int win2k_install_hack = 0;
int singlestep = 0;
-int acpi_enabled = 1;
int no_hpet = 0;
int fd_bootchk = 1;
static int no_reboot;
static NotifierList machine_init_done_notifiers =
NOTIFIER_LIST_INITIALIZER(machine_init_done_notifiers);
-bool xen_allowed;
uint32_t xen_domid;
enum xen_mode xen_mode = XEN_EMULATE;
bool xen_domid_restrict;
return NULL;
}
-static void qemu_add_data_dir(const char *path)
+void qemu_add_data_dir(const char *path)
{
int i;
}
sz = QEMU_ALIGN_UP(sz, 8192);
+ if (mc->fixup_ram_size) {
+ sz = mc->fixup_ram_size(sz);
+ }
ram_size = sz;
if (ram_size != sz) {
error_report("ram size too large");
}
object_property_set_int(obj, ms->ram_size, "size", &error_fatal);
object_property_add_child(object_get_objects_root(), mc->default_ram_id,
- obj, &error_fatal);
+ obj);
+ /* Ensure backend's memory region name is equal to mc->default_ram_id */
+ object_property_set_bool(obj, false, "x-use-canonical-path-for-ramblock-id",
+ &error_fatal);
user_creatable_complete(USER_CREATABLE(obj), &error_fatal);
object_unref(obj);
object_property_set_str(OBJECT(ms), mc->default_ram_id, "memory-backend",
}
break;
case QEMU_OPTION_kernel:
- qemu_opts_set(qemu_find_opts("machine"), 0, "kernel", optarg,
+ qemu_opts_set(qemu_find_opts("machine"), NULL, "kernel", optarg,
&error_abort);
break;
case QEMU_OPTION_initrd:
- qemu_opts_set(qemu_find_opts("machine"), 0, "initrd", optarg,
+ qemu_opts_set(qemu_find_opts("machine"), NULL, "initrd", optarg,
&error_abort);
break;
case QEMU_OPTION_append:
- qemu_opts_set(qemu_find_opts("machine"), 0, "append", optarg,
+ qemu_opts_set(qemu_find_opts("machine"), NULL, "append", optarg,
&error_abort);
break;
case QEMU_OPTION_dtb:
- qemu_opts_set(qemu_find_opts("machine"), 0, "dtb", optarg,
+ qemu_opts_set(qemu_find_opts("machine"), NULL, "dtb", optarg,
&error_abort);
break;
case QEMU_OPTION_cdrom:
}
break;
case QEMU_OPTION_bios:
- qemu_opts_set(qemu_find_opts("machine"), 0, "firmware", optarg,
+ qemu_opts_set(qemu_find_opts("machine"), NULL, "firmware", optarg,
&error_abort);
break;
case QEMU_OPTION_singlestep:
vnc_parse(optarg, &error_fatal);
break;
case QEMU_OPTION_no_acpi:
- acpi_enabled = 0;
+ olist = qemu_find_opts("machine");
+ qemu_opts_parse_noisily(olist, "acpi=off", false);
break;
case QEMU_OPTION_no_hpet:
no_hpet = 1;
no_shutdown = 1;
break;
case QEMU_OPTION_show_cursor:
- warn_report("The -show-cursor option is deprecated, "
- "use -display {sdl,gtk},show-cursor=on instead");
+ warn_report("The -show-cursor option is deprecated. Please "
+ "add show-cursor=on to your -display options.");
+ warn_report("When using the default display you can use "
+ "-display default,show-cursor=on");
dpy.has_show_cursor = true;
dpy.show_cursor = true;
break;
*/
loc_set_none();
+ /*
+ * Check for -cpu help and -device help before we call select_machine(),
+ * which will return an error if the architecture has no default machine
+ * type and the user did not specify one, so that the user doesn't need
+ * to say '-cpu help -machine something'.
+ */
+ if (cpu_option && is_help_option(cpu_option)) {
+ list_cpus(cpu_option);
+ exit(0);
+ }
+
+ if (qemu_opts_foreach(qemu_find_opts("device"),
+ device_help_func, NULL, NULL)) {
+ exit(0);
+ }
+
user_register_global_props();
replay_configure(icount_opts);
exit(0);
}
object_property_add_child(object_get_root(), "machine",
- OBJECT(current_machine), &error_abort);
+ OBJECT(current_machine));
object_property_add_child(container_get(OBJECT(current_machine),
"/unattached"),
- "sysbus", OBJECT(sysbus_get_default()),
- NULL);
+ "sysbus", OBJECT(sysbus_get_default()));
if (machine_class->minimum_page_bits) {
if (!set_preferred_target_page_bits(machine_class->minimum_page_bits)) {
qemu_set_hw_version(machine_class->hw_version);
}
- if (cpu_option && is_help_option(cpu_option)) {
- list_cpus(cpu_option);
- exit(0);
- }
-
if (!trace_init_backends()) {
exit(1);
}
current_machine->smp.max_cpus = machine_class->default_cpus;
current_machine->smp.cores = 1;
current_machine->smp.threads = 1;
+ current_machine->smp.sockets = 1;
machine_class->smp_parse(current_machine,
qemu_opts_find(qemu_find_opts("smp-opts"), NULL));
fsdev_init_func, NULL, &error_fatal);
#endif
- if (qemu_opts_foreach(qemu_find_opts("device"),
- device_help_func, NULL, NULL)) {
- exit(0);
- }
-
/*
* Note: we need to create block backends before
* machine_set_property(), so machine properties can refer to
machine_opts = qemu_get_machine_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;
/*
* Note: uses machine properties such as kernel-irqchip, must run
backend = object_resolve_path_type(current_machine->ram_memdev_id,
TYPE_MEMORY_BACKEND, NULL);
+ if (!backend) {
+ error_report("Memory backend '%s' not found",
+ current_machine->ram_memdev_id);
+ exit(EXIT_FAILURE);
+ }
backend_size = object_property_get_uint(backend, "size", &error_abort);
if (have_custom_ram_size && backend_size != ram_size) {
error_report("Size specified by -m option must match size of "
"explicitly specified 'memory-backend' property");
exit(EXIT_FAILURE);
}
+ if (mem_path) {
+ error_report("'-mem-path' can't be used together with"
+ "'-machine memory-backend'");
+ exit(EXIT_FAILURE);
+ }
ram_size = backend_size;
}
}
}
- current_machine->ram_size = ram_size;
- current_machine->maxram_size = maxram_size;
- current_machine->ram_slots = ram_slots;
-
parse_numa_opts(current_machine);
+ /* do monitor/qmp handling at preconfig state if requested */
+ qemu_main_loop();
+
if (machine_class->default_ram_id && current_machine->ram_size &&
numa_uses_legacy_mem() && !current_machine->ram_memdev_id) {
create_default_memdev(current_machine, mem_path);
}
- /* do monitor/qmp handling at preconfig state if requested */
- qemu_main_loop();
audio_init_audiodevs();