Chardev *sclp_hds[MAX_SCLP_CONSOLES];
int win2k_install_hack = 0;
int singlestep = 0;
-int smp_cpus = 1;
-int max_cpus = 1;
+int smp_cpus;
+unsigned int max_cpus;
int smp_cores = 1;
int smp_threads = 1;
int acpi_enabled = 1;
return NULL;
}
+static void qemu_add_data_dir(const char *path)
+{
+ int i;
+
+ if (path == NULL) {
+ return;
+ }
+ if (data_dir_idx == ARRAY_SIZE(data_dir)) {
+ return;
+ }
+ for (i = 0; i < data_dir_idx; i++) {
+ if (strcmp(data_dir[i], path) == 0) {
+ return; /* duplicate */
+ }
+ }
+ data_dir[data_dir_idx++] = path;
+}
+
static inline bool nonempty_str(const char *str)
{
return str && *str;
*/
static bool object_create_initial(const char *type)
{
- if (g_str_equal(type, "rng-egd")) {
+ if (g_str_equal(type, "rng-egd") ||
+ g_str_has_prefix(type, "pr-manager-")) {
return false;
}
const char *qtest_log = NULL;
const char *pid_file = NULL;
const char *incoming = NULL;
- bool defconfig = true;
bool userconfig = true;
bool nographic = false;
DisplayType display_type = DT_DEFAULT;
Error *main_loop_err = NULL;
Error *err = NULL;
bool list_data_dirs = false;
+ char **dirs;
typedef struct BlockdevOptions_queue {
BlockdevOptions *bdo;
Location loc;
popt = lookup_opt(argc, argv, &optarg, &optind);
switch (popt->index) {
case QEMU_OPTION_nodefconfig:
- defconfig = false;
- break;
case QEMU_OPTION_nouserconfig:
userconfig = false;
break;
}
}
- if (defconfig && userconfig) {
+ if (userconfig) {
if (qemu_read_default_config_file() < 0) {
exit(1);
}
case QEMU_OPTION_L:
if (is_help_option(optarg)) {
list_data_dirs = true;
- } else if (data_dir_idx < ARRAY_SIZE(data_dir)) {
- data_dir[data_dir_idx++] = optarg;
+ } else {
+ qemu_add_data_dir(optarg);
}
break;
case QEMU_OPTION_bios:
qemu_set_log(0);
}
- /* If no data_dir is specified then try to find it relative to the
- executable path. */
- if (data_dir_idx < ARRAY_SIZE(data_dir)) {
- data_dir[data_dir_idx] = os_find_datadir();
- if (data_dir[data_dir_idx] != NULL) {
- data_dir_idx++;
- }
- }
- /* If all else fails use the install path specified when building. */
- if (data_dir_idx < ARRAY_SIZE(data_dir)) {
- data_dir[data_dir_idx++] = CONFIG_QEMU_DATADIR;
+ /* add configured firmware directories */
+ dirs = g_strsplit(CONFIG_QEMU_FIRMWAREPATH, G_SEARCHPATH_SEPARATOR_S, 0);
+ for (i = 0; dirs[i] != NULL; i++) {
+ qemu_add_data_dir(dirs[i]);
}
+ /* try to find datadir relative to the executable path */
+ qemu_add_data_dir(os_find_datadir());
+
+ /* add the datadir specified when building */
+ qemu_add_data_dir(CONFIG_QEMU_DATADIR);
+
/* -L help lists the data directories and exits. */
if (list_data_dirs) {
for (i = 0; i < data_dir_idx; i++) {
exit(0);
}
+ /* machine_class: default to UP */
+ machine_class->max_cpus = machine_class->max_cpus ?: 1;
+ machine_class->min_cpus = machine_class->min_cpus ?: 1;
+ machine_class->default_cpus = machine_class->default_cpus ?: 1;
+
+ /* default to machine_class->default_cpus */
+ smp_cpus = machine_class->default_cpus;
+ max_cpus = machine_class->default_cpus;
+
smp_parse(qemu_opts_find(qemu_find_opts("smp-opts"), NULL));
- machine_class->max_cpus = machine_class->max_cpus ?: 1; /* Default to UP */
+ /* sanity-check smp_cpus and max_cpus against machine_class */
+ if (smp_cpus < machine_class->min_cpus) {
+ error_report("Invalid SMP CPUs %d. The min CPUs "
+ "supported by machine '%s' is %d", smp_cpus,
+ machine_class->name, machine_class->min_cpus);
+ exit(1);
+ }
if (max_cpus > machine_class->max_cpus) {
- error_report("Number of SMP CPUs requested (%d) exceeds max CPUs "
- "supported by machine '%s' (%d)", max_cpus,
+ error_report("Invalid SMP CPUs %d. The max CPUs "
+ "supported by machine '%s' is %d", max_cpus,
machine_class->name, machine_class->max_cpus);
exit(1);
}
exit(1);
}
-#ifdef CONFIG_TPM
if (tpm_init() < 0) {
exit(1);
}
-#endif
/* init the bluetooth world */
if (foreach_device_config(DEV_BT, bt_parse))
default_drive(default_floppy, snapshot, IF_FLOPPY, 0, FD_OPTS);
default_drive(default_sdcard, snapshot, IF_SD, 0, SD_OPTS);
- parse_numa_opts(current_machine);
-
if (qemu_opts_foreach(qemu_find_opts("mon"),
mon_init_func, NULL, NULL)) {
exit(1);
current_machine->boot_order = boot_order;
current_machine->cpu_model = cpu_model;
+ parse_numa_opts(current_machine);
/* parse features once if machine provides default cpu_type */
if (machine_class->default_cpu_type) {
res_free();
/* vhost-user must be cleaned up before chardevs. */
+ tpm_cleanup();
net_cleanup();
audio_cleanup();
monitor_cleanup();