From: "Philippe Mathieu-Daudé" <philmd@linaro.org>
To: qemu-devel@nongnu.org
Cc: "Paolo Bonzini" <pbonzini@redhat.com>,
"Richard Henderson" <richard.henderson@linaro.org>,
"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: [PATCH 3/6: 1/2] accel/tcg: Refactor gen_io_start() as set_can_do_io()
Date: Fri, 15 Sep 2023 11:41:08 +0200 [thread overview]
Message-ID: <20230915094109.82757-1-philmd@linaro.org> (raw)
In-Reply-To: <20230914174436.1597356-4-richard.henderson@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-ID: <20230914174436.1597356-4-richard.henderson@linaro.org>
[PMD: Split patch in 2, extracting set_can_do_io() first]
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
accel/tcg/translator.c | 19 ++++++++-----------
1 file changed, 8 insertions(+), 11 deletions(-)
diff --git a/accel/tcg/translator.c b/accel/tcg/translator.c
index b6ab9f3d33..cebf0a84cc 100644
--- a/accel/tcg/translator.c
+++ b/accel/tcg/translator.c
@@ -16,9 +16,9 @@
#include "tcg/tcg-op-common.h"
#include "internal.h"
-static void gen_io_start(void)
+static void set_can_do_io(DisasContextBase *db, bool val)
{
- tcg_gen_st_i32(tcg_constant_i32(1), cpu_env,
+ tcg_gen_st_i32(tcg_constant_i32(val), cpu_env,
offsetof(ArchCPU, parent_obj.can_do_io) -
offsetof(ArchCPU, env));
}
@@ -35,7 +35,7 @@ bool translator_io_start(DisasContextBase *db)
return true;
}
- gen_io_start();
+ set_can_do_io(db, true);
/*
* Ensure that this instruction will be the last in the TB.
@@ -47,7 +47,7 @@ bool translator_io_start(DisasContextBase *db)
return true;
}
-static TCGOp *gen_tb_start(uint32_t cflags)
+static TCGOp *gen_tb_start(DisasContextBase *db, uint32_t cflags)
{
TCGv_i32 count = NULL;
TCGOp *icount_start_insn = NULL;
@@ -91,12 +91,9 @@ static TCGOp *gen_tb_start(uint32_t cflags)
* cpu->can_do_io is cleared automatically here at the beginning of
* each translation block. The cost is minimal and only paid for
* -icount, plus it would be very easy to forget doing it in the
- * translator. Doing it here means we don't need a gen_io_end() to
- * go with gen_io_start().
+ * translator.
*/
- tcg_gen_st_i32(tcg_constant_i32(0), cpu_env,
- offsetof(ArchCPU, parent_obj.can_do_io) -
- offsetof(ArchCPU, env));
+ set_can_do_io(db, false);
}
return icount_start_insn;
@@ -154,7 +151,7 @@ void translator_loop(CPUState *cpu, TranslationBlock *tb, int *max_insns,
tcg_debug_assert(db->is_jmp == DISAS_NEXT); /* no early exit */
/* Start translating. */
- icount_start_insn = gen_tb_start(cflags);
+ icount_start_insn = gen_tb_start(db, cflags);
ops->tb_start(db, cpu);
tcg_debug_assert(db->is_jmp == DISAS_NEXT); /* no early exit */
@@ -181,7 +178,7 @@ void translator_loop(CPUState *cpu, TranslationBlock *tb, int *max_insns,
the next instruction. */
if (db->num_insns == db->max_insns && (cflags & CF_LAST_IO)) {
/* Accept I/O on the last instruction. */
- gen_io_start();
+ set_can_do_io(db, true);
}
ops->translate_insn(db, cpu);
--
2.41.0
next prev parent reply other threads:[~2023-09-15 9:42 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-14 17:44 [PATCH 0/6] accel/tcg: Always require can_do_io (#1866) Richard Henderson
2023-09-14 17:44 ` [PATCH 1/6] accel/tcg: Avoid load of icount_decr if unused Richard Henderson
2023-09-15 9:23 ` Philippe Mathieu-Daudé
2023-09-14 17:44 ` [PATCH 2/6] accel/tcg: Hoist CF_MEMI_ONLY check outside translation loop Richard Henderson
2023-09-15 9:26 ` Philippe Mathieu-Daudé
2023-09-14 17:44 ` [PATCH 3/6] accel/tcg: Track current value of can_do_io in the TB Richard Henderson
2023-09-15 9:41 ` Philippe Mathieu-Daudé [this message]
2023-09-15 9:41 ` [PATCH 3/6: 2/2] " Philippe Mathieu-Daudé
2023-09-15 9:44 ` Philippe Mathieu-Daudé
2023-09-15 9:42 ` [PATCH 3/6: 1/2] accel/tcg: Refactor gen_io_start() as set_can_do_io() Philippe Mathieu-Daudé
2023-09-14 17:44 ` [PATCH 4/6] accel/tcg: Improve setting of can_do_io at start of TB Richard Henderson
2023-09-15 9:47 ` Philippe Mathieu-Daudé
2023-09-14 17:44 ` [PATCH 5/6] accel/tcg: Always set CF_LAST_IO with CF_NOIRQ Richard Henderson
2023-09-19 9:26 ` Philippe Mathieu-Daudé
2023-09-14 17:44 ` [PATCH 6/6] accel/tcg: Always require can_do_io Richard Henderson
2023-09-19 9:37 ` Philippe Mathieu-Daudé
2023-10-24 9:50 ` Clément Chigot
2023-10-26 0:44 ` Richard Henderson
2023-10-26 8:10 ` Clément Chigot
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=20230915094109.82757-1-philmd@linaro.org \
--to=philmd@linaro.org \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.org \
/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).