From patchwork Mon Jul 10 19:21:24 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: 107315 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp3835685qge; Mon, 10 Jul 2017 12:21:53 -0700 (PDT) X-Received: by 10.200.34.2 with SMTP id o2mr5923276qto.67.1499714513121; Mon, 10 Jul 2017 12:21:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499714513; cv=none; d=google.com; s=arc-20160816; b=0tO8wPjcfnazbsiBqvCSAgo8EYgIFGc/Q8qfQvM5cwsSHfqC6lK64oAQOLrJmZ8ZXi QNhPCFXW0GRgqNeYLFOv2LRfxAwRHdLMLstXHApZb0uhidX1Wvp6+xP0yYU7F+h9BCLS VD1/LNrml4yN2sk0DDd1To6DP+EuJ0ZsMxvbW1dDp7Ho2gl6HBedZQkMFDUQlLg97V1L Q5Qv5S48WEUagF2d1bXSZVUilAHelJPwk6oPj90AYxukdoXCIRw0gzqkrxmKXVtdPzQZ MeKKAUTPDgea7u2xY7BqgeFia29JXbi2uzUoaKg+I2wGL7PCTDHcnlWBOu9q2hkaeHbn TeyQ== 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=oiYY7L6CJhTMaujluKlhbW1IrGWZZrdUFXSimciraWk=; b=KNKJK0le4zAqT+m6TEhuUC8FaTYOr85oadf3U4/zoimEGH/ihqvKrpdbeW5d9qVg0v bmYqkBIFWFI299ruppg5UysoOx6FhxQVxhGgYbKc0xYPKMjM/fTV0BMQFtJcaR7L79q7 c/7wQYM+lKS25DXWmdeN/uJax4JC5tX9+w+Kx1PJo7wdgUoLP7X7guTcwQQUutjFGjlW nJYQFdS56bNfehiEU/iuIdnQISmezuI5IE53dH80K16Qe9xsDqVSlaubrp/SzvsMLqqf VOqHJ2dJGiRo7d7lCxAu6aAQFpNr1htsuYO2/YGdF68zivIZoWB6B4+5l99ReDmkfLt9 DZrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.b=boKLD7M2; 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 n94si11582497qtd.151.2017.07.10.12.21.52 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 10 Jul 2017 12:21:53 -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=boKLD7M2; 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]:42615 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dUeFi-0007dD-Nm for patch@linaro.org; Mon, 10 Jul 2017 15:21:50 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41345) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dUeFT-0007bY-S7 for qemu-devel@nongnu.org; Mon, 10 Jul 2017 15:21:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dUeFR-0006aD-OE for qemu-devel@nongnu.org; Mon, 10 Jul 2017 15:21:35 -0400 Received: from mail-wr0-x235.google.com ([2a00:1450:400c:c0c::235]:35480) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dUeFR-0006a1-Hg for qemu-devel@nongnu.org; Mon, 10 Jul 2017 15:21:33 -0400 Received: by mail-wr0-x235.google.com with SMTP id k67so151272813wrc.2 for ; Mon, 10 Jul 2017 12:21:33 -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=oiYY7L6CJhTMaujluKlhbW1IrGWZZrdUFXSimciraWk=; b=boKLD7M2Y79sGtiJYTBS1rnqgyAKZ2GkmuEYXs3PI7gqKMENEEWBUlvoilxNImf4aW 2ETZrNRAOjpn5lcyJghV75A0BZM1QNxjM/lAJ98a3zsFCMbD07vykAAF+eobnWmTZ4vO YiwPwOoDjrzz2fJKk1IrSuRmWLQdVSgLCRoOU= 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=oiYY7L6CJhTMaujluKlhbW1IrGWZZrdUFXSimciraWk=; b=kCZJ0pUWjOMYyw6KWM8SYn6gizjfFdJJmYI42EcZe6a0NLjqVc2OR1OEDu9pss4JmS WWw899PJvhm29mj0ejtPWPZDebFJKthmW6z69KbeULtizT9o51d2ypRHp5xmojRI5BKc mcCN4m7vGNRa5DazN0lUcqtaDuVcyLZpsT5q2hx0Rm3crVoZnEDedR1V0xtEdwwq3cJY RB6W9K9v8yAKuvq8NhwxT0pSuaYbEb1+kfhzYBW7eqir+l3w5QW8lCCyHayTWlUFRhGO 9lchik/EMyLDHATYkmeq65xjrfcUHlHyzHHNFi496EOA0/qNewXIWTwYXvXgUqOjttxC x5Jg== X-Gm-Message-State: AIVw112ESFhbdcOJk71yv1WFAtSOjMFEbzaVC046FOJwhhDV0LuGqyR1 X7LGcRgrVazqr9zNQT99MA== X-Received: by 10.28.8.144 with SMTP id 138mr8997226wmi.8.1499714492447; Mon, 10 Jul 2017 12:21:32 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id u135sm655915wmu.12.2017.07.10.12.21.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Jul 2017 12:21:28 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 7F7EF3E0258; Mon, 10 Jul 2017 20:21:28 +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 20:21:24 +0100 Message-Id: <20170710192128.9048-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170710192128.9048-1-alex.bennee@linaro.org> References: <20170710192128.9048-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::235 Subject: [Qemu-devel] [PATCH v2 1/5] include/exec/exec-all: document common exit conditions 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: Paolo Bonzini , Peter Crosthwaite , =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org, =?utf-8?q?Llu=C3=ADs_Vilanova?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" As a precursor to later patches attempt to come up with a more concrete wording for what each of the common exit cases would be. CC: Emilio G. Cota CC: Richard Henderson CC: Lluís Vilanova Signed-off-by: Alex Bennée --- include/exec/exec-all.h | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) -- 2.13.0 diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h index 8096d64a1d..a23894f687 100644 --- a/include/exec/exec-all.h +++ b/include/exec/exec-all.h @@ -35,11 +35,34 @@ typedef abi_ulong tb_page_addr_t; typedef ram_addr_t tb_page_addr_t; #endif -/* is_jmp field values */ +/* DisasContext is_jmp field values + * + * is_jmp starts as DISAS_NEXT. The translator will keep processing + * instructions until an exit condition is reached. If we reach the + * exit condition and is_jmp is still DISAS_NEXT (because of some + * other condition) we simply "jump" to the next address. + * The remaining exit cases are: + * + * DISAS_JUMP - Only the PC was modified dynamically (e.g computed) + * DISAS_TB_JUMP - Only the PC was modified statically (e.g. branch) + * + * In these cases as long as the PC is updated we can chain to the + * next TB either by exiting the loop or looking up the next TB via + * the loookup helper. + * + * DISAS_UPDATE - CPU State was modified dynamically + * + * This covers any other CPU state which necessities us exiting the + * TCG code to the main run-loop. Typically this includes anything + * that might change the interrupt state. + * + * Individual translators may define additional exit cases to deal + * with per-target special conditions. + */ #define DISAS_NEXT 0 /* next instruction can be analyzed */ #define DISAS_JUMP 1 /* only pc was modified dynamically */ -#define DISAS_UPDATE 2 /* cpu state was modified dynamically */ -#define DISAS_TB_JUMP 3 /* only pc was modified statically */ +#define DISAS_TB_JUMP 2 /* only pc was modified statically */ +#define DISAS_UPDATE 3 /* cpu state was modified dynamically */ #include "qemu/log.h" From patchwork Mon Jul 10 19:21:25 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: 107318 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp3838132qge; Mon, 10 Jul 2017 12:24:22 -0700 (PDT) X-Received: by 10.55.99.76 with SMTP id x73mr6290307qkb.219.1499714662187; Mon, 10 Jul 2017 12:24:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499714662; cv=none; d=google.com; s=arc-20160816; b=yT8hUWuFkvfDyTTyelyEGqiDQnyGpoW10MNuXiHDPac1Xs2tizqTI5wSlErDAi4Cju 8T1dxy25B/D1VdAvE/6j6BbjhBPQlbHYrUaH57uFTeAEuuzK3A9xIjTf4NmQpBWYAzcu 6q6lSkHS6c/oTW2f/cXbFXI/Vpo206zkKcNe9+xs33LhPBGMOIBpfnwZPKY1ycx08Vwc 28wg5j7jPGE1SaazqcRTrY/YYMX99jQ/CLExlylUH/VliXgzZc7nNqzMeDPpwmNF91c7 4L2hhOXze1EWjoUcBei5O78/Q0KRdEcn9DpZ93zmddl1ETBw48XPD3VtaTzBDpBXmlrC VHpw== 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=dbtvMLbGFELVf1orPK9hygDsZgqdY3uvuUXVoJvEohs=; b=GCv3gGoHF9pn5FwKXKvqC8wrERYRmsc3pIxt2s/v/uxfPl8ZAvR6y7k9Cz30ntze50 xLEK9tGnF7jU7ioLOpdhxeaT5vxGbl0UZJKpHormc55cF46kduPIEcaQStKURpCT6vEl 9y/CVBwww2reXLs7uAgW3uveHYmsBUYKfUV+J16xxZVTdnhzyLu2ZCW61T8Npdr2Dp7q 07gRWJRxd9dLEB719DOoArwaRA0pbqqn6F2h6znuA89dC6UImJufbxQ5RZvXc0kmB9J8 hWOzf6uIwaWtYe93vYAfGc/M86zT1xoaiqVjTiXiTb5ZAKiGCW04Mu8TxUPOD5Un3+fB gajw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.b=F8wjoW5R; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 208.118.235.17 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. [208.118.235.17]) by mx.google.com with ESMTPS id 68si6956076qkq.318.2017.07.10.12.24.21 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 10 Jul 2017 12:24:22 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.b=F8wjoW5R; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 208.118.235.17 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]:42627 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dUeI7-0000ga-PC for patch@linaro.org; Mon, 10 Jul 2017 15:24:19 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41542) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dUeGR-000876-ED for qemu-devel@nongnu.org; Mon, 10 Jul 2017 15:22:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dUeGO-00076S-9m for qemu-devel@nongnu.org; Mon, 10 Jul 2017 15:22:35 -0400 Received: from mail-wr0-f169.google.com ([209.85.128.169]:34786) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dUeGO-00076A-3l for qemu-devel@nongnu.org; Mon, 10 Jul 2017 15:22:32 -0400 Received: by mail-wr0-f169.google.com with SMTP id 77so151753088wrb.1 for ; Mon, 10 Jul 2017 12:22:32 -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=dbtvMLbGFELVf1orPK9hygDsZgqdY3uvuUXVoJvEohs=; b=F8wjoW5Ron8Q8kD5M0IcO1ddAtGuUYy7uVygM23WgQw9Q9LZONgVJNB04ztvwAm8pb 7cEei3HeC3p7bA86AJLpKa0axNZ93wDFZZeV2RaRc510iQljXpG7NI3YrxWBNP1FDjRA nVNwzD2pgSF0X/ejqq09hT8mjIyttnv9uHhAA= 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=dbtvMLbGFELVf1orPK9hygDsZgqdY3uvuUXVoJvEohs=; b=pkVVAvvgbJzejMnr1Wq7QKSzjfMzKkvtGmnTSweob+i48OBsVOj7zag5rqDYhyi7UY 0bKGB4BiyKYmH0ANDm48DepcY3+xx4F0QxUlE7IPm02iWxLFs6KKM/dv2H1v1/4XCO6t jqWL0ISIkOY2xTfBHMfOMJjMNXwdNkTHdRDXUXjNayHYbsM43JObD74Zewj4v79dXYrj Tnk7AhSO1gXf8x3Qia6YqzMjkBkMTRmLHF8+og1BezEn1tu3+oVSDPsTbmrQyIKBfFIZ 1oeT4vy3uD7g5x7sdi9oq8XkU+B20WbScuDHakiiU5S03kRpVEDgCYbB2Uck6hqKCXo1 Fkyg== X-Gm-Message-State: AIVw113wXjgPcpXQsgMJmQVEVwNbgTUcNWH+Svjq/cq12OwsN40dMn92 hkeyXfMxL95mndwv X-Received: by 10.223.162.219 with SMTP id t27mr8662390wra.68.1499714491110; Mon, 10 Jul 2017 12:21:31 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id 24sm16248217wrw.0.2017.07.10.12.21.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Jul 2017 12:21:28 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 922493E03FE; Mon, 10 Jul 2017 20:21:28 +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 20:21:25 +0100 Message-Id: <20170710192128.9048-3-alex.bennee@linaro.org> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170710192128.9048-1-alex.bennee@linaro.org> References: <20170710192128.9048-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.128.169 Subject: [Qemu-devel] [PATCH v2 2/5] target/arm/translate: make DISAS_UPDATE match declared semantics 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" DISAS_UPDATE should be used when the wider CPU state other than just the PC has been updated and we should therefor exit the TCG runtime and return to the main execution loop rather assuming DISAS_JUMP would do that. Signed-off-by: Alex Bennée --- target/arm/translate-a64.c | 14 +++++++------- target/arm/translate.c | 5 ++--- 2 files changed, 9 insertions(+), 10 deletions(-) -- 2.13.0 Reviewed-by: Richard Henderson diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index e55547d95d..66139b6046 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -11364,16 +11364,9 @@ void gen_intermediate_code_a64(ARMCPU *cpu, TranslationBlock *tb) case DISAS_NEXT: gen_goto_tb(dc, 1, dc->pc); break; - default: - case DISAS_UPDATE: - gen_a64_set_pc_im(dc->pc); - /* fall through */ case DISAS_JUMP: tcg_gen_lookup_and_goto_ptr(cpu_pc); break; - case DISAS_EXIT: - tcg_gen_exit_tb(0); - break; case DISAS_TB_JUMP: case DISAS_EXC: case DISAS_SWI: @@ -11397,6 +11390,13 @@ void gen_intermediate_code_a64(ARMCPU *cpu, TranslationBlock *tb) */ tcg_gen_exit_tb(0); break; + case DISAS_UPDATE: + gen_a64_set_pc_im(dc->pc); + /* fall through */ + case DISAS_EXIT: + default: + tcg_gen_exit_tb(0); + break; } } diff --git a/target/arm/translate.c b/target/arm/translate.c index 0862f9e4aa..ccc4768b2e 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -12095,12 +12095,11 @@ void gen_intermediate_code(CPUARMState *env, TranslationBlock *tb) case DISAS_NEXT: gen_goto_tb(dc, 1, dc->pc); break; - case DISAS_UPDATE: - gen_set_pc_im(dc, dc->pc); - /* fall through */ case DISAS_JUMP: gen_goto_ptr(); break; + case DISAS_UPDATE: + gen_set_pc_im(dc, dc->pc); default: /* indicate that the hash table must be used to find the next TB */ tcg_gen_exit_tb(0); From patchwork Mon Jul 10 19:21:26 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: 107320 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp3838884qge; Mon, 10 Jul 2017 12:25:06 -0700 (PDT) X-Received: by 10.55.132.135 with SMTP id g129mr6450037qkd.36.1499714706336; Mon, 10 Jul 2017 12:25:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499714706; cv=none; d=google.com; s=arc-20160816; b=hFZY/8UOzgp6pgXBXHaVRT4iTCG0V+8fU9+d4TW104ax+ngzcpi6dZqekUVSYjke9T YIxU6bbnEQyL6KF2nt1Q5f8V5IfWciGvi1lmZYqLzEdatqME9CBcre1l4nnnCNZW6NR7 cUuwrK5yLqNsDIz3Iz0Oz6q9/SGumHrg68W3E6B1IYuy7t/XP8DdTVqxjLy2knCqA9aB 3QAI6RqiOk0Ulgje7q2QZaTTOQr1AFrc0gMWIJWBv2SfGkSunxCIMspf4TbTM5xLOnje pmpFSkrnctQzzbS+O2kJfAQEOr3SCdyrqDpffslaoKfcTKElgydKp2/ukKwlGUT3gk8v 4rFg== 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=miagGu2m06GsBWnbGIrgvqPDRnh1k6uVQW1God4w2uQ=; b=gqc/gpCYax7kCXA77ge2dqBVi0g7vOT4Cw1SPKzsgOwbiIG0hwVkLohJJ5GjA3Q6JL be4WROHPcutWlKbdLeAinEHBdMfNsIfsgP9c7wPjq+GKru/OqWwIlqOWnGxp0uESqjkD TXx1x6043cbkORJPp7GU9zc+S72/I3nePXOEpF26Em7bDCRrY4pU4dwKoP/ejSS2nT3d vWP+blAQSi46+tvxo3mbj7Fdr0Y49CNEJxD/7aS8d2UabKzaXomNBjog1KW4I4dT1xRu 9FCE+VgW2VOEfm0HnikCzIlEZeLKbapW0k4d0MI4OjWMMXuY8wb1Lwj7+c+qjAqyoPnv N6oQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.b=dN7P2uRh; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 208.118.235.17 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. [208.118.235.17]) by mx.google.com with ESMTPS id x7si11442704qtx.301.2017.07.10.12.25.05 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 10 Jul 2017 12:25:06 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.b=dN7P2uRh; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 208.118.235.17 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]:42629 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dUeIp-0001Sd-OB for patch@linaro.org; Mon, 10 Jul 2017 15:25:03 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41558) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dUeGS-00087Q-6J for qemu-devel@nongnu.org; Mon, 10 Jul 2017 15:22:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dUeGR-00077D-Bc for qemu-devel@nongnu.org; Mon, 10 Jul 2017 15:22:36 -0400 Received: from mail-wr0-f169.google.com ([209.85.128.169]:36026) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dUeGR-00076u-4n for qemu-devel@nongnu.org; Mon, 10 Jul 2017 15:22:35 -0400 Received: by mail-wr0-f169.google.com with SMTP id c11so151877945wrc.3 for ; Mon, 10 Jul 2017 12:22:35 -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=miagGu2m06GsBWnbGIrgvqPDRnh1k6uVQW1God4w2uQ=; b=dN7P2uRheBG0/JkrH1vk1kqSvJKybxYAzHJTb8ibf5rV0v+EJMRF6b2OmwGzSEyG3u j1E2h2/Me1SK438VE9Eh8IPBZf/V0n3q36mHBNzIRRnkrNIxAhk5AnDmGlXm1X9fTxig YerJOJSdob2/Kpc9G44qTA3PW3ksK18lg6Dl0= 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=miagGu2m06GsBWnbGIrgvqPDRnh1k6uVQW1God4w2uQ=; b=LeKw+2z7WL2fEv89u40tBEXNuVdSx2W/k/Zz24bAyEfVyPPnG5NfZAwzCkoKETaw2P DuFRMYBcmCJRaNnaUP4bUhUiGXF1vhjruyK6EecOUqm13e64HXX31GywsQLxhPUGyczB J6CyU3shLI/Pnci+qTARZke+qxVrTB/y3JoMiWgyhHIsmWWUZO+1a5LlxeedYGrO2rpN 6Yywbf2n46ThArXAH+szRjiU6W80CcWniARI/kYrZ8oPrDx7SIXr70RZci8FjG0TkfzI uMLBlP45pneVgGJP0OyfGd99BlcQ0OFtM/4732V1DGuxEFtCeYh2Em3kEpaiJPWOmd0B cdvA== X-Gm-Message-State: AIVw113PyztcgGsAQtl8LhgjUP/jVOM2QG9XRF4UHsV7WbcCtAwEnQ25 MFPrRwQUnUbF8SYU X-Received: by 10.28.57.197 with SMTP id g188mr8735824wma.13.1499714494091; Mon, 10 Jul 2017 12:21:34 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id r200sm5501975wmd.20.2017.07.10.12.21.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Jul 2017 12:21:32 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id A317F3E0641; Mon, 10 Jul 2017 20:21:28 +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 20:21:26 +0100 Message-Id: <20170710192128.9048-4-alex.bennee@linaro.org> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170710192128.9048-1-alex.bennee@linaro.org> References: <20170710192128.9048-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.128.169 Subject: [Qemu-devel] [PATCH v2 3/5] target/arm/translate.h: expand comment on DISAS_EXIT 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" We already have an exit condition, DISAS_UPDATE which will exit the run-loop. Expand on the difference with DISAS_EXIT in the comments. Signed-off-by: Alex Bennée --- target/arm/translate.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) -- 2.13.0 Reviewed-by: Richard Henderson diff --git a/target/arm/translate.h b/target/arm/translate.h index 15d383d9af..12fd79ba8e 100644 --- a/target/arm/translate.h +++ b/target/arm/translate.h @@ -140,7 +140,10 @@ static void disas_set_insn_syndrome(DisasContext *s, uint32_t syn) */ #define DISAS_BX_EXCRET 11 /* For instructions which want an immediate exit to the main loop, - * as opposed to attempting to use lookup_and_goto_ptr. + * as opposed to attempting to use lookup_and_goto_ptr. Unlike + * DISAS_UPDATE this doesn't write the PC on exiting the translation + * loop so you need to ensure something (gen_a64_set_pc_im or runtime + * helper) has done so before we reach return from cpu_tb_exec. */ #define DISAS_EXIT 12 From patchwork Mon Jul 10 19:21:27 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: 107321 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp3839974qge; Mon, 10 Jul 2017 12:26:07 -0700 (PDT) X-Received: by 10.55.184.71 with SMTP id i68mr6107638qkf.87.1499714767612; Mon, 10 Jul 2017 12:26:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499714767; cv=none; d=google.com; s=arc-20160816; b=YfPoAD/BaRWeehqMwOUJ5h2wzANaOXtJWhyzmNH2aGWTCvGqfo1hv7WCtOVJusRH7x J9S6QNXAx72R8b6kkjn/8XS5E8g0fgPkEezk7GzAKU12RpJGqt+qN+RNEK+Y504I1j1Q DkKVX7A+6MvOl7nnz2UVIbFDBmyA1+kaIcrBbANryy3BwNoGkw+CzkhALkDr2lxdZryp X9DwKBdDgQwjz8oofIpS8JdbOxoTi38TMMQ/+WrkasGZds2ze16pgRmfQaySg5TPNt2m 9I7A47aWceeUVWm+8fBVDvGzF9TpKc1GM139Tmpc6ScewakczHoa/gVEufvJnmUmqPnZ Bt7Q== 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=Oq2k5itGUG3T56W06iZ6wHVpmze4AVn+j6M2n/FDFkU=; b=Urw7vFPA6JWoFFxrL+bf1SgYhXZAez2EBOl9koVhm2WMNjyg4G/nmAgCHWGaMMtYgN 1PlB8grsHroL5ZVGCevsifNJUgBTjkb7xO+5NXg4ex/tHq+NB271VK4GEXsicGWmefVr yWtgPe6ELzCTgPO0EJQHrHj7VZkXzfZ78V41PK4qrVIDfSTmwkR8Vdp/yeVBxYTlr4Af bdKd8417NtmkAv0Zv5rEIYUjZA43EdKsJAjCuZyT98coXFHRytTeCOij4Yarrgq2b1m9 K+PX6m6MwIvNkNdIHvOQ5CWuP1n7QGkXJajJ2Ru+rkPMeDjZY4beYazOsCfd/RPnuv6A EmzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.b=kKlKkS3F; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 208.118.235.17 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. [208.118.235.17]) by mx.google.com with ESMTPS id l64si12074589qkl.189.2017.07.10.12.26.07 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 10 Jul 2017 12:26:07 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.b=kKlKkS3F; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 208.118.235.17 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]:42638 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dUeJp-0002He-0r for patch@linaro.org; Mon, 10 Jul 2017 15:26:05 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41596) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dUeGV-00089W-K8 for qemu-devel@nongnu.org; Mon, 10 Jul 2017 15:22:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dUeGS-00077y-G8 for qemu-devel@nongnu.org; Mon, 10 Jul 2017 15:22:39 -0400 Received: from mail-wr0-f180.google.com ([209.85.128.180]:33506) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dUeGS-00077S-9i for qemu-devel@nongnu.org; Mon, 10 Jul 2017 15:22:36 -0400 Received: by mail-wr0-f180.google.com with SMTP id r103so151965621wrb.0 for ; Mon, 10 Jul 2017 12:22:36 -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=Oq2k5itGUG3T56W06iZ6wHVpmze4AVn+j6M2n/FDFkU=; b=kKlKkS3FfiORcwVz88Axwe06jw2JT2/AtyOqeryxEsvC4nyKlRSbGrA86ve4KwvebM m2FErzrnIbUwQpJG5/O7aeoapWW97FG+fhsb4yU13lUCWd3x9Tcxq+zSfgV4K8RRNZqt cXxZL+BO5ejaPmvgaWoi/LEO2tv2qI5JA/EpA= 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=Oq2k5itGUG3T56W06iZ6wHVpmze4AVn+j6M2n/FDFkU=; b=m8YMOkACATLitMVXtHsQ3eU+/UQRn37AkKBYGGXZOiM+fBcbccKXFcnvuOs5xl+TGR rzpVPzlE8Tc6wJgWuXudTYy5CLVLMbKWXhDq9nUSyGEfVLPGy4PyqIGGPy+ycJkA21lK KFlDjcrFr8Cy14ugMK4uaT7S/+qNjJlKJYYMNbA1pyauiBUcYJXDcyPjPJ8Hdbgn6VVw FKC+SqSYLc1vc9qOEOgm6YCsiMMH1JjDrxUGBeXT76cRVtooRzKWfmYsRiOI4dXgFnMX lG0W1ydMydMqtJ1wrXDwu5m4I31C4K0+jxOI0e5gXvWKhqMmiozga530gWKpVsoUOv+8 5wNQ== X-Gm-Message-State: AIVw112ZTez1ATVDIS/hYB1vA5No8DNQlO+xQ09n4ZWG1kFyhIneKnaY Vl2MWPs0rBD8zdhy X-Received: by 10.28.113.23 with SMTP id m23mr8754429wmc.128.1499714495127; Mon, 10 Jul 2017 12:21:35 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id o131sm9640275wmd.26.2017.07.10.12.21.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Jul 2017 12:21:32 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id B48C03E07CF; Mon, 10 Jul 2017 20:21:28 +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 20:21:27 +0100 Message-Id: <20170710192128.9048-5-alex.bennee@linaro.org> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170710192128.9048-1-alex.bennee@linaro.org> References: <20170710192128.9048-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.128.180 Subject: [Qemu-devel] [PATCH v2 4/5] 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 | 3 ++- target/arm/translate.c | 13 +++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) -- 2.13.0 diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 66139b6046..ad46d84efb 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -1393,7 +1393,8 @@ static void handle_sync(DisasContext *s, uint32_t insn, * a self-modified code correctly and also to take * any pending interrupts immediately. */ - s->is_jmp = DISAS_UPDATE; + gen_a64_set_pc_im(s->pc); + s->is_jmp = DISAS_JUMP; return; default: unallocated_encoding(s); diff --git a/target/arm/translate.c b/target/arm/translate.c index ccc4768b2e..94aa4bbb4d 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -1201,6 +1201,15 @@ static inline void gen_lookup_tb(DisasContext *s) s->is_jmp = DISAS_EXIT; } +/* 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. @@ -8165,7 +8174,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; @@ -10558,7 +10567,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; From patchwork Mon Jul 10 19:21:28 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: 107317 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp3837285qge; Mon, 10 Jul 2017 12:23:28 -0700 (PDT) X-Received: by 10.233.235.3 with SMTP id b3mr2743461qkg.138.1499714608857; Mon, 10 Jul 2017 12:23:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499714608; cv=none; d=google.com; s=arc-20160816; b=pxccjZGS67XwaDQUPGNES9CLK9A3/ASrtny08PocjgdpjWYS3EdMDmv4ii3fOTnNqC qQp25PfaUHzgMVHCv7RTF0HMPsZHKKQTcT3dhflPSI5o/QckqD7as3/0GMPGLNDSPHZI GxXfHY1IgzzvBuu5pvW1naoCAcBeXNwzIGn7trUV8B5eCqPyS4jv5HLnXGckN8G/Ir4B S1bsv0nuEod2JBybgRmt+LwWDxNgdXHkyRtK326s4T/ahGGU1T3cx4oNi447Bc5zeCgu nifDgMVe2Gafbtwhuo27TC5NZBV5F6ugN6wlNcO5hCqIj6wgc2gB4w50YNgsbaN6R44P SOvw== 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=V65CAUygFd3FgfSYAI4WlSRIEmrkC8Vsu1/ZrV/v9Eo=; b=I+5Nj/A2ipEsBm1VokhkFI6rI81j9NWzaLsN01Ar1rogDLVQlOgkrtjNzclQrropDJ fckWKead1UlSxFHgZAL+470GOpgvQ0ilaUtOV7qjrTt/hDq1bD8dfXgmv49VUABcegi9 lZblzKDfmErS6H1OdzxNa3YiaLh6QyNxWJry6f7fB/57JVbzPcU2VoKwH7cfNftLKYNm oTDnbRDJAx8QDhDopa39UJmQwSc53Ss0vm8vjZKPJ4zYON5f1I36HRjxLM0kQJUO8GxE l+PyTuCdiq1MnxPTM8arbcLPhFvuiJlDQyMPovG6gKJc53IgKAEvi5RFd2JOAKwfaCpT anZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.b=CBpdjjhJ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 208.118.235.17 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. [208.118.235.17]) by mx.google.com with ESMTPS id c2si11963874qtd.114.2017.07.10.12.23.28 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 10 Jul 2017 12:23:28 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.b=CBpdjjhJ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 208.118.235.17 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]:42625 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dUeHG-00006h-7S for patch@linaro.org; Mon, 10 Jul 2017 15:23:26 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41621) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dUeGX-0008BK-5Y for qemu-devel@nongnu.org; Mon, 10 Jul 2017 15:22:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dUeGT-00078U-Qb for qemu-devel@nongnu.org; Mon, 10 Jul 2017 15:22:41 -0400 Received: from mail-wr0-f179.google.com ([209.85.128.179]:33527) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dUeGT-00078B-KJ for qemu-devel@nongnu.org; Mon, 10 Jul 2017 15:22:37 -0400 Received: by mail-wr0-f179.google.com with SMTP id r103so151966375wrb.0 for ; Mon, 10 Jul 2017 12:22:37 -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=V65CAUygFd3FgfSYAI4WlSRIEmrkC8Vsu1/ZrV/v9Eo=; b=CBpdjjhJvPz5fbs5ABWddP3HczcOoukjY6GRx4yYbviSFeT3uuRzxG6KA9Bk+oSijr 2VpwPMeldS2nyGbOEDagBMLnQxf804gjkcC39S8avxl7euyXHiQBCs+0zPiuPxPAzY+p Oc2kAgEeDUl+wU/AQNVybU1rk+IVKZbaoQjN4= 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=V65CAUygFd3FgfSYAI4WlSRIEmrkC8Vsu1/ZrV/v9Eo=; b=rGHqU/JON1L4mLz78KDvOoONp4s7tD8nv30YgkArNigT9HpuUzFey/nhZ7CFoGRbbj aKQEDy5btanFiTKW5cbz8Em9W0aQMfKnI6HgIN8+XZmmmUCIg0RxEoCXOZladW8muewC ka3WA5iRFUtJ2FSTWm0vhh2cqX90An6ZgoGy1pw0mMrxXr48uadPWc8uGIrIhQ1KNltk mASFo7z+hEKQRhzUAddtWQUtrmiuJOjnETzStQp/awEeRpG9UUsYSU6m3IbLn6W1DCiT O4UIJFAIX8cn6prQo/n+d8u2DjXCXAmBDM/17AW9dAsCGECiQD/cXyoAqK2RyLhnky3/ kEAQ== X-Gm-Message-State: AIVw112RfMSGPnjLC5BtTIdj4XDE3rLmPhFAJJx+puobK8RbV7GNUVYp 7dUceNVwSDdI3P3Q X-Received: by 10.28.174.80 with SMTP id x77mr8970886wme.73.1499714496553; Mon, 10 Jul 2017 12:21:36 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id l73sm17172935wma.27.2017.07.10.12.21.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 10 Jul 2017 12:21:32 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id C65D03E0A57; Mon, 10 Jul 2017 20:21:28 +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 20:21:28 +0100 Message-Id: <20170710192128.9048-6-alex.bennee@linaro.org> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170710192128.9048-1-alex.bennee@linaro.org> References: <20170710192128.9048-1-alex.bennee@linaro.org> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.128.179 Subject: [Qemu-devel] [PATCH v2 5/5] target/arm: use DISAS_EXIT for eret 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: Joakim Bech , Etienne Carriere , =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org, "open list:ARM" Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Previously DISAS_JUMP did ensure this but with the optimisation of 8a6b28c7 (optimize indirect branches) we might not leave the loop. This means if any pending interrupts are cleared by changing IRQ flags we might never get around to servicing them. You usually notice this by seeing the lookup_tb_ptr() helper gainfully chaining TBs together while cpu->interrupt_request remains high and the exit_request has not been set. This breaks amongst other things the OPTEE test suite which executes an eret from the secure world after a non-secure world IRQ has gone pending which then never gets serviced. Instead of using the previously implied semantics of DISAS_JUMP we use DISAS_EXIT which will always exit the run-loop. Signed-off-by: Alex Bennée CC: Etienne Carriere CC: Joakim Bech CC: Peter Maydell CC: Emilio G. Cota CC: Richard Henderson --- target/arm/translate-a64.c | 3 ++- target/arm/translate.c | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) -- 2.13.0 Reviewed-by: Richard Henderson diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index ad46d84efb..48825f5722 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -1789,7 +1789,8 @@ static void disas_uncond_b_reg(DisasContext *s, uint32_t insn) return; } gen_helper_exception_return(cpu_env); - s->is_jmp = DISAS_JUMP; + /* Must exit loop to check un-masked IRQs */ + s->is_jmp = DISAS_EXIT; return; case 5: /* DRPS */ if (rn != 0x1f) { diff --git a/target/arm/translate.c b/target/arm/translate.c index 94aa4bbb4d..c67a4f90d4 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -4484,7 +4484,8 @@ static void gen_rfe(DisasContext *s, TCGv_i32 pc, TCGv_i32 cpsr) */ gen_helper_cpsr_write_eret(cpu_env, cpsr); tcg_temp_free_i32(cpsr); - s->is_jmp = DISAS_JUMP; + /* Must exit loop to check un-masked IRQs */ + s->is_jmp = DISAS_EXIT; } /* Generate an old-style exception return. Marks pc as dead. */ @@ -9528,7 +9529,8 @@ static void disas_arm_insn(DisasContext *s, unsigned int insn) tmp = load_cpu_field(spsr); gen_helper_cpsr_write_eret(cpu_env, tmp); tcg_temp_free_i32(tmp); - s->is_jmp = DISAS_JUMP; + /* Must exit loop to check un-masked IRQs */ + s->is_jmp = DISAS_EXIT; } } break;