Hi On Wed, Nov 13, 2019 at 6:39 PM Paolo Bonzini <pbonz...@redhat.com> 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);
It used to call qemu_tcg_configure() when no -accel option given. In this case, it still sets mttcg_enabled = default_mttcg_enabled(), but now it misses that. Perhaps it could be set earlier. > +} > + > int main(int argc, char **argv, char **envp) > { > int i; > @@ -4241,18 +4268,7 @@ int main(int argc, char **argv, char **envp) > qemu_spice_init(); > > cpu_ticks_init(); > - if (icount_opts) { > - if (!tcg_enabled()) { > - error_report("-icount is not allowed with hardware > virtualization"); > - exit(1); > - } > - configure_icount(icount_opts, &error_abort); > - qemu_opts_del(icount_opts); > - } > - > - if (tcg_enabled()) { > - qemu_tcg_configure(accel_opts, &error_fatal); > - } > + configure_accelerators(); > > if (default_net) { > QemuOptsList *net = qemu_find_opts("net"); > -- > 1.8.3.1 > > > -- Marc-André Lureau