qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] target/nios2: add DISAS_NORETURN case for nothing more to generate
@ 2020-06-29 16:05 Wentong Wu
  2020-06-29 16:05 ` [PATCH 2/3] target/nios2: in line the semantics of DISAS_UPDATE with other targets Wentong Wu
                   ` (2 more replies)
  0 siblings, 3 replies; 21+ messages in thread
From: Wentong Wu @ 2020-06-29 16:05 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial, marex, crwulff, Wentong Wu, peter.maydell

Add DISAS_NORETURN case for nothing more to generate because at runtime
execution will never return from some helper call. And at the same time
replace DISAS_UPDATE in t_gen_helper_raise_exception and gen_exception
with the newly added DISAS_NORETURN.

Signed-off-by: Wentong Wu <wentong.wu@intel.com>
---
 target/nios2/translate.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/target/nios2/translate.c b/target/nios2/translate.c
index e17656e6..b052be85 100644
--- a/target/nios2/translate.c
+++ b/target/nios2/translate.c
@@ -149,7 +149,7 @@ static void t_gen_helper_raise_exception(DisasContext *dc,
     tcg_gen_movi_tl(dc->cpu_R[R_PC], dc->pc);
     gen_helper_raise_exception(dc->cpu_env, tmp);
     tcg_temp_free_i32(tmp);
-    dc->is_jmp = DISAS_UPDATE;
+    dc->is_jmp = DISAS_NORETURN;
 }
 
 static bool use_goto_tb(DisasContext *dc, uint32_t dest)
@@ -802,7 +802,7 @@ static void gen_exception(DisasContext *dc, uint32_t excp)
     tcg_gen_movi_tl(cpu_R[R_PC], dc->pc);
     gen_helper_raise_exception(cpu_env, tmp);
     tcg_temp_free_i32(tmp);
-    dc->is_jmp = DISAS_UPDATE;
+    dc->is_jmp = DISAS_NORETURN;
 }
 
 /* generate intermediate code for basic block 'tb'.  */
@@ -877,6 +877,7 @@ void gen_intermediate_code(CPUState *cs, TranslationBlock *tb, int max_insns)
         tcg_gen_exit_tb(NULL, 0);
         break;
 
+    case DISAS_NORETURN:
     case DISAS_TB_JUMP:
         /* nothing more to generate */
         break;
-- 
2.21.3



^ permalink raw reply related	[flat|nested] 21+ messages in thread
* Re: [PATCH 3/3] target/nios2: Use gen_io_start around wrctl instruction
@ 2020-07-09 11:58 Wu, Wentong
  0 siblings, 0 replies; 21+ messages in thread
From: Wu, Wentong @ 2020-07-09 11:58 UTC (permalink / raw)
  To: peter.maydell; +Cc: QEMU Developers

[-- Attachment #1: Type: text/plain, Size: 1861 bytes --]

> >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>

Hi Peter,

Will this be merged? If not, I would like to follow any suggestions, thanks

Thanks

>
> 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


[-- Attachment #2: Type: text/html, Size: 11574 bytes --]

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2020-07-09 11:59 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-29 16:05 [PATCH 1/3] target/nios2: add DISAS_NORETURN case for nothing more to generate Wentong Wu
2020-06-29 16:05 ` [PATCH 2/3] target/nios2: in line the semantics of DISAS_UPDATE with other targets Wentong Wu
2020-07-02 18:14   ` Richard Henderson
2020-07-02 18:25     ` Richard Henderson
2020-06-29 16:05 ` [PATCH 3/3] target/nios2: Use gen_io_start around wrctl instruction Wentong Wu
2020-07-01 13:26   ` Wu, Wentong
2020-07-02 18:53   ` Richard Henderson
2020-07-03 13:22     ` Wu, Wentong
2020-07-05 13:22     ` Wu, Wentong
2020-07-05 13:24     ` Wu, Wentong
2020-07-05 17:08     ` Peter Maydell
2020-07-05 18:16       ` Max Filippov
2020-07-05 20:53         ` Max Filippov
2020-07-06  8:55           ` Peter Maydell
2020-07-06  0:56     ` Wu, Wentong
2020-07-03 15:14   ` Wu, Wentong
2020-07-05 17:10   ` Peter Maydell
2020-07-06  0:30     ` Wu, Wentong
2020-07-07  2:41     ` Wu, Wentong
2020-07-02 18:12 ` [PATCH 1/3] target/nios2: add DISAS_NORETURN case for nothing more to generate Richard Henderson
2020-07-09 11:58 [PATCH 3/3] target/nios2: Use gen_io_start around wrctl instruction Wu, Wentong

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).