@@ -1,5 +1,4 @@
#include "qemu/osdep.h"
-#include "qapi/error.h"
#include "sysemu/cpu-timers.h"
/* icount - Instruction Counter API */
@@ -10,13 +9,6 @@ void icount_update(CPUState *cpu)
{
abort();
}
-bool icount_configure(QemuOpts *opts, Error **errp)
-{
- /* signal error */
- error_setg(errp, "cannot configure icount, TCG support not available");
-
- return false;
-}
int64_t icount_get_raw(void)
{
abort();
@@ -2270,6 +2270,13 @@ static void user_register_global_props(void)
static int do_configure_icount(void *opaque, QemuOpts *opts, Error **errp)
{
+ if (!tcg_enabled()) {
+ error_setg(errp, "cannot configure icount, TCG support not available");
+ error_append_hint(errp, "-icount is not allowed with"
+ " hardware virtualization\n");
+ return 1;
+ }
+
return !icount_configure(opts, errp);
}
@@ -2339,9 +2346,6 @@ static void configure_accelerators(const char *progname)
{
bool init_failed = false;
- qemu_opts_foreach(qemu_find_opts("icount"),
- do_configure_icount, NULL, &error_fatal);
-
if (QTAILQ_EMPTY(&qemu_accel_opts.head)) {
char **accel_list, **tmp;
@@ -2401,10 +2405,8 @@ static void configure_accelerators(const char *progname)
error_report("falling back to %s", current_accel_name());
}
- if (icount_enabled() && !tcg_enabled()) {
- error_report("-icount is not allowed with hardware virtualization");
- exit(1);
- }
+ qemu_opts_foreach(qemu_find_opts("icount"),
+ do_configure_icount, NULL, &error_fatal);
}
static void qemu_validate_options(const QDict *machine_opts)
We need to parse the accelerators first, to be able to check whether TCG is enabled or not. Then we can parse the -icount option. This allows removing the icount_configure() stub. Fixes: 7f8b6126e7 ("vl: move icount configuration earlier") Reported-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org> --- stubs/icount.c | 8 -------- system/vl.c | 16 +++++++++------- 2 files changed, 9 insertions(+), 15 deletions(-)