From patchwork Fri Jul 8 15:15:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 588530 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:bb16:0:0:0:0 with SMTP id jd22csp764179mab; Fri, 8 Jul 2022 08:31:01 -0700 (PDT) X-Google-Smtp-Source: AGRyM1twuhCxz+FYBqAiQzNLZv7ujvgYfVmSeJ4/SafOYwEhrnuDXqsanswfBDhRR3rOYwwjsDYi X-Received: by 2002:a05:620a:284b:b0:6b4:8685:2aa6 with SMTP id h11-20020a05620a284b00b006b486852aa6mr2754427qkp.780.1657294261578; Fri, 08 Jul 2022 08:31:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657294261; cv=none; d=google.com; s=arc-20160816; b=D4DPH7Cnqout1yodNe28N6pzdhzm3oMp8VWBTE5qrlYp02c0o4v9d0AreaaAf40Hg/ oCAaEnGu6VGBUQ2YkiJ6g1fIKsn1uvFWGIuCavLFTc/MQzPQIwVLS8c/dfD7+IQ3slRM dxnKBsSCtK4gE/sscuB30gfpHnaSSptxr9KmH2cLPymNXPzGAYvReD80KCCyCbfBwiZ0 aRGV88rqVIvsYTpRZfptBuQkSA00WOtcCt4D0KjYqP49wTNG3duMao55JQ4oBM8PZ4sL ONp5OXoOw7s6kb9KhKYronHTvAVKeoizhyU9mDlAWdCUw+Ce176afqkqYXCCt1a75JkV ICHg== 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:cc:to :from:dkim-signature; bh=0yTWCJ1DktZzYQTXntYaiEXNGmdccKtN6uvynpzt0IU=; b=Fh6rjlJifHJoxSohVUDtbxbflY7Xro7xGI0trQbHc0dLzTpLH0cmGoPfvpkZgSybfd s5O5ChjaEwLjK09VqVPX0WUVi7gS+i7820cB6NeN9yQyx3YHDHY3LcrZr+GybPyAe1au LZxsw7HyuxpH0s500iA473ovhrmhQLbpNJtEtmHjN0plBgzo7vOnG3KJTlOPQo7F25iZ BDQVeksfQkwSCcgMgQUtg0xPMEplPdF3/O4BvKQ9RYnfy+d0z/in6CjXu23nl4rZQP00 5U9ejt3QH+1kqEch6lq/OV+FBvFhACuUWdK21UtUOa647WY5iqjKxzwLRHxEzFln9pGJ oNVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ykcqy5iL; 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 d8-20020a05620a240800b006aebefc4c15si18141036qkn.685.2022.07.08.08.31.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Fri, 08 Jul 2022 08:31:01 -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=ykcqy5iL; 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]:58874 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o9pwb-00068V-31 for patch@linaro.org; Fri, 08 Jul 2022 11:31:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:37188) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o9pif-0002dv-C3 for qemu-devel@nongnu.org; Fri, 08 Jul 2022 11:16:37 -0400 Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]:55830) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o9pid-0002Du-RG for qemu-devel@nongnu.org; Fri, 08 Jul 2022 11:16:37 -0400 Received: by mail-pj1-x102a.google.com with SMTP id w24so18318330pjg.5 for ; Fri, 08 Jul 2022 08:16:35 -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 :mime-version:content-transfer-encoding; bh=0yTWCJ1DktZzYQTXntYaiEXNGmdccKtN6uvynpzt0IU=; b=ykcqy5iL8i8pOvOURorfK4XajYxKOyu/nILzzejoGJJTomorraf8K0UoY66N4a03Ho EraPgnG9p4j39gAKdGJIb6cx3pOQoXGsYSyqE0Bxo6uuTYepuUYOJclouaOBUDio4Nby 4mto7YjrmTJelbSupIdr/D8rvrJ3XqIZbGhlVhzkDD3hHfuZDtceJEQfaVPzXxUZCpBT IHpotTu/1b75bzRuYAWDegrm5Fifay3T/+DC1OFCU6ZgW9Bw0RvUSX/Vhulp8DoDXNuu D/OaTvGfgTTGHvhbEeh3eFWkTOwRB060RnFAPoISBBNHCeyfRKxwjvpE+9F4wUpGl73r 2ZHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0yTWCJ1DktZzYQTXntYaiEXNGmdccKtN6uvynpzt0IU=; b=MWujfKMPoLk2yBL95Dc62ertaoHXwoRxdKu5Q6+L9ahcpF16bCiQ5qIWF11znf/qOU 7ywRq3ueM4YAVjlPEsP+jdkFDReEs2mOEcaM922VyJsKGGGjL1ZsQF8nKr++2P0/ovG5 atv7UncpM/gdzMhBdoqLC8gd7HLAq1/arsC8RXUPjOC3rp+2+yj2lPFuuyQvp86P2Q+t vokq/LZKMxNUMi8xU+Z1zN2+pRKc0pZjmtSeQKfZBtCY8s2C8iIaXKcsX5sjrV7TgeqP +LsioNFoBrWdWxIlrIHwmwxNC4AuiotqO7fxc+hdJShxToQdHzl/OnmPHEgIVC+QSyEF ivHg== X-Gm-Message-State: AJIora8vUFEQyAEYj+hLls3PTF9gjGWtAwFThviVgoFDuDLapZzaKbJx pZyAhlm4Tzyj+czgdyAbmLU/O4vCf5zrJINp X-Received: by 2002:a17:90b:2c4a:b0:1ef:8f70:e125 with SMTP id rw10-20020a17090b2c4a00b001ef8f70e125mr401199pjb.50.1657293395076; Fri, 08 Jul 2022 08:16:35 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id n17-20020a056a0007d100b0051bada81bc7sm29085774pfu.161.2022.07.08.08.16.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Jul 2022 08:16:34 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v6 16/45] target/arm: Handle SME in sve_access_check Date: Fri, 8 Jul 2022 20:45:11 +0530 Message-Id: <20220708151540.18136-17-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220708151540.18136-1-richard.henderson@linaro.org> References: <20220708151540.18136-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102a; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102a.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" The pseudocode for CheckSVEEnabled gains a check for Streaming SVE mode, and for SME present but SVE absent. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/translate-a64.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index b16d81bf19..b7b64f7358 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -1183,21 +1183,31 @@ static bool fp_access_check(DisasContext *s) return true; } -/* Check that SVE access is enabled. If it is, return true. +/* + * Check that SVE access is enabled. If it is, return true. * If not, emit code to generate an appropriate exception and return false. + * This function corresponds to CheckSVEEnabled(). */ bool sve_access_check(DisasContext *s) { - if (s->sve_excp_el) { - assert(!s->sve_access_checked); - s->sve_access_checked = true; - + if (s->pstate_sm || !dc_isar_feature(aa64_sve, s)) { + assert(dc_isar_feature(aa64_sme, s)); + if (!sme_sm_enabled_check(s)) { + goto fail_exit; + } + } else if (s->sve_excp_el) { gen_exception_insn_el(s, s->pc_curr, EXCP_UDEF, syn_sve_access_trap(), s->sve_excp_el); - return false; + goto fail_exit; } s->sve_access_checked = true; return fp_access_check(s); + + fail_exit: + /* Assert that we only raise one exception per instruction. */ + assert(!s->sve_access_checked); + s->sve_access_checked = true; + return false; } /*