From patchwork Mon Feb 11 01:08:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 157945 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp2058521jaa; Sun, 10 Feb 2019 17:14:22 -0800 (PST) X-Google-Smtp-Source: AHgI3Iaal9SZ95+igypJWpK7QGCd+wGxDnLdftltkj2Yfx6Ki4zzUGORJRBa3TqNKfy3ekGUMbVj X-Received: by 2002:adf:ba8e:: with SMTP id p14mr24470226wrg.230.1549847662839; Sun, 10 Feb 2019 17:14:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549847662; cv=none; d=google.com; s=arc-20160816; b=n7DuXEQXAtgxD+ZZjRxHCs3WU26M09q9cgLfkGvTXvmJwzdbuF10dL6HA34dNL5BEW 37O/46tJcLqSwXD8TTDYcMq8W887FGcrKsAvOu8IrHb+lfSAwD4ONgdYcSCNEqAjRBZy qOKwjhyyRKP4GTZPOGHV5gN+tONFy8OH7fTrGIldsxxVm4/L7YoscimbB5pBOWVpcVvo iTtY+4NXhbWg84LgkZPG1rY3GqJs/jmN+B7Xr+vkancNiusNH+/Rvu5d5c7mxELm0BuD 2ZNWJGXtfGffnI455xciYJH8LmExHkgdJojJFgI550TXlYvfAZamF8p6K+DEomxg67rW nLUg== 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=Ij+9HSj9EjlnQv2ZtR1c6WDY8j1Z7nqssk3cStgfiK4joESyrDtd7bmYidLzjYtPwb du6XmRFcuIoT07W/u0/kFi/p6IkMXINoBYRaCRCOiDZSggl1dpd8SIszt6rgMRVFSW4V I63vSe3OtUQ90G+Lp5QOhpSOl2goVgRWihrSHpd/qKeqbY+7cYLUitan+zwD9FM/NSX1 YEkrbaguWRZVg4UWiQ1MTMlDyiJlpZmsXDSignAkrIW7qGDCKP+5xjPlUJAeWITKpMmZ wHBrC5aHUtXQPhW5e0WB7h4xUz4GB9Tglw6hSJdeGqdAtZ3yqLZX6InvYpGsOfcI1ZXe Yo2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=zFz7sTPf; 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 v17si6236226wrw.241.2019.02.10.17.14.22 for (version=TLS1 cipher=AES128-SHA bits=128/128); Sun, 10 Feb 2019 17:14:22 -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=zFz7sTPf; 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]:42128 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gt0Av-0000ec-LP for patch@linaro.org; Sun, 10 Feb 2019 20:14:21 -0500 Received: from eggs.gnu.org ([209.51.188.92]:37102) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gt05Q-0005Ol-3i for qemu-devel@nongnu.org; Sun, 10 Feb 2019 20:08:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gt05L-0007xn-5B for qemu-devel@nongnu.org; Sun, 10 Feb 2019 20:08:36 -0500 Received: from mail-pg1-x541.google.com ([2607:f8b0:4864:20::541]:39978) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gt05K-0007wg-UJ for qemu-devel@nongnu.org; Sun, 10 Feb 2019 20:08:35 -0500 Received: by mail-pg1-x541.google.com with SMTP id z10so4201202pgp.7 for ; Sun, 10 Feb 2019 17:08:34 -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=zFz7sTPfqDnYF/jbhcnb/KEZRnordxjRQ+IJglgMBj+JArhgiwbROjQ/dQS/WC5oBS kokP0wQ2jKpTS8zfONNip6cMNr6KXQ/OxVSqnlSx0KeJUxFSE98mg8JkncvoupCR8Swd eJHGH7wukmoPPjBivleVo5N3pcMuJj5ztSO3wzGPo6YjbHhn52Otp/+oJTYSwtAwzwhP KrNz40VoDXADBqT7uXDgowgRUBTw9UkGzXMk+QJOmncu13mAfbjO7uSikcLVO3SIsdEV pHveLwIr/O+CZyRrUpsVBdwGGyOpIfUrn2BW27Q29RAvp7jff7Xey1bwjSDUPzlnp7P2 075Q== 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=gv5own8UJOBFNJPkIUnmuPjH0p9nVh6OgKSTCRJmhlOAO22iWhLT5Q+GxFVbhkahGd HIsKxeYj01KRXPRCsFY+by5lJknBZlQLBx/PG9Kp1kD5LYKItRye4EklG1O0UQN1TERF SugC05slh23JQi2Xn5bXxD86li66aIJAGv5Qv5E7Ac0mKPo3VpQFUPJ9wn3IjDXrARK/ gn3ZZeX221SaB2imPaxt2xPVJAN1ktbvWywY5V5ncwjBnAVH0RlfBVULqBNpJJDIiaT0 YJwK23cKSwg7oEuNYZnyPczM1vzYDrP16OZY0Jtt3MWVP4it1AgxM3gZYTj5KhbJQP1/ ThKw== X-Gm-Message-State: AHQUAuaVyzkpMz0H34BZpFh8M27uu/GLPKFxfRkxzLTaLozVh0ZmEAjU aJBYsn9xw/8Srbr7rjm5Du3a4FtIyxo= X-Received: by 2002:a63:5462:: with SMTP id e34mr20081740pgm.97.1549847313272; Sun, 10 Feb 2019 17:08:33 -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 g14sm17177630pfg.27.2019.02.10.17.08.32 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 10 Feb 2019 17:08:32 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Date: Sun, 10 Feb 2019 17:08:04 -0800 Message-Id: <20190211010829.29869-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20190211010829.29869-1-richard.henderson@linaro.org> References: <20190211010829.29869-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::541 Subject: [Qemu-devel] [PATCH v2 01/26] 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