From patchwork Mon Feb 11 23:52:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 158033 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp3198764jaa; Mon, 11 Feb 2019 15:53:25 -0800 (PST) X-Google-Smtp-Source: AHgI3IZjntbQQdNq+a17kLoS3dS+D9H13MQ1ym0hC3hJs2U+ZnHXtL0XRWfdaRPFym7qMAJwRrfF X-Received: by 2002:a25:4112:: with SMTP id o18mr651988yba.177.1549929205772; Mon, 11 Feb 2019 15:53:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549929205; cv=none; d=google.com; s=arc-20160816; b=bCO3ITHPIpYedZqu9oTVCZJqPdoDNq5cICz7BH7RnCZ8dlsJ3Jt/9txrCAaqpLjOE5 WWhdKv1qi+hnCognhg/dd7oY1HJkVnzfk+AcSFrWFBEX8dQNc0/3I7T/CZlTTp8QIZYC ett0ABHvpY4obZJED6kF58x5ifudXo9sAQQg6i3qHd52xQzpIbVbPabzQtMVcltjmwVk gb7dW48LrlEL2TNcTm26ds8G1/n7mou6c4c8em2CaMAiIjF8nXUqoxYaFHAL4ggMqEI9 cdCngIJjVp22+/oM9L3imw+JBzOEyeDP0CcPvI2i8/csMOmEGUc3F/RKuc1R4eumhVxR If3A== 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=t1Ac8wdCYYJyzUaPePYMhujZZB6jvuYyMH+INQ2PV8M=; b=C7jsNRQ/bi9SOSdi1TpaNi4yuHlZIvgWaVZ6d+5zOzDvyXP6lbDUuyJaMpUXO1XKiy +VFVVq4fD0byF1M8mQ6nH0TDbehoDd37E+/Wu69vW8RLnzbSW7Iut0eQH+X9o2gK7/Qv wqVFK1SREv36HlEdUYXk7e2nSQVqswOjqw8Y4Ce4tmIddCbF4fgfviiqIm3peaOkjD6O cpu/0jOOtlrfKNAz/uyjjYLvlDBU729qKY8v3iuhtrCaz5BzSAomZuHBAXVTtVpEfD1e OdATKIpdflc5j373idsq57RUaMJBMXbMmXRKmbI1LLWcSLOe2LOQVEeKAtCaqbFqoRiG ddLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=HwwJx1d3; 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 c14si6990014ybf.294.2019.02.11.15.53.25 for (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 11 Feb 2019 15:53:25 -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=HwwJx1d3; 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]:58118 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gtLO8-00050H-R9 for patch@linaro.org; Mon, 11 Feb 2019 18:53:24 -0500 Received: from eggs.gnu.org ([209.51.188.92]:37676) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gtLNp-000500-9x for qemu-devel@nongnu.org; Mon, 11 Feb 2019 18:53:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gtLNo-0004FW-8W for qemu-devel@nongnu.org; Mon, 11 Feb 2019 18:53:05 -0500 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]:40691) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gtLNo-0004EF-0o for qemu-devel@nongnu.org; Mon, 11 Feb 2019 18:53:04 -0500 Received: by mail-pl1-x643.google.com with SMTP id bj4so327742plb.7 for ; Mon, 11 Feb 2019 15:53:03 -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=t1Ac8wdCYYJyzUaPePYMhujZZB6jvuYyMH+INQ2PV8M=; b=HwwJx1d3vmxrCDnIg8oMe4dN+LC+cxuIYMkEuOoCfce0dxzK6igk2RrKtmHMRvzPx6 Dv2k+SKB7igThqeu39CN9O4KBBLDnLxke+tqqAh8UYdlGcgSkv3LqHjjV1Fmj26s1H+N yxRKVj6Un5cJHJd8CYUF14kM8loxfaAOTtAwgkf8V42CsuBHbW4Z98I8ttL/q9JeSVmn RLUmnVAB+DTggkQIRadlHrsMS/w/iZ1Ikh6GUVrqYTwbz5JEe9mkABNKTAcS3yDqF8gz PxCC5pP6o5JLTKGiyxXtOBYCaQESTSOSApfnoR3hbMNhcMPQSfI0WW5DX8jyQVAeA3EZ wQKA== 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=t1Ac8wdCYYJyzUaPePYMhujZZB6jvuYyMH+INQ2PV8M=; b=g95NGFfMgxhXXGmZGh2T6wxIEsN3rq5pntQE2dxIZN7fH9bAOHUSmrB5bKl5u7r+fc EMFLKh2OLYolmqrXrRF+2Ef2xg/m3XJKSPEKLhZxfmHMhlSobFa7xhdVnCpI3wEOy+Kg 90WMpLBqHZ8F1Z1sLBspsqZsZWUctdpD7VljaV6l123OI5TiIdCH0J7K4TNwH2z5d5CI 1yJtOMyE3YHmpc0rYtXk8CQPJLrlHgWrI5f3qNVHWJPwn2HQEhJrvQxX50hy563b4LPI Xc7/aP/i6SSVUgwhNiqXVpi8sMoxAj3G3VEfihaUaKUggZoWrlDPPhuC8/fQ05A0IWL/ yyBQ== X-Gm-Message-State: AHQUAuYTqJKBbTMCqejLEU9FWif+l3pm4iXEEziavuj+CMOEV7UC44QF Ev7vfNtyxTVzDQH4uvyza69jiksQcqk= X-Received: by 2002:a17:902:a58c:: with SMTP id az12mr860401plb.299.1549929182714; Mon, 11 Feb 2019 15:53:02 -0800 (PST) Received: from cloudburst.twiddle.net (97-113-188-82.tukw.qwest.net. [97.113.188.82]) by smtp.gmail.com with ESMTPSA id c4sm11861031pgq.85.2019.02.11.15.53.01 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Feb 2019 15:53:01 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Mon, 11 Feb 2019 15:52:31 -0800 Message-Id: <20190211235258.542-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190211235258.542-1-richard.henderson@linaro.org> References: <20190211235258.542-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::643 Subject: [Qemu-devel] [PATCH v3 01/28] 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, qemu-arm@nongnu.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 29663a264d..20be9fb53a 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -2987,11 +2987,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 @@ -3010,15 +3019,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 520ceea7a4..d4abbb5076 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -13796,12 +13796,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