From patchwork Wed Jul 6 08:23:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 587725 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1ec:0:0:0:0 with SMTP id 12csp2556520map; Wed, 6 Jul 2022 02:08:07 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vlWI05XL5tsvGyWyS16WNrP/g8zlwFIfbhQ156iD5A8IEG5VONWTXmR089PwI1YFFJZlWX X-Received: by 2002:a05:620a:2a0e:b0:6b4:68a0:39fe with SMTP id o14-20020a05620a2a0e00b006b468a039femr8884307qkp.3.1657098487174; Wed, 06 Jul 2022 02:08:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657098487; cv=none; d=google.com; s=arc-20160816; b=Uw/zjm7sLPnwzkfkmu4IObYYVtofT9pxQtojkeC+sZiGDMRYz3IoPyXfHqF8EajCOk forhIhl2giqvWkJueddWMACAU+fmbRkFaWvNLtoCIK1cFe3jD1GdBzPZLjPaJTR6LQjA nEEEmMGy+PXuhTEu5OiVpmAO0E4a6FnBMbQNOpvovmbO9wDD0+CZH41qw36+kF1OKsfC 2XpI3h9J1zHQgCna7G79xHpyqK/HrYL9NRMzY88TbqX5DEJaJxEVOfSZHDU8X02Dbngu 7Vhfkm0dGUC+ZaWFC8zzwe9JngQrCJnjndYLbWf3g7cqO1ltGEnpzc0/sakt1GBwXHCm HRVg== 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=XWXHzJVNxaFbLzlqWmu6f1PQRf+5GohE03L6wJt+sCy8C6FTzgRuZ39UM0svdsz7T6 +elD1EmRAqYRtert45YUAC25WHyCVAHZUN/WyNJEE1GApF29vvES7tt99Vtu0wlQS6fG 8E3UC2TO7VPMN/Fh1EBRFNxWy0nYe7BNijGEG4eIIj6v1p2neoCahpPbZBAZh49gyJ4n TxdBnEu59Ff71TNNS7GSMLPUNaYycz0FZHvkF5pF834wk6SJl0nUDrzYYOeuwruy+Arg bjU/ASqKGYhCS0fkW1EWA4o05IQNtuZupHZWDarDufBrzqqWaBv1rmYYYVNfaxx7chrN 97lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="sj63h/zR"; 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 l16-20020a05620a28d000b006b23b8e723bsi12703093qkp.11.2022.07.06.02.08.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Jul 2022 02:08:07 -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="sj63h/zR"; 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]:49960 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o910w-0002Jf-Oq for patch@linaro.org; Wed, 06 Jul 2022 05:08:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49174) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o90LE-00065w-CQ for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:25:00 -0400 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]:39762) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o90LC-0000RE-My for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:25:00 -0400 Received: by mail-pl1-x629.google.com with SMTP id c13so9307847pla.6 for ; Wed, 06 Jul 2022 01:24:57 -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=sj63h/zRkWhQLZV9P/R0rqi1ghEtjEY97oRVCuNVCOoUkDgvv6Umtn4sgBwnuniBCV +u6unh0OcSM9qLEbGSOm/Df8tB6EM8EI0YkoUKcJmm5sShEVf5/m/pTvITRX4AVTVqzk 9KntLE76vW2qjze8Z9KOaKBD1eqMc7udqZ50K0SMWZFdQtonZFEvrtFar9ddOibSIuRb uSKYrs+8swPcUrwkbItQaBhR9Yj3FelLDyh7RmRlsei4jdnt4idTTLt1zs6DYY9d/anX KBoaiBeXy110uTqbcjIlING7IhCb2od+rPM4qC+lTMhCazyN+/GXgr0haEW8ANzMn0/m TewA== 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=6MI3QzXmu2NH6B2jgTEfMyqAIqwGPpdFc5NVYDfl2Bi6BIpjBqnCSR798q7iJQ0How IEav70op2OCqe1a3ayFrALL5N7IWJJR2NLQxtutEPzWq4+2ZnEXGKDBJTwfwYEkqlb9m xzOW8ZLepTk580GI+e4lukWVNjlHTbHLzT5Ya64HONynwabRolgH2uWdMcy2gWma1NMW uHnSOZMPVtS5z7uElQG0Qtov4DFNofrInRefKFuC8M80LD3eipA3s9k69oTUz53OHmeL hh4/fSLA1Ss7AzINVnpFZyBDD4ROjqCtvq9Rbwj0KZog+hTCmF6yCzK1R/VUgD7pNhCd EsOw== X-Gm-Message-State: AJIora+8GK3ICoiZ3gPdyEucAZu2YSFvNc41GiDL/6lgdvpiC4HRKmpO 89Iv1u5fFKe/wfdHFMlBqlLrkqnQqiW//wGK X-Received: by 2002:a17:90b:390d:b0:1ed:3058:45e5 with SMTP id ob13-20020a17090b390d00b001ed305845e5mr46625701pjb.141.1657095896980; Wed, 06 Jul 2022 01:24:56 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id t17-20020a170902e85100b00162529828aesm25199256plg.109.2022.07.06.01.24.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jul 2022 01:24:56 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v5 16/45] target/arm: Handle SME in sve_access_check Date: Wed, 6 Jul 2022 13:53:42 +0530 Message-Id: <20220706082411.1664825-17-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220706082411.1664825-1-richard.henderson@linaro.org> References: <20220706082411.1664825-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::629; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x629.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=unavailable 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; } /*