[PATCH] docs/devel/tcg-icount: Describe translator_io_start()

Philippe Mathieu-Daudé posted 1 patch 1 day, 4 hours ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20261126211851.49019-1-philmd@oss.qualcomm.com
Maintainers: Richard Henderson <richard.henderson@linaro.org>, Paolo Bonzini <pbonzini@redhat.com>, Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
docs/devel/tcg-icount.rst | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
[PATCH] docs/devel/tcg-icount: Describe translator_io_start()
Posted by Philippe Mathieu-Daudé 1 day, 4 hours ago
gen_io_start() no longer exists, and since commit 18a536f1f8d6
("accel/tcg: Always require can_do_io") I/O instructions end the
TB regardless of icount. Document translator_io_start() instead.

Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
---
 docs/devel/tcg-icount.rst | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/docs/devel/tcg-icount.rst b/docs/devel/tcg-icount.rst
index a1dcd79e0fdd..6541d98e170d 100644
--- a/docs/devel/tcg-icount.rst
+++ b/docs/devel/tcg-icount.rst
@@ -73,16 +73,14 @@ system registers are the common examples here. These instructions have
 to be handled by the individual translators which have the knowledge
 of which operations are I/O operations.
 
-When the translator is handling an instruction of this kind:
-
-* it must call gen_io_start() if icount is enabled, at some
-   point before the generation of the code which actually does
-   the I/O, using a code fragment similar to:
+When the translator is handling an instruction of this kind, it must
+call translator_io_start() before generating the code which actually
+does the I/O:
 
 .. code:: c
 
-    if (tb_cflags(s->base.tb) & CF_USE_ICOUNT) {
-        gen_io_start();
-    }
+    translator_io_start(&s->base);
 
-* it must end the TB immediately after this instruction
+This makes the instruction the last one of the TB, whether or not
+icount is enabled, so that it executes with ``can_do_io`` set and,
+with icount, reads an exact clock.
-- 
2.55.0


Re: [PATCH] docs/devel/tcg-icount: Describe translator_io_start()
Posted by Pierrick Bouvier 1 day, 2 hours ago
On 11/26/2026 1:18 PM, Philippe Mathieu-Daudé wrote:
> gen_io_start() no longer exists, and since commit 18a536f1f8d6
> ("accel/tcg: Always require can_do_io") I/O instructions end the
> TB regardless of icount. Document translator_io_start() instead.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>
> ---
>  docs/devel/tcg-icount.rst | 16 +++++++---------
>  1 file changed, 7 insertions(+), 9 deletions(-)
> 

Reviewed-by: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>

Re: [PATCH] docs/devel/tcg-icount: Describe translator_io_start()
Posted by Mohamed Mediouni 1 day, 2 hours ago

> On 26. Nov 2026, at 22:18, Philippe Mathieu-Daudé <philmd@oss.qualcomm.com> wrote:
> 
> gen_io_start() no longer exists, and since commit 18a536f1f8d6
> ("accel/tcg: Always require can_do_io") I/O instructions end the
> TB regardless of icount. Document translator_io_start() instead.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com>

Reviewed-by: Mohamed Mediouni <mohamed.mediouni@linaro.org>
> ---
> docs/devel/tcg-icount.rst | 16 +++++++---------
> 1 file changed, 7 insertions(+), 9 deletions(-)
> 
> diff --git a/docs/devel/tcg-icount.rst b/docs/devel/tcg-icount.rst
> index a1dcd79e0fdd..6541d98e170d 100644
> --- a/docs/devel/tcg-icount.rst
> +++ b/docs/devel/tcg-icount.rst
> @@ -73,16 +73,14 @@ system registers are the common examples here. These instructions have
> to be handled by the individual translators which have the knowledge
> of which operations are I/O operations.
> 
> -When the translator is handling an instruction of this kind:
> -
> -* it must call gen_io_start() if icount is enabled, at some
> -   point before the generation of the code which actually does
> -   the I/O, using a code fragment similar to:
> +When the translator is handling an instruction of this kind, it must
> +call translator_io_start() before generating the code which actually
> +does the I/O:
> 
> .. code:: c
> 
> -    if (tb_cflags(s->base.tb) & CF_USE_ICOUNT) {
> -        gen_io_start();
> -    }
> +    translator_io_start(&s->base);
> 
> -* it must end the TB immediately after this instruction
> +This makes the instruction the last one of the TB, whether or not
> +icount is enabled, so that it executes with ``can_do_io`` set and,
> +with icount, reads an exact clock.
> -- 
> 2.55.0
> 
>