From patchwork Wed Sep 26 19:23:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 147646 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp1111256lji; Wed, 26 Sep 2018 12:26:30 -0700 (PDT) X-Google-Smtp-Source: ACcGV62JJaCO6Z9YshJIabg95pZvYnxBmwUWsrdmIZyVFgf7bdELeKGzEc54SVRjNzNt4ytnG5yF X-Received: by 2002:aed:36a9:: with SMTP id f38-v6mr5814703qtb.64.1537989990008; Wed, 26 Sep 2018 12:26:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537989990; cv=none; d=google.com; s=arc-20160816; b=S0xAwci3nqBsKOeP97xe6rj/4m0DjBzTe4SPoAJq02R5awwh8wZ0LBmwvmkw0j6G3t bxEqx1aMCySGDSMI8b3K/rfi4jdOQh8QkLVvd3pQ3kX/y/dlkzxQ/Jz+eoIQQ+C8/bnS nmp5tb75oKE94ZnZayPFZ6JD49f5CNCm96Kis9Z5n9XvxP0VD/xOIWpZ6OXR42UN2dih lh+X+f5Y9avdOD5GO/QT0RXcyQRM4OOmHK/W2Z41HoDiHdABm//QrfvUZ+31Z71vCm90 Hq2MeB+8ozOWQiGs5uDs1KrC5a+IGAWIuXrabYgFtt0qoWBsNXnqA09ml2/oMqNsd9Sk JVaw== 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=nvFpXRgbv2xHyhfbeVejOIzl8UKfxa25bi65wEEkD8I=; b=Tpi1vYSHS6W/LY+DnTSrocKVFNXu+zhbFA7M+xVqUFxtyDHzs591tCInD8rL+05uTG 0ITUdAGklcbwB33l1KgH/44YS5GzpQKATCLwC/m5tPUDbgmZgL6SD2xlEotOBsJEuruH bHuvgkkHRuVO6Kblcl24ZeStvL7F9YWYFOdtOi1RGT4XLKCcLzbIA2GJL48gdBMTLbBr YhQBhqAKl4AOAENUA8klLGdzyzyRAwEsmnvtFYrlYAcEKQJ8k8y/b0efXpnvpcNu8ED9 ePbRS2lTkR3XJjiqsc5l7f20Wfi75EqSin8sWcO61NbtjkbGljU/LOT7O1OIxGyiMwEE 1dMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=UjIX90eT; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 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. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id l126-v6si4020098qke.89.2018.09.26.12.26.29 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 26 Sep 2018 12:26:30 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=UjIX90eT; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 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 ([::1]:60370 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g5FS9-00042y-D0 for patch@linaro.org; Wed, 26 Sep 2018 15:26:29 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38287) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g5FPJ-0001hZ-2z for qemu-devel@nongnu.org; Wed, 26 Sep 2018 15:23:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g5FPG-0006ln-Oe for qemu-devel@nongnu.org; Wed, 26 Sep 2018 15:23:33 -0400 Received: from mail-pf1-x444.google.com ([2607:f8b0:4864:20::444]:41658) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1g5FPG-0006lN-H5 for qemu-devel@nongnu.org; Wed, 26 Sep 2018 15:23:30 -0400 Received: by mail-pf1-x444.google.com with SMTP id m77-v6so54747pfi.8 for ; Wed, 26 Sep 2018 12:23:30 -0700 (PDT) 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=nvFpXRgbv2xHyhfbeVejOIzl8UKfxa25bi65wEEkD8I=; b=UjIX90eTXNzCe5NQrtwJPOTj/sNeKsEf6fxwSrKz1GQsuPCcNStHELZlTS60vRb7Ja 53mq8lST32sVCE+EmWhSBi/QOrctpXBc3wldZ4uI9UHev186McL4uUix4ISK11dWS0Jr nUjnzFNGHqxrU26RahVR4u04el7j0YctY+q2s= 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=nvFpXRgbv2xHyhfbeVejOIzl8UKfxa25bi65wEEkD8I=; b=tru/p1GeGshiIvLTrFo2AAJHmrQfLpJecrcduqZlU2pEODZ+yKkzekFxRMMPh7tz+J SxmQaaU3amn+TdYXqnuUbX52s6jBlG2qXdoKfEalpG4z8zz38VBuHN7MkmJCrNxzP4z3 5ZuCK7HeeNstuCqHiwgLhw/oTnQJGHIm0cMsH4EjuA/kT1rNjsVUMFmMA5ejRtC477r3 xgzZ+PyvmRAjC2afpi/j48JNuTFos9s+86IMC0XCUpoJoxUWYB7m3fE058rHxF3vFhto z5CbZeYd/KsBQ+uVmq2OIZo3tKk02UkKoRZmdKU2oWH9neVAdi1HnY/jNGFZ8+wjCSHO aGWQ== X-Gm-Message-State: ABuFfoigCtNhA92dE1oaMtvS0m/2Cq3+XNlPki5osJKV73YhduPSZKEr SVGYIyq7/SSRhXaLFJZjJZnRRx7ZYf4= X-Received: by 2002:a62:670a:: with SMTP id b10-v6mr7709222pfc.243.1537989809156; Wed, 26 Sep 2018 12:23:29 -0700 (PDT) Received: from cloudburst.twiddle.net (97-113-8-179.tukw.qwest.net. [97.113.8.179]) by smtp.gmail.com with ESMTPSA id c2-v6sm8493486pfo.107.2018.09.26.12.23.27 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 26 Sep 2018 12:23:28 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 26 Sep 2018 12:23:11 -0700 Message-Id: <20180926192323.12659-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180926192323.12659-1-richard.henderson@linaro.org> References: <20180926192323.12659-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 03/15] 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: , Cc: peter.maydell@linaro.org Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" We are going to want to determine whether sve is enabled for EL other than current. Tested-by: Laurent Desnogues Signed-off-by: Richard Henderson --- target/arm/helper.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) -- 2.17.1 Reviewed-by: Peter Maydell diff --git a/target/arm/helper.c b/target/arm/helper.c index 38a9d32dc4..52fc9d1d4c 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -4406,12 +4406,10 @@ static const ARMCPRegInfo debug_lpae_cp_reginfo[] = { * 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 = arm_current_el(env); - - if (current_el <= 1) { + if (el <= 1) { bool disabled = false; /* 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 = true; } else if (!extract32(env->cp15.cpacr_el1, 17, 1)) { - disabled = current_el == 0; + disabled = el == 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 = true; } else if (!extract32(env->cp15.cpacr_el1, 21, 1)) { - disabled = current_el == 0; + disabled = el == 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 <= 2 && !arm_is_secure_below_el3(env)) { + if (el <= 2 && !arm_is_secure_below_el3(env)) { if (env->cp15.cptr_el[2] & CPTR_TZ) { return 2; } @@ -12513,11 +12511,10 @@ uint32_t HELPER(crc32c)(uint32_t acc, uint32_t val, 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 = arm_current_el(env); /* CPACR and the CPTR registers don't exist before v6, so FP is * always accessible @@ -12580,7 +12577,8 @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, target_ulong *cs_base, uint32_t *pflags) { ARMMMUIdx mmu_idx = core_to_arm_mmu_idx(env, cpu_mmu_index(env, false)); - int fp_el = fp_exception_el(env); + int current_el = arm_current_el(env); + int fp_el = fp_exception_el(env, current_el); uint32_t flags; if (is_a64(env)) { @@ -12591,7 +12589,7 @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, flags |= (arm_regime_tbi1(env, mmu_idx) << ARM_TBFLAG_TBI1_SHIFT); if (arm_feature(env, ARM_FEATURE_SVE)) { - int sve_el = sve_exception_el(env); + int sve_el = sve_exception_el(env, current_el); uint32_t zcr_len; /* If SVE is disabled, but FP is enabled, @@ -12600,7 +12598,6 @@ void cpu_get_tb_cpu_state(CPUARMState *env, target_ulong *pc, if (sve_el != 0 && fp_el == 0) { zcr_len = 0; } else { - int current_el = arm_current_el(env); ARMCPU *cpu = arm_env_get_cpu(env); zcr_len = cpu->sve_max_vq - 1;