From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Stefan Hajnoczi" <stefanha@redhat.com>,
"Peter Maydell" <peter.maydell@linaro.org>,
qemu-block@nongnu.org,
"Pavel Dovgalyuk" <pavel.dovgaluk@ispras.ru>,
"Fam Zheng" <fam@euphon.net>,
"Richard Henderson" <richard.henderson@linaro.org>,
qemu-arm@nongnu.org, "Paolo Bonzini" <pbonzini@redhat.com>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: [PATCH v3 2/6] system/vl: Evaluate icount after accelerator options are parsed
Date: Fri, 8 Dec 2023 12:35:24 +0100 [thread overview]
Message-ID: <20231208113529.74067-3-philmd@linaro.org> (raw)
In-Reply-To: <20231208113529.74067-1-philmd@linaro.org>
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(-)
diff --git a/stubs/icount.c b/stubs/icount.c
index 85c381a0ea..014ae5d8e4 100644
--- a/stubs/icount.c
+++ b/stubs/icount.c
@@ -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();
diff --git a/system/vl.c b/system/vl.c
index 17234012d4..af809331bb 100644
--- a/system/vl.c
+++ b/system/vl.c
@@ -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)
--
2.41.0
next prev parent reply other threads:[~2023-12-08 11:36 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-08 11:35 [PATCH v3 0/6] sysemu/replay: Restrict icount to TCG system emulation Philippe Mathieu-Daudé
2023-12-08 11:35 ` [PATCH v3 1/6] sysemu/cpu-timers: Have icount_configure() return a boolean Philippe Mathieu-Daudé
2023-12-08 17:54 ` Richard Henderson
2023-12-08 11:35 ` Philippe Mathieu-Daudé [this message]
2023-12-08 17:56 ` [PATCH v3 2/6] system/vl: Evaluate icount after accelerator options are parsed Richard Henderson
2023-12-08 11:35 ` [PATCH v3 3/6] sysemu/cpu-timers: Introduce ICountMode enumerator Philippe Mathieu-Daudé
2023-12-08 13:05 ` Philippe Mathieu-Daudé
2023-12-08 11:35 ` [PATCH v3 4/6] target/arm: Ensure icount is enabled when emulating INST_RETIRED Philippe Mathieu-Daudé
2023-12-08 17:59 ` Richard Henderson
2023-12-08 11:35 ` [PATCH v3 5/6] util/async: Only call icount_notify_exit() if icount is enabled Philippe Mathieu-Daudé
2023-12-08 18:01 ` Richard Henderson
2023-12-08 11:35 ` [PATCH v3 6/6] sysemu/replay: Restrict icount to system emulation Philippe Mathieu-Daudé
2023-12-08 18:03 ` Richard Henderson
2024-01-17 8:21 ` [PATCH v3 0/6] sysemu/replay: Restrict icount to TCG " Philippe Mathieu-Daudé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231208113529.74067-3-philmd@linaro.org \
--to=philmd@linaro.org \
--cc=fam@euphon.net \
--cc=pavel.dovgaluk@ispras.ru \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).