vl: configure accelerators from -accel options

Drop the "accel" property from MachineState, and instead desugar
"-machine accel=" to a list of "-accel" options.

This has a semantic change due to removing merge_lists from -accel.
For example:

- "-accel kvm -accel tcg" all but ignored "-accel kvm".  This is a bugfix.

- "-accel kvm -accel thread=single" ignored "thread=single", since it
  applied the option to KVM.  Now it fails due to not specifying the
  accelerator on "-accel thread=single".

- "-accel tcg -accel thread=single" chose single-threaded TCG, while now
  it will fail due to not specifying the accelerator on "-accel
  thread=single".

Also, "-machine accel" and "-accel" become incompatible.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Paolo Bonzini 2019-11-13 10:10:47 +01:00
parent e5db4bd863
commit 6f6e1698a6
14 changed files with 85 additions and 97 deletions

View File

@ -178,21 +178,6 @@ GlobalProperty hw_compat_2_1[] = {
}; };
const size_t hw_compat_2_1_len = G_N_ELEMENTS(hw_compat_2_1); const size_t hw_compat_2_1_len = G_N_ELEMENTS(hw_compat_2_1);
static char *machine_get_accel(Object *obj, Error **errp)
{
MachineState *ms = MACHINE(obj);
return g_strdup(ms->accel);
}
static void machine_set_accel(Object *obj, const char *value, Error **errp)
{
MachineState *ms = MACHINE(obj);
g_free(ms->accel);
ms->accel = g_strdup(value);
}
static void machine_set_kernel_irqchip(Object *obj, Visitor *v, static void machine_set_kernel_irqchip(Object *obj, Visitor *v,
const char *name, void *opaque, const char *name, void *opaque,
Error **errp) Error **errp)
@ -813,11 +798,6 @@ static void machine_class_init(ObjectClass *oc, void *data)
mc->numa_mem_align_shift = 23; mc->numa_mem_align_shift = 23;
mc->numa_auto_assign_ram = numa_default_auto_assign_ram; mc->numa_auto_assign_ram = numa_default_auto_assign_ram;
object_class_property_add_str(oc, "accel",
machine_get_accel, machine_set_accel, &error_abort);
object_class_property_set_description(oc, "accel",
"Accelerator list", &error_abort);
object_class_property_add(oc, "kernel-irqchip", "on|off|split", object_class_property_add(oc, "kernel-irqchip", "on|off|split",
NULL, machine_set_kernel_irqchip, NULL, machine_set_kernel_irqchip,
NULL, NULL, &error_abort); NULL, NULL, &error_abort);
@ -976,7 +956,6 @@ static void machine_finalize(Object *obj)
{ {
MachineState *ms = MACHINE(obj); MachineState *ms = MACHINE(obj);
g_free(ms->accel);
g_free(ms->kernel_filename); g_free(ms->kernel_filename);
g_free(ms->initrd_filename); g_free(ms->initrd_filename);
g_free(ms->kernel_cmdline); g_free(ms->kernel_cmdline);

View File

@ -275,7 +275,6 @@ struct MachineState {
/*< public >*/ /*< public >*/
char *accel;
bool kernel_irqchip_allowed; bool kernel_irqchip_allowed;
bool kernel_irqchip_required; bool kernel_irqchip_required;
bool kernel_irqchip_split; bool kernel_irqchip_split;

View File

@ -20,8 +20,8 @@
*/ */
#define SVE_MAX_VQ 16 #define SVE_MAX_VQ 16
#define MACHINE "-machine virt,gic-version=max,accel=tcg " #define MACHINE "-machine virt,gic-version=max -accel tcg "
#define MACHINE_KVM "-machine virt,gic-version=max,accel=kvm:tcg " #define MACHINE_KVM "-machine virt,gic-version=max -accel kvm -accel tcg "
#define QUERY_HEAD "{ 'execute': 'query-cpu-model-expansion', " \ #define QUERY_HEAD "{ 'execute': 'query-cpu-model-expansion', " \
" 'arguments': { 'type': 'full', " " 'arguments': { 'type': 'full', "
#define QUERY_TAIL "}}" #define QUERY_TAIL "}}"

View File

@ -51,7 +51,7 @@
#define ACPI_REBUILD_EXPECTED_AML "TEST_ACPI_REBUILD_AML" #define ACPI_REBUILD_EXPECTED_AML "TEST_ACPI_REBUILD_AML"
typedef struct { typedef struct {
const char *accel; bool tcg_only;
const char *machine; const char *machine;
const char *variant; const char *variant;
const char *uefi_fl1; const char *uefi_fl1;
@ -607,19 +607,19 @@ static void test_acpi_one(const char *params, test_data *data)
* TODO: convert '-drive if=pflash' to new syntax (see e33763be7cd3) * TODO: convert '-drive if=pflash' to new syntax (see e33763be7cd3)
* when arm/virt boad starts to support it. * when arm/virt boad starts to support it.
*/ */
args = g_strdup_printf("-machine %s,accel=%s -nodefaults -nographic " args = g_strdup_printf("-machine %s %s -accel tcg -nodefaults -nographic "
"-drive if=pflash,format=raw,file=%s,readonly " "-drive if=pflash,format=raw,file=%s,readonly "
"-drive if=pflash,format=raw,file=%s,snapshot=on -cdrom %s %s", "-drive if=pflash,format=raw,file=%s,snapshot=on -cdrom %s %s",
data->machine, data->accel ? data->accel : "kvm:tcg", data->machine, data->tcg_only ? "" : "-accel kvm",
data->uefi_fl1, data->uefi_fl2, data->cd, params ? params : ""); data->uefi_fl1, data->uefi_fl2, data->cd, params ? params : "");
} else { } else {
/* Disable kernel irqchip to be able to override apic irq0. */ /* Disable kernel irqchip to be able to override apic irq0. */
args = g_strdup_printf("-machine %s,accel=%s,kernel-irqchip=off " args = g_strdup_printf("-machine %s,kernel-irqchip=off %s -accel tcg "
"-net none -display none %s " "-net none -display none %s "
"-drive id=hd0,if=none,file=%s,format=raw " "-drive id=hd0,if=none,file=%s,format=raw "
"-device ide-hd,drive=hd0 ", "-device ide-hd,drive=hd0 ",
data->machine, data->accel ? data->accel : "kvm:tcg", data->machine, data->tcg_only ? "" : "-accel kvm",
params ? params : "", disk); params ? params : "", disk);
} }
@ -904,7 +904,7 @@ static void test_acpi_virt_tcg_memhp(void)
{ {
test_data data = { test_data data = {
.machine = "virt", .machine = "virt",
.accel = "tcg", .tcg_only = true,
.uefi_fl1 = "pc-bios/edk2-aarch64-code.fd", .uefi_fl1 = "pc-bios/edk2-aarch64-code.fd",
.uefi_fl2 = "pc-bios/edk2-arm-vars.fd", .uefi_fl2 = "pc-bios/edk2-arm-vars.fd",
.cd = "tests/data/uefi-boot-images/bios-tables-test.aarch64.iso.qcow2", .cd = "tests/data/uefi-boot-images/bios-tables-test.aarch64.iso.qcow2",
@ -929,7 +929,7 @@ static void test_acpi_virt_tcg_numamem(void)
{ {
test_data data = { test_data data = {
.machine = "virt", .machine = "virt",
.accel = "tcg", .tcg_only = true,
.uefi_fl1 = "pc-bios/edk2-aarch64-code.fd", .uefi_fl1 = "pc-bios/edk2-aarch64-code.fd",
.uefi_fl2 = "pc-bios/edk2-arm-vars.fd", .uefi_fl2 = "pc-bios/edk2-arm-vars.fd",
.cd = "tests/data/uefi-boot-images/bios-tables-test.aarch64.iso.qcow2", .cd = "tests/data/uefi-boot-images/bios-tables-test.aarch64.iso.qcow2",
@ -951,7 +951,7 @@ static void test_acpi_virt_tcg(void)
{ {
test_data data = { test_data data = {
.machine = "virt", .machine = "virt",
.accel = "tcg", .tcg_only = true,
.uefi_fl1 = "pc-bios/edk2-aarch64-code.fd", .uefi_fl1 = "pc-bios/edk2-aarch64-code.fd",
.uefi_fl2 = "pc-bios/edk2-arm-vars.fd", .uefi_fl2 = "pc-bios/edk2-arm-vars.fd",
.cd = "tests/data/uefi-boot-images/bios-tables-test.aarch64.iso.qcow2", .cd = "tests/data/uefi-boot-images/bios-tables-test.aarch64.iso.qcow2",

View File

@ -215,9 +215,9 @@ static void test_machine(const void *data)
* Make sure that this test uses tcg if available: It is used as a * Make sure that this test uses tcg if available: It is used as a
* fast-enough smoketest for that. * fast-enough smoketest for that.
*/ */
qts = qtest_initf("%s %s -M %s,accel=tcg:kvm -no-shutdown " qts = qtest_initf("%s %s -M %s -no-shutdown "
"-chardev file,id=serial0,path=%s " "-chardev file,id=serial0,path=%s "
"-serial chardev:serial0 %s", "-serial chardev:serial0 -accel tcg -accel kvm %s",
codeparam, code ? codetmp : "", test->machine, codeparam, code ? codetmp : "", test->machine,
serialtmp, test->extra); serialtmp, test->extra);
if (code) { if (code) {

View File

@ -120,7 +120,7 @@ static void test_cdboot(gconstpointer data)
{ {
QTestState *qts; QTestState *qts;
qts = qtest_initf("-M accel=kvm:tcg -no-shutdown %s%s", (const char *)data, qts = qtest_initf("-accel kvm -accel tcg -no-shutdown %s%s", (const char *)data,
isoimage); isoimage);
boot_sector_test(qts); boot_sector_test(qts);
qtest_quit(qts); qtest_quit(qts);

View File

@ -241,9 +241,9 @@ QTestState *qtest_init_without_qmp_handshake(const char *extra_args)
"-qtest-log %s " "-qtest-log %s "
"-chardev socket,path=%s,id=char0 " "-chardev socket,path=%s,id=char0 "
"-mon chardev=char0,mode=control " "-mon chardev=char0,mode=control "
"-accel qtest "
"-display none " "-display none "
"%s", qemu_binary, socket_path, "%s"
" -accel qtest", qemu_binary, socket_path,
getenv("QTEST_LOG") ? "/dev/fd/2" : "/dev/null", getenv("QTEST_LOG") ? "/dev/fd/2" : "/dev/null",
qmp_socket_path, qmp_socket_path,
extra_args ?: ""); extra_args ?: "");

View File

@ -577,8 +577,7 @@ static int test_migrate_start(QTestState **from, QTestState **to,
char *shmem_opts; char *shmem_opts;
char *shmem_path; char *shmem_path;
const char *arch = qtest_get_arch(); const char *arch = qtest_get_arch();
const char *machine_type; const char *machine_opts = NULL;
const char *machine_args;
const char *memory_size; const char *memory_size;
if (args->use_shmem) { if (args->use_shmem) {
@ -594,8 +593,6 @@ static int test_migrate_start(QTestState **from, QTestState **to,
/* the assembled x86 boot sector should be exactly one sector large */ /* the assembled x86 boot sector should be exactly one sector large */
assert(sizeof(x86_bootsect) == 512); assert(sizeof(x86_bootsect) == 512);
init_bootfile(bootpath, x86_bootsect, sizeof(x86_bootsect)); init_bootfile(bootpath, x86_bootsect, sizeof(x86_bootsect));
machine_type = "";
machine_args = "";
memory_size = "150M"; memory_size = "150M";
arch_source = g_strdup_printf("-drive file=%s,format=raw", bootpath); arch_source = g_strdup_printf("-drive file=%s,format=raw", bootpath);
arch_target = g_strdup(arch_source); arch_target = g_strdup(arch_source);
@ -603,16 +600,13 @@ static int test_migrate_start(QTestState **from, QTestState **to,
end_address = X86_TEST_MEM_END; end_address = X86_TEST_MEM_END;
} else if (g_str_equal(arch, "s390x")) { } else if (g_str_equal(arch, "s390x")) {
init_bootfile(bootpath, s390x_elf, sizeof(s390x_elf)); init_bootfile(bootpath, s390x_elf, sizeof(s390x_elf));
machine_type = "";
machine_args = "";
memory_size = "128M"; memory_size = "128M";
arch_source = g_strdup_printf("-bios %s", bootpath); arch_source = g_strdup_printf("-bios %s", bootpath);
arch_target = g_strdup(arch_source); arch_target = g_strdup(arch_source);
start_address = S390_TEST_MEM_START; start_address = S390_TEST_MEM_START;
end_address = S390_TEST_MEM_END; end_address = S390_TEST_MEM_END;
} else if (strcmp(arch, "ppc64") == 0) { } else if (strcmp(arch, "ppc64") == 0) {
machine_type = ""; machine_opts = "vsmt=8";
machine_args = ",vsmt=8";
memory_size = "256M"; memory_size = "256M";
arch_source = g_strdup_printf("-nodefaults " arch_source = g_strdup_printf("-nodefaults "
"-prom-env 'use-nvramrc?=true' -prom-env " "-prom-env 'use-nvramrc?=true' -prom-env "
@ -624,8 +618,7 @@ static int test_migrate_start(QTestState **from, QTestState **to,
end_address = PPC_TEST_MEM_END; end_address = PPC_TEST_MEM_END;
} else if (strcmp(arch, "aarch64") == 0) { } else if (strcmp(arch, "aarch64") == 0) {
init_bootfile(bootpath, aarch64_kernel, sizeof(aarch64_kernel)); init_bootfile(bootpath, aarch64_kernel, sizeof(aarch64_kernel));
machine_type = "virt,"; machine_opts = "virt,gic-version=max";
machine_args = "gic-version=max";
memory_size = "150M"; memory_size = "150M";
arch_source = g_strdup_printf("-cpu max " arch_source = g_strdup_printf("-cpu max "
"-kernel %s", "-kernel %s",
@ -658,12 +651,13 @@ static int test_migrate_start(QTestState **from, QTestState **to,
shmem_opts = g_strdup(""); shmem_opts = g_strdup("");
} }
cmd_source = g_strdup_printf("-machine %saccel=kvm:tcg%s " cmd_source = g_strdup_printf("-accel kvm -accel tcg%s%s "
"-name source,debug-threads=on " "-name source,debug-threads=on "
"-m %s " "-m %s "
"-serial file:%s/src_serial " "-serial file:%s/src_serial "
"%s %s %s %s", "%s %s %s %s",
machine_type, machine_args, machine_opts ? " -machine " : "",
machine_opts ? machine_opts : "",
memory_size, tmpfs, memory_size, tmpfs,
arch_source, shmem_opts, args->opts_source, arch_source, shmem_opts, args->opts_source,
ignore_stderr); ignore_stderr);
@ -671,13 +665,14 @@ static int test_migrate_start(QTestState **from, QTestState **to,
*from = qtest_init(cmd_source); *from = qtest_init(cmd_source);
g_free(cmd_source); g_free(cmd_source);
cmd_target = g_strdup_printf("-machine %saccel=kvm:tcg%s " cmd_target = g_strdup_printf("-accel kvm -accel tcg%s%s "
"-name target,debug-threads=on " "-name target,debug-threads=on "
"-m %s " "-m %s "
"-serial file:%s/dest_serial " "-serial file:%s/dest_serial "
"-incoming %s " "-incoming %s "
"%s %s %s %s", "%s %s %s %s",
machine_type, machine_args, machine_opts ? " -machine " : "",
machine_opts ? machine_opts : "",
memory_size, tmpfs, uri, memory_size, tmpfs, uri,
arch_target, shmem_opts, arch_target, shmem_opts,
args->opts_target, ignore_stderr); args->opts_target, ignore_stderr);

View File

@ -260,7 +260,7 @@ static void test_geometry(const void *opaque)
{ {
const FlashConfig *config = opaque; const FlashConfig *config = opaque;
QTestState *qtest; QTestState *qtest;
qtest = qtest_initf("-M musicpal,accel=qtest" qtest = qtest_initf("-M musicpal"
" -drive if=pflash,file=%s,format=raw,copy-on-read" " -drive if=pflash,file=%s,format=raw,copy-on-read"
/* Device geometry properties. */ /* Device geometry properties. */
" -global driver=cfi.pflash02," " -global driver=cfi.pflash02,"
@ -580,7 +580,7 @@ static void test_cfi_in_autoselect(const void *opaque)
{ {
const FlashConfig *config = opaque; const FlashConfig *config = opaque;
QTestState *qtest; QTestState *qtest;
qtest = qtest_initf("-M musicpal,accel=qtest" qtest = qtest_initf("-M musicpal"
" -drive if=pflash,file=%s,format=raw,copy-on-read", " -drive if=pflash,file=%s,format=raw,copy-on-read",
image_path); image_path);
FlashConfig explicit_config = expand_config_defaults(config); FlashConfig explicit_config = expand_config_defaults(config);

View File

@ -84,7 +84,7 @@ static void test_cfam_id(const void *data)
machine = "powernv9"; machine = "powernv9";
} }
qts = qtest_initf("-M %s,accel=tcg -cpu %s", qts = qtest_initf("-M %s -accel tcg -cpu %s",
machine, chip->cpu_model); machine, chip->cpu_model);
test_xscom_cfam_id(qts, chip); test_xscom_cfam_id(qts, chip);
qtest_quit(qts); qtest_quit(qts);
@ -125,7 +125,7 @@ static void test_core(const void *data)
machine = "powernv9"; machine = "powernv9";
} }
qts = qtest_initf("-M %s,accel=tcg -cpu %s", qts = qtest_initf("-M %s -accel tcg -cpu %s",
machine, chip->cpu_model); machine, chip->cpu_model);
test_xscom_core(qts, chip); test_xscom_core(qts, chip);
qtest_quit(qts); qtest_quit(qts);

View File

@ -57,7 +57,7 @@ static void test_machine(const void *machine)
" -machine cap-cfpc=broken,cap-sbbc=broken,cap-ibs=broken"; " -machine cap-cfpc=broken,cap-sbbc=broken,cap-ibs=broken";
} }
qts = qtest_initf("-M %s,accel=tcg %s -prom-env 'use-nvramrc?=true' " qts = qtest_initf("-M %s -accel tcg %s -prom-env 'use-nvramrc?=true' "
"-prom-env 'nvramrc=%x %x l!' ", (const char *)machine, "-prom-env 'nvramrc=%x %x l!' ", (const char *)machine,
extra_args, MAGIC, ADDRESS); extra_args, MAGIC, ADDRESS);
check_guest_memory(qts); check_guest_memory(qts);

View File

@ -74,7 +74,7 @@ static void test_pxe_one(const testdef_t *test, bool ipv6)
} }
args = g_strdup_printf( args = g_strdup_printf(
"-machine %s,accel=kvm:tcg -nodefaults -boot order=n " "-accel kvm -accel tcg -machine %s -nodefaults -boot order=n "
"-netdev user,id=" NETNAME ",tftp=./,bootfile=%s,ipv4=%s,ipv6=%s " "-netdev user,id=" NETNAME ",tftp=./,bootfile=%s,ipv4=%s,ipv6=%s "
"-device %s,bootindex=1,netdev=" NETNAME " %s", "-device %s,bootindex=1,netdev=" NETNAME " %s",
test->machine, disk, ipv6 ? "off" : "on", ipv6 ? "on" : "off", test->machine, disk, ipv6 ? "off" : "on", ipv6 ? "on" : "off",

View File

@ -109,7 +109,7 @@ static void read_guid_from_monitor(QTestState *qts, QemuUUID *guid)
static char disk[] = "tests/vmgenid-test-disk-XXXXXX"; static char disk[] = "tests/vmgenid-test-disk-XXXXXX";
#define GUID_CMD(guid) \ #define GUID_CMD(guid) \
"-machine accel=kvm:tcg " \ "-accel kvm -accel tcg " \
"-device vmgenid,id=testvgid,guid=%s " \ "-device vmgenid,id=testvgid,guid=%s " \
"-drive id=hd0,if=none,file=%s,format=raw " \ "-drive id=hd0,if=none,file=%s,format=raw " \
"-device ide-hd,drive=hd0 ", guid, disk "-device ide-hd,drive=hd0 ", guid, disk

93
vl.c
View File

@ -292,7 +292,6 @@ static QemuOptsList qemu_accel_opts = {
.name = "accel", .name = "accel",
.implied_opt_name = "accel", .implied_opt_name = "accel",
.head = QTAILQ_HEAD_INITIALIZER(qemu_accel_opts.head), .head = QTAILQ_HEAD_INITIALIZER(qemu_accel_opts.head),
.merge_lists = true,
.desc = { .desc = {
{ {
.name = "accel", .name = "accel",
@ -2523,6 +2522,11 @@ static int machine_set_property(void *opaque,
} }
} }
/* Legacy options do not correspond to MachineState properties. */
if (g_str_equal(qom_name, "accel")) {
return 0;
}
return object_parse_property_opt(opaque, name, value, "type", errp); return object_parse_property_opt(opaque, name, value, "type", errp);
} }
@ -2713,74 +2717,88 @@ static int do_configure_icount(void *opaque, QemuOpts *opts, Error **errp)
static int do_configure_accelerator(void *opaque, QemuOpts *opts, Error **errp) static int do_configure_accelerator(void *opaque, QemuOpts *opts, Error **errp)
{ {
bool *p_init_failed = opaque;
const char *acc = qemu_opt_get(opts, "accel");
AccelClass *ac = accel_find(acc);
int ret;
if (!ac) {
return 0;
}
ret = accel_init_machine(ac, current_machine);
if (ret < 0) {
*p_init_failed = true;
error_report("failed to initialize %s: %s",
acc, strerror(-ret));
return 0;
}
if (tcg_enabled()) { if (tcg_enabled()) {
qemu_tcg_configure(opts, &error_fatal); qemu_tcg_configure(opts, &error_fatal);
} }
return 0; return 1;
} }
static void configure_accelerators(const char *progname) static void configure_accelerators(const char *progname)
{ {
const char *accel; const char *accel;
char **accel_list, **tmp; char **accel_list, **tmp;
int ret;
bool accel_initialised = false; bool accel_initialised = false;
bool init_failed = false; bool init_failed = false;
AccelClass *acc = NULL;
qemu_opts_foreach(qemu_find_opts("icount"), qemu_opts_foreach(qemu_find_opts("icount"),
do_configure_icount, NULL, &error_fatal); do_configure_icount, NULL, &error_fatal);
accel = qemu_opt_get(qemu_get_machine_opts(), "accel"); accel = qemu_opt_get(qemu_get_machine_opts(), "accel");
if (accel == NULL) { if (QTAILQ_EMPTY(&qemu_accel_opts.head)) {
/* Select the default accelerator */ if (accel == NULL) {
if (!accel_find("tcg") && !accel_find("kvm")) { /* Select the default accelerator */
error_report("No accelerator selected and" if (!accel_find("tcg") && !accel_find("kvm")) {
" no default accelerator available"); error_report("No accelerator selected and"
exit(1); " no default accelerator available");
} else { exit(1);
int pnlen = strlen(progname);
if (pnlen >= 3 && g_str_equal(&progname[pnlen - 3], "kvm")) {
/* If the program name ends with "kvm", we prefer KVM */
accel = "kvm:tcg";
} else { } else {
accel = "tcg:kvm"; int pnlen = strlen(progname);
if (pnlen >= 3 && g_str_equal(&progname[pnlen - 3], "kvm")) {
/* If the program name ends with "kvm", we prefer KVM */
accel = "kvm:tcg";
} else {
accel = "tcg:kvm";
}
} }
} }
}
accel_list = g_strsplit(accel, ":", 0); accel_list = g_strsplit(accel, ":", 0);
for (tmp = accel_list; !accel_initialised && tmp && *tmp; tmp++) { for (tmp = accel_list; !accel_initialised && tmp && *tmp; tmp++) {
acc = accel_find(*tmp); /*
if (!acc) { * Filter invalid accelerators here, to prevent obscenities
continue; * such as "-machine accel=tcg,,thread=single".
*/
if (accel_find(*tmp)) {
qemu_opts_parse_noisily(qemu_find_opts("accel"), *tmp, true);
}
} }
ret = accel_init_machine(acc, current_machine); } else {
if (ret < 0) { if (accel != NULL) {
init_failed = true; error_report("The -accel and \"-machine accel=\" options are incompatible");
error_report("failed to initialize %s: %s", exit(1);
acc->name, strerror(-ret));
} else {
accel_initialised = true;
} }
} }
g_strfreev(accel_list);
if (!accel_initialised) { if (!qemu_opts_foreach(qemu_find_opts("accel"),
do_configure_accelerator, &init_failed, &error_fatal)) {
if (!init_failed) { if (!init_failed) {
error_report("-machine accel=%s: No accelerator found", accel); error_report("no accelerator found");
} }
exit(1); exit(1);
} }
if (init_failed) { if (init_failed) {
error_report("Back to %s accelerator", acc->name); AccelClass *ac = ACCEL_GET_CLASS(current_machine->accelerator);
error_report("Back to %s accelerator", ac->name);
} }
qemu_opts_foreach(qemu_find_opts("accel"),
do_configure_accelerator, NULL, &error_fatal);
if (use_icount && !(tcg_enabled() || qtest_enabled())) { if (use_icount && !(tcg_enabled() || qtest_enabled())) {
error_report("-icount is not allowed with hardware virtualization"); error_report("-icount is not allowed with hardware virtualization");
exit(1); exit(1);
@ -3461,9 +3479,6 @@ int main(int argc, char **argv, char **envp)
"use -M accel=... for now instead"); "use -M accel=... for now instead");
exit(1); exit(1);
} }
opts = qemu_opts_create(qemu_find_opts("machine"), NULL,
false, &error_abort);
qemu_opt_set(opts, "accel", optarg, &error_abort);
break; break;
case QEMU_OPTION_usb: case QEMU_OPTION_usb:
olist = qemu_find_opts("machine"); olist = qemu_find_opts("machine");