From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org
Cc: qemu-arm@nongnu.org, "Pavel Dovgalyuk" <pavel.dovgaluk@ispras.ru>,
"Fam Zheng" <fam@euphon.net>,
"Stefan Hajnoczi" <stefanha@redhat.com>,
"Richard Henderson" <richard.henderson@linaro.org>,
qemu-block@nongnu.org, "Paolo Bonzini" <pbonzini@redhat.com>,
"Peter Maydell" <peter.maydell@linaro.org>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: [PATCH v2 5/5] sysemu/replay: Restrict icount to system emulation
Date: Thu, 7 Dec 2023 16:45:50 +0100 [thread overview]
Message-ID: <20231207154550.65087-6-philmd@linaro.org> (raw)
In-Reply-To: <20231207154550.65087-1-philmd@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
include/sysemu/cpu-timers.h | 2 +-
include/sysemu/replay.h | 11 ++++++++---
stubs/icount.c | 19 -------------------
3 files changed, 9 insertions(+), 23 deletions(-)
diff --git a/include/sysemu/cpu-timers.h b/include/sysemu/cpu-timers.h
index e909ffae47..25dfc76599 100644
--- a/include/sysemu/cpu-timers.h
+++ b/include/sysemu/cpu-timers.h
@@ -30,7 +30,7 @@ typedef enum {
ICOUNT_ADAPTATIVE = 2,
} ICountMode;
-#ifdef CONFIG_TCG
+#if defined(CONFIG_TCG) && !defined(CONFIG_USER_ONLY)
extern ICountMode use_icount;
#define icount_enabled() (use_icount)
#else
diff --git a/include/sysemu/replay.h b/include/sysemu/replay.h
index 08aae5869f..8102fa54f0 100644
--- a/include/sysemu/replay.h
+++ b/include/sysemu/replay.h
@@ -1,6 +1,3 @@
-#ifndef SYSEMU_REPLAY_H
-#define SYSEMU_REPLAY_H
-
/*
* QEMU replay (system interface)
*
@@ -11,6 +8,12 @@
* See the COPYING file in the top-level directory.
*
*/
+#ifndef SYSEMU_REPLAY_H
+#define SYSEMU_REPLAY_H
+
+#ifdef CONFIG_USER_ONLY
+#error Cannot include this header from user emulation
+#endif
#include "exec/replay-core.h"
#include "qapi/qapi-types-misc.h"
@@ -79,12 +82,14 @@ int64_t replay_save_clock(ReplayClockKind kind, int64_t clock,
int64_t replay_read_clock(ReplayClockKind kind, int64_t raw_icount);
/*! Saves or reads the clock depending on the current replay mode. */
#define REPLAY_CLOCK(clock, value) \
+ !icount_enabled() ? (value) : \
(replay_mode == REPLAY_MODE_PLAY \
? replay_read_clock((clock), icount_get_raw()) \
: replay_mode == REPLAY_MODE_RECORD \
? replay_save_clock((clock), (value), icount_get_raw()) \
: (value))
#define REPLAY_CLOCK_LOCKED(clock, value) \
+ !icount_enabled() ? (value) : \
(replay_mode == REPLAY_MODE_PLAY \
? replay_read_clock((clock), icount_get_raw_locked()) \
: replay_mode == REPLAY_MODE_RECORD \
diff --git a/stubs/icount.c b/stubs/icount.c
index b060b03a73..9a29084ecc 100644
--- a/stubs/icount.c
+++ b/stubs/icount.c
@@ -5,30 +5,11 @@
ICountMode use_icount = ICOUNT_DISABLED;
-void icount_update(CPUState *cpu)
-{
- abort();
-}
int64_t icount_get_raw(void)
{
abort();
return 0;
}
-int64_t icount_get(void)
-{
- abort();
- return 0;
-}
-int64_t icount_to_ns(int64_t icount)
-{
- abort();
- return 0;
-}
-int64_t icount_round(int64_t count)
-{
- abort();
- return 0;
-}
void icount_start_warp_timer(void)
{
abort();
--
2.41.0
prev parent reply other threads:[~2023-12-07 15:47 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-07 15:45 [PATCH v2 0/5] sysemu/replay: Restrict icount to TCG system emulation Philippe Mathieu-Daudé
2023-12-07 15:45 ` [PATCH v2 1/5] sysemu/cpu-timers: Introduce ICountMode enumerator Philippe Mathieu-Daudé
2023-12-07 22:06 ` Richard Henderson
2023-12-07 15:45 ` [PATCH v2 2/5] target/arm: Ensure icount is enabled when emulating INST_RETIRED Philippe Mathieu-Daudé
2023-12-07 22:12 ` Richard Henderson
2023-12-08 10:36 ` Philippe Mathieu-Daudé
2023-12-08 10:59 ` Peter Maydell
2023-12-08 11:23 ` Philippe Mathieu-Daudé
2023-12-08 14:00 ` Philippe Mathieu-Daudé
2023-12-07 15:45 ` [PATCH v2 3/5] util/async: Only call icount_notify_exit() if icount is enabled Philippe Mathieu-Daudé
2023-12-07 22:17 ` Richard Henderson
2023-12-07 15:45 ` [PATCH v2 4/5] system/vl: Restrict icount to TCG emulation Philippe Mathieu-Daudé
2023-12-07 22:38 ` Richard Henderson
2023-12-08 11:17 ` Philippe Mathieu-Daudé
2023-12-07 15:45 ` Philippe Mathieu-Daudé [this message]
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=20231207154550.65087-6-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).