From patchwork Fri Mar 1 20:04:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 159514 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp1146143jad; Fri, 1 Mar 2019 12:10:51 -0800 (PST) X-Google-Smtp-Source: APXvYqxUYUnWBIpJqqxdCBmAh1LVASehZbVfKigY7EvnVov02nH4QdX1BQsbRQqmotN8dPmS33NN X-Received: by 2002:a81:e52:: with SMTP id 79mr5221079ywo.367.1551471051535; Fri, 01 Mar 2019 12:10:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551471051; cv=none; d=google.com; s=arc-20160816; b=CuKq6w+XLMP1PnPgpsJY7h7TqQUJzyvRiye4r1oDeNeNXRzBAH1+QINSpyLGeV5B/N d65W+rDgO4r+nWklNe2G24fMsuPj5DFmXM0GH/EgJnwakEK8+Jld+C4hZ7pPbuQ9Ci/I 6wScFmnrKmExws64R9A5X2ftdxiT7zZ6/DTN7R1xrtLuZffbhIkhOxvr/V5KW+5Pta2u iBWunWRncDdoQ5yFkqfAXDghPP0mI0yUmw/bc70NQ1f8E1yKuFr0lrxWFWLQwk8fsgI8 e4uUc2jTwitBMJVx6PhVLu1rPYAPBrmSNJRL1ti/vxui4ZsvBW1x+0Z3Nxoy+YoM6Z9O 3h1w== 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=snPPjJnUHGdCTSecn79/tXDjxGHKZDIkeDVTp9ppzI0=; b=hsR9Elc/pvNoSNyQgcaxDyy9/X7m++OACp6TyuSaCebnyVHza9snK1sJeJHlKVJXtN Zv7S0Ff5G7dYEx/zIH0AlJ3OzCUKjBxedqrSdphn88g+yNTt64eh9DRtEqiRc6+SXkSg 4ALTiqP77Z/da+SK4VxfOjNbtnSEOtBc10ZoKVeZigKEuLDp6GCYfHPASDO9hir97qcB YhTdj95AukeZpE9Vpat3FOSycXrsl4jfdlYlAvtQ1JfHLvZeYtcpGTg6H4bIvmkP1i6y dzzdL7apUvJoOwrSp/++V1AYfprkg33+ZKQcLlzFYhJ3MIckbnxaky+BDLi5JPX98s+G Ro0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=vM+8NDRW; 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 j17si11345171ybm.480.2019.03.01.12.10.51 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 01 Mar 2019 12:10:51 -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=vM+8NDRW; 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]:43490 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gzoUd-0002Hh-1p for patch@linaro.org; Fri, 01 Mar 2019 15:10:51 -0500 Received: from eggs.gnu.org ([209.51.188.92]:44580) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gzoPF-000481-QT for qemu-devel@nongnu.org; Fri, 01 Mar 2019 15:05:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gzoPB-0001gh-Nx for qemu-devel@nongnu.org; Fri, 01 Mar 2019 15:05:17 -0500 Received: from mail-pf1-x443.google.com ([2607:f8b0:4864:20::443]:46948) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gzoP5-0001Zc-Ll for qemu-devel@nongnu.org; Fri, 01 Mar 2019 15:05:07 -0500 Received: by mail-pf1-x443.google.com with SMTP id g6so11889895pfh.13 for ; Fri, 01 Mar 2019 12:05:06 -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=snPPjJnUHGdCTSecn79/tXDjxGHKZDIkeDVTp9ppzI0=; b=vM+8NDRW8LCjws/XYTWWGW9o4olT/16N6snh2uHKpWdzPJF8wH93CvoIwOzWImIqAx qWORrWziVPT4LZjxq9Otyy1fchV6iSplwKDLMal9sIo+iXIL+eGjE4lpVlTT9BE4J3Wk xKjty4dgeawocO8Vj8/j8UArDD+ztAUdBTn+KyL/kpEj04lUmZcRc70YVfDQY5zlHsjf wvpfRClShd+5AEZpwSaNCsTiYiicqawGHguPClcbdFOpJolBApX2zja9BreSKL8Ia8xK E8O7uC81VsBX6x6R9VMLh2fhbuZCDpjHBpWMiv4GhPolkF0J/YA42xhHZqDab7bJa889 ZBvg== 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=snPPjJnUHGdCTSecn79/tXDjxGHKZDIkeDVTp9ppzI0=; b=oElHPuJGu1B3dkHz45+MKEWFkKVyiUPVK9+OVo5sjkXCJqJeQVoxTzar09hAV/UBgz /URwo95z5SvfUbojn4dlk2wF2vlEhmNGcquzHwKM4mhbjZ/QSqj7DtkcLoSyIJLVt2/I lQC02BNDf9iNjo6yFY8zyZciaSWMw2pVsWPH1FM9P0mbXyOjpJmyQ5hnBezda3Van+Pz mWiLdGgZ0dQMNK8qTup3l7rpBJdpayU8XusQkhFX45TkkZdARy6A7eeyv0WpLRTxftUT hgYc/mZb6SCzAlEjR8NaSSer4WrQcOb8KmlB1YkuWpcmJVeBFLoAiXTXRb5irO52Ye3H wAPg== X-Gm-Message-State: APjAAAXhq6C/C03g3D/0UfeJUFhzVh10WxXLq2nIbXrjqRAwnkT8CEI5 35Yb6XpVZYv7G2mX+IOopewkkCnynnw= X-Received: by 2002:a62:3990:: with SMTP id u16mr7379475pfj.80.1551470704931; Fri, 01 Mar 2019 12:05:04 -0800 (PST) Received: from cloudburst.twiddle.net (cpe-72-132-238-51.dc.res.rr.com. [72.132.238.51]) by smtp.gmail.com with ESMTPSA id x8sm31869206pfn.137.2019.03.01.12.05.03 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 01 Mar 2019 12:05:04 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 1 Mar 2019 12:04:52 -0800 Message-Id: <20190301200501.16533-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190301200501.16533-1-richard.henderson@linaro.org> References: <20190301200501.16533-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::443 Subject: [Qemu-devel] [PATCH v3 01/10] 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 36cd365efa..67b06bfad0 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -3042,11 +3042,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 @@ -3065,15 +3074,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 1fa282a7fc..49ff79a146 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -12854,12 +12854,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