On Sun, Jul 5, 2020 at 10:09 AM Peter Maydell <peter.mayd...@linaro.org> wrote: > On Thu, 2 Jul 2020 at 19:53, Richard Henderson > <richard.hender...@linaro.org> wrote: > > This isn't right. Not so much the gen_io_start portion, but the entire > > existence of helper_check_interrupt. > > I agree that it looks bogus (xtensa has a similar helper as well, > incidentally),
I think there was a reason for it. According to Richard > The correct way to acknowledge interrupts after changing an interrupt mask bit > is to exit the TB back to the cpu main loop. But if I do this change for Xtensa I get a bunch of test_interrupt failures that indicate that the interrupt that should have been taken wasn't taken. FTR here's the change that I tested, did I miss something? diff --git a/target/xtensa/translate.c b/target/xtensa/translate.c index fdf47642e6f1..85e8d65f169d 100644 --- a/target/xtensa/translate.c +++ b/target/xtensa/translate.c @@ -631,18 +631,10 @@ static int gen_postprocess(DisasContext *dc, int slot) { uint32_t op_flags = dc->op_flags; -#ifndef CONFIG_USER_ONLY - if (op_flags & XTENSA_OP_CHECK_INTERRUPTS) { - if (tb_cflags(dc->base.tb) & CF_USE_ICOUNT) { - gen_io_start(); - } - gen_helper_check_interrupts(cpu_env); - } -#endif if (op_flags & XTENSA_OP_SYNC_REGISTER_WINDOW) { gen_helper_sync_windowbase(cpu_env); } - if (op_flags & XTENSA_OP_EXIT_TB_M1) { + if (op_flags & (XTENSA_OP_EXIT_TB_M1 | XTENSA_OP_CHECK_INTERRUPTS)) { slot = -1; } return slot; @@ -1175,7 +1167,7 @@ static void disas_xtensa_insn(CPUXtensaState *env, DisasContext *dc) if (dc->base.is_jmp == DISAS_NEXT) { gen_postprocess(dc, 0); dc->op_flags = 0; - if (op_flags & XTENSA_OP_EXIT_TB_M1) { + if (op_flags & (XTENSA_OP_EXIT_TB_M1 | XTENSA_OP_CHECK_INTERRUPTS)) { /* Change in mmu index, memory mapping or tb->flags; exit tb */ gen_jumpi_check_loop_end(dc, -1); } else if (op_flags & XTENSA_OP_EXIT_TB_0) { -- Thanks. -- Max