On 1/2/25 10:25, Philippe Mathieu-Daudé wrote:
Since tcg_cpu_reset_hold() is a system emulation specific
helper, factor tcg_exec_reset() out so we can use it from
user emulation, similarly to the [un]realize() handlers.
Signed-off-by: Philippe Mathieu-Daudé <phi...@linaro.org>
---
accel/tcg/internal-common.h | 1 +
accel/tcg/cpu-exec-common.c | 6 ++++++
accel/tcg/tcg-accel-ops.c | 4 ++--
3 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/accel/tcg/internal-common.h b/accel/tcg/internal-common.h
index c8d714256cb..8b474fc1256 100644
--- a/accel/tcg/internal-common.h
+++ b/accel/tcg/internal-common.h
@@ -55,6 +55,7 @@ void cpu_restore_state_from_tb(CPUState *cpu,
TranslationBlock *tb,
bool tcg_exec_realizefn(CPUState *cpu, Error **errp);
void tcg_exec_unrealizefn(CPUState *cpu);
+void tcg_exec_reset(CPUState *cpu);
/* current cflags for hashing/comparison */
uint32_t curr_cflags(CPUState *cpu);
diff --git a/accel/tcg/cpu-exec-common.c b/accel/tcg/cpu-exec-common.c
index 6ecfc4e7c21..72ab9c3d977 100644
--- a/accel/tcg/cpu-exec-common.c
+++ b/accel/tcg/cpu-exec-common.c
@@ -21,6 +21,7 @@
#include "system/cpus.h"
#include "system/tcg.h"
#include "qemu/plugin.h"
+#include "exec/tb-flush.h"
#include "internal-common.h"
bool tcg_allowed;
@@ -56,3 +57,8 @@ void cpu_loop_exit_atomic(CPUState *cpu, uintptr_t pc)
cpu->exception_index = EXCP_ATOMIC;
cpu_loop_exit_restore(cpu, pc);
}
+
+void tcg_exec_reset(CPUState *cpu)
+{
+ tcg_flush_jmp_cache(cpu);
+}
diff --git a/accel/tcg/tcg-accel-ops.c b/accel/tcg/tcg-accel-ops.c
index 6e3f1fa92b2..4fe6821b017 100644
--- a/accel/tcg/tcg-accel-ops.c
+++ b/accel/tcg/tcg-accel-ops.c
@@ -34,7 +34,6 @@
#include "qemu/timer.h"
#include "exec/exec-all.h"
#include "exec/hwaddr.h"
-#include "exec/tb-flush.h"
#include "exec/translation-block.h"
#include "gdbstub/enums.h"
@@ -44,6 +43,7 @@
#include "tcg-accel-ops-mttcg.h"
#include "tcg-accel-ops-rr.h"
#include "tcg-accel-ops-icount.h"
+#include "internal-common.h"
/* common functionality among all TCG variants */
@@ -83,7 +83,7 @@ int tcg_cpu_exec(CPUState *cpu)
static void tcg_cpu_reset_hold(CPUState *cpu)
{
- tcg_flush_jmp_cache(cpu);
+ tcg_exec_reset(cpu);
tlb_flush(cpu);
}
Reviewed-by: Pierrick Bouvier <pierrick.bouv...@linaro.org>