aboutsummaryrefslogtreecommitdiff
path: root/accel
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2023-04-17 17:40:32 +0100
committerPeter Maydell <peter.maydell@linaro.org>2023-05-02 15:47:40 +0100
commit3cfb0456c352288d5104a89cceb25f7dcda5d4c0 (patch)
tree88300ae6108ad7e01b6bae20d1c03e1973e0b75f /accel
parentf802ff1e281eac50f2b4b177b180be97e80da21f (diff)
downloadqemu-3cfb0456c352288d5104a89cceb25f7dcda5d4c0.zip
qemu-3cfb0456c352288d5104a89cceb25f7dcda5d4c0.tar.gz
qemu-3cfb0456c352288d5104a89cceb25f7dcda5d4c0.tar.bz2
make one-insn-per-tb an accel option
This commit adds 'one-insn-per-tb' as a property on the TCG accelerator object, so you can enable it with -accel tcg,one-insn-per-tb=on It has the same behaviour as the existing '-singlestep' command line option. We use a different name because 'singlestep' has always been a confusing choice, because it doesn't have anything to do with single-stepping the CPU. What it does do is force TCG emulation to put one guest instruction in each TB, which can be useful in some situations (such as analysing debug logs). The existing '-singlestep' commandline options are decoupled from the global 'singlestep' variable and instead now are syntactic sugar for setting the accel property. (These can then go away after a deprecation period.) The global variable remains for the moment as: * what the TCG code looks at to change its behaviour * what HMP and QMP use to query and set the behaviour In the following commits we'll clean those up to not directly look at the global variable. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20230417164041.684562-2-peter.maydell@linaro.org
Diffstat (limited to 'accel')
-rw-r--r--accel/tcg/tcg-all.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/accel/tcg/tcg-all.c b/accel/tcg/tcg-all.c
index 5dab1ae..fcf361c 100644
--- a/accel/tcg/tcg-all.c
+++ b/accel/tcg/tcg-all.c
@@ -42,6 +42,7 @@ struct TCGState {
AccelState parent_obj;
bool mttcg_enabled;
+ bool one_insn_per_tb;
int splitwx_enabled;
unsigned long tb_size;
};
@@ -208,6 +209,20 @@ static void tcg_set_splitwx(Object *obj, bool value, Error **errp)
s->splitwx_enabled = value;
}
+static bool tcg_get_one_insn_per_tb(Object *obj, Error **errp)
+{
+ TCGState *s = TCG_STATE(obj);
+ return s->one_insn_per_tb;
+}
+
+static void tcg_set_one_insn_per_tb(Object *obj, bool value, Error **errp)
+{
+ TCGState *s = TCG_STATE(obj);
+ s->one_insn_per_tb = value;
+ /* For the moment, set the global also: this changes the behaviour */
+ singlestep = value;
+}
+
static int tcg_gdbstub_supported_sstep_flags(void)
{
/*
@@ -245,6 +260,12 @@ static void tcg_accel_class_init(ObjectClass *oc, void *data)
tcg_get_splitwx, tcg_set_splitwx);
object_class_property_set_description(oc, "split-wx",
"Map jit pages into separate RW and RX regions");
+
+ object_class_property_add_bool(oc, "one-insn-per-tb",
+ tcg_get_one_insn_per_tb,
+ tcg_set_one_insn_per_tb);
+ object_class_property_set_description(oc, "one-insn-per-tb",
+ "Only put one guest insn in each translation block");
}
static const TypeInfo tcg_accel_type = {