From patchwork Thu Feb 28 02:24:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 159305 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp112934jad; Wed, 27 Feb 2019 18:29:40 -0800 (PST) X-Google-Smtp-Source: AHgI3IaL9tD2UrBPt+fEhZbIwc0CYZe24c7L12k+WmTOwpesHc/XfYm+8izEg7VWzGJSR7NihHES X-Received: by 2002:a81:12d6:: with SMTP id 205mr3966857yws.338.1551320980067; Wed, 27 Feb 2019 18:29:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551320980; cv=none; d=google.com; s=arc-20160816; b=he2R6PFgsACsVJL6sohgs4tuz+6TAX9APXPFAAk2h5Bg30B85etPzk/xqo0PgAJQA5 jtruUNHaJDKd4RwaUUaVfyrUZlT5Kue8fvkN/YSySwCtuiV6mW4NRoOxIUetHPxYxioq U96ar/ijlEuIASvVqaaHu3lEntcYAKL/f0cKCOjU9KRIEz+VjZmdayAw1qPjIVtPG1rp BDdBXLrae+0hiI1YePc3QKLmoVxvnyox4xjsCX2CXXmXqIzNTcsrYJf+msQ0kOiKGKpW /D+jowZome8EOt7i7Xvc8xnqQkm1Ns/Dbvjn/7QmNdjCsfMwyNINFAynoxXQGaz5o1ez +PUw== 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:references:in-reply-to :message-id:date:to:from:dkim-signature; bh=xvID2qgXqZj1yGEiZojx46MlPX9UnBo71CxlwZmoZ40=; b=U1ZOZ/7SrWNV0X3vMWzT7PGCtAfB54tyPZzvrJHfcUL9DST7icQaV63airQW/xJRq3 UsdLqsWvbQkIqq0oBhQ24Inb2pC1l/rlP8asq09YixUfkHhOtaU+gXK/h01KblskJvu6 8OGf3y1OHmO/gW6D3dS4el5F5I1xoz1WCemNTyIDx84Z9lWJlcLWg8Io3NJs+rp8z0yX 1Tob+AJsktyPUhPXbf5WX6Zg1Fu4GlqxJ16jA6ZV2R4DTa/h/bEYDtk8V5qbRAzFaBfo ouu2Gqh0j1oBsMONuzpQ1RaUA7SWj3K6uEaTdIh2329lijFKxLBCfji9PzJw3Pr66DkN JCiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=xCTNdYeW; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.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. [209.51.188.17]) by mx.google.com with ESMTPS id n6si10108010ywh.299.2019.02.27.18.29.39 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 27 Feb 2019 18:29:40 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=xCTNdYeW; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.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 ([127.0.0.1]:55900 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gzBS7-0006XY-JR for patch@linaro.org; Wed, 27 Feb 2019 21:29:39 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43948) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gzBN9-0003OJ-Ha for qemu-devel@nongnu.org; Wed, 27 Feb 2019 21:24:32 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gzBMz-00053N-4W for qemu-devel@nongnu.org; Wed, 27 Feb 2019 21:24:21 -0500 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]:40170) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gzBMy-000522-Sp for qemu-devel@nongnu.org; Wed, 27 Feb 2019 21:24:21 -0500 Received: by mail-pf1-x444.google.com with SMTP id h1so8937762pfo.7 for ; Wed, 27 Feb 2019 18:24:20 -0800 (PST) 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; bh=xvID2qgXqZj1yGEiZojx46MlPX9UnBo71CxlwZmoZ40=; b=xCTNdYeWRjgqo7ok6xeWY3ZVoD9buli3q+Ooz/Cwtx9k6CN//5r1sAOlS2eIU/QZz/ T31zAw7ms9Rr77j9oqqp/wqAk9KAXK8Q9pH3aOwRG8InA83aDoDCKuv0ZQDQSSrA3bKV CwEC5bvk6HOD3wcKklL6Q4LR6ziv5GViDizGlmEe/rZpVug4W+piK0Lj6NM+A1jzP7hu rPVomHrKPUL0GNpoCtQ2892s5WQ2sOGhF4IyAgNsdKW2Pm2Psgj6/QHnwLuzINZzlFW1 t+Y3ILRo6VsRjwGohiBoMVltJAnnpTk3v2jwfFgf1M0y8EbI7Q6Cqd45f+THDBAqn1ZP TISQ== 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; bh=xvID2qgXqZj1yGEiZojx46MlPX9UnBo71CxlwZmoZ40=; b=jfbRxpnhkhkyAWHvRpo5x6ywh+c9BydAs2RCdcJak1AxnbkzbYinIpuvfjiwCB7uXj Puam8bR1aK0qPoDnnLYEvKFd88XMi4GwDKf6PIrIHr5CnLK4kRtYnA8Z5HT06H2uItuw Ma856dB4ee1IFRIsQ5IchneZ8BsQPJJyexE0RnK9M4AdNtcmnGQ71FXDVLd6szMJ2aKT 14JfRLfT9cQVI6v1vyI0PBiWWcB35LomgUb4Ind4k4s7Ec2movnMzMvnxGRHVS1Xoywp 1KUEsZj9Zc4u0ggxlD6OHFb7xQ9mHMMspNcIbtIm3NFq+tG3fANTuwpnW5mQE06VHoZ6 IxbA== X-Gm-Message-State: AHQUAuZF6MNJfFzcIpbT5e0xuOZk77i6zTpkdx7DRv6CEteJAYVwcUCU vs9BG2suZ7T6NijxDTCXjRVU58Xx6q0= X-Received: by 2002:a63:455f:: with SMTP id u31mr6053273pgk.241.1551320659482; Wed, 27 Feb 2019 18:24:19 -0800 (PST) Received: from cloudburst.dc.rr.com ([2605:e000:100e:478c:cfa2:eb27:db4f:e85]) by smtp.gmail.com with ESMTPSA id l28sm11928346pfi.186.2019.02.27.18.24.18 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 27 Feb 2019 18:24:18 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 27 Feb 2019 18:24:13 -0800 Message-Id: <20190228022415.27878-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190228022415.27878-1-richard.henderson@linaro.org> References: <20190228022415.27878-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::444 Subject: [Qemu-devel] [PATCH v2 1/3] target/arm: Split out arm_sctlr 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: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Minimize the number of places that will need updating when the virtual host extensions are added. Signed-off-by: Richard Henderson --- target/arm/cpu.h | 26 ++++++++++++++++---------- target/arm/helper.c | 8 ++------ 2 files changed, 18 insertions(+), 16 deletions(-) -- 2.17.2 diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 1eea1a408b..9a4c56826a 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -3029,11 +3029,20 @@ static inline bool arm_sctlr_b(CPUARMState *env) (env->cp15.sctlr_el[1] & SCTLR_B) != 0; } +static inline uint64_t arm_sctlr(CPUARMState *env, int el) +{ + if (el == 0) { + /* FIXME: ARMv8.1-VHE S2 translation regime. */ + return env->cp15.sctlr_el[1]; + } else { + return env->cp15.sctlr_el[el]; + } +} + + /* Return true if the processor is in big-endian mode. */ static inline bool arm_cpu_data_is_big_endian(CPUARMState *env) { - int cur_el; - /* In 32bit endianness is determined by looking at CPSR's E bit */ if (!is_a64(env)) { return @@ -3052,15 +3061,12 @@ static inline bool arm_cpu_data_is_big_endian(CPUARMState *env) arm_sctlr_b(env) || #endif ((env->uncached_cpsr & CPSR_E) ? 1 : 0); + } else { + int cur_el = arm_current_el(env); + uint64_t sctlr = arm_sctlr(env, cur_el); + + return (sctlr & (cur_el ? SCTLR_EE : SCTLR_E0E)) != 0; } - - cur_el = arm_current_el(env); - - if (cur_el == 0) { - return (env->cp15.sctlr_el[1] & SCTLR_E0E) != 0; - } - - return (env->cp15.sctlr_el[cur_el] & SCTLR_EE) != 0; } #include "exec/cpu-all.h" diff --git a/target/arm/helper.c b/target/arm/helper.c index fbaa801cea..8a71a80dfd 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -12877,12 +12877,8 @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, flags = FIELD_DP32(flags, TBFLAG_A64, ZCR_LEN, zcr_len); } - if (current_el == 0) { - /* FIXME: ARMv8.1-VHE S2 translation regime. */ - sctlr = env->cp15.sctlr_el[1]; - } else { - sctlr = env->cp15.sctlr_el[current_el]; - } + sctlr = arm_sctlr(env, current_el); + if (cpu_isar_feature(aa64_pauth, cpu)) { /* * In order to save space in flags, we record only whether