From patchwork Thu Jul 13 14:19:23 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: 107692 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp2281322qge; Thu, 13 Jul 2017 07:25:04 -0700 (PDT) X-Received: by 10.55.150.193 with SMTP id y184mr5113115qkd.113.1499955904352; Thu, 13 Jul 2017 07:25:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499955904; cv=none; d=google.com; s=arc-20160816; b=Kmo5UkE74Fin5H7yLGXF4uRp2kqlMt/HaTxmbqeu3km4x9mhzFmzndDZVTVpFrGgDF dS+fcY78y4NBu4LaeyYqPPspeZBT5Z1sgLwpO/juiyjHf+3iNNI4SLvjwJ1eyHu+BZeS wBc62PSkFWDDNOa4VlhgvSS4OFfJA/yvXBl0deHqFoMf4hAYHO1iOUf2rmdJ6pcdjcti /rMu/YTtrOHacS5BTXR1yaYudmxDls7zjmXzy93VsqB9V5gOd0/qolZT3Ca6QZf+eFHA eA1E2hGS3b4MImKy1Ml0JCxQ2arqb59gilQG09H0ecwIwAITlzMsAtme0BIwzzCZ2+nr DrSA== 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=GX78zWPDX8+8rg6HXIAfNrRYuxdLAVkpZVVTP63GZpc=; b=sGrSdiSUAUbpiex0ZSypqRPXc45iQdbtmPvKQLoaN4yWHUZoFC7X8cl37JhVxymgu6 WgkPpbYdd3IgQcqRMxo+BOBCpt6hizByC3Xy7ZMMBn5Jp55hjh5OcOg384dbVyWmJFD9 HxDtJH8fmpMvW9jki1wMCqfMiDlK66Bst1hbeZhR0Xc/oK8lU96HeHYC3nxpXjTgZ/6c xIVafjmni0j2XRizccBmRfoC51vgdkUWvxGMITrZl/XzrfR1jVvguYHTcSuUYvOYYBhJ sDO2ddOG4EpKMeQiK/AXD9h1jfgIDyKdiMaZaqjNBBb+fZOeJ6SlMLlnoGvSwiZLT4cm 4StA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.b=T0gmLx+o; 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 j14si5126722qtc.324.2017.07.13.07.25.03 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 13 Jul 2017 07:25:04 -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=T0gmLx+o; 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]:60356 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVf37-0008PQ-Jj for patch@linaro.org; Thu, 13 Jul 2017 10:25:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48519) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVeyr-000522-0E for qemu-devel@nongnu.org; Thu, 13 Jul 2017 10:20:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dVeym-00076j-Fy for qemu-devel@nongnu.org; Thu, 13 Jul 2017 10:20:36 -0400 Received: from mail-wm0-f49.google.com ([74.125.82.49]:36768) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dVeym-00075m-9L for qemu-devel@nongnu.org; Thu, 13 Jul 2017 10:20:32 -0400 Received: by mail-wm0-f49.google.com with SMTP id 62so25143198wmw.1 for ; Thu, 13 Jul 2017 07:20: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=GX78zWPDX8+8rg6HXIAfNrRYuxdLAVkpZVVTP63GZpc=; b=T0gmLx+o4TtpDDjL8VOlY8G5Rk2Y5nx+jZQThr6Q+swkwWT/Y67aBLSPJMPHE08EU/ 52r0OpZ3OK1B2Lc7zLf4Rx8Tb70ngPn/DP2FLsfyWz9HOJXuLiSdY7D0wW1Y4JMjomL1 WQG+ohUX3IFg+g9qLYFGcxvhhKeV8p5LRcWrE= 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=GX78zWPDX8+8rg6HXIAfNrRYuxdLAVkpZVVTP63GZpc=; b=QJEqedKtVYqM/pNJX3uc8r+0WTl46QGwxe1xeZisfrZtMR4KM3lz7lVcMJx16HJLW+ ntIr18QaglgrBerU66stI83itj4vYguqAqAt7d0iCJdWrN1atDT3waOTyPBlWIDqrMGF GF5uPOCRk0qfYFKADpIp9ZStbSYy9L6U9zrWDQmcYq61oBoCaM6NJW4wzvrwX0xln0Z3 HN6bZdNk8gmEwsxUh0S4lPGvG/DiSMRcQGeJ2MlVoFpBSTsNXLaD2RvXc+gxydPNf+QS Caku7hKbjdMAXU46iSA6NWqA4nHFVtqibXBr6Vd0S+kJSQe3NetoHOf2ke7lS3n6OAi5 2oOA== X-Gm-Message-State: AIVw113GDSAsQYTsSgAUhYTnIz1tJ3435tTE2XJOsM69Z+SjeQAs8Qek 3AqS7v+FzrStHM/l X-Received: by 10.28.209.70 with SMTP id i67mr2299934wmg.3.1499955571259; Thu, 13 Jul 2017 07:19:31 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id c2sm4420103wre.22.2017.07.13.07.19.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Jul 2017 07:19:29 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id EBDF83E06FF; Thu, 13 Jul 2017 15:19:28 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Thu, 13 Jul 2017 15:19:23 +0100 Message-Id: <20170713141928.25419-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170713141928.25419-1-alex.bennee@linaro.org> References: <20170713141928.25419-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: 74.125.82.49 Subject: [Qemu-devel] [PATCH v4 1/6] 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: "Emilio G . Cota" , Peter Crosthwaite , qemu-devel@nongnu.org, qemu-arm@nongnu.org, Paolo Bonzini , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Llu=C3=ADs_Vilanova?= , Richard Henderson 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 Reviewed-by: Richard Henderson --- 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 Thu Jul 13 14:19: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: 107684 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp2277746qge; Thu, 13 Jul 2017 07:22:02 -0700 (PDT) X-Received: by 10.55.187.134 with SMTP id l128mr5370971qkf.90.1499955722793; Thu, 13 Jul 2017 07:22:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499955722; cv=none; d=google.com; s=arc-20160816; b=uDZYKM+v/u1mPSYUHBJV3zr1VsnQSvvBJ2IOZ4S2njnTdH8PFJt3MwaWf/AlcDlwT9 ndg4wNw6nhSUCRoSDYkZ2UaI7bt3EMimgETldNYzFnW9rMC/bN51FN2u5GBCg2KExBtv HqgMdTnPl4WSoebd6SIEJC7U7hjoYA2eejUUhSNxag/aB/4EOEPiX6Wd9jtcVybVqnb8 8QLsDxtxfdg1aGe2qgEqZ2rTxyByF8wwlVaISKr97osdNhrRIw5pa/TYBBNsac+13Irv imQbwGJOwgxvNk6kkB056x3hZDLTwdnH/U1h9BUtt0yHmH0KWH/OXS9FQbf4Z4fAbeZo Mk9g== 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=hwboCQert8ciWJKWXYfHpHHfqDKw/zqK0ghn6J7Czrw=; b=tGYRuxwc79Vygt0DAQmNiWHnD9pdhuF2Y5de83uexXy/VQHGiq4i3jDBOyyM17umB2 6L1Q4SZKK4OblxiWkt5RSyHuKEwd3aVduJ7Yayc5K7Mf/uX17qLjb+VG0bSm9k2fekRL 04Rfxfb+4pvVIi+R4VEBg6lMj7uvu8VikEWubro2Ot10piofioXJXSKpNoI7MuiKmDDg k6yqFnvHs5yvEMqq2x23p8+7+uapbDmU/62M0YsYo9TXP1o9ihWqXsNRASIRKAwdh2W7 14QaXE9PkzhQNqWBCgxA1az2jBk1wpbQEc7mvIk0AWEf/1FHLl+wdURzFXAhYvGLA/w8 EbcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.b=dqRkXoKn; 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 q64si5105543qkf.304.2017.07.13.07.22.02 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 13 Jul 2017 07:22:02 -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=dqRkXoKn; 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]:60341 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVf0C-00060c-7C for patch@linaro.org; Thu, 13 Jul 2017 10:22:00 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47938) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVexu-0003wU-LS for qemu-devel@nongnu.org; Thu, 13 Jul 2017 10:19:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dVexp-0006Fy-Tk for qemu-devel@nongnu.org; Thu, 13 Jul 2017 10:19:38 -0400 Received: from mail-wm0-x229.google.com ([2a00:1450:400c:c09::229]:34003) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dVexp-0006EM-Lg for qemu-devel@nongnu.org; Thu, 13 Jul 2017 10:19:33 -0400 Received: by mail-wm0-x229.google.com with SMTP id 70so4084298wmo.1 for ; Thu, 13 Jul 2017 07:19: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=hwboCQert8ciWJKWXYfHpHHfqDKw/zqK0ghn6J7Czrw=; b=dqRkXoKnVfF8MgA7erPRXwGV+4ssOiKxQJlaUSEdYXngibb+8nzu/cRTkAr44c+X6I J+xy5Ab4OFoCaIpI7FhUufp7lQXMimP0X0labcfKNyuDA1dldMc3Y63aJe90p8inogEu Q9yBLnpLgyMXzrRdIxPmBlS4wx09xUMdLX2ok= 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=hwboCQert8ciWJKWXYfHpHHfqDKw/zqK0ghn6J7Czrw=; b=qkDm7S+MlJPTWlaSsvIEujQ/GJDAZPpoCFYi4PtFsqabLCM596Di6pE51Gstd3oUHQ Ljfto98VT4nFcqk1GODHSBo47glQYUZ2UvBYoIeUVmI7oqIROnhieqmgwCQxk/rlJUuv HUEfwWbKSLX461Qdk5IsStIM0BbIWG/jhVu4qS3HIkIcfhitxUeXaQ9NCHi6sc5TsxFq /s/O8PVmEnvukh6l/a4jtJTloZH4/suh1EEXyD7oydqCyNuRSIRqCwe+ZdIliOk+igYI 5RuXvf5KTmTaPqXZaOLYM/hzrSMRm33aMlELCYhfywMfqgQaVt+IELLeFf3IeUEhGi4X 8Vvg== X-Gm-Message-State: AIVw112pO5o0vUPEmBGe4Q5JNrf7eeodF8+uc8oZJhw8z8xYUgI8fvhT dHtp6F11lTlBnihhjkS0Vg== X-Received: by 10.28.63.66 with SMTP id m63mr2262803wma.118.1499955572587; Thu, 13 Jul 2017 07:19:32 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id m123sm7174973wmb.3.2017.07.13.07.19.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Jul 2017 07:19:30 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 0B1513E0731; Thu, 13 Jul 2017 15:19:29 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Thu, 13 Jul 2017 15:19:24 +0100 Message-Id: <20170713141928.25419-3-alex.bennee@linaro.org> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170713141928.25419-1-alex.bennee@linaro.org> References: <20170713141928.25419-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:c09::229 Subject: [Qemu-devel] [PATCH v4 2/6] 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: qemu-arm@nongnu.org, =?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 Reviewed-by: Richard Henderson --- target/arm/translate-a64.c | 14 +++++++------- target/arm/translate.c | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) -- 2.13.0 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..5f2cea8641 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -12095,12 +12095,12 @@ 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); + /* fall through */ default: /* indicate that the hash table must be used to find the next TB */ tcg_gen_exit_tb(0); From patchwork Thu Jul 13 14:19: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: 107685 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp2277817qge; Thu, 13 Jul 2017 07:22:07 -0700 (PDT) X-Received: by 10.200.46.100 with SMTP id s33mr5761857qta.48.1499955726949; Thu, 13 Jul 2017 07:22:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499955726; cv=none; d=google.com; s=arc-20160816; b=y2J4FRHqfFytc8iyk9GW+o9b2kxxyxIm3rKItP++OHcpWoN6E1bJNpyxzoZ8v9qBmN Ltl3XehnAmWTGbSNWsnl3ch5v4c6ZU3od4frtQqDpPiHTTFA8qlGsv3ZOgw8PzWqyfXw OIT487R/e+1j5E0lcSRYA1IWrhrRG3HXbuTBbcY98crQfTXsKajqU6LGCLh+I+qJth0l pUYHKsoCK9yiggtlrKrCPGFLHNpRtU4pzbBGE82qZz6LxGcY/Bcs0F0W41s5/EcTSci8 unMKPIF6O9f24EFBWmmbVEKcN5ygVE1X8Me6R0nZM+CpXFdqm0ZjoOhahn5amhytUWcq 0zyw== 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=FlaaR0Jjs73VgAMUuW6fKbztHai6vOFa22Y+0NuSm/0=; b=Sr8o+3tjQx2t/K77/yaF5cgzsOletCSlvQA5JifnICWP0mvsNZnIC6DiTCskKkl0oE u8L7btr0itzsYcJBpQNq//DeKT15d0L+Xlvgmab6s0Q+G5YsJju5Gedh3SoR7FM+AhQT MwLEmgeA6U3vLR/ftrJ0F50vBTBD9B/0+LxR3wDXi80LumRt0pxhWmEfKuSDhAZAF6l/ RLJeOMCmWWtSxlXBENzWwXha1fHsSHE208BwC/vc1lU5kLcHZ+YXZUQKWU83VbMC0M0D T70nxVWupL3oUBQwkxfcVhSgmJK5mTlyHmuhf06bMP6sPaVpeqQWY/Wiwku3W0U5JS0X lX7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.b=jEqsbLpj; 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 m37si5556391qtf.131.2017.07.13.07.22.06 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 13 Jul 2017 07:22: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=jEqsbLpj; 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]:60340 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVf0G-0005vZ-H7 for patch@linaro.org; Thu, 13 Jul 2017 10:22:04 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47951) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVexv-0003wl-2O for qemu-devel@nongnu.org; Thu, 13 Jul 2017 10:19:40 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dVexr-0006Gl-1F for qemu-devel@nongnu.org; Thu, 13 Jul 2017 10:19:39 -0400 Received: from mail-wm0-x230.google.com ([2a00:1450:400c:c09::230]:37170) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dVexq-0006GD-Qj for qemu-devel@nongnu.org; Thu, 13 Jul 2017 10:19:34 -0400 Received: by mail-wm0-x230.google.com with SMTP id i127so27713679wma.0 for ; Thu, 13 Jul 2017 07:19:34 -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=FlaaR0Jjs73VgAMUuW6fKbztHai6vOFa22Y+0NuSm/0=; b=jEqsbLpjwfTJyWp5CHOrEauv3LuDFovfxVMqMjR/Fvc28eEPHpg/FBDgZcg7tLqt2g arjbDDOeo9XOs+kaztFQOuYEVj4/2lStzH9GOYzMOS7UIp9lpaDl5fwuLnQMUCiWk7LS mnh6mKUDYZRucHqgVyShCaZ9rO7Kfqo+jI65M= 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=FlaaR0Jjs73VgAMUuW6fKbztHai6vOFa22Y+0NuSm/0=; b=N/o3DjuEWCZgNOt/eeaTE7vN+Vt/20IIslCbwE+je1vciWs/3kf/LAqL5zzX7J/gaz usFifnijsH+obHyoTzpp7iPr+AxdEAywePRHuk+QFsMzXl9P9c0gTdypCGPAnwf04Kdu 0OEicT4hJi/XeW2bGTunbdQrhFg00gLBbg1xmfR3tz+y1cCkmRXbPH1loc7oAYC85MIb aWCR2fNlvZB7i+qrAHrQz0tFVNDPvanHFs+Cm4r5Km3gutNIF80ILLlauRsb8HGOXrZC MRqQvXqKQozoSYcTtpKlOzQK9pjZRvRvGfNglZ41MpaE/USmW2dRQwqtDWI+Pbdlrn0k /ipQ== X-Gm-Message-State: AIVw111EjXwNkvkGu3Ii9NrAusRnqyONSp0onc3gy5k5sU66WpGmibmE 8mMliosJGGFAMcPnwltlpw== X-Received: by 10.28.111.84 with SMTP id k81mr2152087wmc.67.1499955573869; Thu, 13 Jul 2017 07:19:33 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id t12sm7119424wmd.32.2017.07.13.07.19.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Jul 2017 07:19:31 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 1C08F3E07A0; Thu, 13 Jul 2017 15:19:29 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Thu, 13 Jul 2017 15:19:25 +0100 Message-Id: <20170713141928.25419-4-alex.bennee@linaro.org> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170713141928.25419-1-alex.bennee@linaro.org> References: <20170713141928.25419-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:c09::230 Subject: [Qemu-devel] [PATCH v4 3/6] 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: qemu-arm@nongnu.org, =?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 Reviewed-by: Richard Henderson --- target/arm/translate.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) -- 2.13.0 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 Thu Jul 13 14:19: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: 107686 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp2278032qge; Thu, 13 Jul 2017 07:22:17 -0700 (PDT) X-Received: by 10.237.59.78 with SMTP id q14mr5676179qte.143.1499955737832; Thu, 13 Jul 2017 07:22:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499955737; cv=none; d=google.com; s=arc-20160816; b=pzYfsra093Wx6TqCif9tKKz4TeqThPUKpxU/Y2rWol0nogR4WL6UTsItJfC42ELqg9 w+LoIomakDCuZEXQzdbQqqxg/DS2/LPylN6UfPIcmjc/k+qhRlZAIoM9KzryuE1mxQLo q7uiIqswtjn1S9f2Ow9bSvflBYSN4G9+dlEw/dz5YbMSyLREwCN2kjwpEfyuM9ZSogdH k5iZbBltvrM/WwQDPbAVSe16MCvjeu30Mz0RzTQg17pGyitgf5CLVpjQF2uP7/PrLuj6 PKYmitjHXuJyE3MpQ+dbluuVruJsbDMDkGiDa4Ic16qHlj5oI0J5cgEOeZka3t557YMk LDQQ== 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=liCe85V904f4u71sULXskHELisZZqwQo3QCIbYOEZro=; b=JQxJvEjHk5seFAXlgtDcF4XBAPt1Alcs9aEORIu8BGO/KjHjx2oU+Ubn+9a5izE280 8gX1GSoaZ2rfNJc5iq3majL9nAvhlR7De/foN+Ixqw7VMz2W/5PG9vMBxaHPBSdoecHt whO+fO65+ltESOvKrrOCo9ma01gW4/Lz7pkt6yCkcP7Q1DnB5FPJ8ThZCHjB5pCoa47x Mb57paPAZCW9vpdyOjyNujyyDhJnedwEcbaAdD93/JQaYzyLfurdUOx6A6RXLo4n5LcY hcMxvdBt9ZGD9AYPrqejphjCaGjX7AC1e8jTnPRhUm2Ckmc+SlTtT2jkKtFzTYu+sAdH XwiA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.b=gQvsfGiQ; 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 h63si5141672qkd.279.2017.07.13.07.22.17 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 13 Jul 2017 07:22:17 -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=gQvsfGiQ; 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]:60342 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVf0R-000648-6X for patch@linaro.org; Thu, 13 Jul 2017 10:22:15 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48537) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVeyr-00053E-I1 for qemu-devel@nongnu.org; Thu, 13 Jul 2017 10:20:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dVeyq-0007Bn-DN for qemu-devel@nongnu.org; Thu, 13 Jul 2017 10:20:37 -0400 Received: from mail-wr0-f179.google.com ([209.85.128.179]:33445) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dVeyq-0007AV-6U for qemu-devel@nongnu.org; Thu, 13 Jul 2017 10:20:36 -0400 Received: by mail-wr0-f179.google.com with SMTP id r103so53943315wrb.0 for ; Thu, 13 Jul 2017 07:20: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=liCe85V904f4u71sULXskHELisZZqwQo3QCIbYOEZro=; b=gQvsfGiQtEIWbv+HK5O2Qr8OrWRrHWeKdh7OEd4H2NgcPPPRygdB54JnKovfuDYC80 ZXxbpMhv+0gW2vLlkuzmQlV15ynnqoqojZcTZhun/YLn5fZcbCAgyJjA0OIRbgYnT3f1 xoD3BL8SIpIMAyDnNkfoO7uAqolwwSgn0QyMg= 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=liCe85V904f4u71sULXskHELisZZqwQo3QCIbYOEZro=; b=Zx0cNXqwJ0F/x3fMLqklFQ9RYnpmSbdeY3uclRXNGOsf+vUSV85ETfdKHYCGGXZb/0 d9Sp+EwsbQ91HXdKJq+K4Kz8Ud///ClKqPbmdisIn3xbT66IBkpYgkkYxt6bXLAE2MsM LFkDOUD0cORMx10aqsicbYZK7x7WAz32kEU7KGsL7KG0adKx64k820OtwQyFVqo3quY8 Sfd491OoKMCG8dJeSV8+zssvpMT0Vwh0ud/efA9lugznaSc+kYAmLAN1LQmhDV1zdr9a xk95va1gI+Qo+u+qjieY6Ik/s7qAY7cbmTRtvIruUBw6h6QsFX37eexeO09bwvGq4JW1 MRVw== X-Gm-Message-State: AIVw113PcqXKHPvqjxPE3AL4+yh8JeNaF1WrxvBbtJj6C+WCcwp79Ya3 sFBFHS5D4gfhiPWP3OGekQ== X-Received: by 10.223.170.194 with SMTP id i2mr2010964wrc.143.1499955575158; Thu, 13 Jul 2017 07:19:35 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id z108sm4258811wrb.41.2017.07.13.07.19.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Jul 2017 07:19:31 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 2D0503E07A1; Thu, 13 Jul 2017 15:19:29 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Thu, 13 Jul 2017 15:19:26 +0100 Message-Id: <20170713141928.25419-5-alex.bennee@linaro.org> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170713141928.25419-1-alex.bennee@linaro.org> References: <20170713141928.25419-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 v4 4/6] target/arm/translate: ensure gen_goto_tb sets exit flags 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: qemu-arm@nongnu.org, =?utf-8?q?Alex_Benn=C3=A9e?= , qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" As the gen_goto_tb function can do both static and dynamic jumps it should also set the is_jmp field. This matches the behaviour of the a64 code. Signed-off-by: Alex Bennée Reviewed-by: Richard Henderson -- v4 - set s->is_jmp = DISAS_TB_JUMP in both cases --- target/arm/translate.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) -- 2.13.0 diff --git a/target/arm/translate.c b/target/arm/translate.c index 5f2cea8641..493a7b424a 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -4158,6 +4158,9 @@ static void gen_goto_ptr(void) tcg_temp_free(addr); } +/* This will end the TB but doesn't guarantee we'll return to + * cpu_loop_exec. Any live exit_requests will be processed as we + * enter the next TB. */ static void gen_goto_tb(DisasContext *s, int n, target_ulong dest) { if (use_goto_tb(s, dest)) { @@ -4168,6 +4171,7 @@ static void gen_goto_tb(DisasContext *s, int n, target_ulong dest) gen_set_pc_im(s, dest); gen_goto_ptr(); } + s->is_jmp = DISAS_TB_JUMP; } static inline void gen_jmp (DisasContext *s, uint32_t dest) @@ -4179,7 +4183,6 @@ static inline void gen_jmp (DisasContext *s, uint32_t dest) gen_bx_im(s, dest); } else { gen_goto_tb(s, 0, dest); - s->is_jmp = DISAS_TB_JUMP; } } From patchwork Thu Jul 13 14:19: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: 107693 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp2282854qge; Thu, 13 Jul 2017 07:26:24 -0700 (PDT) X-Received: by 10.55.221.76 with SMTP id n73mr5418384qki.186.1499955984611; Thu, 13 Jul 2017 07:26:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499955984; cv=none; d=google.com; s=arc-20160816; b=F/NvxuJwK7MHyXIxDxbxZJuARo9EcqJ4cKg28sSe+UhkQAB2Rd+az0a+bckEnZ/Cx1 onVF18GBMvlIEOmJEBrLIcN4kf7q4XxsW3BRa6fFOXZujgmzLvTiRpTD4f8RAJ5Nizke t3VNnwDpiiu2jyYiMt0Q8CGPyM+N9r4dmqL7xqnG7E5SYxEkS6TN6Yf2gi8TyWxY9uqA 4zuL18SITAxNf7U8UivHaVF6XJS0RIw5CwMXbXKYuPuzFROrXFcL2fr6OAO24VVBRx4c u0MuxOdnqDLrT3+YJz6tD8RuE5THrGap+bVT/xfhq9UlNdlykglKV9V1bQYrCyT096wK 2pVw== 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=pOoVnYiJ2JKFXGGzYSzEkdbvjh7zN2u0Rt3JHYtjaOg=; b=URP2awVunZDiD567PNEswZRJIU/42Ij8RrH8LBkPTM+jdgioa+SgOzSLZz7CM4sGYP u3xTj0THoYLqz6UtDWYsFhKoN3o+7opS2FlzlvVDUoc0V6ZK7KMddKFqAhX7Vl81ROKc Gdo/UxyzqVDG2mUzwKdEySnEFDwVHRY3SO2C+GefK3QSL8/Q+iI2jUWj0yt4s6zTodbm Y/Vdey/vywtv2SvIHJtbsQp0GeZFTVKO9xjUW4du69uI4nnylKxp/SOTkR1liwzy/prI sWmIsb47TlWdJ4FAy7xrNviAIT4D3miimirOzgvTF+imWbObTjQHOF7WYWTn5pjKPvoV SeVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.b=kkfufhAv; 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 y14si5208766qty.347.2017.07.13.07.26.24 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 13 Jul 2017 07:26:24 -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=kkfufhAv; 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]:60365 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVf4Q-0001M6-5q for patch@linaro.org; Thu, 13 Jul 2017 10:26:22 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48622) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVeyx-0005Ct-UA for qemu-devel@nongnu.org; Thu, 13 Jul 2017 10:20:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dVeyt-0007IL-Ib for qemu-devel@nongnu.org; Thu, 13 Jul 2017 10:20:43 -0400 Received: from mail-wm0-f42.google.com ([74.125.82.42]:35568) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dVeyt-0007Fx-7i for qemu-devel@nongnu.org; Thu, 13 Jul 2017 10:20:39 -0400 Received: by mail-wm0-f42.google.com with SMTP id w126so25107937wme.0 for ; Thu, 13 Jul 2017 07:20:39 -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=pOoVnYiJ2JKFXGGzYSzEkdbvjh7zN2u0Rt3JHYtjaOg=; b=kkfufhAv+pU6J5zKO+iUXnG8mQSVjO5P5caL1ela/XAEs25vzLeR91dxcJM3vCUv8L sodtil6CiNIowIc0y1BfhfQ/A+zyuakVfa3+RB0HNSDgAs8+4GoD+Ijmg2Eusx4yyhUH tGNBIvJep6GZEnVSTRR9on4e1riAKGrcLckVc= 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=pOoVnYiJ2JKFXGGzYSzEkdbvjh7zN2u0Rt3JHYtjaOg=; b=bgbL1ITCIZS5l2aO/sjdVmCz0uKf1ylqhCa7BdPvl7vpScmo/J5gCvhSoKDaFAaeK6 n7ZMWh1BzRS6L5clx/xdQbsle6Ia5LUFztkLqgb+6vGQ9NY5kswGKlKd49XYrB5cw7se 4PcOLwc6o3OAeteFdU1mVoCgP5sPXnSuV+4XvAb19MZ5QcZlYoJAs6cRWFZR1MVVxn0K GtFGpN9SAKc4WiI6NF+MlHCAATyAN/cVWyLbO+aDIUJCHkmlntVnb7399IAdg0iZxjES vmGUDsarqLKuAhWt2VB3w7fJ04qQIPAKlGKrLhmOmcIWQ42v4r32MxpdRaM/kMWfiHNm BKdg== X-Gm-Message-State: AIVw1131INUAevFqv5T6AQmEEckrnqgoaN/jqW4t0AsF+YGZXHmztjgT i8caYYTEuJcA04TN4cUSBw== X-Received: by 10.28.191.74 with SMTP id p71mr2136636wmf.45.1499955578119; Thu, 13 Jul 2017 07:19:38 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id 5sm3714127wrq.60.2017.07.13.07.19.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Jul 2017 07:19:32 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 3ECB83E08FA; Thu, 13 Jul 2017 15:19:29 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Thu, 13 Jul 2017 15:19:27 +0100 Message-Id: <20170713141928.25419-6-alex.bennee@linaro.org> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170713141928.25419-1-alex.bennee@linaro.org> References: <20170713141928.25419-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: 74.125.82.42 Subject: [Qemu-devel] [PATCH v4 5/6] target/arm: use gen_goto_tb 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: qemu-arm@nongnu.org, =?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 a simple tb exit 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 Reviewed-by: Richard Henderson --- target/arm/translate-a64.c | 2 +- target/arm/translate.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) -- 2.13.0 diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 66139b6046..2ac565eb10 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -1393,7 +1393,7 @@ 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_goto_tb(s, 0, s->pc); return; default: unallocated_encoding(s); diff --git a/target/arm/translate.c b/target/arm/translate.c index 493a7b424a..d8892d9ba5 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -8168,7 +8168,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_goto_tb(s, 0, s->pc & ~1); return; default: goto illegal_op; @@ -10561,7 +10561,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_goto_tb(s, 0, s->pc & ~1); break; default: goto illegal_op; From patchwork Thu Jul 13 14:19: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: 107682 Delivered-To: patch@linaro.org Received: by 10.140.101.44 with SMTP id t41csp2276827qge; Thu, 13 Jul 2017 07:21:14 -0700 (PDT) X-Received: by 10.200.39.196 with SMTP id x4mr5588250qtx.80.1499955674349; Thu, 13 Jul 2017 07:21:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499955674; cv=none; d=google.com; s=arc-20160816; b=NbnloeDPjf7nxdqiRl47EBB7XMi9CtK2U+1psA2zIEaN2q6dGHlFxoogw2Psrykrhm KFCWr8ZvLJe7dx49efa2FGNyBlF2SVcifv6/q3GsAPRPh9hTqHieCiwMpqGJ5COVcOER 86wGCsXmNjZzqW7Ms9DMpl2iP6TTiWQ6kSBw2j5PJeqpBaAZwfqy1t8g1GG/NO0Fybdq nShO277LXUmwJtJ9XgHCOQaEZBvLhPjHr9u5Uh7DWRaXqucfEPgPkkHINgEiJ+/bXFYM UX95ZELLg54hmUSqUv6I4E9PdByjvC5OMtdEvkSSSk2H82+O07OBJ3CS5+axcsYHBoa8 KJ8g== 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=M+8nmIK2ujRzl+PPkj/JQdJgEdEQPlAfJVlLIUiRr6Y=; b=rY0yzbkZKLrbsUaAyxBmdfQI/RCuhtxIhmTWAkp5+sQLZUQujhTS/eb3aekocv29Ma 1amzXjzINABjAen5qdJOeSwhGkQOUGHVdVJMFQ/JcrK+M6mVs7pbXYWAxH6dA0yW4pNP hI3s/dHgE2xxKF1ILF7RSreKwbMPNT93GqRVnKGSFMprTs2iOJBW6TBgegtTRmLMwARU 8g7hj+qWbHHz6qTG9AOxZvTP6mN9+TOwZNSMdR0BcmvHidJTgt3pHJogd27IYy26ehfN 7IoIv23rPlPC/WemsdqpDNApr9r5r3K5uChnirR/J0mhNRxA5LwRmFd6ApYnFt85EUPC xjrQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.b=dpvXd4qr; 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 t69si5111647qka.264.2017.07.13.07.21.13 for (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 13 Jul 2017 07:21:14 -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=dpvXd4qr; 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]:60338 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVezP-00057Z-Pg for patch@linaro.org; Thu, 13 Jul 2017 10:21:11 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47947) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dVexv-0003wj-1H for qemu-devel@nongnu.org; Thu, 13 Jul 2017 10:19:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dVext-0006Is-SX for qemu-devel@nongnu.org; Thu, 13 Jul 2017 10:19:38 -0400 Received: from mail-wm0-x234.google.com ([2a00:1450:400c:c09::234]:38864) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dVext-0006ID-Mk for qemu-devel@nongnu.org; Thu, 13 Jul 2017 10:19:37 -0400 Received: by mail-wm0-x234.google.com with SMTP id f67so27728690wmh.1 for ; Thu, 13 Jul 2017 07:19: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=M+8nmIK2ujRzl+PPkj/JQdJgEdEQPlAfJVlLIUiRr6Y=; b=dpvXd4qr3G9XUTCLs4Undp3rPY7O3GQQgEI8Q4145momD7bO/Crl63PgseeeBR0k+F ow1HztiXXD/a/2NmUcoKvJcki93XCvlyMzm/INDC9kH0LUFW5Nh+LlvGbT2KezyJTbl8 yN8520QJ5z791Nfnb/YqKOVIzc9ZpX4Y7IpSs= 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=M+8nmIK2ujRzl+PPkj/JQdJgEdEQPlAfJVlLIUiRr6Y=; b=ZlkYt4UikxrlGnnDcynTAiRQ9QwVG+4cOC/Sq2Z7vAEBepFf0e8shqA+sRT54/cR64 Ol01s+fUB1ZoRc08l0GTc9tm8RAYO5NTC/MSfuGZdaXYvKjCftRlHjaqFy5A2yhCUtz8 3zLum2v2TU5AdTC9Ep6PQtn2UomS8uSyFrgfx35JW7UKmiu1SwnnARZY56/LcvRH220I 07BPpmlfa80cVoeXk1AMvV7c/PWqrEEwlk8pFhXCOBUTydbow6YUi/lScMEGIjLQIBUW 0Iu8EV+7YdZO9EKIMLaRPIxM19JfA9bo4/Z6XwtZGNiZ6FOQalvOArLszsFZkP7YPJ/l MONA== X-Gm-Message-State: AIVw112wF0TPUgynowzwpurYIH9j761y95WvcmiwR8blU925UKmuxikc Oe8HE661wYiTF9SI X-Received: by 10.28.224.134 with SMTP id x128mr2493085wmg.12.1499955576634; Thu, 13 Jul 2017 07:19:36 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id l73sm8806105wma.27.2017.07.13.07.19.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 13 Jul 2017 07:19:32 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 518433E0B27; Thu, 13 Jul 2017 15:19:29 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org Date: Thu, 13 Jul 2017 15:19:28 +0100 Message-Id: <20170713141928.25419-7-alex.bennee@linaro.org> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170713141928.25419-1-alex.bennee@linaro.org> References: <20170713141928.25419-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:c09::234 Subject: [Qemu-devel] [PATCH v4 6/6] 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: "Emilio G . Cota" , qemu-devel@nongnu.org, qemu-arm@nongnu.org, Joakim Bech , Etienne Carriere , =?utf-8?q?Alex_Benn=C3=A9e?= , Jaroslaw Pelczar 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. CC: Etienne Carriere CC: Joakim Bech CC: Jaroslaw Pelczar CC: Peter Maydell CC: Emilio G. Cota Signed-off-by: Alex Bennée Reviewed-by: Richard Henderson --- target/arm/translate-a64.c | 3 ++- target/arm/translate.c | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) -- 2.13.0 diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 2ac565eb10..3fa39023ca 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -1788,7 +1788,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 d8892d9ba5..2d2b3f772c 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -4478,7 +4478,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. */ @@ -9522,7 +9523,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;