qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Wentong Wu <wentong.wu@intel.com>
To: qemu-devel@nongnu.org, peter.maydell@linaro.org
Cc: qemu-trivial@nongnu.org, marex@denx.de, crwulff@gmail.com,
	Wentong Wu <wentong.wu@intel.com>
Subject: [PATCH v2 3/4] target/nios2: Use gen_io_start around wrctl instruction
Date: Fri, 10 Jul 2020 19:34:32 -0400	[thread overview]
Message-ID: <20200710233433.19729-3-wentong.wu@intel.com> (raw)
In-Reply-To: <20200710233433.19729-1-wentong.wu@intel.com>

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



  parent reply	other threads:[~2020-07-10 15:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-10 23:34 [PATCH v2 1/4] target/nios2: add DISAS_NORETURN case for nothing more to generate Wentong Wu
2020-07-10 23:34 ` [PATCH v2 2/4] target/nios2: in line the semantics of DISAS_UPDATE with other targets Wentong Wu
2020-07-10 23:34 ` Wentong Wu [this message]
2020-07-10 23:34 ` [PATCH v2 4/4] hw/nios2: exit to main CPU loop only when unmasking interrupts Wentong Wu
2020-07-11 18:49 ` [PATCH v2 1/4] target/nios2: add DISAS_NORETURN case for nothing more to generate Peter Maydell
2020-07-12 15:18   ` Wu, Wentong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200710233433.19729-3-wentong.wu@intel.com \
    --to=wentong.wu@intel.com \
    --cc=crwulff@gmail.com \
    --cc=marex@denx.de \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).