Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1jllZs-0005DH-Gt for mharc-qemu-trivial@gnu.org; Wed, 17 Jun 2020 23:51:00 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52648) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jllZq-0005CK-GO; Wed, 17 Jun 2020 23:50:58 -0400 Received: from mga01.intel.com ([192.55.52.88]:53511) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jllZn-00059E-SJ; Wed, 17 Jun 2020 23:50:57 -0400 IronPort-SDR: fo+KaZzuyzjO+/a6dM9Vc2vl6xIyetpUJsPLSn35gRdYNOiWdOff+g1OkjZIFOoD/YAHksCRza mvkrzzOj1gEA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Jun 2020 20:50:52 -0700 IronPort-SDR: u79IcDOItKp/UTcYXS1JEqid2fwLWQcEEqYlV+h8sVFIkRWMelZGuVDse0mFXnx1V7+uKM5pRu MzGwJiat2xNw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,525,1583222400"; d="scan'208";a="262786990" Received: from unknown (HELO localhost.localdomain.sh.intel.com) ([10.239.153.142]) by orsmga007.jf.intel.com with ESMTP; 17 Jun 2020 20:50:50 -0700 From: wentongw To: qemu-devel@nongnu.org Cc: qemu-trivial@nongnu.org, crwulff@gmail.com, marex@denx.de, peter.maydell@linaro.org, Wentong Wu Subject: [PATCH] target/nios2: Use gen_io_start/end around wrctl instruction. Date: Thu, 18 Jun 2020 07:41:29 -0400 Message-Id: <20200618114129.5636-1-wentong.wu@intel.com> X-Mailer: git-send-email 2.21.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=192.55.52.88; envelope-from=wentong.wu@intel.com; helo=mga01.intel.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/06/17 23:50:52 X-ACL-Warn: Detected OS = FreeBSD 9.x or newer [fuzzy] X-Spam_score_int: -49 X-Spam_score: -5.0 X-Spam_bar: ----- X-Spam_report: (-5.0 / 5.0 requ) BAYES_00=-1.9, DATE_IN_FUTURE_06_12=1.947, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action X-BeenThere: qemu-trivial@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Jun 2020 03:50:58 -0000 From: Wentong Wu 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 a 'can do IO' state, so around wrctl instruction add gen_io_start/end. Signed-off-by: Wentong Wu --- target/nios2/translate.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/target/nios2/translate.c b/target/nios2/translate.c index e17656e6..deaefcaf 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,13 @@ 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); + if (tb_cflags(dc->tb) & CF_USE_ICOUNT) { + gen_io_end(); + } } #endif } -- 2.21.3