[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 22/31] target/sh4: Disable decode_gusa when plugins enabled
From: |
Alex Bennée |
Subject: |
[PATCH 22/31] target/sh4: Disable decode_gusa when plugins enabled |
Date: |
Mon, 25 Sep 2023 15:48:45 +0100 |
From: Richard Henderson <richard.henderson@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20230824181233.1568795-3-richard.henderson@linaro.org>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
target/sh4/translate.c | 41 +++++++++++++++++++++++++++++------------
1 file changed, 29 insertions(+), 12 deletions(-)
diff --git a/target/sh4/translate.c b/target/sh4/translate.c
index c1e590feb3..b4dee34c9a 100644
--- a/target/sh4/translate.c
+++ b/target/sh4/translate.c
@@ -1816,6 +1816,18 @@ static void decode_opc(DisasContext * ctx)
}
#ifdef CONFIG_USER_ONLY
+/*
+ * Restart with the EXCLUSIVE bit set, within a TB run via
+ * cpu_exec_step_atomic holding the exclusive lock.
+ */
+static void gen_restart_exclusive(DisasContext *ctx)
+{
+ ctx->envflags |= TB_FLAG_GUSA_EXCLUSIVE;
+ gen_save_cpu_state(ctx, false);
+ gen_helper_exclusive(cpu_env);
+ ctx->base.is_jmp = DISAS_NORETURN;
+}
+
/* For uniprocessors, SH4 uses optimistic restartable atomic sequences.
Upon an interrupt, a real kernel would simply notice magic values in
the registers and reset the PC to the start of the sequence.
@@ -2149,12 +2161,7 @@ static void decode_gusa(DisasContext *ctx, CPUSH4State
*env)
qemu_log_mask(LOG_UNIMP, "Unrecognized gUSA sequence %08x-%08x\n",
pc, pc_end);
- /* Restart with the EXCLUSIVE bit set, within a TB run via
- cpu_exec_step_atomic holding the exclusive lock. */
- ctx->envflags |= TB_FLAG_GUSA_EXCLUSIVE;
- gen_save_cpu_state(ctx, false);
- gen_helper_exclusive(cpu_env);
- ctx->base.is_jmp = DISAS_NORETURN;
+ gen_restart_exclusive(ctx);
/* We're not executing an instruction, but we must report one for the
purposes of accounting within the TB. We might as well report the
@@ -2242,12 +2249,22 @@ static void sh4_tr_translate_insn(DisasContextBase
*dcbase, CPUState *cs)
#ifdef CONFIG_USER_ONLY
if (unlikely(ctx->envflags & TB_FLAG_GUSA_MASK)
&& !(ctx->envflags & TB_FLAG_GUSA_EXCLUSIVE)) {
- /* We're in an gUSA region, and we have not already fallen
- back on using an exclusive region. Attempt to parse the
- region into a single supported atomic operation. Failure
- is handled within the parser by raising an exception to
- retry using an exclusive region. */
- decode_gusa(ctx, env);
+ /*
+ * We're in an gUSA region, and we have not already fallen
+ * back on using an exclusive region. Attempt to parse the
+ * region into a single supported atomic operation. Failure
+ * is handled within the parser by raising an exception to
+ * retry using an exclusive region.
+ *
+ * Parsing the region in one block conflicts with plugins,
+ * so always use exclusive mode if plugins enabled.
+ */
+ if (ctx->base.plugin_enabled) {
+ gen_restart_exclusive(ctx);
+ ctx->base.pc_next += 2;
+ } else {
+ decode_gusa(ctx, env);
+ }
return;
}
#endif
--
2.39.2
- [PATCH 13/31] gdbstub: Introduce GDBFeature structure, (continued)
- [PATCH 13/31] gdbstub: Introduce GDBFeature structure, Alex Bennée, 2023/09/25
- [PATCH 14/31] target/arm: Move the reference to arm-core.xml, Alex Bennée, 2023/09/25
- [PATCH 15/31] hw/core/cpu: Return static value with gdb_arch_name(), Alex Bennée, 2023/09/25
- [PATCH 19/31] gdbstub: Remove gdb_has_xml variable, Alex Bennée, 2023/09/25
- [PATCH 11/31] plugins: Check if vCPU is realized, Alex Bennée, 2023/09/25
- [PATCH 23/31] plugins: Set final instruction count in plugin_gen_tb_end, Alex Bennée, 2023/09/25
- [PATCH 21/31] accel/tcg: Add plugin_enabled to DisasContextBase, Alex Bennée, 2023/09/25
- [RFC PATCH 27/31] sysemu: add set_virtual_time to accel ops, Alex Bennée, 2023/09/25
- [RFC PATCH 29/31] sysemu: generalise qtest_warp_clock as qemu_clock_advance_virtual_time, Alex Bennée, 2023/09/25
- [RFC PATCH 30/31] plugins: add time control API, Alex Bennée, 2023/09/25
- [PATCH 22/31] target/sh4: Disable decode_gusa when plugins enabled,
Alex Bennée <=
- [PATCH 18/31] target/ppc: Remove references to gdb_has_xml, Alex Bennée, 2023/09/25
- [RFC PATCH 28/31] qtest: use cpu interface in qtest_clock_warp, Alex Bennée, 2023/09/25
- [PATCH 16/31] gdbstub: Use g_markup_printf_escaped(), Alex Bennée, 2023/09/25
- [RFC PATCH 31/31] contrib/plugins: add iops plugin example for cost modelling, Alex Bennée, 2023/09/25
- [PATCH 25/31] contrib/plugins: fix coverity warning in lockstep, Alex Bennée, 2023/09/25
- [PATCH 26/31] contrib/plugins: fix coverity warning in hotblocks, Alex Bennée, 2023/09/25
- [PATCH 20/31] gdbstub: Replace gdb_regs with an array, Alex Bennée, 2023/09/25
- [PATCH 17/31] target/arm: Remove references to gdb_has_xml, Alex Bennée, 2023/09/25
- [PATCH 24/31] contrib/plugins: fix coverity warning in cache, Alex Bennée, 2023/09/25