From patchwork Mon Jun 27 10:22:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 585284 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5036:0:0:0:0 with SMTP id e22csp2956577mab; Mon, 27 Jun 2022 03:40:43 -0700 (PDT) X-Google-Smtp-Source: AGRyM1v0xcWuES/krN0SXXImVOD8lapUYrI20C/V1MDNdvkANp3FW9v5wt0jnEeaISGM+yGwsHQq X-Received: by 2002:a05:622a:1992:b0:319:cb47:b3a4 with SMTP id u18-20020a05622a199200b00319cb47b3a4mr3986630qtc.472.1656326443151; Mon, 27 Jun 2022 03:40:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656326443; cv=none; d=google.com; s=arc-20160816; b=ZP1aYaHKgLEWjCqMJsq4H3Ngiu4WuoG2fssGbtOBJquZGo9ujQjIASw8LXtlJtC5mu /fhE49OB2AsAl2TeDzTzUocd2HY6OPPvfcQcqDnJUR2hZnEBthJ9ETpAEBPsdSbiB21k tBPNbUpfdmzabVnhpI+2vJgHwTTm8ghapr/cddzKRReOS8LqcbyeV/WdklZWTAhN3chJ 5m3D1VnCd3OkMvc3DGVYyyITEq7Up83IE1LED3IwXy9Q6H86j7fM6qcWjOvT7gfVfrPL bg8wduxYdIsEAY1D1Oj8lumTWN46dLv/hxWTo/TO9UOTYVvxfzryT+pokinb4tpIPAV1 N9ug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=JY/mUAhmGGRxTqGc0ySxNo9o+GOj/TKXdVaiRq7sV+I=; b=UxO45iMNQdPBvJ4yQbQwAgduUxMLOFINeX5GnViH9SympLfJXdNcN5iUqwj/sgel1S CxmXIkpbAFvQ2RKWTiAeyjO+sMx0sLEQxkXihFD8OWrn8Uz1DwXK7lLhfEyRFl8VlxZf 1h0RmF7IToLxEmOM94jjSxd1XBAGhK9KfBr7sZZ1sRDELzR7tusS+PPi+IknbuznEOVm BtDVceA2myluAPtGWgrWmcGyT183JYrrufPnW3XwfIyvkwH5jGP0zvNKswB/xdfp4FRo AU51eHHkjpNaM8leLaC4HfDMocUkYt2QtYNEtS2pxIqKKQd6TI53KRo0qNZ0G1arkfZR 0cnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=b451WTlO; 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=pass (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 r10-20020ac85c8a000000b00317ca6f543csi4981360qta.453.2022.06.27.03.40.43 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 27 Jun 2022 03:40:43 -0700 (PDT) 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=pass header.i=@linaro.org header.s=google header.b=b451WTlO; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:57368 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o5mAc-0008C9-Mm for patch@linaro.org; Mon, 27 Jun 2022 06:40:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41738) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o5ltR-0002QO-Oe for qemu-devel@nongnu.org; Mon, 27 Jun 2022 06:22:58 -0400 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]:38770) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o5ltP-0004we-WF for qemu-devel@nongnu.org; Mon, 27 Jun 2022 06:22:57 -0400 Received: by mail-wm1-x334.google.com with SMTP id g39-20020a05600c4ca700b003a03ac7d540so4526735wmp.3 for ; Mon, 27 Jun 2022 03:22:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=JY/mUAhmGGRxTqGc0ySxNo9o+GOj/TKXdVaiRq7sV+I=; b=b451WTlOCtJGE4ndovu4eqgdOHvn57xlvI7tC2dsxibPxyCJfvXCf6s+3bQRsrlJue pA4OgL/eTVmUU2e1EULHnYp87KksQhjmg89vhnCh4EIGgp3es0k6wSwrPqiESASEJ5X+ mqO56p1ULLzm60krcMrTkxpHSDZxhGO1xYtXsyEQQ6I5GweiO0Or/yQ9KhGqxmkMaCm1 WviPcekz23/AQNGS+4RiqPtW2VHLxg+hyoZqMtzVcE2FSK4AP/ZfcEcH5OolWAXT4Dj+ 2pu73CKiSBpplFAeo2isjA54CNppoqBqrbGR9CMtbWCr5/SPwS/3MuJw5w0SUoBKrrjK Qcgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=JY/mUAhmGGRxTqGc0ySxNo9o+GOj/TKXdVaiRq7sV+I=; b=DqV+TVGTdd4l8wudzV6nliBzr7rM06oyI8Go+PaIECKZUhtSC76dZKt6VyXDEnmBE1 NcKAGKdX4ckoHRVfgZFrO+CSWxtIfyGNAy6+A6FED0di3IZrDjAweCZPXHK+rqOPuri/ gNmt6a+51kp+XHw2q3ZJL6VRFohgsxd7RWqtCYisAlFp+bg87/alOHR0H4eiQT/xR+zy wzsQfvXUpu8845GvujnN1OGnMO5TJClEDA/Tt8hbJAeQ6UfMf8jFvzcS0UWHf3URQ9/j fCwL62rl6vp/E00f73+rDomffrxJLXB8pZwRmpjRStEdvX3mToUFpxXOGIgzCjWQCAQP yepw== X-Gm-Message-State: AJIora/fwWtMMMn71au8mzOP975pIANRnf4LfIh+k/dDgjvRdOujN3i5 Hk6zEI120m6Gd0mNp3IunUanb3WCBoqMVA== X-Received: by 2002:a05:600c:a47:b0:39e:f953:84e2 with SMTP id c7-20020a05600c0a4700b0039ef95384e2mr19169552wmq.202.1656325374704; Mon, 27 Jun 2022 03:22:54 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id d11-20020a5d6dcb000000b0020e6ce4dabdsm9754335wrz.103.2022.06.27.03.22.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jun 2022 03:22:54 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 22/25] target/arm: Add SVL to TB flags Date: Mon, 27 Jun 2022 11:22:33 +0100 Message-Id: <20220627102236.3097629-23-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220627102236.3097629-1-peter.maydell@linaro.org> References: <20220627102236.3097629-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x334.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson We need SVL separate from VL for RDSVL et al, as well as ZA storage loads and stores, which do not require PSTATE.SM. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20220620175235.60881-20-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/cpu.h | 12 ++++++++++++ target/arm/translate.h | 1 + target/arm/helper.c | 8 +++++++- target/arm/translate-a64.c | 1 + 4 files changed, 21 insertions(+), 1 deletion(-) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 0295e854838..4a4342f2622 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -3182,6 +3182,7 @@ FIELD(TBFLAG_A64, MTE0_ACTIVE, 19, 1) FIELD(TBFLAG_A64, SMEEXC_EL, 20, 2) FIELD(TBFLAG_A64, PSTATE_SM, 22, 1) FIELD(TBFLAG_A64, PSTATE_ZA, 23, 1) +FIELD(TBFLAG_A64, SVL, 24, 4) /* * Helpers for using the above. @@ -3227,6 +3228,17 @@ static inline int sve_vq(CPUARMState *env) return EX_TBFLAG_A64(env->hflags, VL) + 1; } +/** + * sme_vq + * @env: the cpu context + * + * Return the SVL cached within env->hflags, in units of quadwords. + */ +static inline int sme_vq(CPUARMState *env) +{ + return EX_TBFLAG_A64(env->hflags, SVL) + 1; +} + static inline bool bswap_code(bool sctlr_b) { #ifdef CONFIG_USER_ONLY diff --git a/target/arm/translate.h b/target/arm/translate.h index 93766649f7f..22fd882368b 100644 --- a/target/arm/translate.h +++ b/target/arm/translate.h @@ -44,6 +44,7 @@ typedef struct DisasContext { int sve_excp_el; /* SVE exception EL or 0 if enabled */ int sme_excp_el; /* SME exception EL or 0 if enabled */ int vl; /* current vector length in bytes */ + int svl; /* current streaming vector length in bytes */ bool vfp_enabled; /* FP enabled via FPSCR.EN */ int vec_len; int vec_stride; diff --git a/target/arm/helper.c b/target/arm/helper.c index 2e4e739969a..d2886a123a6 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -11352,7 +11352,13 @@ static CPUARMTBFlags rebuild_hflags_a64(CPUARMState *env, int el, int fp_el, DP_TBFLAG_A64(flags, SVEEXC_EL, sve_el); } if (cpu_isar_feature(aa64_sme, env_archcpu(env))) { - DP_TBFLAG_A64(flags, SMEEXC_EL, sme_exception_el(env, el)); + int sme_el = sme_exception_el(env, el); + + DP_TBFLAG_A64(flags, SMEEXC_EL, sme_el); + if (sme_el == 0) { + /* Similarly, do not compute SVL if SME is disabled. */ + DP_TBFLAG_A64(flags, SVL, sve_vqm1_for_el_sm(env, el, true)); + } if (FIELD_EX64(env->svcr, SVCR, SM)) { DP_TBFLAG_A64(flags, PSTATE_SM, 1); } diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index c050ebe0053..c86b97b1d49 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -14647,6 +14647,7 @@ static void aarch64_tr_init_disas_context(DisasContextBase *dcbase, dc->sve_excp_el = EX_TBFLAG_A64(tb_flags, SVEEXC_EL); dc->sme_excp_el = EX_TBFLAG_A64(tb_flags, SMEEXC_EL); dc->vl = (EX_TBFLAG_A64(tb_flags, VL) + 1) * 16; + dc->svl = (EX_TBFLAG_A64(tb_flags, SVL) + 1) * 16; dc->pauth_active = EX_TBFLAG_A64(tb_flags, PAUTH_ACTIVE); dc->bt = EX_TBFLAG_A64(tb_flags, BT); dc->btype = EX_TBFLAG_A64(tb_flags, BTYPE);