From nobody Wed Apr 16 04:29:41 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1539009683492171.11359979199187; Mon, 8 Oct 2018 07:41:23 -0700 (PDT) Received: from localhost ([::1]:46584 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g9Wim-00078i-B2 for importer@patchew.org; Mon, 08 Oct 2018 10:41:20 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46818) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g9W6Y-0001v7-5U for qemu-devel@nongnu.org; Mon, 08 Oct 2018 10:01:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g9W6U-0007sf-Bn for qemu-devel@nongnu.org; Mon, 08 Oct 2018 10:01:50 -0400 Received: from orth.archaic.org.uk ([2001:8b0:1d0::2]:51692) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g9W6T-0006uy-R4 for qemu-devel@nongnu.org; Mon, 08 Oct 2018 10:01:46 -0400 Received: from pm215 by orth.archaic.org.uk with local (Exim 4.89) (envelope-from ) id 1g9W51-0003fT-Dl for qemu-devel@nongnu.org; Mon, 08 Oct 2018 15:00:15 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Mon, 8 Oct 2018 14:59:38 +0100 Message-Id: <20181008140004.12612-8-peter.maydell@linaro.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181008140004.12612-1-peter.maydell@linaro.org> References: <20181008140004.12612-1-peter.maydell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2001:8b0:1d0::2 Subject: [Qemu-devel] [PULL 07/33] target/arm: Pass in current_el to fp and sve_exception_el 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: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" From: Richard Henderson We are going to want to determine whether sve is enabled for EL other than current. Tested-by: Laurent Desnogues Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20181005175350.30752-4-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/helper.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/target/arm/helper.c b/target/arm/helper.c index 9bb81da2c7f..35458ad4a76 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -4406,12 +4406,10 @@ static const ARMCPRegInfo debug_lpae_cp_reginfo[] = =3D { * take care of raising that exception. * C.f. the ARM pseudocode function CheckSVEEnabled. */ -static int sve_exception_el(CPUARMState *env) +static int sve_exception_el(CPUARMState *env, int el) { #ifndef CONFIG_USER_ONLY - unsigned current_el =3D arm_current_el(env); - - if (current_el <=3D 1) { + if (el <=3D 1) { bool disabled =3D false; =20 /* The CPACR.ZEN controls traps to EL1: @@ -4422,7 +4420,7 @@ static int sve_exception_el(CPUARMState *env) if (!extract32(env->cp15.cpacr_el1, 16, 1)) { disabled =3D true; } else if (!extract32(env->cp15.cpacr_el1, 17, 1)) { - disabled =3D current_el =3D=3D 0; + disabled =3D el =3D=3D 0; } if (disabled) { /* route_to_el2 */ @@ -4435,7 +4433,7 @@ static int sve_exception_el(CPUARMState *env) if (!extract32(env->cp15.cpacr_el1, 20, 1)) { disabled =3D true; } else if (!extract32(env->cp15.cpacr_el1, 21, 1)) { - disabled =3D current_el =3D=3D 0; + disabled =3D el =3D=3D 0; } if (disabled) { return 0; @@ -4445,7 +4443,7 @@ static int sve_exception_el(CPUARMState *env) /* CPTR_EL2. Since TZ and TFP are positive, * they will be zero when EL2 is not present. */ - if (current_el <=3D 2 && !arm_is_secure_below_el3(env)) { + if (el <=3D 2 && !arm_is_secure_below_el3(env)) { if (env->cp15.cptr_el[2] & CPTR_TZ) { return 2; } @@ -12512,11 +12510,10 @@ uint32_t HELPER(crc32c)(uint32_t acc, uint32_t va= l, uint32_t bytes) /* Return the exception level to which FP-disabled exceptions should * be taken, or 0 if FP is enabled. */ -static inline int fp_exception_el(CPUARMState *env) +static int fp_exception_el(CPUARMState *env, int cur_el) { #ifndef CONFIG_USER_ONLY int fpen; - int cur_el =3D arm_current_el(env); =20 /* CPACR and the CPTR registers don't exist before v6, so FP is * always accessible @@ -12579,7 +12576,8 @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_= ulong *pc, target_ulong *cs_base, uint32_t *pflags) { ARMMMUIdx mmu_idx =3D core_to_arm_mmu_idx(env, cpu_mmu_index(env, fals= e)); - int fp_el =3D fp_exception_el(env); + int current_el =3D arm_current_el(env); + int fp_el =3D fp_exception_el(env, current_el); uint32_t flags; =20 if (is_a64(env)) { @@ -12590,7 +12588,7 @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_= ulong *pc, flags |=3D (arm_regime_tbi1(env, mmu_idx) << ARM_TBFLAG_TBI1_SHIFT= ); =20 if (arm_feature(env, ARM_FEATURE_SVE)) { - int sve_el =3D sve_exception_el(env); + int sve_el =3D sve_exception_el(env, current_el); uint32_t zcr_len; =20 /* If SVE is disabled, but FP is enabled, @@ -12599,7 +12597,6 @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_= ulong *pc, if (sve_el !=3D 0 && fp_el =3D=3D 0) { zcr_len =3D 0; } else { - int current_el =3D arm_current_el(env); ARMCPU *cpu =3D arm_env_get_cpu(env); =20 zcr_len =3D cpu->sve_max_vq - 1; --=20 2.19.0