From patchwork Tue Jul 11 17:59:32 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: 107409 Delivered-To: patch@linaro.org Received: by 10.182.45.195 with SMTP id p3csp5274obm; Tue, 11 Jul 2017 11:01:24 -0700 (PDT) X-Received: by 10.55.10.11 with SMTP id 11mr1333585qkk.251.1499796084158; Tue, 11 Jul 2017 11:01:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499796084; cv=none; d=google.com; s=arc-20160816; b=pAX/Va+FpdVF7vHcFmjOXih+dacCpkIeiWvYX7QwoFE9rEonebwbbla8QkTB+UY58P tTLxwOSlt7OF83CX4yYhSxxrEKEc+8PZ7VJ7p7P4ndpYE5hgwvLa1wSlxFjvc0ST8Hwc H2Q78dBAu5GkMrg12pAZH2lQn5Griil3pdnwYxKSgQzRFBOEXOGWd5NvvRAKtAhXsHQ6 +1q+YTtk1MTN2scrTcfaDCWk2R5H2NFtx0V9CGJfb3646Hgt7+1kgq8J97HNj1D+L7SW OqFiXqkCY+1NE8JGjsJyf1ruSK8OFIeGRZXZ36NR1QzoTPxHT3vCU5A9UIyJIjAH/OPR ks/w== 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=wKB4avregVphT+/EZGzsir/Ve11BFMRFxoomhbfe8/tEmW8uAw5BF+RcJH5IzrY6Yg O5qRE309cy/IoB4LKvo2rAcmanUvtzr+/b3URPLnOOvIS4lyuVFopystzjWIu26iWW0O AygScJSPJpGlScpsfbs0JAnw28KlRygOIkatRhjmzjjL7/hl9z7Y3FAppiQmwZB+z48J mZbIiCl/s/aLHU37Jv+PXlMyotamTDldx6gIO8wfHNZVIDTyQimXS1sc1ZDTWsqtD1EK I2EQkxDYEc45k3NQPKhuA3jD3cJHsOXlYj/+pIzYdpwyIhyaKYvxjK5pFPBeDdZCChNy Rj/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.b=UsVp6F6R; 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 q7si522348qkl.241.2017.07.11.11.01.23 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 11 Jul 2017 11:01:24 -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=UsVp6F6R; 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]:48109 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dUzTN-0002UR-Mw for patch@linaro.org; Tue, 11 Jul 2017 14:01:21 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55830) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dUzRo-0001hl-9C for qemu-devel@nongnu.org; Tue, 11 Jul 2017 13:59:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dUzRm-0003kx-33 for qemu-devel@nongnu.org; Tue, 11 Jul 2017 13:59:44 -0400 Received: from mail-wr0-x22f.google.com ([2a00:1450:400c:c0c::22f]:36423) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dUzRl-0003jC-SB for qemu-devel@nongnu.org; Tue, 11 Jul 2017 13:59:42 -0400 Received: by mail-wr0-x22f.google.com with SMTP id c11so9457938wrc.3 for ; Tue, 11 Jul 2017 10:59:41 -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=UsVp6F6RAalrUKNbeMmxUqhbgDFXS9Qg1F24JwkcTNs5VjKyvIiyvfGMm2jvr2OsCO rUBL23Bs02ck6CPrMApqr5+qVayouTMFFcbcQw8GNbSmI+NGYGm1qEHm7aqA5nvPCxO9 vRW8TFOclGxA362MA/OGGswVGMu1IjXUrJPyU= 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=RpJKez6otC5kChgCB4WYAb6enQxy5lOb4sYbYsfGgjLZ3BFnHwZcSI9ZCI9DwyJ0ON m4atl83MJZ6touQQMeIGzpBxsB71uXJRULdQ/I1bfqLm+EqSaNsQy2J+Z+mA0uO0Mm9h 8uisOA6vaYzdfgLW0SAkLSRokEPgO09vxJxK++BBr5wWysulDmMhllLfp7c5Ne5tEmVJ sxh80tfDERdS3fOb1N4S/Wk/ySQfTyt4y0zCpEJEh3DGWiCdbxy806ortkeOgWO6x+VV Pbks3/uQhOT1Qelecx0rWBlnA1Fv2GukHqodYtxy3kSoEny3J0bXwPvckACEmkxck82T iFuA== X-Gm-Message-State: AIVw111VOlErrdPL5JMNb9DBFD9lqcZ545eqQDlHcjfsg5YhGQza6sap HYHtD8OMowCTaIVs X-Received: by 10.223.162.219 with SMTP id t27mr675349wra.68.1499795980681; Tue, 11 Jul 2017 10:59:40 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id q24sm519958wra.16.2017.07.11.10.59.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Jul 2017 10:59:38 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 045E83E06FF; Tue, 11 Jul 2017 18:59:38 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org, rth@twiddle.net, cota@braap.org Date: Tue, 11 Jul 2017 18:59:32 +0100 Message-Id: <20170711175937.23140-2-alex.bennee@linaro.org> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170711175937.23140-1-alex.bennee@linaro.org> References: <20170711175937.23140-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::22f Subject: [Qemu-devel] [PATCH v3 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: 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 Reviewed-by: Richard Henderson Reviewed-by: Emilio G. Cota 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 Tue Jul 11 17:59:33 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: 107410 Delivered-To: patch@linaro.org Received: by 10.182.45.195 with SMTP id p3csp6653obm; Tue, 11 Jul 2017 11:02:15 -0700 (PDT) X-Received: by 10.237.57.163 with SMTP id m32mr1474106qte.117.1499796135713; Tue, 11 Jul 2017 11:02:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499796135; cv=none; d=google.com; s=arc-20160816; b=qQCkFYvbL6S5M2HOGZcU5w4w6QaMaetpWIfKv0MMfO0CR9G1KLtXOsOoq3WLGCO0oM l9AIHEhQ7JiQodHmc9P9sLSXMh/rPHKxAJ4ye2OuYYsdy+b+n3UIeGochszd/VdVeQLP 0RFovBw3qHc/ReSBO65LZ6cmJtrF0SC+4oD1tYGDp72FwoCJPE2CWnjTqZhPtKngqcIq NL0TFSL23QIpzkAWi9BV8gEV8z35gaQxgdEgT4l78DxvJOCqmBHMBnZJne9Tg+5yj0bF BpqvAnGn+TGs2bx9kK7Dm63BTIo0yxlRarul393hJ83t0YfFYOU3gysdF7Izn6R8wTbT +5qA== 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=G070t7uh0AJrDAD+L2kA0qHq7MBUSy+7/GBErfEWzblxLDfoAPOM82uHkXW44V6EoV Fo4gX+D3AZBBEjmXojgxCIsLbvY4NqywYkaf4slwwAgO/hsScmalF+eeMYsghWU2u5CK dl+TJVLkUK/efdkmihC+RavBgDifDVbTrSulKzZWEsrlSlA4y+/SyYFFjVR6WM059LLP Aowm7mUAQIvreAWsW4+Ris0iWwsdpGM9GWm+IuhMW+Hq830ijQ1rPvImkjakRCejRYqR B6UbEwBoq/jWfevCdxc1DPWCFboGaVFXCqek2/TQEcawGD7vcYlB9nl1k7DqzWlx/w9J chBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.b=duON555l; 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 a143si496565qkb.250.2017.07.11.11.02.15 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 11 Jul 2017 11:02:15 -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=duON555l; 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]:48114 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dUzUD-0003LA-6f for patch@linaro.org; Tue, 11 Jul 2017 14:02:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55835) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dUzRo-0001i1-Jp for qemu-devel@nongnu.org; Tue, 11 Jul 2017 13:59:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dUzRn-0003nm-MP for qemu-devel@nongnu.org; Tue, 11 Jul 2017 13:59:44 -0400 Received: from mail-wr0-x22c.google.com ([2a00:1450:400c:c0c::22c]:36439) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dUzRn-0003mH-FT for qemu-devel@nongnu.org; Tue, 11 Jul 2017 13:59:43 -0400 Received: by mail-wr0-x22c.google.com with SMTP id c11so9458923wrc.3 for ; Tue, 11 Jul 2017 10:59:43 -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=duON555lQw2Jr+e0Vufg0kZofNEIrKCzn2xT+6LuNq93tcnpRUMu+a0VBmHUOtj27P /vnSpYIU9KNt9HQfFNx0k25Irt2CPpDM/UDNAj9z/+2JeiHisujqMK9LljkL1KNInZhv La1Wmqdpl66pr3hwUTIJXnBstvsBUCvSxbOx8= 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=XGUoYLzcyg1bDcxXnQj4YFrvlYzQxbK6rxCZA6GGIGN7mghLYPEiRkJnKZik8oj8Ky AqBoXDRKSFdbtvB7tj9jLNk72Npy1xI2nCjoE9DyZIGVXM0+4pDlf29T2+R4pCGYKEGj AnDNLYJlm+kLpF2LZ6pan4nfGUeFgvmB5jfxU7QWaT7cZ4FrEB9HxtVcY62Ub7XqHaKL b9YsWlbs1bI94ew9+nI1j3bDD/tSSQpPOVk1OnKYVRAUh6OqL4bgvdPuSE75Bv6qBJU0 bYiJx/VBlEaYSecks0ak/EGz3Sb5/BOgtTDlh0dtKi7IjizEm0Agy6Tw9MSCbTMe2Dzq kt3Q== X-Gm-Message-State: AIVw112RhSEsoh3uHcufC8KYwZJXW1m6Ywpt4RpDQ2ESbh5Z+JBBm9UH AyxGXpVCPKQ8Y/7p X-Received: by 10.223.141.138 with SMTP id o10mr671050wrb.69.1499795982274; Tue, 11 Jul 2017 10:59:42 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id 123sm15826333wmp.1.2017.07.11.10.59.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Jul 2017 10:59:39 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 169543E07BC; Tue, 11 Jul 2017 18:59:38 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org, rth@twiddle.net, cota@braap.org Date: Tue, 11 Jul 2017 18:59:33 +0100 Message-Id: <20170711175937.23140-3-alex.bennee@linaro.org> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170711175937.23140-1-alex.bennee@linaro.org> References: <20170711175937.23140-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::22c Subject: [Qemu-devel] [PATCH v3 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: "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 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 Reviewed-by: Emilio G. Cota 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 Tue Jul 11 17:59:34 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: 107411 Delivered-To: patch@linaro.org Received: by 10.182.45.195 with SMTP id p3csp7130obm; Tue, 11 Jul 2017 11:02:36 -0700 (PDT) X-Received: by 10.55.40.218 with SMTP id o87mr1420184qko.50.1499796156073; Tue, 11 Jul 2017 11:02:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499796156; cv=none; d=google.com; s=arc-20160816; b=LZh3vtGVJsDev/fWjYxamEQ2K3rS3PHLg8De+ocV2Gc1FgyHWpNgJgFh4UERJeCxes 2dE4/aDqKF3qdMETEn6q1uIPOgTQ9bi7ChHJKIQnK+rKllxib0NTansJ/h40714kRVbJ MgzlF3h/8/9cGf0GScgqYg/nSnFqF0ZOOvfywucqig1awYs7t1rP7VdIG++UZRlczl0h nim1tHOnlWcPr+wjfsNOhDmIaFx+k/6eSXBFaLa5R9kE1Q08NhpD2hXrqURzKQezFV6n e7WNJtaZPUgYTcN5TerEnwTxxAsW7mdJ5fIJiy3K+wbC4cBJdbAcClvQwLWxO9sIJdLH YFVQ== 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=Q/PkhwKAva0PfvkAm5LhiO8fAQQWXia6PoZaecZKGI+RMnxUUAtudM4a2MhLP3f9Cw vVipSExW2Z8A2mIm8P3n/9MBLkrMoiTf3fxMurtFGsrABEQAKjt8s44g3VJKw8S2GXNn D4DjqDXzIfZp9TDCQYzJiz189RB97iXUwa/wla+Y6/SJfbuoeAmFlZIJI7vQeytD2EdM JueDU2RsV1WVsqEvvLpRx7AUOS1TsX+S5+st8K8IaoptJhtvL0d7/bBcGXAWIowpGVYf nZWCKFjVDGEgsxcLe/Vpt+jT7e2pGPUAkte+nm7Uv95UA4cGlKNV97Q5oqByWx/npJpJ BLBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.b=TnvEeZTD; 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 t64si510765qka.249.2017.07.11.11.02.35 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 11 Jul 2017 11:02:36 -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=TnvEeZTD; 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]:48115 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dUzUX-0003Re-BU for patch@linaro.org; Tue, 11 Jul 2017 14:02:33 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56232) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dUzSr-0002UN-DB for qemu-devel@nongnu.org; Tue, 11 Jul 2017 14:00:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dUzSn-0005Dk-9z for qemu-devel@nongnu.org; Tue, 11 Jul 2017 14:00:49 -0400 Received: from mail-wr0-f175.google.com ([209.85.128.175]:34676) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dUzSm-0005CE-PO for qemu-devel@nongnu.org; Tue, 11 Jul 2017 14:00:45 -0400 Received: by mail-wr0-f175.google.com with SMTP id 77so9556886wrb.1 for ; Tue, 11 Jul 2017 11:00:44 -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=TnvEeZTDRhKZgNFqUkHnAKEPhIfyol8wPxZ2lJrmmHfM3VRpg5cRU+y700e89l05aN A28VdGUDbGkQuHbBjVidXcaK5ipNf6L3WQywyNJX6vK26pOARyWKhNKQ/Suo7VMESPT+ CL+o3pElKmZ0LyKMPb03TOBd5swC2PCoHcIl4= 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=mlkqQPLQlX+2NewoY4mOH/q1vseLSl09nRGEj+fj4xn3NqfkhPfoMcKdnvU454X5t/ K3iA1IvkdPpgbLVb8PT7jQNZT40zfDihjEx0YrYM9ywLFt0UjTmfB4IvPMn/K1M6+feL FZZNbquQRTAhkr8+Xa6QgbXDh1yeEakya7xYSk0J2A1EK51Ds7YCOPoWNymsBsypm71C jwLKcWt6xJ6WEX2O2HgUOBzQp+BmrtWfPdKOaRJZnLuQ2OZ8msfDKrEaYQR6nV3AbvRq 7nHsLByWXOV5RzxzJ7x8TmgCPjxNEo76FJ7ngUHIHiAS4552HIt0p89BxXp9m7iARnMp WDWw== X-Gm-Message-State: AIVw111uJwtl5rGbopFXOZsyf+bhiT73LmrHMmYd0yrX3kvrUlgS19LB SLbLAiK5aIUeByGn X-Received: by 10.223.146.161 with SMTP id 30mr689991wrn.164.1499795983590; Tue, 11 Jul 2017 10:59:43 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id g63sm661442wrd.11.2017.07.11.10.59.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Jul 2017 10:59:40 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 27BEE3E0C03; Tue, 11 Jul 2017 18:59:38 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org, rth@twiddle.net, cota@braap.org Date: Tue, 11 Jul 2017 18:59:34 +0100 Message-Id: <20170711175937.23140-4-alex.bennee@linaro.org> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170711175937.23140-1-alex.bennee@linaro.org> References: <20170711175937.23140-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.175 Subject: [Qemu-devel] [PATCH v3 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: "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 Reviewed-by: Richard Henderson --- target/arm/translate.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) -- 2.13.0 Reviewed-by: Emilio G. Cota 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 Tue Jul 11 17:59:35 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: 107413 Delivered-To: patch@linaro.org Received: by 10.182.45.195 with SMTP id p3csp10542obm; Tue, 11 Jul 2017 11:04:55 -0700 (PDT) X-Received: by 10.200.53.78 with SMTP id z14mr1513317qtb.184.1499796295304; Tue, 11 Jul 2017 11:04:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499796295; cv=none; d=google.com; s=arc-20160816; b=TcBO+WVNMAocoQeyX88w4zPMnl/0ppcfmUbhJ/LU3TUzRvma9kTP90IK00seuG7FXF u5GSanh5dlOlCAxz7BQboP53b8ubD/FQMhJIypHIkibJ21VMAJ0crrbkNi2+A5EmttPP RkXaumVclnDR4g1cqch7x8zMHT4PIb9772MESUblgfXlNQJGWzYCrp4Xr5IKkptvDbXg K6VRQ+PE2jGNPMiLasDG//JIQe1V5ClXCjEf8/jdStG6bvCYOmScsLzJ9COo6cCny4Tk AfZMDC5fK55BVzIkSZGYZYgPuqVvLahQaMicsm6Tn70I88vDlrE8pIybWAEPh5lzwsx2 RnjQ== 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=hfILuYeoW/2VUcoI1OEJJp+m/FkdK0C8eGA81xN2QhU=; b=Sm8neGn3l58H7/UuxgAAZoIVU2AsKFW8h1qLHEk9aLe8PMTen3sCDUXcnPV6JAKdqA gye7bM7L99gEhXw3+TZanXtaZzZpZWhXnjcd5+pzSlaXpvSvmH/mpt6+4KatiIk0rOLz qmXpoL9V3PLkFalHU+iKWYNx5PKHqipAhvKZSO0NMw5DnOFaRcQNqzPTTJCnh4sVo+es fJEa5AxSj31gXIkEDAYmbOVgHY9Wu8NbH5K2F1I1gZFsZR1eSer6Dua2O+yWxvQwaAcQ FsEyYJpD91FUMczAkuvApLDHu/nIsIKkjJkXwFdMfA36ctRuEsy87jo1TW4C/acKMq6A lg1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.b=dt4niN6e; 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 s55si538839qtb.326.2017.07.11.11.04.54 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 11 Jul 2017 11:04:55 -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=dt4niN6e; 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]:48122 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dUzWm-0005CZ-Mv for patch@linaro.org; Tue, 11 Jul 2017 14:04:52 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56237) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dUzSr-0002Ud-Nh for qemu-devel@nongnu.org; Tue, 11 Jul 2017 14:00:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dUzSo-0005F1-Fp for qemu-devel@nongnu.org; Tue, 11 Jul 2017 14:00:49 -0400 Received: from mail-wr0-f180.google.com ([209.85.128.180]:34697) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dUzSo-0005E6-43 for qemu-devel@nongnu.org; Tue, 11 Jul 2017 14:00:46 -0400 Received: by mail-wr0-f180.google.com with SMTP id 77so9557709wrb.1 for ; Tue, 11 Jul 2017 11:00:45 -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=hfILuYeoW/2VUcoI1OEJJp+m/FkdK0C8eGA81xN2QhU=; b=dt4niN6eL/AXsiZg9cDKeypk4NuMb/STgBHn5RsunR6jAX59O2wqjqbddi0e4mOaTr 8t1wgmrcuM0N6vMfiyBjZEb0cHnT4w9dEyBCCB1CEncKiZ23P9dqE5058Yy+vYND9RSC PRwy5iYpvRUfl6iSxoNMxStKPiapv4F6Jliik= 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=hfILuYeoW/2VUcoI1OEJJp+m/FkdK0C8eGA81xN2QhU=; b=nLlIV6DyPXe2pG/3wwi/Z3/xFSRKXWB7aUEPEDMjn5e0nDTRGWqTToTYxRpsiZWdHl Ue1ukYXFv0Q8wwX7p1fZRg+MF7f7Y5/NLuAI7ic4b4UVIdNldr/yANeUOACG3Bg8ssKn kA9IUnrkpcZg3uihoJRC+InoJ3aGqMGW0LdWJZAPzjJL+BaLyXuns6439oTPL8ST31nr KiRHGn2kQs2YcaYTKaHidDi156NboTGu80H08VFgNc5aez7rDpMoAQVo2bCGIiBSxxgC iEtsBnBqMhKJ8F0WA6OqC8XuX5eZcQVofOFO5Fhiir/8Y16iE5eJ+ABDykyN9DmeTTg6 UKxw== X-Gm-Message-State: AIVw111GfV7hjbp6tSJaJsUD/b9gEctkrcCeAUl1uEBH6clpkO86hRMg Ik3MdVY4NHv7a5kj X-Received: by 10.28.227.67 with SMTP id a64mr3613836wmh.116.1499795984956; Tue, 11 Jul 2017 10:59:44 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id l8sm3153464wmd.15.2017.07.11.10.59.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Jul 2017 10:59:40 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 389B73E0C22; Tue, 11 Jul 2017 18:59:38 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org, rth@twiddle.net, cota@braap.org Date: Tue, 11 Jul 2017 18:59:35 +0100 Message-Id: <20170711175937.23140-5-alex.bennee@linaro.org> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170711175937.23140-1-alex.bennee@linaro.org> References: <20170711175937.23140-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 v3 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: "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" 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 --- target/arm/translate.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) -- 2.13.0 Reviewed-by: Richard Henderson diff --git a/target/arm/translate.c b/target/arm/translate.c index 5f2cea8641..82341ee709 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -4158,15 +4158,20 @@ 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)) { tcg_gen_goto_tb(n); gen_set_pc_im(s, dest); tcg_gen_exit_tb((uintptr_t)s->tb + n); + s->is_jmp = DISAS_TB_JUMP; } else { gen_set_pc_im(s, dest); gen_goto_ptr(); + s->is_jmp = DISAS_JUMP; } } @@ -4179,7 +4184,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 Tue Jul 11 17:59:36 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: 107412 Delivered-To: patch@linaro.org Received: by 10.182.45.195 with SMTP id p3csp8266obm; Tue, 11 Jul 2017 11:03:21 -0700 (PDT) X-Received: by 10.55.52.202 with SMTP id b193mr1490378qka.220.1499796201089; Tue, 11 Jul 2017 11:03:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499796201; cv=none; d=google.com; s=arc-20160816; b=l+T9EzPCzyELY4cGAOpQSDYAbcqO7+x/VXK6H72Iz3e1JWeX28SUxRld+9x8awTHF4 XTeAWgTqUKYgQzAVIylAaJCDs/mY5DlqKK1Y/Oic1eyyRMVckT2XA0Asc1/QlaM6ZvlN zXa61sXu+q1XGYoQeAfuM8XJV/MiHF9DuJ9wvsJEiRXHluuaK0LyEs165R9h+H/2rb1i b+KtdNOHsdsazOdlTIfFiz+ijjM/wlOLIHqXxm2qww8lA4X7fsTkrpylFSJEUbkUCmmY +Z8ULCDPiEmigoNWxs38Lpn1JxCAREuHiXCUs2eHOZjNL8nJkjj4NN5iysG3uoZHoOxA 1z+w== 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=uzR4g936SSavaoSDPDoeTBWt59Ogr1zRaToBHlxex0c=; b=BaBXzrzdoyLTCCa+oaOmArsBEWKuAnPvqeg3DTaaveHPqfoo6RrDjXMtaX8Iz5vs0T uMsIbI4jMWOlUdi/3GkIGADJPCwdIbnzcQxigjFrWJDa+Ll2zbb3c50pnfcseI4aInXu 0Ij/gmd5UolFap8bYEOunU4AiEV4fBT/FeOLwW6uBd+7C1RsPeMFtD3/LeDpY5Sj+MhF Xh4WfJI4pOdYCP8KguPqQm+1mEEqrayY4wfV1nEF8NAEEC0pW1YJKtdC31Wn6Lep7itW WIp7pIFVWSG0x6+1u36GPchWcSWAJ7EGkR9gHfrVrm2aQgcQq+AVa2QuR+yvQHfonVX0 XdSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.b=M5ifRUMt; 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 j184si516256qkd.335.2017.07.11.11.03.20 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 11 Jul 2017 11:03:21 -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=M5ifRUMt; 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]:48116 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dUzVG-00040H-IP for patch@linaro.org; Tue, 11 Jul 2017 14:03:18 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56266) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dUzSt-0002W8-Nx for qemu-devel@nongnu.org; Tue, 11 Jul 2017 14:00:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dUzSq-0005Gm-GB for qemu-devel@nongnu.org; Tue, 11 Jul 2017 14:00:51 -0400 Received: from mail-wr0-f174.google.com ([209.85.128.174]:34947) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dUzSq-0005FQ-0V for qemu-devel@nongnu.org; Tue, 11 Jul 2017 14:00:48 -0400 Received: by mail-wr0-f174.google.com with SMTP id k67so9435771wrc.2 for ; Tue, 11 Jul 2017 11:00:47 -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=uzR4g936SSavaoSDPDoeTBWt59Ogr1zRaToBHlxex0c=; b=M5ifRUMtsLvsQKDPUEBq3Lr1tiQfIb1VX7+PCT3V2a4mko3+3G1uoTVtHjeAXv9+vZ +7EdZilfgURGZtnwz9SF/kEq3DtaU+EVxfZrXSl0LME0gBEcTjMIMjkiID1J27cCzr7H U01g6HLD3Q7rrLjHe8P4H4xRLxpzoB7rPPiy0= 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=uzR4g936SSavaoSDPDoeTBWt59Ogr1zRaToBHlxex0c=; b=XpmV3AxWRfOmk2owNMrWMVteGIbaxkJ4fLaiLQ59kszCNg1WpXnbCDS7krX3TZYLkw 45BF2OYFFU6C1TpPOUtkGlEgMqMSIh2IH64VktmZEWEWQisE2M2/TvwB4qQ9I9Jx0ezZ n4z4AjpBxnE5zd342OohheE70Aq4bjdYIM0sg2c5lMEKf9QsMSJxibqUeRyrv1TafK63 FsIqlpCV3LkiiWR70s+EAuc04CKv471d111D1fGkSM/rqPXrEufJb6gOD3acQUUCcezC ypShs4JpH2wDhHy4z0hVetWSh0n62P0MYWnCgRMlJfj/5Zf128scdaq2BA8jDOZ/pkOR dbzw== X-Gm-Message-State: AIVw113a50ya1YXVobpx+gd5f9Oxmf8BIgOfss54nMAFQ/HxLBBovg2f WNBzskKjJKiUTtMA X-Received: by 10.28.14.149 with SMTP id 143mr3626435wmo.105.1499795986583; Tue, 11 Jul 2017 10:59:46 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id t33sm580277wrc.50.2017.07.11.10.59.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Jul 2017 10:59:42 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 49FB73E0C26; Tue, 11 Jul 2017 18:59:38 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org, rth@twiddle.net, cota@braap.org Date: Tue, 11 Jul 2017 18:59:36 +0100 Message-Id: <20170711175937.23140-6-alex.bennee@linaro.org> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170711175937.23140-1-alex.bennee@linaro.org> References: <20170711175937.23140-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.174 Subject: [Qemu-devel] [PATCH v3 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: "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 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 --- target/arm/translate-a64.c | 2 +- target/arm/translate.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) -- 2.13.0 Reviewed-by: Richard Henderson Reviewed-by: Emilio G. Cota 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 82341ee709..dbf919cce3 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -8169,7 +8169,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; @@ -10562,7 +10562,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 Tue Jul 11 17:59:37 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: 107414 Delivered-To: patch@linaro.org Received: by 10.182.45.195 with SMTP id p3csp11631obm; Tue, 11 Jul 2017 11:05:45 -0700 (PDT) X-Received: by 10.55.111.195 with SMTP id k186mr1455543qkc.206.1499796345229; Tue, 11 Jul 2017 11:05:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1499796345; cv=none; d=google.com; s=arc-20160816; b=WkapgZAeM19VOLAkFkQtlhPeE/3wOZ0CX4P5jOvGJ14Ta1p4QX8EVrt/haylpI3TJG sqqvJ1XX3gryODNnd093gwMDznEpdfrIWCr6RT/0cLUbFqa9O++963IKtMt1f1xHMOtc LkRkp+dEn2YsF6JEX2OJGGTIEsCJa3vI3aljeHmzs+adm7cBdsNrFvRAwYyO5+W4SycT 5eLMIGQo4WTVJzkCFpAabWYNGq/8abw35pvB75aLLLqVOTbDv/zApt12VBp2mxjGej3w JtWeHjNhqH6W8UwYKIST8aBNsEKm88KPzLC9kOp0GTIIxChOdNsjvljUrbAyBU0Ic9/8 p5DA== 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=x2o5mdP7zuD828LkB7mQtBhpict2fQOo3TsMXHlbqVQ=; b=GjadUBdmVrWKdLf3pofuOFO4bmDAEAzUL1CFMuQy6W8zY7Wp2HdFybq8hElZ+COSbK 3FBZtFpeDu0OL5+uzcfJ2emMNP7hG8TE51aCFFXETDpDgevVatQqupNqLX8UC3yc6DvZ kGIVJ6T/G17RPdCxqv3hTX6G994va0/tWsPogNq+0T1CKjV+mtomoUqss4WwLo/npdhB ITdT7dO7JROXeujlKGAhwDw2YhU9xRDQ6O9zJ8gRmc37b1mbxR9wVZfYhPXm/EewsLDe dm9OSaMYurMAD5CicO4S3/fiSnCvx23WQXE/dPHie4rwDMJvGar7DQ0ZUTV6lvIrAq5a Ybhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.b=SQURLSEb; 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 b76si543483qkj.267.2017.07.11.11.05.44 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 11 Jul 2017 11:05:45 -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=SQURLSEb; 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]:48127 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dUzXZ-0005t1-1u for patch@linaro.org; Tue, 11 Jul 2017 14:05:41 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56272) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dUzSu-0002WS-0R for qemu-devel@nongnu.org; Tue, 11 Jul 2017 14:00:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dUzSq-0005HG-Q8 for qemu-devel@nongnu.org; Tue, 11 Jul 2017 14:00:52 -0400 Received: from mail-wr0-f177.google.com ([209.85.128.177]:32853) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dUzSq-0005G0-KE for qemu-devel@nongnu.org; Tue, 11 Jul 2017 14:00:48 -0400 Received: by mail-wr0-f177.google.com with SMTP id r103so9571833wrb.0 for ; Tue, 11 Jul 2017 11:00:48 -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=x2o5mdP7zuD828LkB7mQtBhpict2fQOo3TsMXHlbqVQ=; b=SQURLSEbmMsBxeGSV/TrY7oZTfR9/Kvv2Ex88B9UTJ4NwlobhIetBT4BoRSpqdM4QE EPNMgDgcjzUtnMKQ95k8DOh6I5r+bkRzlt9kQF3fsMHqgE7eyYhTGHNzdb38Kt92YZFD F204zdTsAP0NVQy3LuNfMGTFZcv1j+CB6hRb0= 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=x2o5mdP7zuD828LkB7mQtBhpict2fQOo3TsMXHlbqVQ=; b=Zxizq811wtxquZJdgs0HMdUr1XkWMWkhz6/nbwAY5aYQsbifHwTunwiH6p+YFtmBdj tztbGVsqhetqL2jnjK0fTU3Z8ruzkWwjqwMNV09DH/gJq8xMTSrbtX0vPH+7BvR3TXUz Jmp7EywuIni/JXQ4mo/yina17HWkqCA1JfT6u0T+6jf/3WK0hSaPDicgPWf7uTY33M5N 4q4QxJNaFC/Ny1bKUYAIiqqNHHy31rl1XiIwlReMl6DvIRn+xhB2DfrIWsyX2CY0etoQ 9uWIeFMRCIE46ZEm5AX6piclx39r9A9YvPcrUe1j4OuUgVlsYSSugj4b9+qc9TisqFCv 9XQA== X-Gm-Message-State: AIVw110ulf+SrCviZLaGdXvna5NxzVi1QrRdmBl23ba+P0bJuoLLtyLP hiV/vKrgo6De2Al8 X-Received: by 10.28.133.76 with SMTP id h73mr12314205wmd.92.1499795987436; Tue, 11 Jul 2017 10:59:47 -0700 (PDT) Received: from zen.linaro.local ([81.128.185.34]) by smtp.gmail.com with ESMTPSA id g66sm13986221wmc.6.2017.07.11.10.59.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Jul 2017 10:59:42 -0700 (PDT) Received: from zen.linaroharston (localhost [127.0.0.1]) by zen.linaro.local (Postfix) with ESMTP id 5C5593E0F9A; Tue, 11 Jul 2017 18:59:38 +0100 (BST) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: peter.maydell@linaro.org, rth@twiddle.net, cota@braap.org Date: Tue, 11 Jul 2017 18:59:37 +0100 Message-Id: <20170711175937.23140-7-alex.bennee@linaro.org> X-Mailer: git-send-email 2.13.0 In-Reply-To: <20170711175937.23140-1-alex.bennee@linaro.org> References: <20170711175937.23140-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.177 Subject: [Qemu-devel] [PATCH v3 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: 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. CC: Etienne Carriere CC: Joakim Bech 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 Reviewed-by: Emilio G. Cota 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 dbf919cce3..f1023d5263 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -4479,7 +4479,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. */ @@ -9523,7 +9524,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;