]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
accel/tcg: Improve setting of can_do_io at start of TB
authorRichard Henderson <richard.henderson@linaro.org>
Thu, 14 Sep 2023 15:26:47 +0000 (08:26 -0700)
committerMichael Tokarev <mjt@tls.msk.ru>
Mon, 2 Oct 2023 23:01:36 +0000 (02:01 +0300)
Initialize can_do_io to true if this the TB has CF_LAST_IO
and will consist of a single instruction.  This avoids a
set to 0 followed immediately by a set to 1.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
(cherry picked from commit a2f99d484c54adda13e62bf75ba512618a3fe470)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
accel/tcg/translator.c

index 850d82e26f9c5b357ea3f5216d5edb2fbbd28321..dd507cd4719a6f84a40cf034bc478de59b8f912a 100644 (file)
@@ -87,12 +87,12 @@ static TCGOp *gen_tb_start(DisasContextBase *db, uint32_t cflags)
                          offsetof(ArchCPU, neg.icount_decr.u16.low) -
                          offsetof(ArchCPU, env));
         /*
-         * cpu->can_do_io is cleared automatically here at the beginning of
+         * cpu->can_do_io is set 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.
          */
-        set_can_do_io(db, false);
+        set_can_do_io(db, db->max_insns == 1 && (cflags & CF_LAST_IO));
     }
 
     return icount_start_insn;