From patchwork Mon Jul 11 13:57:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 589358 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:bb16:0:0:0:0 with SMTP id jd22csp3283877mab; Mon, 11 Jul 2022 07:12:36 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tPlmQ5jOupjczNFqNGy8NMMGW3++qVzSV0dRf8DAL0rUk7+po3i97u8Pd6mXY6GxglFa8c X-Received: by 2002:a05:6214:19ec:b0:473:4e67:d4d4 with SMTP id q12-20020a05621419ec00b004734e67d4d4mr9317734qvc.61.1657548756780; Mon, 11 Jul 2022 07:12:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657548756; cv=none; d=google.com; s=arc-20160816; b=GlQkwqw6eb/bt/OXji23IEyMH0fRahAJQPRFDzDsMtVy4zVteevR675QFhR1TQk7Un qPTxl9MTaCoQyR8ZVpWMKfkxhxdfZzHQWgBHHT4o11YnA90767lietMB7kAlmAZi5fpF y4OqjPitnsfJ7eXleOB6raPQm3B52cucfEgxuE+gQIKRmDC3voRS+9g/bwGv6r2sQsNu 7REYQvWI7lmb+VIxIVUIGNXmTlPunhgiG7wZVN9yZVU06qoh532IqX1adFEaT4vuECjD H2DgVlW2EDHMU13dvfayf1i9qfD6B8H/qqTwKuorb4/WtuA3/9fJMniKxAFQD+FHmne9 KvXQ== 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=iUJ2sm4ykqwIgMCGtXLZ1jWMeR/9y75k/xuAaZSsGgw=; b=CLAlJtk+z5QyboSfN+46eiMw/xuz0FTVEG5NJoEhwTgqCHLaNNVoSuvjsd5Ffd0iR2 c586X8garJWaUHckx2VG7RXkvGmLsQbREFWf4KNTAYpjgMuC44QHqq+tnCj49bwSJEbH ObK5vZKJQdfoUAKBZT4vmOCfQQdRYSoUnZxZbPFgYw+MdvW1G4W7ca0VUWA1TCA5GEtr V2cjjlIvfc/zc8GKrA6Bc66jNsHYbZH0lg2Fs4D0xCxLR4KtCEhIg+CQXyCA2nNtjtnP dqIbu6+sH9BsTb50R7N8Ws5sKq21jD1mbjUfrnaj5F3pox63iQULOLS5oD1Ro3z9rnLA +VBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=s2V0A2vi; 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 bs7-20020a05620a470700b006b263cd9f07si3904803qkb.735.2022.07.11.07.12.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Jul 2022 07:12:36 -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=s2V0A2vi; 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]:37618 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oAu9M-0007Y3-9w for patch@linaro.org; Mon, 11 Jul 2022 10:12:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42614) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oAtvS-0006Wf-Oy for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:15 -0400 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]:46673) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oAtvQ-0002pv-3X for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:13 -0400 Received: by mail-wr1-x435.google.com with SMTP id v16so7099742wrd.13 for ; Mon, 11 Jul 2022 06:58:06 -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=iUJ2sm4ykqwIgMCGtXLZ1jWMeR/9y75k/xuAaZSsGgw=; b=s2V0A2vicMkb/gmZaVb31xl+Of7w/mXz4hTaw3m2QUlvR8MRvAXd6jsr6AbgJGLMg4 rZAuY3NyW29tbBslgza0fSsGt+PxZEkjbBkKiWS+STBS5qBoMgWbWiQfK/ZKlnlTWrNT XOFOI6bhr6TwYdF9gPuFSAAm3jLHBXDplnCwbT8e4Yn0Q8ihvjB+nuaelG33vO6BeDO/ ObcmBt1XbAva9vgO9vzvjIFvnql/a7Qoc+qYbWs6LY2WmrIlXkHvHYA0BQNmpWWosM6Q XW1mXOG/0zHlBWzja1ZJ/v4QFvhrQGmDTFWfXwnKXXVVkUqG6FD17XggywWNGmpqVs2i uaow== 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=iUJ2sm4ykqwIgMCGtXLZ1jWMeR/9y75k/xuAaZSsGgw=; b=frk9dNgyhKQY3mKil/qKlZ/36OdvXyJ58pVTZg8wR50uO/ZAIjGHOSWw2EHH7TS8vp UyZCk/SrvXNprueNER969Peq1IlkQWKFXwghLZNHUZUkVCvc4SZdumcq4SgGNRubaEhi ZYVqHpQGRDSw/Nocx2A6cZ5dV2BEy5o1PZQclcRZXOUrLM25xPmXYCD/lcJ3orXjYC9G Ul7GKNuxJz+Ubn4cLsMj3lYSzEo4oIiO/M2FKn2Mu1TflLyGIIiYS2rFqsiQdyYheMXd LtMMclTzDjRgvFkXKM3o8Cegw/ll8aia/Gr41aiG+FFptKu6wwMRwfVLWajFLuF/Fnxj tGsA== X-Gm-Message-State: AJIora+lLlrKVRX4OVDVMfOJNXbCUt7ByeDPKvRJ3XUwpbd9Ry2/+gkt q+AN8X9EwDIHDkMWoxROxkhltAz6LplM5g== X-Received: by 2002:a05:6000:15c3:b0:21d:9f8b:2c3e with SMTP id y3-20020a05600015c300b0021d9f8b2c3emr8367710wry.72.1657547885103; Mon, 11 Jul 2022 06:58:05 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id q123-20020a1c4381000000b00397402ae674sm7595596wma.11.2022.07.11.06.58.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jul 2022 06:58:04 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 16/45] target/arm: Handle SME in sve_access_check Date: Mon, 11 Jul 2022 14:57:21 +0100 Message-Id: <20220711135750.765803-17-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220711135750.765803-1-peter.maydell@linaro.org> References: <20220711135750.765803-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::435; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x435.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 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 Message-id: 20220708151540.18136-17-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- 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 b16d81bf197..b7b64f73584 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; } /*