aboutsummaryrefslogtreecommitdiff
path: root/vl.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2019-11-14 11:10:43 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2019-12-17 19:32:25 +0100
commitdeda73e89f271e15044334ad6c0dcdae5341b71d (patch)
tree2768542f410731f756e59df84439e0220c28b767 /vl.c
parentaf0440ae8521b9c173062cce4f231ae981bb9044 (diff)
vl: extract accelerator option processing to a separate function
As a first step towards supporting multiple "-accel" options, push the late processing of -icount and -accel into a new function, and use qemu_opts_foreach to retrieve -accel options instead of stashing them into globals. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'vl.c')
-rw-r--r--vl.c28
1 files changed, 20 insertions, 8 deletions
diff --git a/vl.c b/vl.c
index 6e58c1d08d..7ed90263e7 100644
--- a/vl.c
+++ b/vl.c
@@ -2706,6 +2706,25 @@ static int do_configure_icount(void *opaque, QemuOpts *opts, Error **errp)
return 0;
}
+static int do_configure_accelerator(void *opaque, QemuOpts *opts, Error **errp)
+{
+ if (tcg_enabled()) {
+ qemu_tcg_configure(opts, &error_fatal);
+ }
+ return 0;
+}
+
+static void configure_accelerators(void)
+{
+ qemu_opts_foreach(qemu_find_opts("accel"),
+ do_configure_accelerator, NULL, &error_fatal);
+
+ if (use_icount && !(tcg_enabled() || qtest_enabled())) {
+ error_report("-icount is not allowed with hardware virtualization");
+ exit(1);
+ }
+}
+
int main(int argc, char **argv, char **envp)
{
int i;
@@ -4103,14 +4122,7 @@ int main(int argc, char **argv, char **envp)
qemu_spice_init();
cpu_ticks_init();
- if (use_icount && !(tcg_enabled() || qtest_enabled())) {
- error_report("-icount is not allowed with hardware virtualization");
- exit(1);
- }
-
- if (tcg_enabled()) {
- qemu_tcg_configure(accel_opts, &error_fatal);
- }
+ configure_accelerators();
if (default_net) {
QemuOptsList *net = qemu_find_opts("net");