From patchwork Mon Jul 10 15:47:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 107310 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp3598320qge; Mon, 10 Jul 2017 08:52:36 -0700 (PDT) X-Received: by 10.55.100.130 with SMTP id y124mr4752541qkb.54.1499701956725; Mon, 10 Jul 2017 08:52:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499701956; cv=none; d=google.com; s=arc-20160816; b=dUHvIYt9liowZLSnQLXZavxX+vw8bFawXIjJ7bnWCBCiSRA1W91jhGqB0FEGB7p4Pa pHRYW5k3VWeHyzaPKYQm/KZaSqHgTUvls1X4VHygsGRgUw7ss18YuL6rIBlETszqwEoF 6VNesDgfJvSI6VcRaAUxAZOkfJDARD9ZULSfwq+x4RPI8xHeUJ0hmnySsTHewoVBXPQo O0xuylHBn1MdhdFyNuCs0/A5uLBtKs4VoGHcgiM2oZOEtnLowyN9US4+95adygqjQRFM teM3/M+7W2YZH7hQxjMG5GbeE9e4wb4zyxa7EtAULHtAnIPX+XjcqHPq4Jko+VmRW1fU 2mlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=xaXIChuFtQzU2BFFQRDYvr57aCCwpvRqSY/ssnz7wE4=; b=x9tqMOzZQQII0D2OTIZRLK6XW/XQ3harsL27idbwijuBs66bkoO1HzxfaMCOaiyBh6 VGxycfaVim+EvGFGCgDN2AfFAl1HamvhMS0MAzhtXTyGFrOfCwAYp6U5UvrwuXDJnrhZ fLGxCmFuPlVgs217eVYcTrQF818FDXeMpYw2fJPE+vPxVtxNSXaJZ3JFMpRapfD6Q5zH zB+YlNmal8DdxHgPG5U3bxfrBVn0FC81pWANEBeE7NzkCKGyl2uLh+rZtl9i29YiXMFv GLd0SeH4JSNiuNPsa9QKtXF/wZSaG4vNm97bBka8VX0z63P4AbrE0fglL4qv4Fv9cmxD dWQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.b=Kn6tlPwa; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id h2si11224683qte.246.2017.07.10.08.52.36 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 10 Jul 2017 08:52:36 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.b=Kn6tlPwa; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:41530 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dUazC-0000sz-4P for patch@linaro.org; Mon, 10 Jul 2017 11:52:34 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60819) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dUaun-00063j-Um for qemu-devel@nongnu.org; Mon, 10 Jul 2017 11:48:08 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dUaun-0003aR-0m for qemu-devel@nongnu.org; Mon, 10 Jul 2017 11:48:01 -0400 Received: from mail-wr0-x234.google.com ([2a00:1450:400c:c0c::234]:34231) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dUaum-0003a5-QR for qemu-devel@nongnu.org; Mon, 10 Jul 2017 11:48:00 -0400 Received: by mail-wr0-x234.google.com with SMTP id 77so144034242wrb.1 for ; Mon, 10 Jul 2017 08:48:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xaXIChuFtQzU2BFFQRDYvr57aCCwpvRqSY/ssnz7wE4=; b=Kn6tlPwaWrvJBLX1PVi/wQHyvCa+tnA1ZLtMlCoRUeaDIalSfatqE2AHpxMIBdP/re HWq19yPVjE/VxqH7KCpli1A6ylMQNyx24uTZk5wHLYoXtp4ExD+Zk+dWavh1F4C0FcAr ugIOmZiV8ZtSH1sM/efWLlAWBh+aAZ7+E0EMg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xaXIChuFtQzU2BFFQRDYvr57aCCwpvRqSY/ssnz7wE4=; b=pevId57S3Mf4G/1MC7mvMMX93d/ZpET4/9gQRo+wo2y93CGapRSm0X35PkEbwgSOqG rasUx4PN+vQZ6J7MWi78S3wgJvHCStxotp/jBVUGkNf/LvAgPdSEeuASqhhHnA6SeXVY i1mAxcsUwM+vZ/iW5Kem1EZc+wWkB/yyQW3EuM08kOUbbV9axNFKW9C5olB32ONtZw5a Y/TlSFkPQHwa2kMsL8ZPCPQUFSgW0fZKlx6FWlELJHdPAaGvwJUgzLqqWKG+aLQm7DdO VWEeohZwsIWva1GAlNEenUgEh2BnXWy4lPVzwGi3o8FEa72kX1uhgw6JDRCOSBj+Gv4R rupA== X-Gm-Message-State: AIVw112C5smlBjn1KKSwznQstynjblZIb93IwCUd08OnC4aUP5Yqs0Sd zZ34OSQHdvW8nfb+ X-Received: by 10.223.147.132 with SMTP id 4mr7603256wrp.107.1499701679560; Mon, 10 Jul 2017 08:47:59 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id m26sm19363033wrm.4.2017.07.10.08.47.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Jul 2017 08:47:54 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id C76333E0A57; Mon, 10 Jul 2017 16:47:49 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org, rth@twiddle.net, cota@braap.org Date: Mon, 10 Jul 2017 16:47:48 +0100 Message-Id: <20170710154749.13624-6-alex.bennee@linaro.org> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170710154749.13624-1-alex.bennee@linaro.org> References: <20170710154749.13624-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::234 Subject: [Qemu-devel] [PATCH v1 5/6] target/arm: use DISAS_JUMP for ISB handling X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "open list:ARM" , =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" While an ISB will ensure any raised IRQs happen on the next instruction it doesn't cause any to get raised by itself. We can therefor use DISAS_JUMP for ISB instructions and rely on the exit_request check at the top of each TB to deal with exiting if needed. Signed-off-by: Alex Bennée --- target/arm/translate-a64.c | 2 +- target/arm/translate.c | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) -- 2.13.0 diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index bde6ca934e..fd9724b890 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -1394,7 +1394,7 @@ static void handle_sync(DisasContext *s, uint32_t insn, * any pending interrupts immediately. */ gen_a64_set_pc_im(s->pc); - s->is_jmp = DISAS_UPDATE; + s->is_jmp = DISAS_JUMP; return; default: unallocated_encoding(s); diff --git a/target/arm/translate.c b/target/arm/translate.c index e840499c6f..f7f5f917c7 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -1203,6 +1203,15 @@ static inline void gen_lookup_tb(DisasContext *s) s->is_jmp = DISAS_UPDATE; } +/* End the current block and force a TB lookup. We may chain to the + * next TB but exit_req will be immediately checked so we will exit to + * the main loop if we need to */ +static inline void gen_jump_tb(DisasContext *s) +{ + tcg_gen_movi_i32(cpu_R[15], s->pc & ~1); + s->is_jmp = DISAS_JUMP; +} + static inline void gen_hlt(DisasContext *s, int imm) { /* HLT. This has two purposes. @@ -8171,7 +8180,7 @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) * self-modifying code correctly and also to take * any pending interrupts immediately. */ - gen_lookup_tb(s); + gen_jump_tb(s); return; default: goto illegal_op; @@ -10564,7 +10573,7 @@ static int disas_thumb2_insn(CPUARMState *env, DisasContext *s, uint16_t insn_hw * and also to take any pending interrupts * immediately. */ - gen_lookup_tb(s); + gen_jump_tb(s); break; default: goto illegal_op;