On 13/11/2019 15.38, Paolo Bonzini wrote: > As a first step towards supporting multiple "-accel" options, push -icount > and -accel semantics into a new function, and use qemu_opts_foreach to > retrieve the key/value lists instead of stashing them into globals. > > Signed-off-by: Paolo Bonzini <pbonz...@redhat.com> > --- > vl.c | 40 ++++++++++++++++++++++++++++------------ > 1 file changed, 28 insertions(+), 12 deletions(-) > > diff --git a/vl.c b/vl.c > index 841fdae..5367f23 100644 > --- a/vl.c > +++ b/vl.c > @@ -2827,6 +2827,33 @@ static void user_register_global_props(void) > global_init_func, NULL, NULL); > } > > +static int do_configure_icount(void *opaque, QemuOpts *opts, Error **errp) > +{ > + if (tcg_enabled()) { > + configure_icount(opts, errp); > + } else { > + error_setg(errp, "-icount is not allowed with hardware > virtualization"); > + } > + 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("icount"), > + do_configure_icount, NULL, &error_fatal); > + > + qemu_opts_foreach(qemu_find_opts("accel"), > + do_configure_accelerator, NULL, &error_fatal); > +}
vl.c is already quite overcrowded ... maybe you could add the new code to accel/accel.c instead? Just my 0.02 €. Thomas