From patchwork Fri Oct 5 17:53:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 148274 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp747996lji; Fri, 5 Oct 2018 10:57:13 -0700 (PDT) X-Google-Smtp-Source: ACcGV60aSQRAJDgGfzJHLJOK5JsXP4cd4KypBP/Kw3Z9gx01lIxNGkGOsm7G/lAfTgs6eytl79XY X-Received: by 2002:ac8:33d6:: with SMTP id d22-v6mr10402560qtb.313.1538762233413; Fri, 05 Oct 2018 10:57:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538762233; cv=none; d=google.com; s=arc-20160816; b=REvgr8ZbNuOuH6Z9rml53v+NFDa7722rXHVwCntNQ9GYNoX+cbiyVUk5vQzcZft376 zf26eUEXzC0qqs6AtjfZx+TTB8OIwPYNFA3sEnEtFjM3xqj0YjgoBwSjjZZ6tCNUp2Oi 6heTxJsnnpLv6XceSLWWVtRqzVuzxLlRbDO2JzaWCPUHb/73ffguFcowfPipQbnDhOOH c6saAYDA+RbyjV+bU4s/s5LVDsOiS1BEnClkmUX6KSkXPMWEqM7CkevqaD1Kkma+mwVt m5IdXwFrrrJqyuJ46B3el65PTTzUopTI8s+EVeezjEdyfzl8jtABSa2UVmhfnUmJJbyW r16w== 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=Ac3Ld+/xiFMcRoSQF0aZyj2ZreDFk/4TR7ndmFjspGU=; b=tQxICR4OPCVxJ8Tx9Hssoo4o6u0fjhOPt9R0N1mK6vt1iAI94I9qivlWbQ9Qwz2nb5 RlMT8C0P2tGPi9bROAl1OZB5SmEEPtSHXVxJOvXSeJmy3IFRwNlljgUF04YSpbFx9VgT YAk5UnntYRvsslKW5RvZx8q0V7KdPMtaFl6UR795TFHHHX+qhuME2tA6eCMcIgxr/hRM ZuQN/0sCSiGUE93jzfgpmMO5yP1w+zsgQg7g972q4+r5UG2ji4huy+7f9etpZnI4XcA9 jPMgC3beoASzV2IViN6me2P/ivuGPDgvwrhsCHm0X5qY2acF8OlOdeMFtoer+5bjdFPN dV7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=ZapQ2sF+; 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 m51-v6si4329932qvm.38.2018.10.05.10.57.13 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 05 Oct 2018 10:57:13 -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=ZapQ2sF+; 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]:36344 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g8ULg-0003ve-TZ for patch@linaro.org; Fri, 05 Oct 2018 13:57:12 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35418) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g8UIc-00012d-HQ for qemu-devel@nongnu.org; Fri, 05 Oct 2018 13:54:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g8UIb-0003Ca-Iu for qemu-devel@nongnu.org; Fri, 05 Oct 2018 13:54:02 -0400 Received: from mail-oi1-x243.google.com ([2607:f8b0:4864:20::243]:41923) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1g8UIb-0003CC-DS for qemu-devel@nongnu.org; Fri, 05 Oct 2018 13:54:01 -0400 Received: by mail-oi1-x243.google.com with SMTP id l197-v6so11077859oib.8 for ; Fri, 05 Oct 2018 10:54:01 -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=Ac3Ld+/xiFMcRoSQF0aZyj2ZreDFk/4TR7ndmFjspGU=; b=ZapQ2sF+N006smq0xCFsJKZPoeGLIdypix7h2+ZnQpXEW11M3gmgDh5NgGr/wqUMib NUr9xbIUV0dAKw5AWh/saQRKMUmPnk/L4QNwLkTef0E/Kmlu85jxNzIX/PJVZTx6hUqb Bo+gq88epFiV56NeP9iat644OoRJMGtalEwgw= 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=Ac3Ld+/xiFMcRoSQF0aZyj2ZreDFk/4TR7ndmFjspGU=; b=UIJWzMYAT4s2O2XPdwlhWYLG6ShRSAFP/ZHHbFmCJlh4mkznvU0iRmNxiDb4KT86Tb /PZURnn3s/Jm8uD61GyCPtEm52BzzCvuQB7LXhKptLoXZjpDPPzDssvcl4n6JcR883R4 +17zX0O47HiKxa90zFIAFGWfIhpOJf7cLz/87UKI2SvDifIjXkdEuesp96EOJsQNsEeU oWvU2e4AZhUKuPWOU7VeW1XcrBBFR0/VuEO/+dhGvPdLFv6k+Pt2L7yVTZKPLC3pjZdg SWVMFv9U1JxSmE6u6umaKf/zsfn17qsjbhf5mNgbpU73r0IgMR3mHrcIV1Yiws+SwD+l oYJw== X-Gm-Message-State: ABuFfog2xRwaOpl1LHE6G+0HvLwtjpxNOBJvmRwBlmjarOPd+AGSRfcF Yn3rewIQaWh/8uNGy8AKxZzt3cKsniU4tw== X-Received: by 2002:a54:4f89:: with SMTP id g9-v6mr23659oiy.214.1538762040281; Fri, 05 Oct 2018 10:54:00 -0700 (PDT) Received: from cloudburst.twiddle.net ([187.217.230.84]) by smtp.gmail.com with ESMTPSA id q10-v6sm2672278otg.31.2018.10.05.10.53.58 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 05 Oct 2018 10:53:59 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Fri, 5 Oct 2018 12:53:38 -0500 Message-Id: <20181005175350.30752-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181005175350.30752-1-richard.henderson@linaro.org> References: <20181005175350.30752-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::243 Subject: [Qemu-devel] [PATCH v3 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 Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/helper.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) -- 2.17.1 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;