From patchwork Thu Aug 9 04:21:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 143662 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp1605700ljj; Wed, 8 Aug 2018 21:27:59 -0700 (PDT) X-Google-Smtp-Source: AA+uWPx30M+GV3sIfAFVo7CQ6HeCJJzcMQdhDBboOfIGx1ph0JJHf8Qg/ksf9ZtySfjV5mr+FLwy X-Received: by 2002:aed:2a33:: with SMTP id c48-v6mr478209qtd.147.1533788879706; Wed, 08 Aug 2018 21:27:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533788879; cv=none; d=google.com; s=arc-20160816; b=DeHBNCJ9spnHY4PMHndal5IfwTvrynqZ18tAzR0iMiSitHXbaPc8Mly0bJ9zERLOLS crAcIch/7ox5jKFgbLA6H9DMzwz7Lqvf8YiAOztNqNa7gD92bb6FKZzCXNK9nsfW+e/1 aD3C9kj3GsrkdL14R4xduCyYYYP22mlI8gxAz/T0Knr3HI9YEvaL4131iXeJI4mGAKoA 4tYyc6hQFVj1BQS2xiKGc3ttRAeLtStk1lhdrBZw0FXxHzaPaRZES4bkXRl90eMs1JmM H/WC6A7cy5rAD0Gd3kZAZpektQssiF8E25qlhoTXlsSyRzYzldxjPZ5xOoXGArnlpKWG QYDQ== 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:arc-authentication-results; bh=iPTMcFpTowzzeR3AA8m0CxGcQ3PcWy1tCYbypW7plhs=; b=OU3Vw4p4F9dmDBNsa5UsgeGGZ5a0BaWE/nukNkn9alCWlrwsj3uqv6kJAIZJvZHwuN FiZo1BgPDAwoWmBm2yUNsGgVhtuRLoaJ1nHi+v5Ljyy6+zXVoLVPBvZTjj6YmSGZn4vc Rf+FKc9PVvvgX5ObiMqtWpBkdnauJyBF1zDDar0cW9fM7fhApo9C7QjaNayqFL7BoFln TUBg05oJ8g8q3McYG2a2yK9BnZ9L6u2JdLAnwsdoTUVA/bJTjXcbrOonOY7YXB09HO6m VfVxcjuMCFciaOOBHCHfnmhn6+qrr3/5O8/LXhyG83NbyBZg/gKIY9jpyM+r1J+PCK7U 5jeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linaro.org header.s=google header.b=RnkwxGB9; 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 c40-v6si6091341qtb.208.2018.08.08.21.27.59 for (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 08 Aug 2018 21:27:59 -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=RnkwxGB9; 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]:47249 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fncYJ-0004nX-3m for patch@linaro.org; Thu, 09 Aug 2018 00:27:59 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54015) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fncSs-0000oj-IA for qemu-devel@nongnu.org; Thu, 09 Aug 2018 00:22:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fncSr-0007Gv-FJ for qemu-devel@nongnu.org; Thu, 09 Aug 2018 00:22:22 -0400 Received: from mail-pl0-x242.google.com ([2607:f8b0:400e:c01::242]:47012) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fncSr-0007GM-8d for qemu-devel@nongnu.org; Thu, 09 Aug 2018 00:22:21 -0400 Received: by mail-pl0-x242.google.com with SMTP id t17-v6so1967497ply.13 for ; Wed, 08 Aug 2018 21:22:21 -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=iPTMcFpTowzzeR3AA8m0CxGcQ3PcWy1tCYbypW7plhs=; b=RnkwxGB9pyCnDTdyOHHhZhDWwbMvV9USJ+alu1vyr2HUx/P4qkLr9YWikNlXDuO6gO w+DXWLEO2UjiLhHqd3qD0YJt5l7De58U+ehfwS1O6YlBh7I3P7GG3FK9yAjHC7AVEgx9 XdI1LccGqmh6Bf1q6X2Q3VG2PJKHL8rKd1cDE= 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=iPTMcFpTowzzeR3AA8m0CxGcQ3PcWy1tCYbypW7plhs=; b=nSS8cMvPiqsbs/lXl1mcmnx1UwQR+kXiNfaps5xlPRDWFlXKnV6EjLnFVcatadrrq6 NG0DmgMG5vUA5JDDyIgY7VxsHcP1x3dujp0hP393lNqgE2XJPw5X8fI80ex0/ERJm/gT D+6W7q7DunVMX3u+OaeiK+kLwyZCFz9KUJ/G4FEl4/paq2YRcTm7DlEa65+YomczPZvn 3h9tNrz3+Q/m1QKDzbQLAo1VcAGw+wEU8mxn1MmnVFKtuKjtAzpQ+zawZHrBvtgHkOqw yH8rtBIAwKU7kiWyDzxv9kTF8Ozi38fyHYG1tnbxYDXYUBR8a55RQZ4yzaMvBngWJNaf kzPw== X-Gm-Message-State: AOUpUlH0hlTkB+e2jH47cLTRpluuG8CfTvXv4sx4ow8UVrdqR2UvlfAA R6FYX0x0cKMFUVW5FvsbtLwY1dQf6Yk= X-Received: by 2002:a17:902:26c:: with SMTP id 99-v6mr466624plc.341.1533788539995; Wed, 08 Aug 2018 21:22:19 -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 m30-v6sm7355799pff.121.2018.08.08.21.22.18 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 08 Aug 2018 21:22:19 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Date: Wed, 8 Aug 2018 21:21:54 -0700 Message-Id: <20180809042206.15726-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180809042206.15726-1-richard.henderson@linaro.org> References: <20180809042206.15726-1-richard.henderson@linaro.org> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400e:c01::242 Subject: [Qemu-devel] [PATCH 08/20] 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: laurent.desnogues@gmail.com, peter.maydell@linaro.org, alex.bennee@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 than current. 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 26e9098c5f..290b1a849e 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -4344,12 +4344,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: @@ -4360,7 +4358,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 */ @@ -4373,7 +4371,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; @@ -4383,7 +4381,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; } @@ -12318,11 +12316,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 @@ -12385,11 +12382,12 @@ 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)) { - int sve_el = sve_exception_el(env); + int sve_el = sve_exception_el(env, current_el); uint32_t zcr_len; *pc = env->pc; @@ -12404,7 +12402,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;