[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 3/3] target/nios2: Use gen_io_start around wrctl instruction
From: |
Peter Maydell |
Subject: |
Re: [PATCH 3/3] target/nios2: Use gen_io_start around wrctl instruction |
Date: |
Sun, 5 Jul 2020 18:10:06 +0100 |
On Mon, 29 Jun 2020 at 09:17, Wentong Wu <wentong.wu@intel.com> wrote:
>
> wrctl instruction on nios2 target will cause checking cpu
> interrupt but tcg_handle_interrupt() will call cpu_abort()
> if the CPU gets an interrupt while it's not in 'can do IO'
> state, so add gen_io_start around wrctl instruction. Also
> at the same time, end the onging TB with DISAS_UPDATE.
>
> Signed-off-by: Wentong Wu <wentong.wu@intel.com>
> ---
> target/nios2/translate.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/target/nios2/translate.c b/target/nios2/translate.c
> index 83c10eb2..51347ada 100644
> --- a/target/nios2/translate.c
> +++ b/target/nios2/translate.c
> @@ -32,6 +32,7 @@
> #include "exec/cpu_ldst.h"
> #include "exec/translator.h"
> #include "qemu/qemu-print.h"
> +#include "exec/gen-icount.h"
>
> /* is_jmp field values */
> #define DISAS_JUMP DISAS_TARGET_0 /* only pc was modified dynamically */
> @@ -518,7 +519,11 @@ static void wrctl(DisasContext *dc, uint32_t code,
> uint32_t flags)
> /* If interrupts were enabled using WRCTL, trigger them. */
> #if !defined(CONFIG_USER_ONLY)
> if ((instr.imm5 + CR_BASE) == CR_STATUS) {
> + if (tb_cflags(dc->tb) & CF_USE_ICOUNT) {
> + gen_io_start();
> + }
> gen_helper_check_interrupts(dc->cpu_env);
> + dc->is_jmp = DISAS_UPDATE;
> }
> #endif
> }
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
though as Richard notes ideally the interrupt handling code here should
be rewritten because the check_interrupts helper is a very weird way
to implement things.
thanks
-- PMM
- Re: [PATCH 3/3] target/nios2: Use gen_io_start around wrctl instruction, (continued)
- Re: [PATCH 3/3] target/nios2: Use gen_io_start around wrctl instruction, Richard Henderson, 2020/07/02
- RE: [PATCH 3/3] target/nios2: Use gen_io_start around wrctl instruction, Wu, Wentong, 2020/07/03
- RE: [PATCH 3/3] target/nios2: Use gen_io_start around wrctl instruction, Wu, Wentong, 2020/07/05
- RE: [PATCH 3/3] target/nios2: Use gen_io_start around wrctl instruction, Wu, Wentong, 2020/07/05
- Re: [PATCH 3/3] target/nios2: Use gen_io_start around wrctl instruction, Peter Maydell, 2020/07/05
- RE: [PATCH 3/3] target/nios2: Use gen_io_start around wrctl instruction, Wu, Wentong, 2020/07/05
RE: [PATCH 3/3] target/nios2: Use gen_io_start around wrctl instruction, Wu, Wentong, 2020/07/03
Re: [PATCH 3/3] target/nios2: Use gen_io_start around wrctl instruction,
Peter Maydell <=
Re: [PATCH 3/3] target/nios2: Use gen_io_start around wrctl instruction, Wu, Wentong, 2020/07/09