From nobody Thu May  8 21:38:42 2025
Delivered-To: importer@patchew.org
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass(p=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1657548430; cv=none;
	d=zohomail.com; s=zohoarc;
	b=maK/OkjuioFwkKbkSdf5IqhJCYGR+MzIrt7w7tcVOU4P8A7UhGDij4jvUNDtWEfNzq80AtLntp9FLjdxjfWdNLns43jxSD6sft1cOcGltEXTOtePnovveyJ6IQbjssk+smH6Ot45JvOW8bS2Uk1CMLDrqUG/Gad+w/gt7fi4YYQ=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1657548430;
 h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
	bh=arOhUrEykX6T/wdn4c/Rfw9Py5CnhEHkSl6mPSXt/2Q=;
	b=WtB9JDbBlLeEJ+62NVIqqcJieFo5aDbqIu7q2FkII5lYgHR9jGiyFhl6GDLv44kXZhA6yKG71bYOgLjpkg7f9mh/dmRFP8qh8ylH9NDcRpeEFh7fE0CMRJ+e8X+7Q6eJkR2iCzHFx4RaiAXyUOUG8x0mL3d9uhiw3iKvMMF8ibE=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass header.from=<peter.maydell@linaro.org> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1657548430414920.1995947452226;
 Mon, 11 Jul 2022 07:07:10 -0700 (PDT)
Received: from localhost ([::1]:57208 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces+importer=patchew.org@nongnu.org>)
	id 1oAu45-0001ji-AS
	for importer@patchew.org; Mon, 11 Jul 2022 10:07:09 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:42536)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvQ-0006VC-JJ
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:12 -0400
Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]:51890)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtv9-0002fb-5R
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:02 -0400
Received: by mail-wm1-x32f.google.com with SMTP id ay25so3094421wmb.1
 for <qemu-devel@nongnu.org>; Mon, 11 Jul 2022 06:57:54 -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.57.53
 for <qemu-devel@nongnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 11 Jul 2022 06:57:53 -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=arOhUrEykX6T/wdn4c/Rfw9Py5CnhEHkSl6mPSXt/2Q=;
 b=PtyIRllweAUM8WqX0vdd4hE772d1r05p/MFAAdP5qCGfrPB/vUcBWCIV7RQHT0Rx/4
 kDgPpAh/xvIoGlcZpN6nKewUyUP8y8oaRJRHRq8MYgwAu8u3ZGuNzHkD12Lqg9EGwuhT
 KNxcGYTD2qxnufhszxZPwqTw2D+dy1e8Xdy80BHJLAPRqnYK/Aek/I3MnBIDlBJYxKrD
 XkJ7IMV3ag6a7c86nSywtJhp8Bu3lDV1rtuC+/Gclp0VQUpa7n0Z4TC1UoHgGLabPXg7
 Sm6WMSa6CJ4ViaT721dSHV5/3mFMjSD91DbGx7fdPeDYHA5vcHG3WuJ1Rm13CnwoZhPH
 6z3g==
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=arOhUrEykX6T/wdn4c/Rfw9Py5CnhEHkSl6mPSXt/2Q=;
 b=vqBOBVJXxcpCXNve4LQ0/yjMJ9G+v2z35EwyNiaBW8y8mOGoqXRZ8hMvdngGLYkgq3
 UZVkvhA5c/iGHMurD4Qwep/M92Mlc8bfjaxEGvv+UC6SQz0r7MmleVi9p7bK/rM4zKvW
 VTeSc0x900LOil68VyLmiWNVxrMDAWzZfa1VKlAVYjQjwJyw/wtu06Pb/y7acL3SWtrV
 ZB2T07OuExnmETtE2gFf5tVkaZUX8m8mGHsrA88pADNd48KUD7Kcpuj5fvkc0XsjgzQ9
 C+iDSrw/W8Z+5otONdVV2r6oTAClwuDy9akzXtrP2kOyZ56sgObrX3tZ4gq2bvdww+O9
 dauQ==
X-Gm-Message-State: AJIora8RoyvfTY6g8CWKdAA5enz72xwuzwq4i/be9T1D1HU9Iwe2j1XS
 FWk2YiZoAlM1jTjY/xywl8o2QAWI7Xu78g==
X-Google-Smtp-Source: 
 AGRyM1uJ/2OoBt1cPEgCs/igfdEOUlEg68tct6pL6s4imVyPsL6H6/sqHzKMmIVDaNoz4CKr0oVfEw==
X-Received: by 2002:a05:600c:4e07:b0:3a1:8548:4dd7 with SMTP id
 b7-20020a05600c4e0700b003a185484dd7mr16441021wmq.170.1657547873710;
 Mon, 11 Jul 2022 06:57:53 -0700 (PDT)
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 01/45] target/arm: Handle SME in aarch64_cpu_dump_state
Date: Mon, 11 Jul 2022 14:57:06 +0100
Message-Id: <20220711135750.765803-2-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
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17
 as permitted sender) client-ip=209.51.188.17;
 envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org;
 helo=lists.gnu.org;
Received-SPF: pass client-ip=2a00:1450:4864:20::32f;
 envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32f.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_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01,
 T_SPF_HELO_TEMPERROR=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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>
Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org
Sender: "Qemu-devel" <qemu-devel-bounces+importer=patchew.org@nongnu.org>
X-ZohoMail-DKIM: pass (identity @linaro.org)
X-ZM-MESSAGEID: 1657548430966100001
Content-Type: text/plain; charset="utf-8"

From: Richard Henderson <richard.henderson@linaro.org>

Dump SVCR, plus use the correct access check for Streaming Mode.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220708151540.18136-2-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 target/arm/cpu.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/target/arm/cpu.c b/target/arm/cpu.c
index ae6dca2f010..9c58be8b146 100644
--- a/target/arm/cpu.c
+++ b/target/arm/cpu.c
@@ -878,6 +878,7 @@ static void aarch64_cpu_dump_state(CPUState *cs, FILE *=
f, int flags)
     int i;
     int el =3D arm_current_el(env);
     const char *ns_status;
+    bool sve;
=20
     qemu_fprintf(f, " PC=3D%016" PRIx64 " ", env->pc);
     for (i =3D 0; i < 32; i++) {
@@ -904,6 +905,12 @@ static void aarch64_cpu_dump_state(CPUState *cs, FILE =
*f, int flags)
                  el,
                  psr & PSTATE_SP ? 'h' : 't');
=20
+    if (cpu_isar_feature(aa64_sme, cpu)) {
+        qemu_fprintf(f, "  SVCR=3D%08" PRIx64 " %c%c",
+                     env->svcr,
+                     (FIELD_EX64(env->svcr, SVCR, ZA) ? 'Z' : '-'),
+                     (FIELD_EX64(env->svcr, SVCR, SM) ? 'S' : '-'));
+    }
     if (cpu_isar_feature(aa64_bti, cpu)) {
         qemu_fprintf(f, "  BTYPE=3D%d", (psr & PSTATE_BTYPE) >> 10);
     }
@@ -918,7 +925,15 @@ static void aarch64_cpu_dump_state(CPUState *cs, FILE =
*f, int flags)
     qemu_fprintf(f, "     FPCR=3D%08x FPSR=3D%08x\n",
                  vfp_get_fpcr(env), vfp_get_fpsr(env));
=20
-    if (cpu_isar_feature(aa64_sve, cpu) && sve_exception_el(env, el) =3D=
=3D 0) {
+    if (cpu_isar_feature(aa64_sme, cpu) && FIELD_EX64(env->svcr, SVCR, SM)=
) {
+        sve =3D sme_exception_el(env, el) =3D=3D 0;
+    } else if (cpu_isar_feature(aa64_sve, cpu)) {
+        sve =3D sve_exception_el(env, el) =3D=3D 0;
+    } else {
+        sve =3D false;
+    }
+
+    if (sve) {
         int j, zcr_len =3D sve_vqm1_for_el(env, el);
=20
         for (i =3D 0; i <=3D FFR_PRED_NUM; i++) {
--=20
2.25.1
From nobody Thu May  8 21:38:42 2025
Delivered-To: importer@patchew.org
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass(p=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1657548348; cv=none;
	d=zohomail.com; s=zohoarc;
	b=e+b83PCxSngs46+ncHOFewPScaKR6mXm79FW9b2ecEstBYq0W8FjLHM/rQe9C9HJfndpUMg5w1S7B4oAFuFSzFUwMddUeaLkU6bTpDy8IVUDcVopSaoG2Jnowemy1uge/FhEmtgVCG6t6TLikRiZbe7JmAB0+k8e8F3+z96Gx+Q=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1657548348;
 h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
	bh=cq6njPeWKBmD/7wPffofXcxJCvDo9VaNMF80FcBqOjU=;
	b=gcwDDP1e3wth609Zo/k4vLV9aj4IGEy8b02V5GNCqGJeyW8XPIXGEnWD+H5Qa3k37kT0UCngHF3SwndGVqKpJGCkGFLUQtCazUq8bsHwtZdtynSJncNJu4Mf9NoccKmDM4h9WCxdt4UroASkvng88VosTw065GxUNZ7CyPSHwx0=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass header.from=<peter.maydell@linaro.org> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1657548348850199.71767013587453;
 Mon, 11 Jul 2022 07:05:48 -0700 (PDT)
Received: from localhost ([::1]:52878 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces+importer=patchew.org@nongnu.org>)
	id 1oAu2l-00079G-SA
	for importer@patchew.org; Mon, 11 Jul 2022 10:05:47 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:42522)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvQ-0006V6-HN
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:12 -0400
Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]:38514)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtv9-0002kD-QX
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:05 -0400
Received: by mail-wr1-x42a.google.com with SMTP id v14so7134470wra.5
 for <qemu-devel@nongnu.org>; Mon, 11 Jul 2022 06:57:55 -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.57.53
 for <qemu-devel@nongnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 11 Jul 2022 06:57:54 -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=cq6njPeWKBmD/7wPffofXcxJCvDo9VaNMF80FcBqOjU=;
 b=secG/W/dlqoCgGDHSLGYpo62C5tGwl5aZRZ6nrfwxLrEyTX3Kr1Ya3FjZsqbTuzLVL
 TUfw/QlX3vFE55lzGU1Qa99Q4VNVtXMlMmmgi0u4tfs59ToVCg+hM9P6KqCaXIAvmps4
 xjY21oaUuuMEJqZNF2PtB4HuvJem8gj7E69dvyQq0oNRBXVaoMCS6N+3OPViu7gkP8h6
 UNnyETszLC6gtlWnusVHDY35OwSU9YpDg2V6010Fzj4vIPwGMKVJkrEFXHTjLrT/lD87
 qCiimcuWTV+KTMxjN34fa22H9lgvzI4h0SM43S42Tz3hBy3r5/9IpvOVDAYfePrLZxPZ
 8U+g==
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=cq6njPeWKBmD/7wPffofXcxJCvDo9VaNMF80FcBqOjU=;
 b=vOgI4QXeA23JFTiKbxtmQaT8mDax+82XhXXmtkluzNLgzq7VtRxR3auZ+fiW6KmO6W
 TrxTKLuYEcNv10iO9rqkQTd+0iVLylUA779W3RZg3ZTDPhBg4dovfbOnzvAFAMov83H5
 bCZ/6lWczOQIXwM/DKs8u+yTXO2N56J7DfVH//9vRlsecOZ3X+o7e0/oitIsOeKdTPe0
 9r04HlRxERJaC5bHZi9nF2VALwkhxitoUxk9/Sgj1mbz0occscGxoauKewuFqhGPIcOH
 eMsLwWLFB/xcONfeAGL7DFNfkPS6pX8ZL3lmVUx/TTxTVllXHwsFkepiRb+RcmOrwrY+
 pI1w==
X-Gm-Message-State: AJIora+PvJZlnUPs8qgTmQz/JIfkoi6tD+cPxK1qiwXoMa5nPq+JvS2L
 P524Wfa3a6T361U/8iWuJd/yTvKad6QHpw==
X-Google-Smtp-Source: 
 AGRyM1szLMsJtVS/m/Of1i8Xct5GQ1/3S31JM8fRjlfVghaIhKLrZAzBvNoB3FpQZ2pdV+Tk7kbH/A==
X-Received: by 2002:a5d:6488:0:b0:203:b628:70d2 with SMTP id
 o8-20020a5d6488000000b00203b62870d2mr16555207wri.83.1657547874483;
 Mon, 11 Jul 2022 06:57:54 -0700 (PDT)
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 02/45] target/arm: Add infrastructure for disas_sme
Date: Mon, 11 Jul 2022 14:57:07 +0100
Message-Id: <20220711135750.765803-3-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
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17
 as permitted sender) client-ip=209.51.188.17;
 envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org;
 helo=lists.gnu.org;
Received-SPF: pass client-ip=2a00:1450:4864:20::42a;
 envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42a.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, 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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>
Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org
Sender: "Qemu-devel" <qemu-devel-bounces+importer=patchew.org@nongnu.org>
X-ZohoMail-DKIM: pass (identity @linaro.org)
X-ZM-MESSAGEID: 1657548349324100002
Content-Type: text/plain; charset="utf-8"

From: Richard Henderson <richard.henderson@linaro.org>

This includes the build rules for the decoder, and the
new file for translation, but excludes any instructions.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220708151540.18136-3-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 target/arm/translate-a64.h |  1 +
 target/arm/sme.decode      | 20 ++++++++++++++++++++
 target/arm/translate-a64.c |  7 ++++++-
 target/arm/translate-sme.c | 35 +++++++++++++++++++++++++++++++++++
 target/arm/meson.build     |  2 ++
 5 files changed, 64 insertions(+), 1 deletion(-)
 create mode 100644 target/arm/sme.decode
 create mode 100644 target/arm/translate-sme.c

diff --git a/target/arm/translate-a64.h b/target/arm/translate-a64.h
index f0970c6b8cf..789b6e8e781 100644
--- a/target/arm/translate-a64.h
+++ b/target/arm/translate-a64.h
@@ -146,6 +146,7 @@ static inline int pred_gvec_reg_size(DisasContext *s)
 }
=20
 bool disas_sve(DisasContext *, uint32_t);
+bool disas_sme(DisasContext *, uint32_t);
=20
 void gen_gvec_rax1(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs,
                    uint32_t rm_ofs, uint32_t opr_sz, uint32_t max_sz);
diff --git a/target/arm/sme.decode b/target/arm/sme.decode
new file mode 100644
index 00000000000..c25c031a71d
--- /dev/null
+++ b/target/arm/sme.decode
@@ -0,0 +1,20 @@
+# AArch64 SME instruction descriptions
+#
+#  Copyright (c) 2022 Linaro, Ltd
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, see <http://www.gnu.org/license=
s/>.
+
+#
+# This file is processed by scripts/decodetree.py
+#
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
index c86b97b1d49..a5f8a6c771b 100644
--- a/target/arm/translate-a64.c
+++ b/target/arm/translate-a64.c
@@ -14806,7 +14806,12 @@ static void aarch64_tr_translate_insn(DisasContext=
Base *dcbase, CPUState *cpu)
     }
=20
     switch (extract32(insn, 25, 4)) {
-    case 0x0: case 0x1: case 0x3: /* UNALLOCATED */
+    case 0x0:
+        if (!extract32(insn, 31, 1) || !disas_sme(s, insn)) {
+            unallocated_encoding(s);
+        }
+        break;
+    case 0x1: case 0x3: /* UNALLOCATED */
         unallocated_encoding(s);
         break;
     case 0x2:
diff --git a/target/arm/translate-sme.c b/target/arm/translate-sme.c
new file mode 100644
index 00000000000..786c93fb2db
--- /dev/null
+++ b/target/arm/translate-sme.c
@@ -0,0 +1,35 @@
+/*
+ * AArch64 SME translation
+ *
+ * Copyright (c) 2022 Linaro, Ltd
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, see <http://www.gnu.org/licens=
es/>.
+ */
+
+#include "qemu/osdep.h"
+#include "cpu.h"
+#include "tcg/tcg-op.h"
+#include "tcg/tcg-op-gvec.h"
+#include "tcg/tcg-gvec-desc.h"
+#include "translate.h"
+#include "exec/helper-gen.h"
+#include "translate-a64.h"
+#include "fpu/softfloat.h"
+
+
+/*
+ * Include the generated decoder.
+ */
+
+#include "decode-sme.c.inc"
diff --git a/target/arm/meson.build b/target/arm/meson.build
index 43dc6005478..6dd7e93643d 100644
--- a/target/arm/meson.build
+++ b/target/arm/meson.build
@@ -1,5 +1,6 @@
 gen =3D [
   decodetree.process('sve.decode', extra_args: '--decode=3Ddisas_sve'),
+  decodetree.process('sme.decode', extra_args: '--decode=3Ddisas_sme'),
   decodetree.process('neon-shared.decode', extra_args: '--decode=3Ddisas_n=
eon_shared'),
   decodetree.process('neon-dp.decode', extra_args: '--decode=3Ddisas_neon_=
dp'),
   decodetree.process('neon-ls.decode', extra_args: '--decode=3Ddisas_neon_=
ls'),
@@ -50,6 +51,7 @@ arm_ss.add(when: 'TARGET_AARCH64', if_true: files(
   'sme_helper.c',
   'translate-a64.c',
   'translate-sve.c',
+  'translate-sme.c',
 ))
=20
 arm_softmmu_ss =3D ss.source_set()
--=20
2.25.1
From nobody Thu May  8 21:38:42 2025
Delivered-To: importer@patchew.org
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass(p=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1657548072; cv=none;
	d=zohomail.com; s=zohoarc;
	b=dWCI0J995NlDWCK2JCd1c+bU2C2/l+8Rb67gn91hDmigIbzkNLmPXSZRE/u1KS4a4dbaKcZlicPwbHNUZi9FqnuWYLIDW74uZnCzOM+eyLdAXEpnjxx1tcNkXPPF9mKohv3jBq38L3cNQAC6HRE9+fVhpueXdAT74SHyXgc0wYs=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1657548072;
 h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
	bh=xo5x3f5DFykiglro7trGefQrOb/O5QrFa/9gBehc4w0=;
	b=NWNVGjGBGZ5BNPF20dZ+OUJuO12dFVV8shXlb59FdJ8ZnVpz334x+78XVc83i6sc5ImfJ3ZDXGwjGNmnkurlaaeW7UcbmW+R4aw3rivoUl1hVxnhppt9brOQqCRHRTDxlIJvooQ0yxb9chktyTz3Jyy6oz72lcjRG1y6UJtQTug=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass header.from=<peter.maydell@linaro.org> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1657548072299246.55506871376963;
 Mon, 11 Jul 2022 07:01:12 -0700 (PDT)
Received: from localhost ([::1]:44340 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces+importer=patchew.org@nongnu.org>)
	id 1oAtyJ-00019p-67
	for importer@patchew.org; Mon, 11 Jul 2022 10:01:11 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:42534)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvQ-0006VB-It
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:12 -0400
Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]:55902)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvB-0002nJ-Fh
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:01 -0400
Received: by mail-wm1-x32e.google.com with SMTP id l42so3020786wms.5
 for <qemu-devel@nongnu.org>; Mon, 11 Jul 2022 06:57:57 -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.57.54
 for <qemu-devel@nongnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 11 Jul 2022 06:57: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=xo5x3f5DFykiglro7trGefQrOb/O5QrFa/9gBehc4w0=;
 b=FLT3QWptituDVHJ502RGxxZfXwPRjX87MPQnSFP2srQ8HMEwnE8FmOWGosGqJmdB7M
 WzkTF3SMOCCsrNNAXWKNz/7LslDH/LmjP1W7MvCePDfWWo/OQMnsmlYdUpm5BGV32TYb
 fu2WuSsptyfwWwyuSki2grw4QNnOkbQBGLe8lNY4qDh9X7sbsq95bxqYGU59FioDp2PU
 zggtomHgUSCOfSqF8ltBq5PLQYoBVYG2AkJKOHramGKq6bi8ZLp1v58dD8nHx1klEwFW
 gvUT74ES21HFKAl6mC9qpbqp+zAOOKiibLNb2m9XT3dwrq5qE77W7XJ9wCuBq69+1Tof
 lrvQ==
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=xo5x3f5DFykiglro7trGefQrOb/O5QrFa/9gBehc4w0=;
 b=sBX27JZHj4SABEYaG/Zo6oGXJBKg79NkOFPwYw6z0P1NshoyzAr3A+ZxZQCzdHgZ/a
 N6Z3ZAGTbPD1ivSkj/HbKWodXdsrP6osqqSL573zFRp7kAIErnKYC/ri7+N2yKcWn+8t
 ej4gt0XN+9412LYNdqWtibyI3Jb8KqUvsKPxESa4ntYxANgAZY+yDMayKc7PLPY7Pg9x
 onFTTF5XNW9EUKLe/Gv4ERWfJuCrxK15KnH9UZK2EHnSp8iRRA+GMlSC3zeYPEt6J4rJ
 BB2lapT5d7kMd/uQDQyuFBH1SGNStbmjSX21b0U8zwHV9xqQdXYCPu4Dt+MIgUu3kupm
 OLmw==
X-Gm-Message-State: AJIora+43YueRifK5zskhTeLBBA/TvtqyQv3MGnl+w9o3yQX4UUUeWpo
 a/utPLOcotIyXklyKHQtg4g5SHNI9Bz+dw==
X-Google-Smtp-Source: 
 AGRyM1sSHEdQjSdSf35dBl8fsGNo7tn7t+ZQTid39NbI8FoWtBMYz/CEjFA64jFdLJ1mFnH93Xv79Q==
X-Received: by 2002:a05:600c:1986:b0:3a1:9fc4:b683 with SMTP id
 t6-20020a05600c198600b003a19fc4b683mr16776319wmq.72.1657547875392;
 Mon, 11 Jul 2022 06:57:55 -0700 (PDT)
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 03/45] target/arm: Trap non-streaming usage when Streaming SVE
 is active
Date: Mon, 11 Jul 2022 14:57:08 +0100
Message-Id: <20220711135750.765803-4-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
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17
 as permitted sender) client-ip=209.51.188.17;
 envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org;
 helo=lists.gnu.org;
Received-SPF: pass client-ip=2a00:1450:4864:20::32e;
 envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32e.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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>
Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org
Sender: "Qemu-devel" <qemu-devel-bounces+importer=patchew.org@nongnu.org>
X-ZohoMail-DKIM: pass (identity @linaro.org)
X-ZM-MESSAGEID: 1657548073240100001
Content-Type: text/plain; charset="utf-8"

From: Richard Henderson <richard.henderson@linaro.org>

This new behaviour is in the ARM pseudocode function
AArch64.CheckFPAdvSIMDEnabled, which applies to AArch32
via AArch32.CheckAdvSIMDOrFPEnabled when the EL to which
the trap would be delivered is in AArch64 mode.

Given that ARMv9 drops support for AArch32 outside EL0, the trap EL
detection ought to be trivially true, but the pseudocode still contains
a number of conditions, and QEMU has not yet committed to dropping A32
support for EL[12] when v9 features are present.

Since the computation of SME_TRAP_NONSTREAMING is necessarily different
for the two modes, we might as well preserve bits within TBFLAG_ANY and
allocate separate bits within TBFLAG_A32 and TBFLAG_A64 instead.

Note that DDI0616A.a has typos for bits [22:21] of LD1RO in the table
of instructions illegal in streaming mode.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220708151540.18136-4-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 target/arm/cpu.h           |  7 +++
 target/arm/translate.h     |  4 ++
 target/arm/sme-fa64.decode | 90 ++++++++++++++++++++++++++++++++++++++
 target/arm/helper.c        | 41 +++++++++++++++++
 target/arm/translate-a64.c | 40 ++++++++++++++++-
 target/arm/translate-vfp.c | 12 +++++
 target/arm/translate.c     |  2 +
 target/arm/meson.build     |  1 +
 8 files changed, 195 insertions(+), 2 deletions(-)
 create mode 100644 target/arm/sme-fa64.decode

diff --git a/target/arm/cpu.h b/target/arm/cpu.h
index 1f4f3e0485c..1e36a839ee4 100644
--- a/target/arm/cpu.h
+++ b/target/arm/cpu.h
@@ -3158,6 +3158,11 @@ FIELD(TBFLAG_A32, HSTR_ACTIVE, 9, 1)
  * the same thing as the current security state of the processor!
  */
 FIELD(TBFLAG_A32, NS, 10, 1)
+/*
+ * Indicates that SME Streaming mode is active, and SMCR_ELx.FA64 is not.
+ * This requires an SME trap from AArch32 mode when using NEON.
+ */
+FIELD(TBFLAG_A32, SME_TRAP_NONSTREAMING, 11, 1)
=20
 /*
  * Bit usage when in AArch32 state, for M-profile only.
@@ -3195,6 +3200,8 @@ 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)
+/* Indicates that SME Streaming mode is active, and SMCR_ELx.FA64 is not. =
*/
+FIELD(TBFLAG_A64, SME_TRAP_NONSTREAMING, 28, 1)
=20
 /*
  * Helpers for using the above.
diff --git a/target/arm/translate.h b/target/arm/translate.h
index 22fd882368b..cbc907c7516 100644
--- a/target/arm/translate.h
+++ b/target/arm/translate.h
@@ -102,6 +102,10 @@ typedef struct DisasContext {
     bool pstate_sm;
     /* True if PSTATE.ZA is set. */
     bool pstate_za;
+    /* True if non-streaming insns should raise an SME Streaming exception=
. */
+    bool sme_trap_nonstreaming;
+    /* True if the current instruction is non-streaming. */
+    bool is_nonstreaming;
     /* True if MVE insns are definitely not predicated by VPR or LTPSIZE */
     bool mve_no_pred;
     /*
diff --git a/target/arm/sme-fa64.decode b/target/arm/sme-fa64.decode
new file mode 100644
index 00000000000..3d90837fc7c
--- /dev/null
+++ b/target/arm/sme-fa64.decode
@@ -0,0 +1,90 @@
+# AArch64 SME allowed instruction decoding
+#
+#  Copyright (c) 2022 Linaro, Ltd
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, see <http://www.gnu.org/license=
s/>.
+
+#
+# This file is processed by scripts/decodetree.py
+#
+
+# These patterns are taken from Appendix E1.1 of DDI0616 A.a,
+# Arm Architecture Reference Manual Supplement,
+# The Scalable Matrix Extension (SME), for Armv9-A
+
+{
+  [
+    OK  0-00 1110 0000 0001 0010 11-- ---- ----   # SMOV W|Xd,Vn.B[0]
+    OK  0-00 1110 0000 0010 0010 11-- ---- ----   # SMOV W|Xd,Vn.H[0]
+    OK  0100 1110 0000 0100 0010 11-- ---- ----   # SMOV Xd,Vn.S[0]
+    OK  0000 1110 0000 0001 0011 11-- ---- ----   # UMOV Wd,Vn.B[0]
+    OK  0000 1110 0000 0010 0011 11-- ---- ----   # UMOV Wd,Vn.H[0]
+    OK  0000 1110 0000 0100 0011 11-- ---- ----   # UMOV Wd,Vn.S[0]
+    OK  0100 1110 0000 1000 0011 11-- ---- ----   # UMOV Xd,Vn.D[0]
+  ]
+  FAIL  0--0 111- ---- ---- ---- ---- ---- ----   # Advanced SIMD vector o=
perations
+}
+
+{
+  [
+    OK  0101 1110 --1- ---- 11-1 11-- ---- ----   # FMULX/FRECPS/FRSQRTS (=
scalar)
+    OK  0101 1110 -10- ---- 00-1 11-- ---- ----   # FMULX/FRECPS/FRSQRTS (=
scalar, FP16)
+    OK  01-1 1110 1-10 0001 11-1 10-- ---- ----   # FRECPE/FRSQRTE/FRECPX =
(scalar)
+    OK  01-1 1110 1111 1001 11-1 10-- ---- ----   # FRECPE/FRSQRTE/FRECPX =
(scalar, FP16)
+  ]
+  FAIL  01-1 111- ---- ---- ---- ---- ---- ----   # Advanced SIMD single-e=
lement operations
+}
+
+FAIL    0-00 110- ---- ---- ---- ---- ---- ----   # Advanced SIMD structur=
e load/store
+FAIL    1100 1110 ---- ---- ---- ---- ---- ----   # Advanced SIMD cryptogr=
aphy extensions
+FAIL    0001 1110 0111 1110 0000 00-- ---- ----   # FJCVTZS
+
+# These are the "avoidance of doubt" final table of Illegal Advanced SIMD =
instructions
+# We don't actually need to include these, as the default is OK.
+#       -001 111- ---- ---- ---- ---- ---- ----   # Scalar floating-point =
operations
+#       --10 110- ---- ---- ---- ---- ---- ----   # Load/store pair of FP =
registers
+#       --01 1100 ---- ---- ---- ---- ---- ----   # Load FP register (PC-r=
elative literal)
+#       --11 1100 --0- ---- ---- ---- ---- ----   # Load/store FP register=
 (unscaled imm)
+#       --11 1100 --1- ---- ---- ---- ---- --10   # Load/store FP register=
 (register offset)
+#       --11 1101 ---- ---- ---- ---- ---- ----   # Load/store FP register=
 (scaled imm)
+
+FAIL    0000 0100 --1- ---- 1010 ---- ---- ----   # ADR
+FAIL    0000 0100 --1- ---- 1011 -0-- ---- ----   # FTSSEL, FEXPA
+FAIL    0000 0101 --10 0001 100- ---- ---- ----   # COMPACT
+FAIL    0010 0101 --01 100- 1111 000- ---0 ----   # RDFFR, RDFFRS
+FAIL    0010 0101 --10 1--- 1001 ---- ---- ----   # WRFFR, SETFFR
+FAIL    0100 0101 --0- ---- 1011 ---- ---- ----   # BDEP, BEXT, BGRP
+FAIL    0100 0101 000- ---- 0110 1--- ---- ----   # PMULLB, PMULLT (128b r=
esult)
+FAIL    0110 0100 --1- ---- 1110 01-- ---- ----   # FMMLA, BFMMLA
+FAIL    0110 0101 --0- ---- 0000 11-- ---- ----   # FTSMUL
+FAIL    0110 0101 --01 0--- 100- ---- ---- ----   # FTMAD
+FAIL    0110 0101 --01 1--- 001- ---- ---- ----   # FADDA
+FAIL    0100 0101 --0- ---- 1001 10-- ---- ----   # SMMLA, UMMLA, USMMLA
+FAIL    0100 0101 --1- ---- 1--- ---- ---- ----   # SVE2 string/histo/cryp=
to instructions
+FAIL    1000 010- -00- ---- 10-- ---- ---- ----   # SVE2 32-bit gather NT =
load (vector+scalar)
+FAIL    1000 010- -00- ---- 111- ---- ---- ----   # SVE 32-bit gather pref=
etch (vector+imm)
+FAIL    1000 0100 0-1- ---- 0--- ---- ---- ----   # SVE 32-bit gather pref=
etch (scalar+vector)
+FAIL    1000 010- -01- ---- 1--- ---- ---- ----   # SVE 32-bit gather load=
 (vector+imm)
+FAIL    1000 0100 0-0- ---- 0--- ---- ---- ----   # SVE 32-bit gather load=
 byte (scalar+vector)
+FAIL    1000 0100 1--- ---- 0--- ---- ---- ----   # SVE 32-bit gather load=
 half (scalar+vector)
+FAIL    1000 0101 0--- ---- 0--- ---- ---- ----   # SVE 32-bit gather load=
 word (scalar+vector)
+FAIL    1010 010- ---- ---- 011- ---- ---- ----   # SVE contiguous FF load=
 (scalar+scalar)
+FAIL    1010 010- ---1 ---- 101- ---- ---- ----   # SVE contiguous NF load=
 (scalar+imm)
+FAIL    1010 010- -01- ---- 000- ---- ---- ----   # SVE load & replicate 3=
2 bytes (scalar+scalar)
+FAIL    1010 010- -010 ---- 001- ---- ---- ----   # SVE load & replicate 3=
2 bytes (scalar+imm)
+FAIL    1100 010- ---- ---- ---- ---- ---- ----   # SVE 64-bit gather load=
/prefetch
+FAIL    1110 010- -00- ---- 001- ---- ---- ----   # SVE2 64-bit scatter NT=
 store (vector+scalar)
+FAIL    1110 010- -10- ---- 001- ---- ---- ----   # SVE2 32-bit scatter NT=
 store (vector+scalar)
+FAIL    1110 010- ---- ---- 1-0- ---- ---- ----   # SVE scatter store (sca=
lar+32-bit vector)
+FAIL    1110 010- ---- ---- 101- ---- ---- ----   # SVE scatter store (mis=
c)
diff --git a/target/arm/helper.c b/target/arm/helper.c
index e6f37e160f8..73a5b2b86d9 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -6098,6 +6098,32 @@ int sme_exception_el(CPUARMState *env, int el)
     return 0;
 }
=20
+/* This corresponds to the ARM pseudocode function IsFullA64Enabled(). */
+static bool sme_fa64(CPUARMState *env, int el)
+{
+    if (!cpu_isar_feature(aa64_sme_fa64, env_archcpu(env))) {
+        return false;
+    }
+
+    if (el <=3D 1 && !el_is_in_host(env, el)) {
+        if (!FIELD_EX64(env->vfp.smcr_el[1], SMCR, FA64)) {
+            return false;
+        }
+    }
+    if (el <=3D 2 && arm_is_el2_enabled(env)) {
+        if (!FIELD_EX64(env->vfp.smcr_el[2], SMCR, FA64)) {
+            return false;
+        }
+    }
+    if (arm_feature(env, ARM_FEATURE_EL3)) {
+        if (!FIELD_EX64(env->vfp.smcr_el[3], SMCR, FA64)) {
+            return false;
+        }
+    }
+
+    return true;
+}
+
 /*
  * Given that SVE is enabled, return the vector length for EL.
  */
@@ -10801,6 +10827,20 @@ static CPUARMTBFlags rebuild_hflags_a32(CPUARMStat=
e *env, int fp_el,
         DP_TBFLAG_ANY(flags, PSTATE__IL, 1);
     }
=20
+    /*
+     * The SME exception we are testing for is raised via
+     * AArch64.CheckFPAdvSIMDEnabled(), as called from
+     * AArch32.CheckAdvSIMDOrFPEnabled().
+     */
+    if (el =3D=3D 0
+        && FIELD_EX64(env->svcr, SVCR, SM)
+        && (!arm_is_el2_enabled(env)
+            || (arm_el_is_aa64(env, 2) && !(env->cp15.hcr_el2 & HCR_TGE)))
+        && arm_el_is_aa64(env, 1)
+        && !sme_fa64(env, el)) {
+        DP_TBFLAG_A32(flags, SME_TRAP_NONSTREAMING, 1);
+    }
+
     return rebuild_hflags_common_32(env, fp_el, mmu_idx, flags);
 }
=20
@@ -10850,6 +10890,7 @@ static CPUARMTBFlags rebuild_hflags_a64(CPUARMState=
 *env, int el, int fp_el,
         }
         if (FIELD_EX64(env->svcr, SVCR, SM)) {
             DP_TBFLAG_A64(flags, PSTATE_SM, 1);
+            DP_TBFLAG_A64(flags, SME_TRAP_NONSTREAMING, !sme_fa64(env, el)=
);
         }
         DP_TBFLAG_A64(flags, PSTATE_ZA, FIELD_EX64(env->svcr, SVCR, ZA));
     }
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
index a5f8a6c771b..7fab7f64f86 100644
--- a/target/arm/translate-a64.c
+++ b/target/arm/translate-a64.c
@@ -1155,7 +1155,7 @@ static void do_vec_ld(DisasContext *s, int destidx, i=
nt element,
  * unallocated-encoding checks (otherwise the syndrome information
  * for the resulting exception will be incorrect).
  */
-static bool fp_access_check(DisasContext *s)
+static bool fp_access_check_only(DisasContext *s)
 {
     if (s->fp_excp_el) {
         assert(!s->fp_access_checked);
@@ -1170,6 +1170,19 @@ static bool fp_access_check(DisasContext *s)
     return true;
 }
=20
+static bool fp_access_check(DisasContext *s)
+{
+    if (!fp_access_check_only(s)) {
+        return false;
+    }
+    if (s->sme_trap_nonstreaming && s->is_nonstreaming) {
+        gen_exception_insn(s, s->pc_curr, EXCP_UDEF,
+                           syn_smetrap(SME_ET_Streaming, false));
+        return false;
+    }
+    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.
  */
@@ -1994,7 +2007,7 @@ static void handle_sys(DisasContext *s, uint32_t insn=
, bool isread,
     default:
         g_assert_not_reached();
     }
-    if ((ri->type & ARM_CP_FPU) && !fp_access_check(s)) {
+    if ((ri->type & ARM_CP_FPU) && !fp_access_check_only(s)) {
         return;
     } else if ((ri->type & ARM_CP_SVE) && !sve_access_check(s)) {
         return;
@@ -14530,6 +14543,23 @@ static void disas_data_proc_simd_fp(DisasContext *=
s, uint32_t insn)
     }
 }
=20
+/*
+ * Include the generated SME FA64 decoder.
+ */
+
+#include "decode-sme-fa64.c.inc"
+
+static bool trans_OK(DisasContext *s, arg_OK *a)
+{
+    return true;
+}
+
+static bool trans_FAIL(DisasContext *s, arg_OK *a)
+{
+    s->is_nonstreaming =3D true;
+    return true;
+}
+
 /**
  * is_guarded_page:
  * @env: The cpu environment
@@ -14657,6 +14687,7 @@ static void aarch64_tr_init_disas_context(DisasCont=
extBase *dcbase,
     dc->mte_active[1] =3D EX_TBFLAG_A64(tb_flags, MTE0_ACTIVE);
     dc->pstate_sm =3D EX_TBFLAG_A64(tb_flags, PSTATE_SM);
     dc->pstate_za =3D EX_TBFLAG_A64(tb_flags, PSTATE_ZA);
+    dc->sme_trap_nonstreaming =3D EX_TBFLAG_A64(tb_flags, SME_TRAP_NONSTRE=
AMING);
     dc->vec_len =3D 0;
     dc->vec_stride =3D 0;
     dc->cp_regs =3D arm_cpu->cp_regs;
@@ -14805,6 +14836,11 @@ static void aarch64_tr_translate_insn(DisasContext=
Base *dcbase, CPUState *cpu)
         }
     }
=20
+    s->is_nonstreaming =3D false;
+    if (s->sme_trap_nonstreaming) {
+        disas_sme_fa64(s, insn);
+    }
+
     switch (extract32(insn, 25, 4)) {
     case 0x0:
         if (!extract32(insn, 31, 1) || !disas_sme(s, insn)) {
diff --git a/target/arm/translate-vfp.c b/target/arm/translate-vfp.c
index 82fdbcae530..bd5ae27d090 100644
--- a/target/arm/translate-vfp.c
+++ b/target/arm/translate-vfp.c
@@ -234,6 +234,18 @@ static bool vfp_access_check_a(DisasContext *s, bool i=
gnore_vfp_enabled)
         return false;
     }
=20
+    /*
+     * Note that rebuild_hflags_a32 has already accounted for being in EL0
+     * and the higher EL in A64 mode, etc.  Unlike A64 mode, there do not
+     * appear to be any insns which touch VFP which are allowed.
+     */
+    if (s->sme_trap_nonstreaming) {
+        gen_exception_insn(s, s->pc_curr, EXCP_UDEF,
+                           syn_smetrap(SME_ET_Streaming,
+                                       s->base.pc_next - s->pc_curr =3D=3D=
 2));
+        return false;
+    }
+
     if (!s->vfp_enabled && !ignore_vfp_enabled) {
         assert(!arm_dc_feature(s, ARM_FEATURE_M));
         unallocated_encoding(s);
diff --git a/target/arm/translate.c b/target/arm/translate.c
index 6617de775fd..4ffb095c734 100644
--- a/target/arm/translate.c
+++ b/target/arm/translate.c
@@ -9378,6 +9378,8 @@ static void arm_tr_init_disas_context(DisasContextBas=
e *dcbase, CPUState *cs)
             dc->vec_len =3D EX_TBFLAG_A32(tb_flags, VECLEN);
             dc->vec_stride =3D EX_TBFLAG_A32(tb_flags, VECSTRIDE);
         }
+        dc->sme_trap_nonstreaming =3D
+            EX_TBFLAG_A32(tb_flags, SME_TRAP_NONSTREAMING);
     }
     dc->cp_regs =3D cpu->cp_regs;
     dc->features =3D env->features;
diff --git a/target/arm/meson.build b/target/arm/meson.build
index 6dd7e93643d..87e911b27fb 100644
--- a/target/arm/meson.build
+++ b/target/arm/meson.build
@@ -1,6 +1,7 @@
 gen =3D [
   decodetree.process('sve.decode', extra_args: '--decode=3Ddisas_sve'),
   decodetree.process('sme.decode', extra_args: '--decode=3Ddisas_sme'),
+  decodetree.process('sme-fa64.decode', extra_args: '--static-decode=3Ddis=
as_sme_fa64'),
   decodetree.process('neon-shared.decode', extra_args: '--decode=3Ddisas_n=
eon_shared'),
   decodetree.process('neon-dp.decode', extra_args: '--decode=3Ddisas_neon_=
dp'),
   decodetree.process('neon-ls.decode', extra_args: '--decode=3Ddisas_neon_=
ls'),
--=20
2.25.1
From nobody Thu May  8 21:38:42 2025
Delivered-To: importer@patchew.org
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass(p=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1657548348; cv=none;
	d=zohomail.com; s=zohoarc;
	b=efIUchnpCHNrtmezI7wux9gTOVdJS6IKjoiutBOQFKrmF18vcRaOh0yuHRyifyY9yZRLGtZD14mDy3PONGDWDJoihDxOlBKEh39S+Cx4+1gKjOG+RReEv6YsCVG/CU/J8UJZHvHD/EO2NYbz1GO/wjfhZx2Rcjl3f/F9YENIQfg=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1657548348;
 h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
	bh=fI18+z5edTaeRfrH4Mp6ek59dUDomNqM3YPKq/pXVYg=;
	b=Y/0xSbJhdROGxwhflETBiY5JkBNlWExVYgn2IaXbaXJI/tCxpFnZkJMA2NfioG40WERuUgSVsaW4GNeZ4h/BBU+dfwQFYnQEz3pTDqtV3DF/HWILLJk3ZPRIIf0tapURMh95Di9NptJRAHEDVS2NEMmc1vTsA87x+YsSTzl5GOA=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass header.from=<peter.maydell@linaro.org> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1657548348135922.8593742330809;
 Mon, 11 Jul 2022 07:05:48 -0700 (PDT)
Received: from localhost ([::1]:52760 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces+importer=patchew.org@nongnu.org>)
	id 1oAu2l-00074B-31
	for importer@patchew.org; Mon, 11 Jul 2022 10:05:47 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:42428)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvF-0006No-8o
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:01 -0400
Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]:42549)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvC-0002nQ-KV
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:01 -0400
Received: by mail-wr1-x434.google.com with SMTP id bu1so5946594wrb.9
 for <qemu-devel@nongnu.org>; Mon, 11 Jul 2022 06:57:57 -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.57.55
 for <qemu-devel@nongnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 11 Jul 2022 06:57: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=fI18+z5edTaeRfrH4Mp6ek59dUDomNqM3YPKq/pXVYg=;
 b=N7nKfodaaa/h8ATKhvtMvX/S8Y45rlcFw8ZxMjRMPxlhszit/5PvFWcQ+YpFGdDjT6
 lmuhjeRvaUhPcrw4uPp6qoRQ73W5eY4WXUaOEgE8FV3kmfH68Lj/ZU0Ce1irQvUINiXZ
 6oGtI9NAvxJKEg0C2LDbPt/1T1FeU7/0J1G/vkshgjdWGwqPJgPwMNF429fvKDZiw2bp
 HRGe7anA1CpYbFPtmjpcdn5RJw2Z8l9PBGsfM6C7PrNxMpQzdtUdxesH/pFVExhIPdxq
 eRhNT5de9BDqYgAK/Tx+vfHmgZpD+7jgQrcFGaomIXP3kHbsoQRy8kKJZslvglty22qQ
 OSNA==
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=fI18+z5edTaeRfrH4Mp6ek59dUDomNqM3YPKq/pXVYg=;
 b=vpTV8wE3SMZUdUIEXAKznUo+mr1FaeBKBDdqqVdslw0TKMT0TwUoaAd0Z1OH5zwb1j
 Fv1wuNI+/py9nntzckB18Jwpl41jxBB0+RRv5nRj4eHqAgikK9GMGmdK3ROyN6uH/fkL
 9zDSQKv8eJSJZsJ6HEvaVwA9FMxyJOXVtD29IjwkCnxJHD+t8CJVHy0pud9K5wxnJAtP
 vlm7gofUQFbwJy83w24ihpKN6xPetEjAKqwk9J+uTYVRv+fVrlPGX+pIh3U7tkzRFJDP
 yZZyqv6L87EhksjCsrg01AEBdjAZTHKvOAUCEUJUu8zSoOZ8tm4NukWEO/Wym6428mI+
 TF0w==
X-Gm-Message-State: AJIora/c0lEFjByoRHsOD8qpmQ2X0Q/ncIqbE1YdLOpH01nMmH3hXCUK
 AClO7OStkeqR+pFfDDEEGD2ZIZSEFjCILg==
X-Google-Smtp-Source: 
 AGRyM1ubocUR7tCW9kalT5dV8TJzq3fzwIOvvZwGbdPmZEPW7sSEYInAjTMSH00QLiEOVb+JYEXM1A==
X-Received: by 2002:a5d:5a9d:0:b0:21b:8247:7ec4 with SMTP id
 bp29-20020a5d5a9d000000b0021b82477ec4mr16837271wrb.561.1657547876105;
 Mon, 11 Jul 2022 06:57:56 -0700 (PDT)
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 04/45] target/arm: Mark ADR as non-streaming
Date: Mon, 11 Jul 2022 14:57:09 +0100
Message-Id: <20220711135750.765803-5-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
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17
 as permitted sender) client-ip=209.51.188.17;
 envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org;
 helo=lists.gnu.org;
Received-SPF: pass client-ip=2a00:1450:4864:20::434;
 envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x434.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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>
Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org
Sender: "Qemu-devel" <qemu-devel-bounces+importer=patchew.org@nongnu.org>
X-ZohoMail-DKIM: pass (identity @linaro.org)
X-ZM-MESSAGEID: 1657548349191100001
Content-Type: text/plain; charset="utf-8"

From: Richard Henderson <richard.henderson@linaro.org>

Mark ADR as a non-streaming instruction, which should trap
if full a64 support is not enabled in streaming mode.

Removing entries from sme-fa64.decode is an easy way to see
what remains to be done.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220708151540.18136-5-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 target/arm/translate.h     | 7 +++++++
 target/arm/sme-fa64.decode | 1 -
 target/arm/translate-sve.c | 8 ++++----
 3 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/target/arm/translate.h b/target/arm/translate.h
index cbc907c7516..e2e619dab25 100644
--- a/target/arm/translate.h
+++ b/target/arm/translate.h
@@ -566,4 +566,11 @@ uint64_t asimd_imm_const(uint32_t imm, int cmode, int =
op);
     static bool trans_##NAME(DisasContext *s, arg_##NAME *a) \
     { return dc_isar_feature(FEAT, s) && FUNC(s, __VA_ARGS__); }
=20
+#define TRANS_FEAT_NONSTREAMING(NAME, FEAT, FUNC, ...)            \
+    static bool trans_##NAME(DisasContext *s, arg_##NAME *a)      \
+    {                                                             \
+        s->is_nonstreaming =3D true;                                \
+        return dc_isar_feature(FEAT, s) && FUNC(s, __VA_ARGS__);  \
+    }
+
 #endif /* TARGET_ARM_TRANSLATE_H */
diff --git a/target/arm/sme-fa64.decode b/target/arm/sme-fa64.decode
index 3d90837fc7c..73c71abc462 100644
--- a/target/arm/sme-fa64.decode
+++ b/target/arm/sme-fa64.decode
@@ -59,7 +59,6 @@ FAIL    0001 1110 0111 1110 0000 00-- ---- ----   # FJCVT=
ZS
 #       --11 1100 --1- ---- ---- ---- ---- --10   # Load/store FP register=
 (register offset)
 #       --11 1101 ---- ---- ---- ---- ---- ----   # Load/store FP register=
 (scaled imm)
=20
-FAIL    0000 0100 --1- ---- 1010 ---- ---- ----   # ADR
 FAIL    0000 0100 --1- ---- 1011 -0-- ---- ----   # FTSSEL, FEXPA
 FAIL    0000 0101 --10 0001 100- ---- ---- ----   # COMPACT
 FAIL    0010 0101 --01 100- 1111 000- ---0 ----   # RDFFR, RDFFRS
diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c
index 62b5f3040c7..5d1db0d3ff9 100644
--- a/target/arm/translate-sve.c
+++ b/target/arm/translate-sve.c
@@ -1320,10 +1320,10 @@ static bool do_adr(DisasContext *s, arg_rrri *a, ge=
n_helper_gvec_3 *fn)
     return gen_gvec_ool_zzz(s, fn, a->rd, a->rn, a->rm, a->imm);
 }
=20
-TRANS_FEAT(ADR_p32, aa64_sve, do_adr, a, gen_helper_sve_adr_p32)
-TRANS_FEAT(ADR_p64, aa64_sve, do_adr, a, gen_helper_sve_adr_p64)
-TRANS_FEAT(ADR_s32, aa64_sve, do_adr, a, gen_helper_sve_adr_s32)
-TRANS_FEAT(ADR_u32, aa64_sve, do_adr, a, gen_helper_sve_adr_u32)
+TRANS_FEAT_NONSTREAMING(ADR_p32, aa64_sve, do_adr, a, gen_helper_sve_adr_p=
32)
+TRANS_FEAT_NONSTREAMING(ADR_p64, aa64_sve, do_adr, a, gen_helper_sve_adr_p=
64)
+TRANS_FEAT_NONSTREAMING(ADR_s32, aa64_sve, do_adr, a, gen_helper_sve_adr_s=
32)
+TRANS_FEAT_NONSTREAMING(ADR_u32, aa64_sve, do_adr, a, gen_helper_sve_adr_u=
32)
=20
 /*
  *** SVE Integer Misc - Unpredicated Group
--=20
2.25.1
From nobody Thu May  8 21:38:42 2025
Delivered-To: importer@patchew.org
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass(p=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1657548042; cv=none;
	d=zohomail.com; s=zohoarc;
	b=EIiPx/ZOlTCZ/zxWEZkhatfs6yr922GbuhcyvcKddjtYqRDe6PJ0oSeYzc/DhHdd4XXzgk0qMyDeeOKK7cLo9TdsHeb9KZY+bhkwBUYhJWkZ7TCsEfKnMeRbkq2APIVSPhYyUmGI2kSna2Xpgw9GklDWhvWMWvF77W2nhvHkM4M=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1657548042;
 h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
	bh=7NGRjcW6POBMRqlOP/cTnnyIXKw34HJdhD9MVrSH9hs=;
	b=CeqG+86ZQCq5/XsyAbtXS+SA6/plMFMOUKRx/o7rxjDs1uvLWaZjNS2WSa2MLfpRj7kAw3Szs9l6aT1kYlVAbbBlswr3Ob7r+yZqOxQOrxn+VaM16pWoH+YFxhri1yvavueEDfTDhCguvutvmbTgv04b2r0cY3Au/rblRHM+npA=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass header.from=<peter.maydell@linaro.org> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 165754804255631.816719707988113;
 Mon, 11 Jul 2022 07:00:42 -0700 (PDT)
Received: from localhost ([::1]:44050 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces+importer=patchew.org@nongnu.org>)
	id 1oAtxp-0000yS-1P
	for importer@patchew.org; Mon, 11 Jul 2022 10:00:41 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:42398)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvD-0006L6-Vf
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:00 -0400
Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]:33723)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvC-0002ng-2u
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:57:59 -0400
Received: by mail-wr1-x432.google.com with SMTP id h17so7181291wrx.0
 for <qemu-devel@nongnu.org>; Mon, 11 Jul 2022 06:57:57 -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.57.56
 for <qemu-devel@nongnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 11 Jul 2022 06:57:56 -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=7NGRjcW6POBMRqlOP/cTnnyIXKw34HJdhD9MVrSH9hs=;
 b=YGfk2a3o145gMr7ZaO0pMjMZiC9R/Dxnvmbrph4eD9ep9e2pdT6dQKldkNcFcU+zHH
 vusdzwas6L2JFBS1H6h/3IfdPY24EMWNhNOleiFN5n3eqfaBzahy622DRtbbh2U3J+dT
 6lr7ZVneRpwM69T53XiZhQQsIDj2d+G+42SBL47C2cgVagyJRgUNfW5mIhG5VnmhNy9y
 8NiH3BsfVXDk198Wq/OWcLQTFkKqo4dPY1Qs9RHlgHu0gbqClV0G6PpPxaq5Lis7MkeQ
 sqwp5Dutrj0UIIfJg0dI/8eV73HNmdHrTVInYC2x+zHCq8ZZ7w3uwadVmo+yqC4HnWRo
 IKbw==
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=7NGRjcW6POBMRqlOP/cTnnyIXKw34HJdhD9MVrSH9hs=;
 b=LQoYPOflluLq2PS4kT63K+d6PwFwZHAeXFsKH+K9wAW9+arGbfvDwNDqsa3tVU9GPl
 hMxjDdexXc2rImpwBUly75Mtr78SYPyUzgFdykiLs95WMo81NCWZCrQEG+3qQ/2jc4Vd
 N+IiazoUO5WEFn2ygIbIzaXh7S6WYtQP1Ibus3Xd+jS+x/aI+CrBDlz6UbwJFcYXPuMD
 21wUE3GnsmNBONzhgKp2Tf7Qew593qj4e0IsHMopUKEkZ6xzQLChrb6CexADRXN8cXHa
 8zHatkjyu00RvE2VjUpl5HiRPwSCUXUyoapchCC87lVtUeBBw9q75BkK1lPa45IoMHHr
 EbRw==
X-Gm-Message-State: AJIora9NpP6QT9woz72lzDR7kqkhX2LO0LH996WDRJW91Litdqf1Sd2P
 OYUW4/PRi87L8GZ5fB2a9HtYBpj/6h0jcw==
X-Google-Smtp-Source: 
 AGRyM1tIeypE6hSnQHHZEbPLreSJMVwVdAslsL1o3omSkZa/BW8ml761e1Un0Vm6OR+4MFEc0hIWlw==
X-Received: by 2002:a5d:6149:0:b0:21d:6ba7:6095 with SMTP id
 y9-20020a5d6149000000b0021d6ba76095mr16720628wrt.680.1657547876760;
 Mon, 11 Jul 2022 06:57:56 -0700 (PDT)
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 05/45] target/arm: Mark RDFFR, WRFFR, SETFFR as non-streaming
Date: Mon, 11 Jul 2022 14:57:10 +0100
Message-Id: <20220711135750.765803-6-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
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17
 as permitted sender) client-ip=209.51.188.17;
 envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org;
 helo=lists.gnu.org;
Received-SPF: pass client-ip=2a00:1450:4864:20::432;
 envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x432.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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>
Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org
Sender: "Qemu-devel" <qemu-devel-bounces+importer=patchew.org@nongnu.org>
X-ZohoMail-DKIM: pass (identity @linaro.org)
X-ZM-MESSAGEID: 1657548043975100001
Content-Type: text/plain; charset="utf-8"

From: Richard Henderson <richard.henderson@linaro.org>

Mark these as a non-streaming instructions, which should trap
if full a64 support is not enabled in streaming mode.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220708151540.18136-6-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 target/arm/sme-fa64.decode | 2 --
 target/arm/translate-sve.c | 9 ++++++---
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/target/arm/sme-fa64.decode b/target/arm/sme-fa64.decode
index 73c71abc462..fa2b5cbf1a3 100644
--- a/target/arm/sme-fa64.decode
+++ b/target/arm/sme-fa64.decode
@@ -61,8 +61,6 @@ FAIL    0001 1110 0111 1110 0000 00-- ---- ----   # FJCVT=
ZS
=20
 FAIL    0000 0100 --1- ---- 1011 -0-- ---- ----   # FTSSEL, FEXPA
 FAIL    0000 0101 --10 0001 100- ---- ---- ----   # COMPACT
-FAIL    0010 0101 --01 100- 1111 000- ---0 ----   # RDFFR, RDFFRS
-FAIL    0010 0101 --10 1--- 1001 ---- ---- ----   # WRFFR, SETFFR
 FAIL    0100 0101 --0- ---- 1011 ---- ---- ----   # BDEP, BEXT, BGRP
 FAIL    0100 0101 000- ---- 0110 1--- ---- ----   # PMULLB, PMULLT (128b r=
esult)
 FAIL    0110 0100 --1- ---- 1110 01-- ---- ----   # FMMLA, BFMMLA
diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c
index 5d1db0d3ff9..d6faec15fe9 100644
--- a/target/arm/translate-sve.c
+++ b/target/arm/translate-sve.c
@@ -1785,7 +1785,8 @@ static bool do_predset(DisasContext *s, int esz, int =
rd, int pat, bool setflag)
 TRANS_FEAT(PTRUE, aa64_sve, do_predset, a->esz, a->rd, a->pat, a->s)
=20
 /* Note pat =3D=3D 31 is #all, to set all elements.  */
-TRANS_FEAT(SETFFR, aa64_sve, do_predset, 0, FFR_PRED_NUM, 31, false)
+TRANS_FEAT_NONSTREAMING(SETFFR, aa64_sve,
+                        do_predset, 0, FFR_PRED_NUM, 31, false)
=20
 /* Note pat =3D=3D 32 is #unimp, to set no elements.  */
 TRANS_FEAT(PFALSE, aa64_sve, do_predset, 0, a->rd, 32, false)
@@ -1799,11 +1800,13 @@ static bool trans_RDFFR_p(DisasContext *s, arg_RDFF=
R_p *a)
         .rd =3D a->rd, .pg =3D a->pg, .s =3D a->s,
         .rn =3D FFR_PRED_NUM, .rm =3D FFR_PRED_NUM,
     };
+
+    s->is_nonstreaming =3D true;
     return trans_AND_pppp(s, &alt_a);
 }
=20
-TRANS_FEAT(RDFFR, aa64_sve, do_mov_p, a->rd, FFR_PRED_NUM)
-TRANS_FEAT(WRFFR, aa64_sve, do_mov_p, FFR_PRED_NUM, a->rn)
+TRANS_FEAT_NONSTREAMING(RDFFR, aa64_sve, do_mov_p, a->rd, FFR_PRED_NUM)
+TRANS_FEAT_NONSTREAMING(WRFFR, aa64_sve, do_mov_p, FFR_PRED_NUM, a->rn)
=20
 static bool do_pfirst_pnext(DisasContext *s, arg_rr_esz *a,
                             void (*gen_fn)(TCGv_i32, TCGv_ptr,
--=20
2.25.1
From nobody Thu May  8 21:38:42 2025
Delivered-To: importer@patchew.org
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass(p=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1657548578; cv=none;
	d=zohomail.com; s=zohoarc;
	b=MhIeutv/uSKPfjv8PUPmGVW87GuboCA10wM2F0qu6P83CM1hd7hmx+wtj+N0ks7NWEsZPgGhvDYMUyRtWjhfJCkKUOcsXrE2/vLLOwhlVvqGyAyh2nLiCHJUudtNlXvUJRp0r2/8/RNgdSjE20zVXI28ScNtfA1pexbCJ8gKd6Q=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1657548578;
 h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
	bh=I1g46N7GyifDhLvrgy885389BGvUDqIbWCLHK1RD3mA=;
	b=fsyc5A794UyW3S4RPzGixgfHpD/DMUhOTC/UhT+4OvcdKLF6fSqJWvr5coeLpXGe4E4bIr1IM9y4TarAMBzpiva3m9G1a24s1nWwRfnlnS0keBedOhFfmzMveN5o9JsOPDdBQv9z6ZbtHKvpkYQ9LRxJo6G5Cr3g2rb4WU1OnSw=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass header.from=<peter.maydell@linaro.org> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1657548578176733.8208482067652;
 Mon, 11 Jul 2022 07:09:38 -0700 (PDT)
Received: from localhost ([::1]:35526 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces+importer=patchew.org@nongnu.org>)
	id 1oAu6S-00067f-0u
	for importer@patchew.org; Mon, 11 Jul 2022 10:09:36 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:42526)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvQ-0006V8-JQ
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:13 -0400
Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]:54928)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvC-0002o9-Rm
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:02 -0400
Received: by mail-wm1-x330.google.com with SMTP id n185so3088480wmn.4
 for <qemu-devel@nongnu.org>; Mon, 11 Jul 2022 06:57:58 -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.57.56
 for <qemu-devel@nongnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 11 Jul 2022 06:57:57 -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=I1g46N7GyifDhLvrgy885389BGvUDqIbWCLHK1RD3mA=;
 b=N23zhAuyXsmgoib6tFw8RZLpnxSyNjsKwQG81qPbz3ilmFBiOtfz3nZPUnMYTyYR5l
 URoU5E4OsLv47qwtsXgNrH6u8lMRvxn73NXxyfcpeUKAp/0hf4Sai9/tjV3BpgxwL7oW
 LA483TsUKrAoGQ4eyo+NfhArRMgrFwsHybm3WupsVuP7IVobN23S2xxMTxtHRhSBxpRn
 a+f0bJr79SjZ2kj91H9y0kG4XACdugLkoGAjcmazcDkYF6dyFmkEXZBu0fQ/ms3Mhzhf
 cAeTXzisPS5ovuzusPTRU693H2AyvAlQ0CK/KVsz0HmXblZTl5UIAOlvpzVMHjV3A59U
 3oLg==
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=I1g46N7GyifDhLvrgy885389BGvUDqIbWCLHK1RD3mA=;
 b=oe0AoE/AIe3lzthKvCg8iDUL5Dl20D4QFtjNqvZ8IzBebVEgOIg1zYfMXwGFgcM6sO
 5S7b+/giiWjXZYni1Ked8YSMnCSExdW3RaExbg2+L/UNj8xd+gRDEDyvZqWvPYyZpCiU
 9D4pzDR6cezcN55nmOCW7b+iURKuGhVyp9Ggpm107Mjf50SmgaDIBgEbcSnMKH/C3vGp
 H1T1px+tcOGr4nOEjRxjZoiLx3zxl2Afecv/4jfc2Zr75vZ5ji0xXj9bjiO7Q+1ALYBk
 o0OfgIbYW+YnMWwdOrydtpd6pMcZKo1redipEr1XAC3VhbGRg6O3kEGNpigEDT6+S30I
 SZ3Q==
X-Gm-Message-State: AJIora+b8ZSPtvzvKlv0jTHQpsu+FKqA7m4afbkbmdqhPwcGshjVCWB2
 Fte2N2NO8UJ9z582JqSaTCgLtecyRDRpGQ==
X-Google-Smtp-Source: 
 AGRyM1s0t/TP4GvoBGh/tEY4KogCr9pcHXq7vREiwxYmHrpP9btoD3eOV5FoOqFcMzFPZs+zK8Rseg==
X-Received: by 2002:a05:600c:3491:b0:3a0:4d4a:2e2d with SMTP id
 a17-20020a05600c349100b003a04d4a2e2dmr16579351wmq.4.1657547877467;
 Mon, 11 Jul 2022 06:57:57 -0700 (PDT)
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 06/45] target/arm: Mark BDEP, BEXT, BGRP, COMPACT, FEXPA,
 FTSSEL as non-streaming
Date: Mon, 11 Jul 2022 14:57:11 +0100
Message-Id: <20220711135750.765803-7-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
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17
 as permitted sender) client-ip=209.51.188.17;
 envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org;
 helo=lists.gnu.org;
Received-SPF: pass client-ip=2a00:1450:4864:20::330;
 envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x330.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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>
Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org
Sender: "Qemu-devel" <qemu-devel-bounces+importer=patchew.org@nongnu.org>
X-ZohoMail-DKIM: pass (identity @linaro.org)
X-ZM-MESSAGEID: 1657548579552100001
Content-Type: text/plain; charset="utf-8"

From: Richard Henderson <richard.henderson@linaro.org>

Mark these as a non-streaming instructions, which should trap
if full a64 support is not enabled in streaming mode.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220708151540.18136-7-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 target/arm/sme-fa64.decode |  3 ---
 target/arm/translate-sve.c | 22 ++++++++++++----------
 2 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/target/arm/sme-fa64.decode b/target/arm/sme-fa64.decode
index fa2b5cbf1a3..4f515939d9c 100644
--- a/target/arm/sme-fa64.decode
+++ b/target/arm/sme-fa64.decode
@@ -59,9 +59,6 @@ FAIL    0001 1110 0111 1110 0000 00-- ---- ----   # FJCVT=
ZS
 #       --11 1100 --1- ---- ---- ---- ---- --10   # Load/store FP register=
 (register offset)
 #       --11 1101 ---- ---- ---- ---- ---- ----   # Load/store FP register=
 (scaled imm)
=20
-FAIL    0000 0100 --1- ---- 1011 -0-- ---- ----   # FTSSEL, FEXPA
-FAIL    0000 0101 --10 0001 100- ---- ---- ----   # COMPACT
-FAIL    0100 0101 --0- ---- 1011 ---- ---- ----   # BDEP, BEXT, BGRP
 FAIL    0100 0101 000- ---- 0110 1--- ---- ----   # PMULLB, PMULLT (128b r=
esult)
 FAIL    0110 0100 --1- ---- 1110 01-- ---- ----   # FMMLA, BFMMLA
 FAIL    0110 0101 --0- ---- 0000 11-- ---- ----   # FTSMUL
diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c
index d6faec15fe9..ae48040aa4c 100644
--- a/target/arm/translate-sve.c
+++ b/target/arm/translate-sve.c
@@ -1333,14 +1333,15 @@ static gen_helper_gvec_2 * const fexpa_fns[4] =3D {
     NULL,                   gen_helper_sve_fexpa_h,
     gen_helper_sve_fexpa_s, gen_helper_sve_fexpa_d,
 };
-TRANS_FEAT(FEXPA, aa64_sve, gen_gvec_ool_zz,
-           fexpa_fns[a->esz], a->rd, a->rn, 0)
+TRANS_FEAT_NONSTREAMING(FEXPA, aa64_sve, gen_gvec_ool_zz,
+                        fexpa_fns[a->esz], a->rd, a->rn, 0)
=20
 static gen_helper_gvec_3 * const ftssel_fns[4] =3D {
     NULL,                    gen_helper_sve_ftssel_h,
     gen_helper_sve_ftssel_s, gen_helper_sve_ftssel_d,
 };
-TRANS_FEAT(FTSSEL, aa64_sve, gen_gvec_ool_arg_zzz, ftssel_fns[a->esz], a, =
0)
+TRANS_FEAT_NONSTREAMING(FTSSEL, aa64_sve, gen_gvec_ool_arg_zzz,
+                        ftssel_fns[a->esz], a, 0)
=20
 /*
  *** SVE Predicate Logical Operations Group
@@ -2536,7 +2537,8 @@ TRANS_FEAT(TRN2_q, aa64_sve_f64mm, gen_gvec_ool_arg_z=
zz,
 static gen_helper_gvec_3 * const compact_fns[4] =3D {
     NULL, NULL, gen_helper_sve_compact_s, gen_helper_sve_compact_d
 };
-TRANS_FEAT(COMPACT, aa64_sve, gen_gvec_ool_arg_zpz, compact_fns[a->esz], a=
, 0)
+TRANS_FEAT_NONSTREAMING(COMPACT, aa64_sve, gen_gvec_ool_arg_zpz,
+                        compact_fns[a->esz], a, 0)
=20
 /* Call the helper that computes the ARM LastActiveElement pseudocode
  * function, scaled by the element size.  This includes the not found
@@ -6374,22 +6376,22 @@ static gen_helper_gvec_3 * const bext_fns[4] =3D {
     gen_helper_sve2_bext_b, gen_helper_sve2_bext_h,
     gen_helper_sve2_bext_s, gen_helper_sve2_bext_d,
 };
-TRANS_FEAT(BEXT, aa64_sve2_bitperm, gen_gvec_ool_arg_zzz,
-           bext_fns[a->esz], a, 0)
+TRANS_FEAT_NONSTREAMING(BEXT, aa64_sve2_bitperm, gen_gvec_ool_arg_zzz,
+                        bext_fns[a->esz], a, 0)
=20
 static gen_helper_gvec_3 * const bdep_fns[4] =3D {
     gen_helper_sve2_bdep_b, gen_helper_sve2_bdep_h,
     gen_helper_sve2_bdep_s, gen_helper_sve2_bdep_d,
 };
-TRANS_FEAT(BDEP, aa64_sve2_bitperm, gen_gvec_ool_arg_zzz,
-           bdep_fns[a->esz], a, 0)
+TRANS_FEAT_NONSTREAMING(BDEP, aa64_sve2_bitperm, gen_gvec_ool_arg_zzz,
+                        bdep_fns[a->esz], a, 0)
=20
 static gen_helper_gvec_3 * const bgrp_fns[4] =3D {
     gen_helper_sve2_bgrp_b, gen_helper_sve2_bgrp_h,
     gen_helper_sve2_bgrp_s, gen_helper_sve2_bgrp_d,
 };
-TRANS_FEAT(BGRP, aa64_sve2_bitperm, gen_gvec_ool_arg_zzz,
-           bgrp_fns[a->esz], a, 0)
+TRANS_FEAT_NONSTREAMING(BGRP, aa64_sve2_bitperm, gen_gvec_ool_arg_zzz,
+                        bgrp_fns[a->esz], a, 0)
=20
 static gen_helper_gvec_3 * const cadd_fns[4] =3D {
     gen_helper_sve2_cadd_b, gen_helper_sve2_cadd_h,
--=20
2.25.1
From nobody Thu May  8 21:38:42 2025
Delivered-To: importer@patchew.org
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass(p=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1657548668; cv=none;
	d=zohomail.com; s=zohoarc;
	b=ZcNtNTWYmn8u0xrBqeapGtllmNAi51NQK56C7rT68/Y7PMSzJJ6yl/HU+ENdbBifOLK4Yn04u1waib/j+HiSEV+iv67wgQJ0gzBwodRkGGTSlQsjlprz84VLNz+fLYpBogzksRH8RMYRx9X3lSl0OSQG9qjFY4XT1+ywyBqCZdg=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1657548668;
 h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
	bh=b/+WDKk3Mk2Y2JF1uylZFAgYZTRJ5lUsqHT3ajN06B8=;
	b=KMKgWTXh69R0Epcus+kY/EKTZtIgekVTiRUWWpoZlkulDtS1D2EU8bSLWkX/k4+++tRhUHHzRB1GSyybWQk1qbraAb/VVxm9JTGsWJAaNzll53rI0mh5iIMj1NxDChqSAe3mqvLtrDUFZctCnrtQsXo60+bPfdQY8xbapTT5keg=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass header.from=<peter.maydell@linaro.org> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1657548668199900.8971924749917;
 Mon, 11 Jul 2022 07:11:08 -0700 (PDT)
Received: from localhost ([::1]:37466 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces+importer=patchew.org@nongnu.org>)
	id 1oAu7u-0007SM-1j
	for importer@patchew.org; Mon, 11 Jul 2022 10:11:06 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:42528)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvQ-0006V9-IK
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:12 -0400
Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]:54929)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvD-0002oE-KQ
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:03 -0400
Received: by mail-wm1-x331.google.com with SMTP id n185so3088514wmn.4
 for <qemu-devel@nongnu.org>; Mon, 11 Jul 2022 06:57:59 -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.57.57
 for <qemu-devel@nongnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 11 Jul 2022 06:57:57 -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=b/+WDKk3Mk2Y2JF1uylZFAgYZTRJ5lUsqHT3ajN06B8=;
 b=fonUMEhqZBII12HhvTgMPJCSEzdQQ4j0PWp76CCLErVvHyNtCXQTvGmZjXI/tehrZL
 HCorogZHptEdqLeqCUvRzAm1Bp4az3ixBogaM8D3nVNrHOnyfQba48u8iumlXmZFrK80
 8qJJiVzdbrDTZDlo/NF04Gt9kTImdNfIEpGTAasHOh49U1rZlyxLVUGsMsKmqEfdpI/A
 pcnq6EB3oJBE6knStK9xRdYDSoG6C5GtJkdnGoUffU2tXQPg/jNwAxHKq7rQPOM9grPP
 UDz0UN/TV42PvbntlzX0bTQx6SbHK8HZs+p1+x3BUnNi4fr9o25xLCjiPlYMZXOqz/i8
 6JMg==
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=b/+WDKk3Mk2Y2JF1uylZFAgYZTRJ5lUsqHT3ajN06B8=;
 b=RdUuDYtN24APqKQWo+iAG8050x+lWC8bZ31gO1P9vmYitayuBdMckaNyYrUfayrxT9
 C+rqrSQrHBrzTzGjjQiRmn+lv1zac9+tnVUsuzUqBk9EP7yvZdrK1l7R67ROo/BJdhzB
 ri5K3o2kDmlUWJk29pd40kMOm5rncuTbeiXu46RPNQqCl+TimXQw5osXozhURf/6Sn3a
 32VRvkLNKklAHfJcDaxmb9P2JGVN+x57Ma8XXXoLYSXEdbm9rQV895JBuw3z3+XInD7x
 M9AT/9owOn7PKsyjbxaIa8zIcMZbqMOzCVG2ednFPcoR8vThZ/x0zQ/FV5nnnrbzguhx
 vVDg==
X-Gm-Message-State: AJIora9wajp5NOKq1J+AHKj9w9sPuPwnI3K93O7gtFdTl3ppysz6pLkG
 gze0FHY3tO3Ls8SWcZrU4O4A0JlwynkT8w==
X-Google-Smtp-Source: 
 AGRyM1sUDh1Tkp1zM6WvfSO2K6/dYlX58cv4IkqqaBjxaM7q+Aui0k8ZlChWqqe+yo48rqoY6hhdhw==
X-Received: by 2002:a05:600c:3b8d:b0:3a2:ea2b:d0f9 with SMTP id
 n13-20020a05600c3b8d00b003a2ea2bd0f9mr1572088wms.120.1657547878248;
 Mon, 11 Jul 2022 06:57:58 -0700 (PDT)
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 07/45] target/arm: Mark PMULL, FMMLA as non-streaming
Date: Mon, 11 Jul 2022 14:57:12 +0100
Message-Id: <20220711135750.765803-8-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
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17
 as permitted sender) client-ip=209.51.188.17;
 envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org;
 helo=lists.gnu.org;
Received-SPF: pass client-ip=2a00:1450:4864:20::331;
 envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x331.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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>
Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org
Sender: "Qemu-devel" <qemu-devel-bounces+importer=patchew.org@nongnu.org>
X-ZohoMail-DKIM: pass (identity @linaro.org)
X-ZM-MESSAGEID: 1657548669792100001
Content-Type: text/plain; charset="utf-8"

From: Richard Henderson <richard.henderson@linaro.org>

Mark these as a non-streaming instructions, which should trap
if full a64 support is not enabled in streaming mode.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220708151540.18136-8-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 target/arm/sme-fa64.decode |  2 --
 target/arm/translate-sve.c | 24 +++++++++++++++---------
 2 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/target/arm/sme-fa64.decode b/target/arm/sme-fa64.decode
index 4f515939d9c..4ff2df82e5b 100644
--- a/target/arm/sme-fa64.decode
+++ b/target/arm/sme-fa64.decode
@@ -59,8 +59,6 @@ FAIL    0001 1110 0111 1110 0000 00-- ---- ----   # FJCVT=
ZS
 #       --11 1100 --1- ---- ---- ---- ---- --10   # Load/store FP register=
 (register offset)
 #       --11 1101 ---- ---- ---- ---- ---- ----   # Load/store FP register=
 (scaled imm)
=20
-FAIL    0100 0101 000- ---- 0110 1--- ---- ----   # PMULLB, PMULLT (128b r=
esult)
-FAIL    0110 0100 --1- ---- 1110 01-- ---- ----   # FMMLA, BFMMLA
 FAIL    0110 0101 --0- ---- 0000 11-- ---- ----   # FTSMUL
 FAIL    0110 0101 --01 0--- 100- ---- ---- ----   # FTMAD
 FAIL    0110 0101 --01 1--- 001- ---- ---- ----   # FADDA
diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c
index ae48040aa4c..4ff2102fc86 100644
--- a/target/arm/translate-sve.c
+++ b/target/arm/translate-sve.c
@@ -6186,9 +6186,13 @@ static bool do_trans_pmull(DisasContext *s, arg_rrr_=
esz *a, bool sel)
         gen_helper_gvec_pmull_q, gen_helper_sve2_pmull_h,
         NULL,                    gen_helper_sve2_pmull_d,
     };
-    if (a->esz =3D=3D 0
-        ? !dc_isar_feature(aa64_sve2_pmull128, s)
-        : !dc_isar_feature(aa64_sve, s)) {
+
+    if (a->esz =3D=3D 0) {
+        if (!dc_isar_feature(aa64_sve2_pmull128, s)) {
+            return false;
+        }
+        s->is_nonstreaming =3D true;
+    } else if (!dc_isar_feature(aa64_sve, s)) {
         return false;
     }
     return gen_gvec_ool_arg_zzz(s, fns[a->esz], a, sel);
@@ -7125,10 +7129,12 @@ DO_ZPZZ_FP(FMINP, aa64_sve2, sve2_fminp_zpzz)
  * SVE Integer Multiply-Add (unpredicated)
  */
=20
-TRANS_FEAT(FMMLA_s, aa64_sve_f32mm, gen_gvec_fpst_zzzz, gen_helper_fmmla_s,
-           a->rd, a->rn, a->rm, a->ra, 0, FPST_FPCR)
-TRANS_FEAT(FMMLA_d, aa64_sve_f64mm, gen_gvec_fpst_zzzz, gen_helper_fmmla_d,
-           a->rd, a->rn, a->rm, a->ra, 0, FPST_FPCR)
+TRANS_FEAT_NONSTREAMING(FMMLA_s, aa64_sve_f32mm, gen_gvec_fpst_zzzz,
+                        gen_helper_fmmla_s, a->rd, a->rn, a->rm, a->ra,
+                        0, FPST_FPCR)
+TRANS_FEAT_NONSTREAMING(FMMLA_d, aa64_sve_f64mm, gen_gvec_fpst_zzzz,
+                        gen_helper_fmmla_d, a->rd, a->rn, a->rm, a->ra,
+                        0, FPST_FPCR)
=20
 static gen_helper_gvec_4 * const sqdmlal_zzzw_fns[] =3D {
     NULL,                           gen_helper_sve2_sqdmlal_zzzw_h,
@@ -7301,8 +7307,8 @@ TRANS_FEAT(BFDOT_zzzz, aa64_sve_bf16, gen_gvec_ool_ar=
g_zzzz,
 TRANS_FEAT(BFDOT_zzxz, aa64_sve_bf16, gen_gvec_ool_arg_zzxz,
            gen_helper_gvec_bfdot_idx, a)
=20
-TRANS_FEAT(BFMMLA, aa64_sve_bf16, gen_gvec_ool_arg_zzzz,
-           gen_helper_gvec_bfmmla, a, 0)
+TRANS_FEAT_NONSTREAMING(BFMMLA, aa64_sve_bf16, gen_gvec_ool_arg_zzzz,
+                        gen_helper_gvec_bfmmla, a, 0)
=20
 static bool do_BFMLAL_zzzw(DisasContext *s, arg_rrrr_esz *a, bool sel)
 {
--=20
2.25.1
From nobody Thu May  8 21:38:42 2025
Delivered-To: importer@patchew.org
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass(p=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1657548941; cv=none;
	d=zohomail.com; s=zohoarc;
	b=a83307Soru223id51yN8CaORf86wEB1iijg9em6HbRwyerusLeLxAdsf/5tJTUFIU024bfrpovnne0a0CswhLL1Uhf30jZJ2InPjyy0swBqhED7N4dLz697BDElGMedYidsPL0vJA68tVA2xvGOWLAPSlSqu45O5Ne7fQisC4EU=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1657548941;
 h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
	bh=GiZFVh2F4B2LmzFGkdkJQAwP+jfXxKtCxSQAc8iRXro=;
	b=aHZmVZqf4bwD9qeVNcCGadWle8bPiYwvGk8wyLUists5xhiqe35umsUfayN9qL+ARpsfjUr/sk6wgFQ73v4sDC6u6Aj/X3oGipLpJahUjy6liHDWkYvIsztOowgMjM+iVr75DfJJ6LXvG0ksMAblsJIeJLvTNzwQUZOjIUI7Xmo=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass header.from=<peter.maydell@linaro.org> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1657548941891458.30074763507685;
 Mon, 11 Jul 2022 07:15:41 -0700 (PDT)
Received: from localhost ([::1]:45684 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces+importer=patchew.org@nongnu.org>)
	id 1oAuCI-0004vs-Pg
	for importer@patchew.org; Mon, 11 Jul 2022 10:15:40 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:42520)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvQ-0006V5-Hx
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:12 -0400
Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]:43864)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvE-0002om-DF
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:03 -0400
Received: by mail-wm1-x32f.google.com with SMTP id
 v10-20020a05600c15ca00b003a2db8aa2c4so3084813wmf.2
 for <qemu-devel@nongnu.org>; Mon, 11 Jul 2022 06:58:00 -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.57.58
 for <qemu-devel@nongnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 11 Jul 2022 06:57:58 -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=GiZFVh2F4B2LmzFGkdkJQAwP+jfXxKtCxSQAc8iRXro=;
 b=j30pUtSPxa2DbpiNdn77XHKOfc3EJxjy9jyWn/AogV2wmkpWvVKIh5Z/sKsUZMwv4u
 nbjvPxX+F2BrPuoL7MqhrQntSzlRl6znyjTyqaYMHNtLMG/Uh4jy/eULYqXZ/XwTIRtQ
 c2dNJ30AhuF8J5wr9HJZaOYW9yXJRlL7rxUaLnpwjLzif+cNHiabWnEFn6Oba+x7JSHQ
 T02W1theLx4RfW/QlVVgPF+BYxlsSYHmXA1lv+izctljsceWDPlYdQirXkNXRdeVc6f9
 VpKpKI9A1ZvKhjc6qtP38Ltf4BjLeFLFeV5Jk35+qR6NMdnih7S06L+PvWR7KvW3NwFO
 4Ppw==
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=GiZFVh2F4B2LmzFGkdkJQAwP+jfXxKtCxSQAc8iRXro=;
 b=eVLUM+m0TYWJJ6aj/PA2Kv7FnDL13vZjc+aCvdHlLHRIyLvwaGMDFL9StRM6Gdz8HO
 kWTT9j5NgY4PGoZtXu3Xval3mANp8o49s5zOIiWnXJ/FVNQe6mB+TbB9FG0Pcc+XoCzh
 2HPYlFXDqxIwNI1Pk2PWMsxBKYzW2khb/lQtAm4EHjVBe2w8fxnIPCBb2lvH/emYzbyk
 M855pfG1JLjXtT2+ZdUavcSQVE7f+ZP2SixYqozVJYxOAXrwHDcgkXVEIQDR+w7JwOCK
 G9ihqSRN7GjlBg9WBgKhYqcxlJR6oK3QcxQW9iUGli8gpfh/ESKoewQlK0T9XRmgUtf6
 AbeQ==
X-Gm-Message-State: AJIora8+T1GYwKCGAHGuKsJ4tGF6oYS2qUbOuQfQxFV3FSUfRZrWBLuL
 onxNrqitgng6NxHfmf9bg/U8i9LnAhNW/Q==
X-Google-Smtp-Source: 
 AGRyM1tKe8Ft71maROcaEqkevJkcCcO2yeqZA3X+qPAF6C6o1WRlH6q0hyR2TWc3xwzMsPd4nDLcMQ==
X-Received: by 2002:a05:600c:42d3:b0:3a2:e7b8:8430 with SMTP id
 j19-20020a05600c42d300b003a2e7b88430mr6371019wme.42.1657547879118;
 Mon, 11 Jul 2022 06:57:59 -0700 (PDT)
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 08/45] target/arm: Mark FTSMUL, FTMAD, FADDA as non-streaming
Date: Mon, 11 Jul 2022 14:57:13 +0100
Message-Id: <20220711135750.765803-9-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
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17
 as permitted sender) client-ip=209.51.188.17;
 envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org;
 helo=lists.gnu.org;
Received-SPF: pass client-ip=2a00:1450:4864:20::32f;
 envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32f.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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>
Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org
Sender: "Qemu-devel" <qemu-devel-bounces+importer=patchew.org@nongnu.org>
X-ZohoMail-DKIM: pass (identity @linaro.org)
X-ZM-MESSAGEID: 1657548943035100001
Content-Type: text/plain; charset="utf-8"

From: Richard Henderson <richard.henderson@linaro.org>

Mark these as a non-streaming instructions, which should trap
if full a64 support is not enabled in streaming mode.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220708151540.18136-9-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 target/arm/sme-fa64.decode |  3 ---
 target/arm/translate-sve.c | 15 +++++++++++----
 2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/target/arm/sme-fa64.decode b/target/arm/sme-fa64.decode
index 4ff2df82e5b..b5eaa2d0faa 100644
--- a/target/arm/sme-fa64.decode
+++ b/target/arm/sme-fa64.decode
@@ -59,9 +59,6 @@ FAIL    0001 1110 0111 1110 0000 00-- ---- ----   # FJCVT=
ZS
 #       --11 1100 --1- ---- ---- ---- ---- --10   # Load/store FP register=
 (register offset)
 #       --11 1101 ---- ---- ---- ---- ---- ----   # Load/store FP register=
 (scaled imm)
=20
-FAIL    0110 0101 --0- ---- 0000 11-- ---- ----   # FTSMUL
-FAIL    0110 0101 --01 0--- 100- ---- ---- ----   # FTMAD
-FAIL    0110 0101 --01 1--- 001- ---- ---- ----   # FADDA
 FAIL    0100 0101 --0- ---- 1001 10-- ---- ----   # SMMLA, UMMLA, USMMLA
 FAIL    0100 0101 --1- ---- 1--- ---- ---- ----   # SVE2 string/histo/cryp=
to instructions
 FAIL    1000 010- -00- ---- 10-- ---- ---- ----   # SVE2 32-bit gather NT =
load (vector+scalar)
diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c
index 4ff2102fc86..d5aad539235 100644
--- a/target/arm/translate-sve.c
+++ b/target/arm/translate-sve.c
@@ -3861,9 +3861,9 @@ static gen_helper_gvec_3_ptr * const ftmad_fns[4] =3D=
 {
     NULL,                   gen_helper_sve_ftmad_h,
     gen_helper_sve_ftmad_s, gen_helper_sve_ftmad_d,
 };
-TRANS_FEAT(FTMAD, aa64_sve, gen_gvec_fpst_zzz,
-           ftmad_fns[a->esz], a->rd, a->rn, a->rm, a->imm,
-           a->esz =3D=3D MO_16 ? FPST_FPCR_F16 : FPST_FPCR)
+TRANS_FEAT_NONSTREAMING(FTMAD, aa64_sve, gen_gvec_fpst_zzz,
+                        ftmad_fns[a->esz], a->rd, a->rn, a->rm, a->imm,
+                        a->esz =3D=3D MO_16 ? FPST_FPCR_F16 : FPST_FPCR)
=20
 /*
  *** SVE Floating Point Accumulating Reduction Group
@@ -3886,6 +3886,7 @@ static bool trans_FADDA(DisasContext *s, arg_rprr_esz=
 *a)
     if (a->esz =3D=3D 0 || !dc_isar_feature(aa64_sve, s)) {
         return false;
     }
+    s->is_nonstreaming =3D true;
     if (!sve_access_check(s)) {
         return true;
     }
@@ -3923,12 +3924,18 @@ static bool trans_FADDA(DisasContext *s, arg_rprr_e=
sz *a)
 DO_FP3(FADD_zzz, fadd)
 DO_FP3(FSUB_zzz, fsub)
 DO_FP3(FMUL_zzz, fmul)
-DO_FP3(FTSMUL, ftsmul)
 DO_FP3(FRECPS, recps)
 DO_FP3(FRSQRTS, rsqrts)
=20
 #undef DO_FP3
=20
+static gen_helper_gvec_3_ptr * const ftsmul_fns[4] =3D {
+    NULL,                     gen_helper_gvec_ftsmul_h,
+    gen_helper_gvec_ftsmul_s, gen_helper_gvec_ftsmul_d
+};
+TRANS_FEAT_NONSTREAMING(FTSMUL, aa64_sve, gen_gvec_fpst_arg_zzz,
+                        ftsmul_fns[a->esz], a, 0)
+
 /*
  *** SVE Floating Point Arithmetic - Predicated Group
  */
--=20
2.25.1
From nobody Thu May  8 21:38:42 2025
Delivered-To: importer@patchew.org
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass(p=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1657548523; cv=none;
	d=zohomail.com; s=zohoarc;
	b=NM33XQVrJpIQl8/PZiJHNXJwZ0jW1BMXwuZno4FldIQsO9nd7YEPkUcHf20aA/wZAqrnIE8ooi7lFhnJojMouo+pd2WYmGw19S30XEH4TXyIvLvAOiAO/NsNnBOTYFh56EGDGdKyyo1IJ8401oxT2nRypS4MQMZhAm1jhJxvW30=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1657548523;
 h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
	bh=Ou0toLpgNQdjfsKkvJnes6zuCeqVFu/r7dnmnsOjFiA=;
	b=e6K0hbWlAzEfKBqo0rWue73KuRI9mLe15kdWWfpYzIuAA6VlipoA/Q6T7lMaCaOq27CoF167NQJlTkdgL3db74GFTYbI2womjuaVEHcQi0EXhBSxVpa/+VWg/HheWJeR1D3auPvc9wJUPvFJFOOARHNi8TyW2CWNS2oWHl48AuI=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass header.from=<peter.maydell@linaro.org> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1657548523407452.92306491690647;
 Mon, 11 Jul 2022 07:08:43 -0700 (PDT)
Received: from localhost ([::1]:33000 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces+importer=patchew.org@nongnu.org>)
	id 1oAu5Z-0004Qu-75
	for importer@patchew.org; Mon, 11 Jul 2022 10:08:41 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:42532)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvQ-0006VA-IR
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:12 -0400
Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]:54932)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvF-0002ov-5c
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:04 -0400
Received: by mail-wm1-x334.google.com with SMTP id n185so3088553wmn.4
 for <qemu-devel@nongnu.org>; Mon, 11 Jul 2022 06:58:00 -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.57.59
 for <qemu-devel@nongnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 11 Jul 2022 06:57:59 -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=Ou0toLpgNQdjfsKkvJnes6zuCeqVFu/r7dnmnsOjFiA=;
 b=pR0AFYnyPIUl7EQlGiWfCOENd0+ULCSmg4CXQIaRyZEBPX7Yjfq6R/Sf04obVbWmD4
 denTYO1HpcmG4LdGcwKqTInnl8k6q9eRbQk0ff2m/0cmdZK4Xi5DsNXsd5F6LEg1jkIM
 qDnfNSfyqnnkSl5BfVShzGh91HH8+CJ+RCH8nBhL2vjDOPq1D8LBSIh371/9VWQkxnCf
 PL4aygp2El/GbXCH4UR+Rhe6lY0ieEVVEkAQqdBxVtWNKrst/kHtrOAUc9s23uBEk4RJ
 GpH7chjKlVsd+myfSM3u4dj1WWjqUbG+radbBm1LFONbMZB+me0WRhAqLOKsGn0te0nU
 updA==
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=Ou0toLpgNQdjfsKkvJnes6zuCeqVFu/r7dnmnsOjFiA=;
 b=z57zDQhqc6EdQa0OirsYTYwy0brVcpp7TAo0GlkeXHBiJaFKQYptsVY5i8zOM1X4tq
 GNKXffdePB9WXXgHbzp/JB7ceq0Jb6oYG9OchnoOjwh+Zj0WScqxYSbHxOGj2ju/DLKH
 WVLIl2SLsyQLa52H28dEd1bgFQvxaMiFweQoVOW9GLxp5m4ljNuFOxdNY7dHIcgadubW
 2eXzutzfe5Q4wjXPeW4ZvXOM1AXDIM7Dheb4TBIVhPnAKxg94CtHF27WNFUPmjFKR8Ay
 9svvvrovt7QXBsKf4PXuXTupBJwha0RxJrUPpS5dHPmkOXrI1lqC+ZJwhwc1jqwvDFq8
 ZXBw==
X-Gm-Message-State: AJIora/qSNvAKjVlXIdCM9uC5cAt/fXzyDMiwSlu7PX0sghD7IUGVAar
 2z7bZ/kv7i2hTmn0xTo7ptjK9x4L87OlAA==
X-Google-Smtp-Source: 
 AGRyM1ukxXMD5jOb9Sb0vU3ga9l/qwPT3cAuBpJxpvcN30g3JF2bhgr7SkQqlyT8GQHZGmmgYyzYXQ==
X-Received: by 2002:a05:600c:c2:b0:3a2:e51a:78aa with SMTP id
 u2-20020a05600c00c200b003a2e51a78aamr9163430wmm.48.1657547879850;
 Mon, 11 Jul 2022 06:57:59 -0700 (PDT)
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 09/45] target/arm: Mark SMMLA, UMMLA, USMMLA as non-streaming
Date: Mon, 11 Jul 2022 14:57:14 +0100
Message-Id: <20220711135750.765803-10-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
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17
 as permitted sender) client-ip=209.51.188.17;
 envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org;
 helo=lists.gnu.org;
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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>
Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org
Sender: "Qemu-devel" <qemu-devel-bounces+importer=patchew.org@nongnu.org>
X-ZohoMail-DKIM: pass (identity @linaro.org)
X-ZM-MESSAGEID: 1657548525210100001
Content-Type: text/plain; charset="utf-8"

From: Richard Henderson <richard.henderson@linaro.org>

Mark these as a non-streaming instructions, which should trap
if full a64 support is not enabled in streaming mode.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220708151540.18136-10-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 target/arm/sme-fa64.decode |  1 -
 target/arm/translate-sve.c | 12 ++++++------
 2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/target/arm/sme-fa64.decode b/target/arm/sme-fa64.decode
index b5eaa2d0faa..3260ea2d64c 100644
--- a/target/arm/sme-fa64.decode
+++ b/target/arm/sme-fa64.decode
@@ -59,7 +59,6 @@ FAIL    0001 1110 0111 1110 0000 00-- ---- ----   # FJCVT=
ZS
 #       --11 1100 --1- ---- ---- ---- ---- --10   # Load/store FP register=
 (register offset)
 #       --11 1101 ---- ---- ---- ---- ---- ----   # Load/store FP register=
 (scaled imm)
=20
-FAIL    0100 0101 --0- ---- 1001 10-- ---- ----   # SMMLA, UMMLA, USMMLA
 FAIL    0100 0101 --1- ---- 1--- ---- ---- ----   # SVE2 string/histo/cryp=
to instructions
 FAIL    1000 010- -00- ---- 10-- ---- ---- ----   # SVE2 32-bit gather NT =
load (vector+scalar)
 FAIL    1000 010- -00- ---- 111- ---- ---- ----   # SVE 32-bit gather pref=
etch (vector+imm)
diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c
index d5aad539235..9bbf44f0082 100644
--- a/target/arm/translate-sve.c
+++ b/target/arm/translate-sve.c
@@ -7302,12 +7302,12 @@ TRANS_FEAT(FMLALT_zzxw, aa64_sve2, do_FMLAL_zzxw, a=
, false, true)
 TRANS_FEAT(FMLSLB_zzxw, aa64_sve2, do_FMLAL_zzxw, a, true, false)
 TRANS_FEAT(FMLSLT_zzxw, aa64_sve2, do_FMLAL_zzxw, a, true, true)
=20
-TRANS_FEAT(SMMLA, aa64_sve_i8mm, gen_gvec_ool_arg_zzzz,
-           gen_helper_gvec_smmla_b, a, 0)
-TRANS_FEAT(USMMLA, aa64_sve_i8mm, gen_gvec_ool_arg_zzzz,
-           gen_helper_gvec_usmmla_b, a, 0)
-TRANS_FEAT(UMMLA, aa64_sve_i8mm, gen_gvec_ool_arg_zzzz,
-           gen_helper_gvec_ummla_b, a, 0)
+TRANS_FEAT_NONSTREAMING(SMMLA, aa64_sve_i8mm, gen_gvec_ool_arg_zzzz,
+                        gen_helper_gvec_smmla_b, a, 0)
+TRANS_FEAT_NONSTREAMING(USMMLA, aa64_sve_i8mm, gen_gvec_ool_arg_zzzz,
+                        gen_helper_gvec_usmmla_b, a, 0)
+TRANS_FEAT_NONSTREAMING(UMMLA, aa64_sve_i8mm, gen_gvec_ool_arg_zzzz,
+                        gen_helper_gvec_ummla_b, a, 0)
=20
 TRANS_FEAT(BFDOT_zzzz, aa64_sve_bf16, gen_gvec_ool_arg_zzzz,
            gen_helper_gvec_bfdot, a, 0)
--=20
2.25.1
From nobody Thu May  8 21:38:42 2025
Delivered-To: importer@patchew.org
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass(p=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1657548350; cv=none;
	d=zohomail.com; s=zohoarc;
	b=J8huuiHdZ2/jet9NABZ5s2yB11ju5YoW409YGOtAU6OB2ryrRBtou4Ghat6H9TjGTLxg9gwSPiwrNoH3lgjAPqlmRHfkk+MQ6AzS7AvUoR+GM/RdH/1reqXUR2QzGDmv3p8664VpwkqWRz+8yGuMQxcx2bG6yBej7yXStOWwq7Q=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1657548350;
 h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
	bh=G70vVW74+p3/r9FWSpVODhv2PfvwQ8MRxKmUWAG1PNU=;
	b=ALbk3sJ61J5TdZt+7eFoyRZubCMOsTIZ7exBu6wloSnzYObjlqeRYMcLs5omzcq12xLBCm9jUaD7D5K2V+KsIjZkHHR0NIkteqGZKvn+eYIqfiso4vwJChIyY084evxnZRm11qcjiVUk4fZGw8WAQudiZbSturZzQhn+M1PMurU=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass header.from=<peter.maydell@linaro.org> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1657548350459341.15565783939394;
 Mon, 11 Jul 2022 07:05:50 -0700 (PDT)
Received: from localhost ([::1]:53032 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces+importer=patchew.org@nongnu.org>)
	id 1oAu2n-0007FH-8e
	for importer@patchew.org; Mon, 11 Jul 2022 10:05:49 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:42642)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvT-0006XB-Qj
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:17 -0400
Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]:38728)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvQ-0002p0-3Y
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:14 -0400
Received: by mail-wm1-x32f.google.com with SMTP id
 9-20020a1c0209000000b003a2dfdebe47so2267349wmc.3
 for <qemu-devel@nongnu.org>; Mon, 11 Jul 2022 06:58:01 -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.00
 for <qemu-devel@nongnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 11 Jul 2022 06:58:00 -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=G70vVW74+p3/r9FWSpVODhv2PfvwQ8MRxKmUWAG1PNU=;
 b=kAI2Rjy2hL7WJpDv7wJGGHrRY/8j7tjDz2EPGXLN9mfFrdLlv7Jikb05Oug0JOfmuh
 vYDdqTN8BqEoJ2U4B6SIMK83AtwSCDKS6tUgCYtRv04t7dtDY5IELRX8gsfxqcWsLVyQ
 le7a7nfAudolPydqfsPjYmw5HIaErJQd+Hc7SPMvUxoxgs4Du2uSg5n9fwlNsRs7vsr+
 Y+/wtKBuahtlD8HKR8Vo3KsEHPc1zyzofEV38n2KeWIZaZCkiYrdDHCtgI5szT8Ei5/R
 adaE1xNcz+bJbEyYhN9vxmf4pmVbd9hs8CZaG/9Y3LixDI4ZKRbS3g5FeY5ryCkiF1Pj
 J81w==
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=G70vVW74+p3/r9FWSpVODhv2PfvwQ8MRxKmUWAG1PNU=;
 b=qZ79JF4+SueJybvC02TFXwOelX2rszPe0LqCxNN9BXhWBZts32avKt4he7y5HRlXeU
 CjPNLM2qYOplJwLuDoKbP/o9xJdXM1vHwXNKEhni0/7SmwPOzz8DygmW7dKr/vOSmyzE
 agv6lnD1/qSGGec9l2158mRKxuM0qXFBhgkTCBbobwgO9WvV9lJ8j3Lxp9glW1rgm7S6
 S5yMXYoZGLXL75Cb16sz/WtQxnxaXJv2tnOQBUb3TRSWP8K81yXYlI7iKfbkPnKKQ4nJ
 gkECxcIAEG7F36dK9MSw7tN2dlNZCnu6oeXIxprrdbxbzK53guqyAKalz+lT5nKgZr/I
 frIA==
X-Gm-Message-State: AJIora++dUsmFHS/wHxruTqzR8Tf9Mqp+zurWNElD5FKxwoBfNCFzTcD
 6GqprN7ZyDN5iC8vFdlDfqD8T3wL0+PrZQ==
X-Google-Smtp-Source: 
 AGRyM1vwNv9L2ezfbY3RO1vS7D9QHrLccNMIGXjXkOVE++oEofqTz9A5coi1dMpuTGQ8X8AiBJHQAQ==
X-Received: by 2002:a05:600c:ce:b0:3a2:e02b:bd8e with SMTP id
 u14-20020a05600c00ce00b003a2e02bbd8emr14561789wmm.123.1657547880608;
 Mon, 11 Jul 2022 06:58:00 -0700 (PDT)
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 10/45] target/arm: Mark string/histo/crypto as non-streaming
Date: Mon, 11 Jul 2022 14:57:15 +0100
Message-Id: <20220711135750.765803-11-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
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17
 as permitted sender) client-ip=209.51.188.17;
 envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org;
 helo=lists.gnu.org;
Received-SPF: pass client-ip=2a00:1450:4864:20::32f;
 envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32f.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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>
Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org
Sender: "Qemu-devel" <qemu-devel-bounces+importer=patchew.org@nongnu.org>
X-ZohoMail-DKIM: pass (identity @linaro.org)
X-ZM-MESSAGEID: 1657548351242100005
Content-Type: text/plain; charset="utf-8"

From: Richard Henderson <richard.henderson@linaro.org>

Mark these as non-streaming instructions, which should trap
if full a64 support is not enabled in streaming mode.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220708151540.18136-11-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 target/arm/sme-fa64.decode |  1 -
 target/arm/translate-sve.c | 35 ++++++++++++++++++-----------------
 2 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/target/arm/sme-fa64.decode b/target/arm/sme-fa64.decode
index 3260ea2d64c..fe462d2ccce 100644
--- a/target/arm/sme-fa64.decode
+++ b/target/arm/sme-fa64.decode
@@ -59,7 +59,6 @@ FAIL    0001 1110 0111 1110 0000 00-- ---- ----   # FJCVT=
ZS
 #       --11 1100 --1- ---- ---- ---- ---- --10   # Load/store FP register=
 (register offset)
 #       --11 1101 ---- ---- ---- ---- ---- ----   # Load/store FP register=
 (scaled imm)
=20
-FAIL    0100 0101 --1- ---- 1--- ---- ---- ----   # SVE2 string/histo/cryp=
to instructions
 FAIL    1000 010- -00- ---- 10-- ---- ---- ----   # SVE2 32-bit gather NT =
load (vector+scalar)
 FAIL    1000 010- -00- ---- 111- ---- ---- ----   # SVE 32-bit gather pref=
etch (vector+imm)
 FAIL    1000 0100 0-1- ---- 0--- ---- ---- ----   # SVE 32-bit gather pref=
etch (scalar+vector)
diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c
index 9bbf44f0082..f8e07164748 100644
--- a/target/arm/translate-sve.c
+++ b/target/arm/translate-sve.c
@@ -7110,21 +7110,21 @@ DO_SVE2_ZZZ_NARROW(RSUBHNT, rsubhnt)
 static gen_helper_gvec_flags_4 * const match_fns[4] =3D {
     gen_helper_sve2_match_ppzz_b, gen_helper_sve2_match_ppzz_h, NULL, NULL
 };
-TRANS_FEAT(MATCH, aa64_sve2, do_ppzz_flags, a, match_fns[a->esz])
+TRANS_FEAT_NONSTREAMING(MATCH, aa64_sve2, do_ppzz_flags, a, match_fns[a->e=
sz])
=20
 static gen_helper_gvec_flags_4 * const nmatch_fns[4] =3D {
     gen_helper_sve2_nmatch_ppzz_b, gen_helper_sve2_nmatch_ppzz_h, NULL, NU=
LL
 };
-TRANS_FEAT(NMATCH, aa64_sve2, do_ppzz_flags, a, nmatch_fns[a->esz])
+TRANS_FEAT_NONSTREAMING(NMATCH, aa64_sve2, do_ppzz_flags, a, nmatch_fns[a-=
>esz])
=20
 static gen_helper_gvec_4 * const histcnt_fns[4] =3D {
     NULL, NULL, gen_helper_sve2_histcnt_s, gen_helper_sve2_histcnt_d
 };
-TRANS_FEAT(HISTCNT, aa64_sve2, gen_gvec_ool_arg_zpzz,
-           histcnt_fns[a->esz], a, 0)
+TRANS_FEAT_NONSTREAMING(HISTCNT, aa64_sve2, gen_gvec_ool_arg_zpzz,
+                        histcnt_fns[a->esz], a, 0)
=20
-TRANS_FEAT(HISTSEG, aa64_sve2, gen_gvec_ool_arg_zzz,
-           a->esz =3D=3D 0 ? gen_helper_sve2_histseg : NULL, a, 0)
+TRANS_FEAT_NONSTREAMING(HISTSEG, aa64_sve2, gen_gvec_ool_arg_zzz,
+                        a->esz =3D=3D 0 ? gen_helper_sve2_histseg : NULL, =
a, 0)
=20
 DO_ZPZZ_FP(FADDP, aa64_sve2, sve2_faddp_zpzz)
 DO_ZPZZ_FP(FMAXNMP, aa64_sve2, sve2_fmaxnmp_zpzz)
@@ -7238,20 +7238,21 @@ TRANS_FEAT(SQRDCMLAH_zzzz, aa64_sve2, gen_gvec_ool_=
zzzz,
 TRANS_FEAT(USDOT_zzzz, aa64_sve_i8mm, gen_gvec_ool_arg_zzzz,
            a->esz =3D=3D 2 ? gen_helper_gvec_usdot_b : NULL, a, 0)
=20
-TRANS_FEAT(AESMC, aa64_sve2_aes, gen_gvec_ool_zz,
-           gen_helper_crypto_aesmc, a->rd, a->rd, a->decrypt)
+TRANS_FEAT_NONSTREAMING(AESMC, aa64_sve2_aes, gen_gvec_ool_zz,
+                        gen_helper_crypto_aesmc, a->rd, a->rd, a->decrypt)
=20
-TRANS_FEAT(AESE, aa64_sve2_aes, gen_gvec_ool_arg_zzz,
-           gen_helper_crypto_aese, a, false)
-TRANS_FEAT(AESD, aa64_sve2_aes, gen_gvec_ool_arg_zzz,
-           gen_helper_crypto_aese, a, true)
+TRANS_FEAT_NONSTREAMING(AESE, aa64_sve2_aes, gen_gvec_ool_arg_zzz,
+                        gen_helper_crypto_aese, a, false)
+TRANS_FEAT_NONSTREAMING(AESD, aa64_sve2_aes, gen_gvec_ool_arg_zzz,
+                        gen_helper_crypto_aese, a, true)
=20
-TRANS_FEAT(SM4E, aa64_sve2_sm4, gen_gvec_ool_arg_zzz,
-           gen_helper_crypto_sm4e, a, 0)
-TRANS_FEAT(SM4EKEY, aa64_sve2_sm4, gen_gvec_ool_arg_zzz,
-           gen_helper_crypto_sm4ekey, a, 0)
+TRANS_FEAT_NONSTREAMING(SM4E, aa64_sve2_sm4, gen_gvec_ool_arg_zzz,
+                        gen_helper_crypto_sm4e, a, 0)
+TRANS_FEAT_NONSTREAMING(SM4EKEY, aa64_sve2_sm4, gen_gvec_ool_arg_zzz,
+                        gen_helper_crypto_sm4ekey, a, 0)
=20
-TRANS_FEAT(RAX1, aa64_sve2_sha3, gen_gvec_fn_arg_zzz, gen_gvec_rax1, a)
+TRANS_FEAT_NONSTREAMING(RAX1, aa64_sve2_sha3, gen_gvec_fn_arg_zzz,
+                        gen_gvec_rax1, a)
=20
 TRANS_FEAT(FCVTNT_sh, aa64_sve2, gen_gvec_fpst_arg_zpz,
            gen_helper_sve2_fcvtnt_sh, a, 0, FPST_FPCR)
--=20
2.25.1
From nobody Thu May  8 21:38:42 2025
Delivered-To: importer@patchew.org
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass(p=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1657549501; cv=none;
	d=zohomail.com; s=zohoarc;
	b=LoxMdK/7YO7rCeeRMilP4DipmB3oeS9NI9N8p9WdNIN0SgT2/qTc9L9MEj0B7D8lCZ/iz4EXn6BRoDNz9+9e/4Dir4yNE8bMpS1BB/tPdZQCP4kEsaJezApqDtYaG6Vy1Hh4Uu8FwoOnRXubmt8ZtG0sl1pK+pE0Z//WGLgJ7iw=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1657549501;
 h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
	bh=uTMMqjDRKpIHGPC7OkIB/YQ8tJedyxE3xlM4z9DBACI=;
	b=JFqH3wrsBbYzDfYC8ehUUh+I3zHLPjX71v7ug5qRf9jTX9pjop4ylZi5TAgVGUk+rHRPcg+Ku1IMosWMBl8/sarBKYcz7tMZah3l01eqk4txGoDkRi5mi6oVbJTH6G6Or1WLHCd3VwmtL+Vv5WGqw1hE/QKjT6NC2GT9zjpfmmQ=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass header.from=<peter.maydell@linaro.org> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1657549500951572.9725362907147;
 Mon, 11 Jul 2022 07:25:00 -0700 (PDT)
Received: from localhost ([::1]:33570 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces+importer=patchew.org@nongnu.org>)
	id 1oAuLK-0000Bh-1Q
	for importer@patchew.org; Mon, 11 Jul 2022 10:24:58 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:42662)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvU-0006XE-39
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:17 -0400
Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]:42576)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvQ-0002pI-3x
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:15 -0400
Received: by mail-wm1-x333.google.com with SMTP id
 bi22-20020a05600c3d9600b003a04de22ab6so3092047wmb.1
 for <qemu-devel@nongnu.org>; Mon, 11 Jul 2022 06:58:02 -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.00
 for <qemu-devel@nongnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 11 Jul 2022 06:58:01 -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=uTMMqjDRKpIHGPC7OkIB/YQ8tJedyxE3xlM4z9DBACI=;
 b=Aks/FESqU5783IxvcXqYvw4pYX/iDSiZzUu7swdKsRj9DOeIvefuiugz6OSPTHRopz
 edslCPAAi5Wu1PD+V7YZO2/VouQm0yvP2/hviLh8YUTqyWWcjWOQTaXC5Tq5R7aC6xMh
 MjmizLkKM2b0/gTBiorA50y9wMnkIHHN9q2kY21EZp5LbluUqUPpZyLS0zVntFCDuDkV
 Tt08AT+uMgnCORCybTTZPZTfYHJHy0zfPzwUx3/Qst+eMaU4xWc4KDzyju9ooskbAeyF
 3mVtS64m/zu5f1gcG9gNc/YlTmSl9GAUww4NnXD2/30LL87uq8LmC/zjDhRnbOCDre6Y
 JoyQ==
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=uTMMqjDRKpIHGPC7OkIB/YQ8tJedyxE3xlM4z9DBACI=;
 b=7l/tZ1qiYhlDxx1ozXiNCM0tyWluX1NQSU1v8as3xZdYtrgJLRxEhI0kjOu22TH01/
 KOg4Sei5UyidZnWGvL4hsd+OXcvfUZIwumqvxoNuDuq1xlsEAwcD7kQ/ONeSTgjb/2/f
 rXbjFXxFoMtikuYaYTuNCMmTb06gKQFB6QSeazZdP+tz2MyA8P3QO6t24vGoFgyvrUDk
 9Bmc0j6pEFfqPjDnE579LnK6QjFq0NCBsqndYiqhp9y84GOwrtLXq+kEHUqtmZ3+YRQ+
 LaGt+68UhkRL9sIw3B16Ipys0gPKHzP285HSLCJsh2k6a/065Wd+f9DaOGg4ztIUddwc
 qg2Q==
X-Gm-Message-State: AJIora/Rs6CqF5i3QptJMsXZZo2GbeRFc4Bk7FGD+xAw6PnFGgKNaj09
 /+WwLAzsRv7xjS6sbPUujOAhyq6DWxAGjg==
X-Google-Smtp-Source: 
 AGRyM1uzBipuWs01U1wL94a+jIVEjwKsA+SFpjFUlHiKtbM40e6i/us6OETP8JWka6NkjVSuf3L55A==
X-Received: by 2002:a05:600c:a42:b0:39c:9166:5a55 with SMTP id
 c2-20020a05600c0a4200b0039c91665a55mr15789610wmq.141.1657547881344;
 Mon, 11 Jul 2022 06:58:01 -0700 (PDT)
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 11/45] target/arm: Mark gather/scatter load/store as
 non-streaming
Date: Mon, 11 Jul 2022 14:57:16 +0100
Message-Id: <20220711135750.765803-12-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
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17
 as permitted sender) client-ip=209.51.188.17;
 envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org;
 helo=lists.gnu.org;
Received-SPF: pass client-ip=2a00:1450:4864:20::333;
 envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x333.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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>
Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org
Sender: "Qemu-devel" <qemu-devel-bounces+importer=patchew.org@nongnu.org>
X-ZohoMail-DKIM: pass (identity @linaro.org)
X-ZM-MESSAGEID: 1657549501621100001
Content-Type: text/plain; charset="utf-8"

From: Richard Henderson <richard.henderson@linaro.org>

Mark these as a non-streaming instructions, which should trap
if full a64 support is not enabled in streaming mode.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220708151540.18136-12-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 target/arm/sme-fa64.decode | 9 ---------
 target/arm/translate-sve.c | 6 ++++++
 2 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/target/arm/sme-fa64.decode b/target/arm/sme-fa64.decode
index fe462d2ccce..1acc3ae0809 100644
--- a/target/arm/sme-fa64.decode
+++ b/target/arm/sme-fa64.decode
@@ -59,19 +59,10 @@ FAIL    0001 1110 0111 1110 0000 00-- ---- ----   # FJC=
VTZS
 #       --11 1100 --1- ---- ---- ---- ---- --10   # Load/store FP register=
 (register offset)
 #       --11 1101 ---- ---- ---- ---- ---- ----   # Load/store FP register=
 (scaled imm)
=20
-FAIL    1000 010- -00- ---- 10-- ---- ---- ----   # SVE2 32-bit gather NT =
load (vector+scalar)
 FAIL    1000 010- -00- ---- 111- ---- ---- ----   # SVE 32-bit gather pref=
etch (vector+imm)
 FAIL    1000 0100 0-1- ---- 0--- ---- ---- ----   # SVE 32-bit gather pref=
etch (scalar+vector)
-FAIL    1000 010- -01- ---- 1--- ---- ---- ----   # SVE 32-bit gather load=
 (vector+imm)
-FAIL    1000 0100 0-0- ---- 0--- ---- ---- ----   # SVE 32-bit gather load=
 byte (scalar+vector)
-FAIL    1000 0100 1--- ---- 0--- ---- ---- ----   # SVE 32-bit gather load=
 half (scalar+vector)
-FAIL    1000 0101 0--- ---- 0--- ---- ---- ----   # SVE 32-bit gather load=
 word (scalar+vector)
 FAIL    1010 010- ---- ---- 011- ---- ---- ----   # SVE contiguous FF load=
 (scalar+scalar)
 FAIL    1010 010- ---1 ---- 101- ---- ---- ----   # SVE contiguous NF load=
 (scalar+imm)
 FAIL    1010 010- -01- ---- 000- ---- ---- ----   # SVE load & replicate 3=
2 bytes (scalar+scalar)
 FAIL    1010 010- -010 ---- 001- ---- ---- ----   # SVE load & replicate 3=
2 bytes (scalar+imm)
 FAIL    1100 010- ---- ---- ---- ---- ---- ----   # SVE 64-bit gather load=
/prefetch
-FAIL    1110 010- -00- ---- 001- ---- ---- ----   # SVE2 64-bit scatter NT=
 store (vector+scalar)
-FAIL    1110 010- -10- ---- 001- ---- ---- ----   # SVE2 32-bit scatter NT=
 store (vector+scalar)
-FAIL    1110 010- ---- ---- 1-0- ---- ---- ----   # SVE scatter store (sca=
lar+32-bit vector)
-FAIL    1110 010- ---- ---- 101- ---- ---- ----   # SVE scatter store (mis=
c)
diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c
index f8e07164748..b23c6aa0bfd 100644
--- a/target/arm/translate-sve.c
+++ b/target/arm/translate-sve.c
@@ -5669,6 +5669,7 @@ static bool trans_LD1_zprz(DisasContext *s, arg_LD1_z=
prz *a)
     if (!dc_isar_feature(aa64_sve, s)) {
         return false;
     }
+    s->is_nonstreaming =3D true;
     if (!sve_access_check(s)) {
         return true;
     }
@@ -5700,6 +5701,7 @@ static bool trans_LD1_zpiz(DisasContext *s, arg_LD1_z=
piz *a)
     if (!dc_isar_feature(aa64_sve, s)) {
         return false;
     }
+    s->is_nonstreaming =3D true;
     if (!sve_access_check(s)) {
         return true;
     }
@@ -5734,6 +5736,7 @@ static bool trans_LDNT1_zprz(DisasContext *s, arg_LD1=
_zprz *a)
     if (!dc_isar_feature(aa64_sve2, s)) {
         return false;
     }
+    s->is_nonstreaming =3D true;
     if (!sve_access_check(s)) {
         return true;
     }
@@ -5857,6 +5860,7 @@ static bool trans_ST1_zprz(DisasContext *s, arg_ST1_z=
prz *a)
     if (!dc_isar_feature(aa64_sve, s)) {
         return false;
     }
+    s->is_nonstreaming =3D true;
     if (!sve_access_check(s)) {
         return true;
     }
@@ -5887,6 +5891,7 @@ static bool trans_ST1_zpiz(DisasContext *s, arg_ST1_z=
piz *a)
     if (!dc_isar_feature(aa64_sve, s)) {
         return false;
     }
+    s->is_nonstreaming =3D true;
     if (!sve_access_check(s)) {
         return true;
     }
@@ -5921,6 +5926,7 @@ static bool trans_STNT1_zprz(DisasContext *s, arg_ST1=
_zprz *a)
     if (!dc_isar_feature(aa64_sve2, s)) {
         return false;
     }
+    s->is_nonstreaming =3D true;
     if (!sve_access_check(s)) {
         return true;
     }
--=20
2.25.1
From nobody Thu May  8 21:38:42 2025
Delivered-To: importer@patchew.org
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass(p=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1657550290; cv=none;
	d=zohomail.com; s=zohoarc;
	b=WCiI1Q+7wKIVhy967LCp/k9WZ9K7hnYOd6INr2mm9v79eznVdUXscvBQBSwNs2UjQLP9Z89BFiP5oIjxInOKmKWZ9d4yuGb9CDvv37wbKKlgkDCTJ6lMe/dfT0WO4tKDtCVTZBc1NCPrWevq9t1aPfmM247/JxKD/kAt6v26ypk=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1657550290;
 h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
	bh=9H4vayvC6P8HyxpZR8DvsdsTXJo88+HbItchv84O0iE=;
	b=OHoODsjO7LI/gD25/eiqQXZQNMBc6VwkaqzEi4vLinMdoUlRisE1fnTT08Q7PzrgD7odTrz3sS2xvDpJml6fBL8pW9V9vZF+K/cKeqac5QHdaH635MeTqjQ+OQpA08eCM75n5qZMvWYve7lQQCqRJaLKeEEhC7VG/2rW3lY3r+g=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass header.from=<peter.maydell@linaro.org> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1657550290898694.7698111954401;
 Mon, 11 Jul 2022 07:38:10 -0700 (PDT)
Received: from localhost ([::1]:50414 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces+importer=patchew.org@nongnu.org>)
	id 1oAuY5-0005KN-0U
	for importer@patchew.org; Mon, 11 Jul 2022 10:38:09 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:42746)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvV-0006Yx-P8
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:18 -0400
Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]:36550)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvQ-0002pO-3t
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:15 -0400
Received: by mail-wr1-x430.google.com with SMTP id o4so7142332wrh.3
 for <qemu-devel@nongnu.org>; Mon, 11 Jul 2022 06:58:03 -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.01
 for <qemu-devel@nongnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 11 Jul 2022 06:58:01 -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=9H4vayvC6P8HyxpZR8DvsdsTXJo88+HbItchv84O0iE=;
 b=QmhX5Ai7AUKVLyGTlRPmwGEAaIUrljdejQgLrGmW97FuqF4Q1eEfOF+W+j/fIRxwXY
 Mpd9uAzG9ie9w0TLCzsh3oK1Dj+YeeolS3/PYkKG7yZpXwrist1j2TmB/XQo3sIYpWz1
 8D5/4DkUK6MZQOM20L5eVZnYd4uheIof6Hva88kKuyuCHKTtxTl3fTHKNprRhWQmSO69
 C94rVaKL3HZZjzmOT4uKh4/Gpr24DRnitwMdq8EP8E3XxmlWCFXPpXBAueskK7u6TYUi
 Hke+psH3o8wP2nlNYJK4EN9AljspYdn8dTJ4j8l1zwcUqlloamHJI0a0MdMko2kaACMa
 uGmw==
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=9H4vayvC6P8HyxpZR8DvsdsTXJo88+HbItchv84O0iE=;
 b=qnVPU4kJpyhbZM7lawAm+A98Ybbe9PKhXheLz3bN6vhF8GuPIZXjV+1eDuMZIkwPx7
 AXsj5ClOJHi7LGfu/dWd5Av4YEVTnFIUCDW36Hbeg+c0BYI1MPxZHWH50/4AFBiQohzN
 Imnd+itDWaA+jccQZ8Acdv6b+H82usTLOVm9yiCxDmT0SmZJ5RmFkapBipqFZIWnSaXx
 4fyUN6St7odeJd85qOPw+tRI3S/+x32T0rtMAITJGJEjXXSykqDEizVdHlDXZEqL+sN2
 8bm1TSDWGwhzJS2Q56UlSGF9cqhsiZzLFy8Agt9I63IcZvBHGKFy4dOswlKu7/3193Kf
 nq8Q==
X-Gm-Message-State: AJIora/w8uk67DMPL+Xllmd/HCv1Ju+5nLr/6Jpjtx50LYBxVgwaHkjg
 aUJhamoEnlVxIr/W8tdDAujsUSEn84YUKg==
X-Google-Smtp-Source: 
 AGRyM1u2Z71IGI3a98FQiTqQRx0lHTSxHtXFmIGY8O3OwAIPSgOq5mRW5VRhrWfh7pqbwQYkoxaYXA==
X-Received: by 2002:a5d:4aca:0:b0:21d:6793:1c11 with SMTP id
 y10-20020a5d4aca000000b0021d67931c11mr16516057wrs.202.1657547882128;
 Mon, 11 Jul 2022 06:58:02 -0700 (PDT)
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 12/45] target/arm: Mark gather prefetch as non-streaming
Date: Mon, 11 Jul 2022 14:57:17 +0100
Message-Id: <20220711135750.765803-13-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
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17
 as permitted sender) client-ip=209.51.188.17;
 envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org;
 helo=lists.gnu.org;
Received-SPF: pass client-ip=2a00:1450:4864:20::430;
 envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x430.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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>
Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org
Sender: "Qemu-devel" <qemu-devel-bounces+importer=patchew.org@nongnu.org>
X-ZohoMail-DKIM: pass (identity @linaro.org)
X-ZM-MESSAGEID: 1657550292108100001
Content-Type: text/plain; charset="utf-8"

From: Richard Henderson <richard.henderson@linaro.org>

Mark these as a non-streaming instructions, which should trap if full
a64 support is not enabled in streaming mode.  In this case, introduce
PRF_ns (prefetch non-streaming) to handle the checks.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220708151540.18136-13-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 target/arm/sme-fa64.decode |  3 ---
 target/arm/sve.decode      | 10 +++++-----
 target/arm/translate-sve.c | 11 +++++++++++
 3 files changed, 16 insertions(+), 8 deletions(-)

diff --git a/target/arm/sme-fa64.decode b/target/arm/sme-fa64.decode
index 1acc3ae0809..7d4c33fb5b8 100644
--- a/target/arm/sme-fa64.decode
+++ b/target/arm/sme-fa64.decode
@@ -59,10 +59,7 @@ FAIL    0001 1110 0111 1110 0000 00-- ---- ----   # FJCV=
TZS
 #       --11 1100 --1- ---- ---- ---- ---- --10   # Load/store FP register=
 (register offset)
 #       --11 1101 ---- ---- ---- ---- ---- ----   # Load/store FP register=
 (scaled imm)
=20
-FAIL    1000 010- -00- ---- 111- ---- ---- ----   # SVE 32-bit gather pref=
etch (vector+imm)
-FAIL    1000 0100 0-1- ---- 0--- ---- ---- ----   # SVE 32-bit gather pref=
etch (scalar+vector)
 FAIL    1010 010- ---- ---- 011- ---- ---- ----   # SVE contiguous FF load=
 (scalar+scalar)
 FAIL    1010 010- ---1 ---- 101- ---- ---- ----   # SVE contiguous NF load=
 (scalar+imm)
 FAIL    1010 010- -01- ---- 000- ---- ---- ----   # SVE load & replicate 3=
2 bytes (scalar+scalar)
 FAIL    1010 010- -010 ---- 001- ---- ---- ----   # SVE load & replicate 3=
2 bytes (scalar+imm)
-FAIL    1100 010- ---- ---- ---- ---- ---- ----   # SVE 64-bit gather load=
/prefetch
diff --git a/target/arm/sve.decode b/target/arm/sve.decode
index a54feb2f61d..908643d7d90 100644
--- a/target/arm/sve.decode
+++ b/target/arm/sve.decode
@@ -1183,10 +1183,10 @@ LD1RO_zpri      1010010 .. 01 0.... 001 ... ..... .=
.... \
                 @rpri_load_msz nreg=3D0
=20
 # SVE 32-bit gather prefetch (scalar plus 32-bit scaled offsets)
-PRF             1000010 00 -1 ----- 0-- --- ----- 0 ----
+PRF_ns          1000010 00 -1 ----- 0-- --- ----- 0 ----
=20
 # SVE 32-bit gather prefetch (vector plus immediate)
-PRF             1000010 -- 00 ----- 111 --- ----- 0 ----
+PRF_ns          1000010 -- 00 ----- 111 --- ----- 0 ----
=20
 # SVE contiguous prefetch (scalar plus immediate)
 PRF             1000010 11 1- ----- 0-- --- ----- 0 ----
@@ -1223,13 +1223,13 @@ LD1_zpiz        1100010 .. 01 ..... 1.. ... ..... .=
.... \
                 @rpri_g_load esz=3D3
=20
 # SVE 64-bit gather prefetch (scalar plus 64-bit scaled offsets)
-PRF             1100010 00 11 ----- 1-- --- ----- 0 ----
+PRF_ns          1100010 00 11 ----- 1-- --- ----- 0 ----
=20
 # SVE 64-bit gather prefetch (scalar plus unpacked 32-bit scaled offsets)
-PRF             1100010 00 -1 ----- 0-- --- ----- 0 ----
+PRF_ns          1100010 00 -1 ----- 0-- --- ----- 0 ----
=20
 # SVE 64-bit gather prefetch (vector plus immediate)
-PRF             1100010 -- 00 ----- 111 --- ----- 0 ----
+PRF_ns          1100010 -- 00 ----- 111 --- ----- 0 ----
=20
 ### SVE Memory Store Group
=20
diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c
index b23c6aa0bfd..bbf3bf2119a 100644
--- a/target/arm/translate-sve.c
+++ b/target/arm/translate-sve.c
@@ -5971,6 +5971,17 @@ static bool trans_PRF_rr(DisasContext *s, arg_PRF_rr=
 *a)
     return true;
 }
=20
+static bool trans_PRF_ns(DisasContext *s, arg_PRF_ns *a)
+{
+    if (!dc_isar_feature(aa64_sve, s)) {
+        return false;
+    }
+    /* Prefetch is a nop within QEMU.  */
+    s->is_nonstreaming =3D true;
+    (void)sve_access_check(s);
+    return true;
+}
+
 /*
  * Move Prefix
  *
--=20
2.25.1
From nobody Thu May  8 21:38:42 2025
Delivered-To: importer@patchew.org
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass(p=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1657550816; cv=none;
	d=zohomail.com; s=zohoarc;
	b=NBhBa2bkGRDc4lAbn/SzHKdaDJ48yy5FrvMyVxLer92y5AQ0F0M6j+xUERU1+BMEr1O8AS1dk2uYVrUdoESBt7G0EgYAGu/RPl42NEnjym8fvo/FYHo1aTOUb2xdRbR2VFekjRDomXRJQO04amLTJr9zVb5b6q9CyaypiiAEiF0=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1657550816;
 h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
	bh=3Y3RKAb9EKRHz85QQ1SBe15QE606OXLqE7AmpOCzWmo=;
	b=PEIpmx6tM0ZAC24p6cCRYeU5owB1RqX26zJHcSvx75xRsgtP5Hy0p065AaeYIv7c5lSIqgwFMKXCp1zFHPZ5UhSw84Txgb+6yG/0f5zVJCIWSI97ftQnBlarlYSVHH7lgFn/IZiIpOTge3dFE2TszukDNG+aTXCwGJNq6HbrBOo=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass header.from=<peter.maydell@linaro.org> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1657550816455471.11073309492315;
 Mon, 11 Jul 2022 07:46:56 -0700 (PDT)
Received: from localhost ([::1]:39720 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces+importer=patchew.org@nongnu.org>)
	id 1oAugZ-0000XS-8X
	for importer@patchew.org; Mon, 11 Jul 2022 10:46:55 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:42744)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvV-0006Yv-On
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:18 -0400
Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]:45762)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvQ-0002pU-4W
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:15 -0400
Received: by mail-wm1-x32f.google.com with SMTP id
 d13-20020a05600c34cd00b003a2dc1cf0b4so3078943wmq.4
 for <qemu-devel@nongnu.org>; Mon, 11 Jul 2022 06:58:03 -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.02
 for <qemu-devel@nongnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 11 Jul 2022 06:58:02 -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=3Y3RKAb9EKRHz85QQ1SBe15QE606OXLqE7AmpOCzWmo=;
 b=ojPJK69pXcjj9Qx3XC6fosp2s9RE60jftDViFEhWa4zHXBkiSXVB1me8xADcHj2KTM
 JRtAg6gunRN6qGe1AGYiHYo3VEytaf+x/EpC2IIsYszi8L1jwb4EjsBvgirYU6vWUDUO
 LD7bGXp3FWcflegWMN2XfAFjKUFEBpJXzdMfXvwv+jWx6Cewb0PyQ1kDo7QeDH7Cu/ge
 ivXDmrkvZsup+d9oVKOwigWk1ssnC+NU25tli9mV4jwg6YOHIbyGWIzO4gxsSEjmH2wZ
 EYw5iVEl1UmMtuVqXTNo0WCvnstnWQY7r2dryadiYfhaLzOEae7rSK/Yb1GxODul1BQK
 xOjQ==
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=3Y3RKAb9EKRHz85QQ1SBe15QE606OXLqE7AmpOCzWmo=;
 b=C1IOUZsPtUalfU7UdsWjoNYdkvIG+hIFWxTb51mfSmOivJTRssBjXgHcWUdAVQ8872
 I9a8pID0zO08Q/qSrO0RikaYDPreX4KH+d889rhCPDBqQWww4OkxElc2crCSkY4xdThK
 ul8MpJRAoXIcDEPJjIhLXETcrZOr7sF6YInBOb8iHBFfIU3Pjucv4O7Fg6KGXSqhNMTU
 +HXzh0iNvFPGyLRteXkL6e4xWdkXqydDbha8mAjsmA3o5gChLGH39kgN2TIBHy+lftrW
 94zWFI2mPSbVA+7K9Ox7WQvyETFwn8xOuX1ZyGlyPVJTWzRMmPmLyzK8J3KEzVgvwfZs
 xqaQ==
X-Gm-Message-State: AJIora9abviXLzT6G6lLdMiOxk2FnTMWdHSLELF7PpKKQO35g/CMywzw
 AuXKbktSa55FW39sgR/UeebkFI+OR+KQ+g==
X-Google-Smtp-Source: 
 AGRyM1uwT4+BfbYvyfn34msQT2OhEMu6KiyX+wObyzGd5VrZDLZ1gMFfQPiuFXPy5HbttAfB2xXhAQ==
X-Received: by 2002:a05:600c:3553:b0:3a0:519b:4b96 with SMTP id
 i19-20020a05600c355300b003a0519b4b96mr15516751wmq.61.1657547882788;
 Mon, 11 Jul 2022 06:58:02 -0700 (PDT)
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 13/45] target/arm: Mark LDFF1 and LDNF1 as non-streaming
Date: Mon, 11 Jul 2022 14:57:18 +0100
Message-Id: <20220711135750.765803-14-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
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17
 as permitted sender) client-ip=209.51.188.17;
 envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org;
 helo=lists.gnu.org;
Received-SPF: pass client-ip=2a00:1450:4864:20::32f;
 envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32f.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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>
Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org
Sender: "Qemu-devel" <qemu-devel-bounces+importer=patchew.org@nongnu.org>
X-ZohoMail-DKIM: pass (identity @linaro.org)
X-ZM-MESSAGEID: 1657550818158100001
Content-Type: text/plain; charset="utf-8"

From: Richard Henderson <richard.henderson@linaro.org>

Mark these as a non-streaming instructions, which should trap
if full a64 support is not enabled in streaming mode.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220708151540.18136-14-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 target/arm/sme-fa64.decode | 2 --
 target/arm/translate-sve.c | 2 ++
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/target/arm/sme-fa64.decode b/target/arm/sme-fa64.decode
index 7d4c33fb5b8..2b5432bf856 100644
--- a/target/arm/sme-fa64.decode
+++ b/target/arm/sme-fa64.decode
@@ -59,7 +59,5 @@ FAIL    0001 1110 0111 1110 0000 00-- ---- ----   # FJCVT=
ZS
 #       --11 1100 --1- ---- ---- ---- ---- --10   # Load/store FP register=
 (register offset)
 #       --11 1101 ---- ---- ---- ---- ---- ----   # Load/store FP register=
 (scaled imm)
=20
-FAIL    1010 010- ---- ---- 011- ---- ---- ----   # SVE contiguous FF load=
 (scalar+scalar)
-FAIL    1010 010- ---1 ---- 101- ---- ---- ----   # SVE contiguous NF load=
 (scalar+imm)
 FAIL    1010 010- -01- ---- 000- ---- ---- ----   # SVE load & replicate 3=
2 bytes (scalar+scalar)
 FAIL    1010 010- -010 ---- 001- ---- ---- ----   # SVE load & replicate 3=
2 bytes (scalar+imm)
diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c
index bbf3bf2119a..5182ee4c068 100644
--- a/target/arm/translate-sve.c
+++ b/target/arm/translate-sve.c
@@ -4805,6 +4805,7 @@ static bool trans_LDFF1_zprr(DisasContext *s, arg_rpr=
r_load *a)
     if (!dc_isar_feature(aa64_sve, s)) {
         return false;
     }
+    s->is_nonstreaming =3D true;
     if (sve_access_check(s)) {
         TCGv_i64 addr =3D new_tmp_a64(s);
         tcg_gen_shli_i64(addr, cpu_reg(s, a->rm), dtype_msz(a->dtype));
@@ -4906,6 +4907,7 @@ static bool trans_LDNF1_zpri(DisasContext *s, arg_rpr=
i_load *a)
     if (!dc_isar_feature(aa64_sve, s)) {
         return false;
     }
+    s->is_nonstreaming =3D true;
     if (sve_access_check(s)) {
         int vsz =3D vec_full_reg_size(s);
         int elements =3D vsz >> dtype_esz[a->dtype];
--=20
2.25.1
From nobody Thu May  8 21:38:42 2025
Delivered-To: importer@patchew.org
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass(p=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1657550572; cv=none;
	d=zohomail.com; s=zohoarc;
	b=jDPo42B7T7VHZ9LvdvNc2gz5CSBGPB2e+1qoDVEQztokRJKjXjSG+Cn2HP1Blz0wiWV+OLV9tKFFK/ic0UF9HnImykbpqS6imRsY6unsPewf6IpxQtRlh0B0fZotC393Xxqfl23K6AlU3BwwKH0so9sPU5K5fiL/NJXRbbr5vyE=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1657550572;
 h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
	bh=/RhdQJhnWDHCgh0k4clVqzvRti9Nt0LbFx159lSbzvk=;
	b=O55NT2faaUZf0vT2E6NPbahG/A96tlclXuQx2SpYDsqCtMx0Uu6bF5XzDYpgmbikYOkfTsZ+GN9aYcOQnOz0TEP7/T+Zhx1FJ55qjQJ24/fKmZIk5Wx0+osYgSp8tadMWVjQaC4QDKqPOhiK6TY+esU3rf3LIXGNfNcLuCiB1y0=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass header.from=<peter.maydell@linaro.org> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1657550572734380.3636328602547;
 Mon, 11 Jul 2022 07:42:52 -0700 (PDT)
Received: from localhost ([::1]:59054 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces+importer=patchew.org@nongnu.org>)
	id 1oAucd-0002yC-KP
	for importer@patchew.org; Mon, 11 Jul 2022 10:42:51 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:42754)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvV-0006Z7-SN
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:18 -0400
Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]:53119)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvR-0002pb-Lk
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:16 -0400
Received: by mail-wm1-x330.google.com with SMTP id o8so3085856wms.2
 for <qemu-devel@nongnu.org>; Mon, 11 Jul 2022 06:58:04 -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.02
 for <qemu-devel@nongnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 11 Jul 2022 06:58:03 -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=/RhdQJhnWDHCgh0k4clVqzvRti9Nt0LbFx159lSbzvk=;
 b=VJjAg4wx/p/h/PPmbx3PBM6VoRZwZ32EbVVBlfUMS/U4ZuciLWkmy+NHVLM/5sPYiq
 /JwLXvs4QKRtKKfR9gwAuwTT7YE0CYEsr0qRAytoMTcJciHBxs1CbNqNm+xTQ5fB7bfA
 RLK9Sywq7K3uMIYRYpRzIguBfuQPgMGs+PagIS/5itsD99s/CGUI7VE6t0Lm8KxPakqt
 eW2ueor+X5HLOJpJhLewvueVZ3el4ipbMosMfdCjN7N32rP8el/V/l1wvhdYe2An58hM
 gij/JacC3sB2d0RcnOTq0O6oIB9srW3Y97nv//460BTgmsvIEiWg0D2/pgFGSnI0F7WP
 W7pw==
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=/RhdQJhnWDHCgh0k4clVqzvRti9Nt0LbFx159lSbzvk=;
 b=DPwnsdRunH0aORvuqOa7phY8FAcNID9YejdAviyN3nhj3jOzqmkrzIiuXrybNoBU0y
 ssm/o9f2g6Q/jRmiZM7804KHnegJAzepUaJS6M+hRLb/XyJBPNCm/IiNMhlCo/7y3JgU
 CXKHuvRqzfvFpaVMgyRP7iMtaTC0UEVxzZjKIgeX10TwL6usX0AbA05KaRaK+k8D85VT
 l/S31kwPI9XE9615dtrN32htPh5uPOvpABpQeMHLMgABay6xZ1qqAy4bcLb+2MYFM8WL
 uitD/sbLkTwgs/VGI6wPYsRLVc/Zyj2P1ElYBNrGpSoojTrhhf+PPfhZ+OajTkNvZSD2
 DtiA==
X-Gm-Message-State: AJIora8Y1h0Fw3MEu+nNYGB7+MrdI0+UuJuR5dFAOsStkTIrDFaaavmK
 Qfi9bU49kHdMdlkMoLYZZRNjRIdQOMmI5w==
X-Google-Smtp-Source: 
 AGRyM1su7+QBssXT+sqal+2n2jMxJVS3XqW+Et61W8PMMcMSv8TESd+7A13Svia9v9WQ+9UGLyLObg==
X-Received: by 2002:a05:600c:4e4c:b0:3a0:53a2:48b5 with SMTP id
 e12-20020a05600c4e4c00b003a053a248b5mr15482318wmq.174.1657547883594;
 Mon, 11 Jul 2022 06:58:03 -0700 (PDT)
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 14/45] target/arm: Mark LD1RO as non-streaming
Date: Mon, 11 Jul 2022 14:57:19 +0100
Message-Id: <20220711135750.765803-15-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
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17
 as permitted sender) client-ip=209.51.188.17;
 envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org;
 helo=lists.gnu.org;
Received-SPF: pass client-ip=2a00:1450:4864:20::330;
 envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x330.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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>
Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org
Sender: "Qemu-devel" <qemu-devel-bounces+importer=patchew.org@nongnu.org>
X-ZohoMail-DKIM: pass (identity @linaro.org)
X-ZM-MESSAGEID: 1657550574215100001
Content-Type: text/plain; charset="utf-8"

From: Richard Henderson <richard.henderson@linaro.org>

Mark these as a non-streaming instructions, which should trap
if full a64 support is not enabled in streaming mode.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220708151540.18136-15-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 target/arm/sme-fa64.decode | 3 ---
 target/arm/translate-sve.c | 2 ++
 2 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/target/arm/sme-fa64.decode b/target/arm/sme-fa64.decode
index 2b5432bf856..47708ccc8da 100644
--- a/target/arm/sme-fa64.decode
+++ b/target/arm/sme-fa64.decode
@@ -58,6 +58,3 @@ FAIL    0001 1110 0111 1110 0000 00-- ---- ----   # FJCVT=
ZS
 #       --11 1100 --0- ---- ---- ---- ---- ----   # Load/store FP register=
 (unscaled imm)
 #       --11 1100 --1- ---- ---- ---- ---- --10   # Load/store FP register=
 (register offset)
 #       --11 1101 ---- ---- ---- ---- ---- ----   # Load/store FP register=
 (scaled imm)
-
-FAIL    1010 010- -01- ---- 000- ---- ---- ----   # SVE load & replicate 3=
2 bytes (scalar+scalar)
-FAIL    1010 010- -010 ---- 001- ---- ---- ----   # SVE load & replicate 3=
2 bytes (scalar+imm)
diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c
index 5182ee4c068..96e934c1ea9 100644
--- a/target/arm/translate-sve.c
+++ b/target/arm/translate-sve.c
@@ -5062,6 +5062,7 @@ static bool trans_LD1RO_zprr(DisasContext *s, arg_rpr=
r_load *a)
     if (a->rm =3D=3D 31) {
         return false;
     }
+    s->is_nonstreaming =3D true;
     if (sve_access_check(s)) {
         TCGv_i64 addr =3D new_tmp_a64(s);
         tcg_gen_shli_i64(addr, cpu_reg(s, a->rm), dtype_msz(a->dtype));
@@ -5076,6 +5077,7 @@ static bool trans_LD1RO_zpri(DisasContext *s, arg_rpr=
i_load *a)
     if (!dc_isar_feature(aa64_sve_f64mm, s)) {
         return false;
     }
+    s->is_nonstreaming =3D true;
     if (sve_access_check(s)) {
         TCGv_i64 addr =3D new_tmp_a64(s);
         tcg_gen_addi_i64(addr, cpu_reg_sp(s, a->rn), a->imm * 32);
--=20
2.25.1
From nobody Thu May  8 21:38:42 2025
Delivered-To: importer@patchew.org
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass(p=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1657549299; cv=none;
	d=zohomail.com; s=zohoarc;
	b=ZHQJgG6vq8yq4rpkyFSW+NJZH2rV1Zl9zjesbNAgWvAtz0lymD3rMbYpZ9nH38s539A1TI2F/nsLExJj92qLB32XUjSsh/ONLQZje44HhpAwzkLmSUga57pWDEv3rk2wQkurJS8agNyIoF+EejTVJu/OlzDKb/sXqGaP7aGOhr8=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1657549299;
 h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
	bh=eWXMTGlXUgB42hymanetwXDWMolb+Ga7HqnDSm4JcUg=;
	b=AdMzIEE3hEw4DLU+B6KpPS7KU/8Y/ITkLJ+WIg9R8OgyXCqCgH5y3/s0cIWBCDZZ6P2nDOA47/Khju2WWTWDp3Pvf9ZApnIvzXCX7PAdOurCqZsjggG5dcRv7wED1vlB2AuRz43TFH2vUM+xMOAawXljHDoAvlGLHp4YF3ADv3g=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass header.from=<peter.maydell@linaro.org> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1657549299160330.6268207211225;
 Mon, 11 Jul 2022 07:21:39 -0700 (PDT)
Received: from localhost ([::1]:53574 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces+importer=patchew.org@nongnu.org>)
	id 1oAuI5-00029Q-0w
	for importer@patchew.org; Mon, 11 Jul 2022 10:21:37 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:42616)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvS-0006Wi-Oc
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:15 -0400
Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]:38522)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvQ-0002bg-3W
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:13 -0400
Received: by mail-wr1-x433.google.com with SMTP id v14so7135092wra.5
 for <qemu-devel@nongnu.org>; Mon, 11 Jul 2022 06:58:04 -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.03
 for <qemu-devel@nongnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 11 Jul 2022 06:58:04 -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=eWXMTGlXUgB42hymanetwXDWMolb+Ga7HqnDSm4JcUg=;
 b=jiVOr/BLuJ3vQuajPip4tMXdolyVvZ3LuO7lA5ORUJOZi57fzV1oevvF3xSKXOO3Ug
 yeBLOryv3sQOzPuZbyXTwCxY9aYujSGO2F0hP3vk4PF48ZMBc3ZAFZs6dZUgIdBk5LAx
 EWW222pPmWh7haW7ChlDAkCwfLCOxaIBkOXgcKm171vl1Sr8gTprIK2zJhU7GnVGbRZi
 kbFEByO/eMaljGZKkXd0tdlRRh78hH5DRTGbOaBjreLoTiz1eOfORWfitFqPU4wVjLNY
 nGf48IRBgJgWlkDz38cpFvjv8PoK6ceWzdhpEU17XmSU/wbLTy7ejqnBKS8k5Ur2z50H
 HmQw==
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=eWXMTGlXUgB42hymanetwXDWMolb+Ga7HqnDSm4JcUg=;
 b=5Ok0CG2kBwJGawPMRIywuDIM7hyxKsd5tlfj4JUAQMsjd/nQp1K5hSH6X9DQp+0vAu
 CcD/UPqxEvlhMMJn9Tr1y5tQbfKCvOw45zlCgYp9Q8PgTf507VcJQtKrSpmescT1xEBc
 lIInpu7C/XMg4fINR0DKHCyNkjlyW6KtBXbg56hRAmNkaoZflLGucJgrfyxMZSdXxJWn
 lWwWCnPzKh7uSnVdrOSr/Dl4C4Po+87niHHHTWwOEy7vNVEWNFwgS+IBbUNDyyjXg5aC
 mesN5KOqhIIBhZf9VkM7iXbV3EIS5FDH6YhJFqjsNZK49qq60Q/Y6wdpjEPtfIbegct6
 E0eQ==
X-Gm-Message-State: AJIora/IHnK0EVH4EN5HJhuiJeZA4wFt+Jyg4RxnA36pijFV5VAZnqjS
 Fl6eQRSDx8o2mAMmQ3M7Gzd6iXxTvw8Nnw==
X-Google-Smtp-Source: 
 AGRyM1sC8KAkSd0xwX7B5ShrWOU/Kjqbll1lXXh63NR9BBfCNBAtgruShbsdo521BzfJhw0Xi7QIWA==
X-Received: by 2002:adf:f7c3:0:b0:21d:6d21:f704 with SMTP id
 a3-20020adff7c3000000b0021d6d21f704mr17152601wrq.590.1657547884426;
 Mon, 11 Jul 2022 06:58:04 -0700 (PDT)
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 15/45] target/arm: Add SME enablement checks
Date: Mon, 11 Jul 2022 14:57:20 +0100
Message-Id: <20220711135750.765803-16-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
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17
 as permitted sender) client-ip=209.51.188.17;
 envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org;
 helo=lists.gnu.org;
Received-SPF: pass client-ip=2a00:1450:4864:20::433;
 envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x433.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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>
Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org
Sender: "Qemu-devel" <qemu-devel-bounces+importer=patchew.org@nongnu.org>
X-ZohoMail-DKIM: pass (identity @linaro.org)
X-ZM-MESSAGEID: 1657549299962100001
Content-Type: text/plain; charset="utf-8"

From: Richard Henderson <richard.henderson@linaro.org>

These functions will be used to verify that the cpu
is in the correct state for a given instruction.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220708151540.18136-16-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 target/arm/translate-a64.h | 21 +++++++++++++++++++++
 target/arm/translate-a64.c | 34 ++++++++++++++++++++++++++++++++++
 2 files changed, 55 insertions(+)

diff --git a/target/arm/translate-a64.h b/target/arm/translate-a64.h
index 789b6e8e781..02fb95e0199 100644
--- a/target/arm/translate-a64.h
+++ b/target/arm/translate-a64.h
@@ -29,6 +29,27 @@ void write_fp_dreg(DisasContext *s, int reg, TCGv_i64 v);
 bool logic_imm_decode_wmask(uint64_t *result, unsigned int immn,
                             unsigned int imms, unsigned int immr);
 bool sve_access_check(DisasContext *s);
+bool sme_enabled_check(DisasContext *s);
+bool sme_enabled_check_with_svcr(DisasContext *s, unsigned);
+
+/* This function corresponds to CheckStreamingSVEEnabled. */
+static inline bool sme_sm_enabled_check(DisasContext *s)
+{
+    return sme_enabled_check_with_svcr(s, R_SVCR_SM_MASK);
+}
+
+/* This function corresponds to CheckSMEAndZAEnabled. */
+static inline bool sme_za_enabled_check(DisasContext *s)
+{
+    return sme_enabled_check_with_svcr(s, R_SVCR_ZA_MASK);
+}
+
+/* Note that this function corresponds to CheckStreamingSVEAndZAEnabled. */
+static inline bool sme_smza_enabled_check(DisasContext *s)
+{
+    return sme_enabled_check_with_svcr(s, R_SVCR_SM_MASK | R_SVCR_ZA_MASK);
+}
+
 TCGv_i64 clean_data_tbi(DisasContext *s, TCGv_i64 addr);
 TCGv_i64 gen_mte_check1(DisasContext *s, TCGv_i64 addr, bool is_write,
                         bool tag_checked, int log2_size);
diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c
index 7fab7f64f86..b16d81bf197 100644
--- a/target/arm/translate-a64.c
+++ b/target/arm/translate-a64.c
@@ -1216,6 +1216,40 @@ static bool sme_access_check(DisasContext *s)
     return true;
 }
=20
+/* This function corresponds to CheckSMEEnabled. */
+bool sme_enabled_check(DisasContext *s)
+{
+    /*
+     * Note that unlike sve_excp_el, we have not constrained sme_excp_el
+     * to be zero when fp_excp_el has priority.  This is because we need
+     * sme_excp_el by itself for cpregs access checks.
+     */
+    if (!s->fp_excp_el || s->sme_excp_el < s->fp_excp_el) {
+        s->fp_access_checked =3D true;
+        return sme_access_check(s);
+    }
+    return fp_access_check_only(s);
+}
+
+/* Common subroutine for CheckSMEAnd*Enabled. */
+bool sme_enabled_check_with_svcr(DisasContext *s, unsigned req)
+{
+    if (!sme_enabled_check(s)) {
+        return false;
+    }
+    if (FIELD_EX64(req, SVCR, SM) && !s->pstate_sm) {
+        gen_exception_insn(s, s->pc_curr, EXCP_UDEF,
+                           syn_smetrap(SME_ET_NotStreaming, false));
+        return false;
+    }
+    if (FIELD_EX64(req, SVCR, ZA) && !s->pstate_za) {
+        gen_exception_insn(s, s->pc_curr, EXCP_UDEF,
+                           syn_smetrap(SME_ET_InactiveZA, false));
+        return false;
+    }
+    return true;
+}
+
 /*
  * This utility function is for doing register extension with an
  * optional shift. You will likely want to pass a temporary for the
--=20
2.25.1
From nobody Thu May  8 21:38:42 2025
Delivered-To: importer@patchew.org
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass(p=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1657548823; cv=none;
	d=zohomail.com; s=zohoarc;
	b=Wh/YeqioTMOXfYLIi2jDHV9MUCWOf+xJ7d3xgCzmmqDQJWna2nrmuWQjg58tUcgMECSbpExKXrAbl3W55EpCvxx47aPrfk6VSlAUVun4oIwYV96e8yyfD8fAB6uWWTIXL+O4RJYSGNwjDzIyKnW59q6GELx8jlBKK+rPrmTzjKE=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1657548823;
 h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
	bh=iUJ2sm4ykqwIgMCGtXLZ1jWMeR/9y75k/xuAaZSsGgw=;
	b=ei7qqiEJTQf6F/siJLsPVaQSZhAmkQPAI2kJHm+eTSVAZMntuoQhQIpRs/5InHtCeRAKbQ0Zj4O3WXiT/2ISRWD/zXDhRn/sjrqsiL+u4spCHpWDiJqobmkCrfvxMUjvrlGG+6Ciccu0acTm6S7V9LBk/qnRaT4Me696o7KG7b8=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass header.from=<peter.maydell@linaro.org> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1657548823490745.3803922007194;
 Mon, 11 Jul 2022 07:13:43 -0700 (PDT)
Received: from localhost ([::1]:41808 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces+importer=patchew.org@nongnu.org>)
	id 1oAuAQ-0002CD-3W
	for importer@patchew.org; Mon, 11 Jul 2022 10:13:42 -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 <peter.maydell@linaro.org>)
 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 <peter.maydell@linaro.org>)
 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 <qemu-devel@nongnu.org>; Mon, 11 Jul 2022 06:58:06 -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 <qemu-devel@nongnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 11 Jul 2022 06:58:04 -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-Google-Smtp-Source: 
 AGRyM1uPJtiIyC1KElSCrozXUEmY6s3Q9roIKRpzGYU2a+R8kU7gVNiF9ycskIiggXeTyGnJUgqm7A==
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)
From: Peter Maydell <peter.maydell@linaro.org>
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
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17
 as permitted sender) client-ip=209.51.188.17;
 envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org;
 helo=lists.gnu.org;
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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>
Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org
Sender: "Qemu-devel" <qemu-devel-bounces+importer=patchew.org@nongnu.org>
X-ZohoMail-DKIM: pass (identity @linaro.org)
X-ZM-MESSAGEID: 1657548825902100002
Content-Type: text/plain; charset="utf-8"

From: Richard Henderson <richard.henderson@linaro.org>

The pseudocode for CheckSVEEnabled gains a check for Streaming
SVE mode, and for SME present but SVE absent.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220708151540.18136-17-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 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;
 }
=20
-/* 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 =3D 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 =3D 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 =3D true;
+    return false;
 }
=20
 /*
--=20
2.25.1
From nobody Thu May  8 21:38:42 2025
Delivered-To: importer@patchew.org
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass(p=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1657549027; cv=none;
	d=zohomail.com; s=zohoarc;
	b=L9McIfcXPiFq++Pp4CEtV+vjPN/OvzjPGCVRhhqNBf8HUV1dlmrXusT7+/unDw2uqVkmifsRJtt0+U2bKc5ZOoWHdw0lx6BPu1uInWqbmYQRX6Sg2yF5pYyC0ZB43JQmmNlMkARW9bYc/IvzyfC+7D2WICG2G47lBoNwCEv967E=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1657549027;
 h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
	bh=0SnW41amKkOvYQy7JWpeer4ukEO9PLX9nZ7OoMrxHX8=;
	b=b5PoYaLMYKrZ6N5WnjDPDZxXmwPCvqzBYLPD9nuTtwdWYEoKpe6LTE96XDMtRaWR50WdxElvcI+3GpFPyuMISClrcrvVCvTyGiLDhkGPOSz1wOvsa4LODmBpSMiJP8qLGEeO26KP77XwXQZ5Tyrrd/aA59jqmwOOK2KAARvq9BI=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass header.from=<peter.maydell@linaro.org> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1657549027270458.8986887297484;
 Mon, 11 Jul 2022 07:17:07 -0700 (PDT)
Received: from localhost ([::1]:46584 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces+importer=patchew.org@nongnu.org>)
	id 1oAuDi-0005XO-6U
	for importer@patchew.org; Mon, 11 Jul 2022 10:17:06 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:42862)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvd-0006c6-HS
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:26 -0400
Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]:43747)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvT-0002q3-Qq
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:25 -0400
Received: by mail-wr1-x42e.google.com with SMTP id d16so7106529wrv.10
 for <qemu-devel@nongnu.org>; Mon, 11 Jul 2022 06:58:06 -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.05
 for <qemu-devel@nongnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 11 Jul 2022 06:58:05 -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=0SnW41amKkOvYQy7JWpeer4ukEO9PLX9nZ7OoMrxHX8=;
 b=YdSN+EVtwVxk5j2FeViqmNxXOPCPNpNpS+AsgMR0sGVuq1IWuN4+P2Kot83rAOg5oV
 ga68QBZtn9xwzhovi873WrEUrzAJHOWLedjPVeAlJhwyzwR1qid3KnM2vL/vzybauVIt
 037lWWqQ095jkR55wuE3Ah01/8KE3hkWVMgjAQGc9DWx8Dkw8io05quxmNgISspDHUSX
 0ALIJkSFW9mtee0lV2mZPCyI2oll7iFkQT1HNz7jBEldrzozHMKV3RqBZAJ0/n8+cOMp
 bk0BqFArgR9Jwc0eLPYaI09sxmCd4IiqwN2ktsvaq3XLIRl7A+Dimj3AlRk9rsevHUHj
 3eCQ==
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=0SnW41amKkOvYQy7JWpeer4ukEO9PLX9nZ7OoMrxHX8=;
 b=WUwbHj8cr1cZJFLmWPXdp+ajmKzAoF7/i5VA/5XsuKDQwvIyx66aGSmUyDcqT4dUnS
 nsuWA/t60nNpzezG+2M4AJUIpcSl1DhnRcmVWttc8zYhyHTceavcQmPwe3QQpsJsJk6f
 2kA6Fkw4PspElxMvMVQw18GT1dSgMFuQw3uZBEn848U6/pzQDcJHae3LVDTFpQv9v9WF
 VU2mDQcGB+tyOIfPfsEL5r8qes/42XtjhkMeCl0HF59G1bgyXeYzSE4zaLyQ8a7I7JXk
 4cQsA4LZi4cMWQLGwKaaLorCSyLzD+VxaDny8QMaPAPI1K3vQKr0amRDTcPBOjVV0UBh
 2eSQ==
X-Gm-Message-State: AJIora/MMGOfPLTh6WbaWZJ9jHnQgBXpHKW40dmCdlvSiLfGknNPWd/8
 f7ExSkafsK3wmEHIjjsKGDcsZxWrZqGaoA==
X-Google-Smtp-Source: 
 AGRyM1vgr3KXr2YSQGkcavU/ZAvTPK3fKJIsRiQt7J6dgOazXX6SNGzw2tqJi+Q3gbbXOZRzmoUTRw==
X-Received: by 2002:a5d:5151:0:b0:21d:730b:c64a with SMTP id
 u17-20020a5d5151000000b0021d730bc64amr17336831wrt.392.1657547885843;
 Mon, 11 Jul 2022 06:58:05 -0700 (PDT)
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 17/45] target/arm: Implement SME RDSVL, ADDSVL, ADDSPL
Date: Mon, 11 Jul 2022 14:57:22 +0100
Message-Id: <20220711135750.765803-18-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
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17
 as permitted sender) client-ip=209.51.188.17;
 envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org;
 helo=lists.gnu.org;
Received-SPF: pass client-ip=2a00:1450:4864:20::42e;
 envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42e.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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>
Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org
Sender: "Qemu-devel" <qemu-devel-bounces+importer=patchew.org@nongnu.org>
X-ZohoMail-DKIM: pass (identity @linaro.org)
X-ZM-MESSAGEID: 1657549027608100001
Content-Type: text/plain; charset="utf-8"

From: Richard Henderson <richard.henderson@linaro.org>

These SME instructions are nominally within the SVE decode space,
so we add them to sve.decode and translate-sve.c.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220708151540.18136-18-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 target/arm/translate-a64.h | 12 ++++++++++++
 target/arm/sve.decode      |  5 ++++-
 target/arm/translate-sve.c | 38 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 54 insertions(+), 1 deletion(-)

diff --git a/target/arm/translate-a64.h b/target/arm/translate-a64.h
index 02fb95e0199..099d3d11d60 100644
--- a/target/arm/translate-a64.h
+++ b/target/arm/translate-a64.h
@@ -128,6 +128,12 @@ static inline int vec_full_reg_size(DisasContext *s)
     return s->vl;
 }
=20
+/* Return the byte size of the vector register, SVL / 8. */
+static inline int streaming_vec_reg_size(DisasContext *s)
+{
+    return s->svl;
+}
+
 /*
  * Return the offset info CPUARMState of the predicate vector register Pn.
  * Note for this purpose, FFR is P16.
@@ -143,6 +149,12 @@ static inline int pred_full_reg_size(DisasContext *s)
     return s->vl >> 3;
 }
=20
+/* Return the byte size of the predicate register, SVL / 64.  */
+static inline int streaming_pred_reg_size(DisasContext *s)
+{
+    return s->svl >> 3;
+}
+
 /*
  * Round up the size of a register to a size allowed by
  * the tcg vector infrastructure.  Any operation which uses this
diff --git a/target/arm/sve.decode b/target/arm/sve.decode
index 908643d7d90..95af08c139f 100644
--- a/target/arm/sve.decode
+++ b/target/arm/sve.decode
@@ -449,14 +449,17 @@ INDEX_ri        00000100 esz:2 1 imm:s5 010001 rn:5 r=
d:5
 # SVE index generation (register start, register increment)
 INDEX_rr        00000100 .. 1 ..... 010011 ..... .....          @rd_rn_rm
=20
-### SVE Stack Allocation Group
+### SVE / Streaming SVE Stack Allocation Group
=20
 # SVE stack frame adjustment
 ADDVL           00000100 001 ..... 01010 ...... .....           @rd_rn_i6
+ADDSVL          00000100 001 ..... 01011 ...... .....           @rd_rn_i6
 ADDPL           00000100 011 ..... 01010 ...... .....           @rd_rn_i6
+ADDSPL          00000100 011 ..... 01011 ...... .....           @rd_rn_i6
=20
 # SVE stack frame size
 RDVL            00000100 101 11111 01010 imm:s6 rd:5
+RDSVL           00000100 101 11111 01011 imm:s6 rd:5
=20
 ### SVE Bitwise Shift - Unpredicated Group
=20
diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c
index 96e934c1ea9..95016e49e9d 100644
--- a/target/arm/translate-sve.c
+++ b/target/arm/translate-sve.c
@@ -1286,6 +1286,19 @@ static bool trans_ADDVL(DisasContext *s, arg_ADDVL *=
a)
     return true;
 }
=20
+static bool trans_ADDSVL(DisasContext *s, arg_ADDSVL *a)
+{
+    if (!dc_isar_feature(aa64_sme, s)) {
+        return false;
+    }
+    if (sme_enabled_check(s)) {
+        TCGv_i64 rd =3D cpu_reg_sp(s, a->rd);
+        TCGv_i64 rn =3D cpu_reg_sp(s, a->rn);
+        tcg_gen_addi_i64(rd, rn, a->imm * streaming_vec_reg_size(s));
+    }
+    return true;
+}
+
 static bool trans_ADDPL(DisasContext *s, arg_ADDPL *a)
 {
     if (!dc_isar_feature(aa64_sve, s)) {
@@ -1299,6 +1312,19 @@ static bool trans_ADDPL(DisasContext *s, arg_ADDPL *=
a)
     return true;
 }
=20
+static bool trans_ADDSPL(DisasContext *s, arg_ADDSPL *a)
+{
+    if (!dc_isar_feature(aa64_sme, s)) {
+        return false;
+    }
+    if (sme_enabled_check(s)) {
+        TCGv_i64 rd =3D cpu_reg_sp(s, a->rd);
+        TCGv_i64 rn =3D cpu_reg_sp(s, a->rn);
+        tcg_gen_addi_i64(rd, rn, a->imm * streaming_pred_reg_size(s));
+    }
+    return true;
+}
+
 static bool trans_RDVL(DisasContext *s, arg_RDVL *a)
 {
     if (!dc_isar_feature(aa64_sve, s)) {
@@ -1311,6 +1337,18 @@ static bool trans_RDVL(DisasContext *s, arg_RDVL *a)
     return true;
 }
=20
+static bool trans_RDSVL(DisasContext *s, arg_RDSVL *a)
+{
+    if (!dc_isar_feature(aa64_sme, s)) {
+        return false;
+    }
+    if (sme_enabled_check(s)) {
+        TCGv_i64 reg =3D cpu_reg(s, a->rd);
+        tcg_gen_movi_i64(reg, a->imm * streaming_vec_reg_size(s));
+    }
+    return true;
+}
+
 /*
  *** SVE Compute Vector Address Group
  */
--=20
2.25.1
From nobody Thu May  8 21:38:42 2025
Delivered-To: importer@patchew.org
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass(p=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1657548073; cv=none;
	d=zohomail.com; s=zohoarc;
	b=jOYh7rvtZK9xuXhzDepFssofnFPtzuil2C8N4vtBda7lv2GtQKzMEznWWHy8y6j/kgxgwBqQvebOJCOP+cdUe6HtI7p5ohyCjz7LiFkAa7KJn/0k6SmY8B5jS/cB7SJTVYYa/pzGIPZMl6yuzGH6uQ21GueeEus/fPSYZjXz2Wg=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1657548073;
 h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
	bh=xU+wxBR/nb5VhvZR6dMFf9W7EuBiUbFbtZKkKknvG9M=;
	b=DCkIsfhi8DULqnwjLSr2XwDEUgiLHPLezBM/TWyoVwt1uORJUhWplHqU1HizlAMTis8Zl5MikBVGYVxjxw+m59gX0I5diuOiMKWHnyNHQHY2prYplEz1VN54QsTqR1EuShZay5ZiAv0WZbxJEdZ3lIsE5p+kbAqvQjmf2Pv5g4A=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass header.from=<peter.maydell@linaro.org> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1657548073765206.5600706487793;
 Mon, 11 Jul 2022 07:01:13 -0700 (PDT)
Received: from localhost ([::1]:44408 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces+importer=patchew.org@nongnu.org>)
	id 1oAtyK-0001CI-La
	for importer@patchew.org; Mon, 11 Jul 2022 10:01:12 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:42742)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvV-0006Yc-Mf
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:18 -0400
Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]:46667)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvQ-0002qA-6J
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:16 -0400
Received: by mail-wr1-x42e.google.com with SMTP id v16so7099852wrd.13
 for <qemu-devel@nongnu.org>; Mon, 11 Jul 2022 06:58:07 -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.05
 for <qemu-devel@nongnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 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=xU+wxBR/nb5VhvZR6dMFf9W7EuBiUbFbtZKkKknvG9M=;
 b=I3+YpVZmJGcz8r6Tx+fKQJezfhERsRh8glJlDJ8XdzOX28Gn1ut4s3SYBzO/Rbx73e
 ql6CSIcVhqb+cAbF4gwB3qqCFQgb4QluoG1jZhRODSpAQSaJKu+8O3gtOfDeW81eIjUO
 TTOg8ukuRDeUq06RnJWEqmgiuRV2TAZuqQdrD7Yb/mhBbTYScViEXmDyDn+TC9ihqf4P
 97aNugH9Ufu5/GVugf8GdYddhvwo/WVNMfeKC0yiEziSs3NacmkRTPkiyRcMs6ptSpwC
 C0e5ixXhXrZ29YDQzNTbCClrOnQklgZNNXrgfG4vua3YSITftnibwPw+mq4GPisuivfL
 OjeQ==
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=xU+wxBR/nb5VhvZR6dMFf9W7EuBiUbFbtZKkKknvG9M=;
 b=muiXkKO3fGQfBjlKWRvWQGdun3uv1kf9mDMl5WH+318U405pcVX79Cd+ud2b9pitCE
 vZn4eb5IUQ2gpmSLBnap3hJEgCe0vdAAgMKcPFyyhqYRqw/NehzRYmAtfVLZW/QIjDLc
 StiDGZ7LfwlH/bNcwBExC8Ul8HUr97DkMs9tCvYlNHGXXdWxWjYDJRDcxiGX0xzFJLP/
 AyYDl3rEriQhYwwS6BIocnC4XMTkhM2+brQt1XepXTEkuFj1gqC63DHQjnZ1AFfr9iAT
 W8k9QSyJP6aFyUUCbJc0CfoF1sXzWKz5jZYgrf3rWtwYW8otGTFBo0gRJonmHOCAWiP+
 yqew==
X-Gm-Message-State: AJIora/DL5rmOl37a401QcdnlmF73U9lZ6CByWnWYCviSutDwWfddFxb
 heydUztPb+Fv5qXPsp4+8ZJzX1k+yfq+lg==
X-Google-Smtp-Source: 
 AGRyM1vw14UDuF+KC3OMwHfZMgozdN9dEmj1sMnsMo8Z5TKCoxJShGdVdjPuHyQNpQXB7oMMKVNrsw==
X-Received: by 2002:adf:fbc6:0:b0:21d:3fc3:99e with SMTP id
 d6-20020adffbc6000000b0021d3fc3099emr17158821wrs.550.1657547886560;
 Mon, 11 Jul 2022 06:58:06 -0700 (PDT)
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 18/45] target/arm: Implement SME ZERO
Date: Mon, 11 Jul 2022 14:57:23 +0100
Message-Id: <20220711135750.765803-19-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
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17
 as permitted sender) client-ip=209.51.188.17;
 envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org;
 helo=lists.gnu.org;
Received-SPF: pass client-ip=2a00:1450:4864:20::42e;
 envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42e.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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>
Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org
Sender: "Qemu-devel" <qemu-devel-bounces+importer=patchew.org@nongnu.org>
X-ZohoMail-DKIM: pass (identity @linaro.org)
X-ZM-MESSAGEID: 1657548075189100003
Content-Type: text/plain; charset="utf-8"

From: Richard Henderson <richard.henderson@linaro.org>

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220708151540.18136-19-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 target/arm/helper-sme.h    |  2 ++
 target/arm/sme.decode      |  4 ++++
 target/arm/sme_helper.c    | 25 +++++++++++++++++++++++++
 target/arm/translate-sme.c | 13 +++++++++++++
 4 files changed, 44 insertions(+)

diff --git a/target/arm/helper-sme.h b/target/arm/helper-sme.h
index 3bd48c235f0..c4ee1f09e46 100644
--- a/target/arm/helper-sme.h
+++ b/target/arm/helper-sme.h
@@ -19,3 +19,5 @@
=20
 DEF_HELPER_FLAGS_2(set_pstate_sm, TCG_CALL_NO_RWG, void, env, i32)
 DEF_HELPER_FLAGS_2(set_pstate_za, TCG_CALL_NO_RWG, void, env, i32)
+
+DEF_HELPER_FLAGS_3(sme_zero, TCG_CALL_NO_RWG, void, env, i32, i32)
diff --git a/target/arm/sme.decode b/target/arm/sme.decode
index c25c031a71d..6e4483fdcea 100644
--- a/target/arm/sme.decode
+++ b/target/arm/sme.decode
@@ -18,3 +18,7 @@
 #
 # This file is processed by scripts/decodetree.py
 #
+
+### SME Misc
+
+ZERO            11000000 00 001 00000000000 imm:8
diff --git a/target/arm/sme_helper.c b/target/arm/sme_helper.c
index b2157255943..eef2df73e11 100644
--- a/target/arm/sme_helper.c
+++ b/target/arm/sme_helper.c
@@ -59,3 +59,28 @@ void helper_set_pstate_za(CPUARMState *env, uint32_t i)
         memset(env->zarray, 0, sizeof(env->zarray));
     }
 }
+
+void helper_sme_zero(CPUARMState *env, uint32_t imm, uint32_t svl)
+{
+    uint32_t i;
+
+    /*
+     * Special case clearing the entire ZA space.
+     * This falls into the CONSTRAINED UNPREDICTABLE zeroing of any
+     * parts of the ZA storage outside of SVL.
+     */
+    if (imm =3D=3D 0xff) {
+        memset(env->zarray, 0, sizeof(env->zarray));
+        return;
+    }
+
+    /*
+     * Recall that ZAnH.D[m] is spread across ZA[n+8*m],
+     * so each row is discontiguous within ZA[].
+     */
+    for (i =3D 0; i < svl; i++) {
+        if (imm & (1 << (i % 8))) {
+            memset(&env->zarray[i], 0, svl);
+        }
+    }
+}
diff --git a/target/arm/translate-sme.c b/target/arm/translate-sme.c
index 786c93fb2db..971504559b3 100644
--- a/target/arm/translate-sme.c
+++ b/target/arm/translate-sme.c
@@ -33,3 +33,16 @@
  */
=20
 #include "decode-sme.c.inc"
+
+
+static bool trans_ZERO(DisasContext *s, arg_ZERO *a)
+{
+    if (!dc_isar_feature(aa64_sme, s)) {
+        return false;
+    }
+    if (sme_za_enabled_check(s)) {
+        gen_helper_sme_zero(cpu_env, tcg_constant_i32(a->imm),
+                            tcg_constant_i32(streaming_vec_reg_size(s)));
+    }
+    return true;
+}
--=20
2.25.1
From nobody Thu May  8 21:38:42 2025
Delivered-To: importer@patchew.org
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass(p=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1657549103; cv=none;
	d=zohomail.com; s=zohoarc;
	b=ak/C8tREIKd3YxHJFL1l6v9waxDNZeUFt/bqsW5rrbnvYD7JoUr9m8M908SVpCGABEYpV7RCzGJzMEVwa/AO0SBLZFupWo1wmou1A8tpjsZGVUxU3ubxIexg6DYomz4IPYtsWDAWNhiEH9IVfbP6jlvjalRTgnlro/rl3+jZGZc=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1657549103;
 h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
	bh=P+PObeibL5C3+Uz8LfbpgBOBFwzFbCbwTK56pDFrdzU=;
	b=d8Mdv/1nyNw8JkheS/seDGwKRWRJYfhV7EkZge/MLplpMu9e47xxOcimZqNO0gnYDMn823zzc2wRSBkEaZDW6MT5H8wPZ9Lm5MmefK7nXma0IghU3m4S6mz2mpHdXZxH7Xha4KY1De/7GR484u2zIW2/FNsBV0lG3VqFUajFvNk=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass header.from=<peter.maydell@linaro.org> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1657549103506112.91716986428503;
 Mon, 11 Jul 2022 07:18:23 -0700 (PDT)
Received: from localhost ([::1]:50224 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces+importer=patchew.org@nongnu.org>)
	id 1oAuEw-0008DJ-E3
	for importer@patchew.org; Mon, 11 Jul 2022 10:18:22 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:42748)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvV-0006Z0-PB
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:18 -0400
Received: from mail-wm1-x330.google.com ([2a00:1450:4864:20::330]:43866)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvQ-0002qG-4O
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:16 -0400
Received: by mail-wm1-x330.google.com with SMTP id
 v10-20020a05600c15ca00b003a2db8aa2c4so3085073wmf.2
 for <qemu-devel@nongnu.org>; Mon, 11 Jul 2022 06:58:08 -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.06
 for <qemu-devel@nongnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 11 Jul 2022 06:58:07 -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=P+PObeibL5C3+Uz8LfbpgBOBFwzFbCbwTK56pDFrdzU=;
 b=Pka/28UA9kYV3mlfjFyfcDK2q6tRWt8HuoUkR8tOfjIqzJYBzvhBxD/WLPrLsTxF+1
 bqT0kyPpc0VDliPV0zSxs7VBR9bcf3i8Uusr8e2rIKUySXP7vaOPNZN5Yk4+ld6MzfyS
 SVgqufFMrK2pkRE2LcSKXYG2QQjFQFj3NZxTA46UEMZ2qvaGvhzVSukN5cX0ZiTevYlm
 oFAOMZtLHozQ/HgDjUQOaA4bAerZMmTvu93pEp+ZR4mwLFyndzcIMNeiUecgAbpNnE9D
 Q7ReXx+LR/BtRYJhWTqhfpxUt648fmr0L6MjAndbxGYPfgfIcyiuLVHDhsJPX7VA6leb
 4Big==
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=P+PObeibL5C3+Uz8LfbpgBOBFwzFbCbwTK56pDFrdzU=;
 b=BYk2DpGedJRgetR850QtJCjtWOSMA/Vl5rKcoGZEKlSbo0KU1xGLBIaTc0p42S2afk
 qt8LMGlfHLqdYw4JFPp8DUqKEy80vWZDMEBboRPPhdy+q7cWapIyhWBseSFrTQEdXDyr
 iQjUxqTeWsVrkgRkIjsVZS2hQs3KpS+1PRKKkPj2gtdgN4whkYwt/ARMqmn5ded5h+HN
 hT6DoUJgfPn4CPDtv9xoe8Du8kYugPcRu3lAhWiByr60gDklHGxP2n+VQOJnVpYDEOqq
 IRM1d/g3KY95QpAHGsZ+L7R/OAMeM/gFS0W1z7CsnlJE2Y+9YXoRAaV84vPLF+rMME/o
 egzg==
X-Gm-Message-State: AJIora/eui/neGt+5Sw0Yhn+ds/iFdFseKpAxglg2NcQe3ENR6ZZgkvK
 NoH46HlgZrxrhdb7QcvFztV9/wBQ1Aqjwg==
X-Google-Smtp-Source: 
 AGRyM1uaCfbw9urjbZ6bFOi8OZu3cMISNenPQy4v8mHDXRto3P8iadbr6N27GsONSIDTsivgmv75VA==
X-Received: by 2002:a05:600c:4e07:b0:3a1:8548:4dd7 with SMTP id
 b7-20020a05600c4e0700b003a185484dd7mr16442018wmq.170.1657547887549;
 Mon, 11 Jul 2022 06:58:07 -0700 (PDT)
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 19/45] target/arm: Implement SME MOVA
Date: Mon, 11 Jul 2022 14:57:24 +0100
Message-Id: <20220711135750.765803-20-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
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17
 as permitted sender) client-ip=209.51.188.17;
 envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org;
 helo=lists.gnu.org;
Received-SPF: pass client-ip=2a00:1450:4864:20::330;
 envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x330.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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>
Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org
Sender: "Qemu-devel" <qemu-devel-bounces+importer=patchew.org@nongnu.org>
X-ZohoMail-DKIM: pass (identity @linaro.org)
X-ZM-MESSAGEID: 1657549105446100001
Content-Type: text/plain; charset="utf-8"

From: Richard Henderson <richard.henderson@linaro.org>

We can reuse the SVE functions for implementing moves to/from
horizontal tile slices, but we need new ones for moves to/from
vertical tile slices.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220708151540.18136-20-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 target/arm/helper-sme.h    |  12 +++
 target/arm/helper-sve.h    |   2 +
 target/arm/translate-a64.h |   8 ++
 target/arm/translate.h     |   5 ++
 target/arm/sme.decode      |  15 ++++
 target/arm/sme_helper.c    | 151 ++++++++++++++++++++++++++++++++++++-
 target/arm/sve_helper.c    |  12 +++
 target/arm/translate-sme.c | 127 +++++++++++++++++++++++++++++++
 8 files changed, 331 insertions(+), 1 deletion(-)

diff --git a/target/arm/helper-sme.h b/target/arm/helper-sme.h
index c4ee1f09e46..154bc73d2eb 100644
--- a/target/arm/helper-sme.h
+++ b/target/arm/helper-sme.h
@@ -21,3 +21,15 @@ DEF_HELPER_FLAGS_2(set_pstate_sm, TCG_CALL_NO_RWG, void,=
 env, i32)
 DEF_HELPER_FLAGS_2(set_pstate_za, TCG_CALL_NO_RWG, void, env, i32)
=20
 DEF_HELPER_FLAGS_3(sme_zero, TCG_CALL_NO_RWG, void, env, i32, i32)
+
+/* Move to/from vertical array slices, i.e. columns, so 'c'.  */
+DEF_HELPER_FLAGS_4(sme_mova_cz_b, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i3=
2)
+DEF_HELPER_FLAGS_4(sme_mova_zc_b, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i3=
2)
+DEF_HELPER_FLAGS_4(sme_mova_cz_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i3=
2)
+DEF_HELPER_FLAGS_4(sme_mova_zc_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i3=
2)
+DEF_HELPER_FLAGS_4(sme_mova_cz_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i3=
2)
+DEF_HELPER_FLAGS_4(sme_mova_zc_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i3=
2)
+DEF_HELPER_FLAGS_4(sme_mova_cz_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i3=
2)
+DEF_HELPER_FLAGS_4(sme_mova_zc_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i3=
2)
+DEF_HELPER_FLAGS_4(sme_mova_cz_q, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i3=
2)
+DEF_HELPER_FLAGS_4(sme_mova_zc_q, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i3=
2)
diff --git a/target/arm/helper-sve.h b/target/arm/helper-sve.h
index dc629f851a3..ab0333400f0 100644
--- a/target/arm/helper-sve.h
+++ b/target/arm/helper-sve.h
@@ -325,6 +325,8 @@ DEF_HELPER_FLAGS_5(sve_sel_zpzz_s, TCG_CALL_NO_RWG,
                    void, ptr, ptr, ptr, ptr, i32)
 DEF_HELPER_FLAGS_5(sve_sel_zpzz_d, TCG_CALL_NO_RWG,
                    void, ptr, ptr, ptr, ptr, i32)
+DEF_HELPER_FLAGS_5(sve_sel_zpzz_q, TCG_CALL_NO_RWG,
+                   void, ptr, ptr, ptr, ptr, i32)
=20
 DEF_HELPER_FLAGS_5(sve2_addp_zpzz_b, TCG_CALL_NO_RWG,
                    void, ptr, ptr, ptr, ptr, i32)
diff --git a/target/arm/translate-a64.h b/target/arm/translate-a64.h
index 099d3d11d60..2a7fe6e9e7f 100644
--- a/target/arm/translate-a64.h
+++ b/target/arm/translate-a64.h
@@ -178,6 +178,14 @@ static inline int pred_gvec_reg_size(DisasContext *s)
     return size_for_gvec(pred_full_reg_size(s));
 }
=20
+/* Return a newly allocated pointer to the predicate register.  */
+static inline TCGv_ptr pred_full_reg_ptr(DisasContext *s, int regno)
+{
+    TCGv_ptr ret =3D tcg_temp_new_ptr();
+    tcg_gen_addi_ptr(ret, cpu_env, pred_full_reg_offset(s, regno));
+    return ret;
+}
+
 bool disas_sve(DisasContext *, uint32_t);
 bool disas_sme(DisasContext *, uint32_t);
=20
diff --git a/target/arm/translate.h b/target/arm/translate.h
index e2e619dab25..af5d4a7086f 100644
--- a/target/arm/translate.h
+++ b/target/arm/translate.h
@@ -156,6 +156,11 @@ static inline int plus_2(DisasContext *s, int x)
     return x + 2;
 }
=20
+static inline int plus_12(DisasContext *s, int x)
+{
+    return x + 12;
+}
+
 static inline int times_2(DisasContext *s, int x)
 {
     return x * 2;
diff --git a/target/arm/sme.decode b/target/arm/sme.decode
index 6e4483fdcea..241b4895b77 100644
--- a/target/arm/sme.decode
+++ b/target/arm/sme.decode
@@ -22,3 +22,18 @@
 ### SME Misc
=20
 ZERO            11000000 00 001 00000000000 imm:8
+
+### SME Move into/from Array
+
+%mova_rs        13:2 !function=3Dplus_12
+&mova           esz rs pg zr za_imm v:bool to_vec:bool
+
+MOVA            11000000 esz:2 00000 0 v:1 .. pg:3 zr:5 0 za_imm:4  \
+                &mova to_vec=3D0 rs=3D%mova_rs
+MOVA            11000000 11    00000 1 v:1 .. pg:3 zr:5 0 za_imm:4  \
+                &mova to_vec=3D0 rs=3D%mova_rs esz=3D4
+
+MOVA            11000000 esz:2 00001 0 v:1 .. pg:3 0 za_imm:4 zr:5  \
+                &mova to_vec=3D1 rs=3D%mova_rs
+MOVA            11000000 11    00001 1 v:1 .. pg:3 0 za_imm:4 zr:5  \
+                &mova to_vec=3D1 rs=3D%mova_rs esz=3D4
diff --git a/target/arm/sme_helper.c b/target/arm/sme_helper.c
index eef2df73e11..e88244423d0 100644
--- a/target/arm/sme_helper.c
+++ b/target/arm/sme_helper.c
@@ -19,8 +19,10 @@
=20
 #include "qemu/osdep.h"
 #include "cpu.h"
-#include "internals.h"
+#include "tcg/tcg-gvec-desc.h"
 #include "exec/helper-proto.h"
+#include "qemu/int128.h"
+#include "vec_internal.h"
=20
 /* ResetSVEState */
 void arm_reset_sve_state(CPUARMState *env)
@@ -84,3 +86,150 @@ void helper_sme_zero(CPUARMState *env, uint32_t imm, ui=
nt32_t svl)
         }
     }
 }
+
+
+/*
+ * When considering the ZA storage as an array of elements of
+ * type T, the index within that array of the Nth element of
+ * a vertical slice of a tile can be calculated like this,
+ * regardless of the size of type T. This is because the tiles
+ * are interleaved, so if type T is size N bytes then row 1 of
+ * the tile is N rows away from row 0. The division by N to
+ * convert a byte offset into an array index and the multiplication
+ * by N to convert from vslice-index-within-the-tile to
+ * the index within the ZA storage cancel out.
+ */
+#define tile_vslice_index(i) ((i) * sizeof(ARMVectorReg))
+
+/*
+ * When doing byte arithmetic on the ZA storage, the element
+ * byteoff bytes away in a tile vertical slice is always this
+ * many bytes away in the ZA storage, regardless of the
+ * size of the tile element, assuming that byteoff is a multiple
+ * of the element size. Again this is because of the interleaving
+ * of the tiles. For instance if we have 1 byte per element then
+ * each row of the ZA storage has one byte of the vslice data,
+ * and (counting from 0) byte 8 goes in row 8 of the storage
+ * at offset (8 * row-size-in-bytes).
+ * If we have 8 bytes per element then each row of the ZA storage
+ * has 8 bytes of the data, but there are 8 interleaved tiles and
+ * so byte 8 of the data goes into row 1 of the tile,
+ * which is again row 8 of the storage, so the offset is still
+ * (8 * row-size-in-bytes). Similarly for other element sizes.
+ */
+#define tile_vslice_offset(byteoff) ((byteoff) * sizeof(ARMVectorReg))
+
+
+/*
+ * Move Zreg vector to ZArray column.
+ */
+#define DO_MOVA_C(NAME, TYPE, H)                                        \
+void HELPER(NAME)(void *za, void *vn, void *vg, uint32_t desc)          \
+{                                                                       \
+    int i, oprsz =3D simd_oprsz(desc);                                    \
+    for (i =3D 0; i < oprsz; ) {                                          \
+        uint16_t pg =3D *(uint16_t *)(vg + H1_2(i >> 3));                 \
+        do {                                                            \
+            if (pg & 1) {                                               \
+                *(TYPE *)(za + tile_vslice_offset(i)) =3D *(TYPE *)(vn + H=
(i)); \
+            }                                                           \
+            i +=3D sizeof(TYPE);                                          \
+            pg >>=3D sizeof(TYPE);                                        \
+        } while (i & 15);                                               \
+    }                                                                   \
+}
+
+DO_MOVA_C(sme_mova_cz_b, uint8_t, H1)
+DO_MOVA_C(sme_mova_cz_h, uint16_t, H1_2)
+DO_MOVA_C(sme_mova_cz_s, uint32_t, H1_4)
+
+void HELPER(sme_mova_cz_d)(void *za, void *vn, void *vg, uint32_t desc)
+{
+    int i, oprsz =3D simd_oprsz(desc) / 8;
+    uint8_t *pg =3D vg;
+    uint64_t *n =3D vn;
+    uint64_t *a =3D za;
+
+    for (i =3D 0; i < oprsz; i++) {
+        if (pg[H1(i)] & 1) {
+            a[tile_vslice_index(i)] =3D n[i];
+        }
+    }
+}
+
+void HELPER(sme_mova_cz_q)(void *za, void *vn, void *vg, uint32_t desc)
+{
+    int i, oprsz =3D simd_oprsz(desc) / 16;
+    uint16_t *pg =3D vg;
+    Int128 *n =3D vn;
+    Int128 *a =3D za;
+
+    /*
+     * Int128 is used here simply to copy 16 bytes, and to simplify
+     * the address arithmetic.
+     */
+    for (i =3D 0; i < oprsz; i++) {
+        if (pg[H2(i)] & 1) {
+            a[tile_vslice_index(i)] =3D n[i];
+        }
+    }
+}
+
+#undef DO_MOVA_C
+
+/*
+ * Move ZArray column to Zreg vector.
+ */
+#define DO_MOVA_Z(NAME, TYPE, H)                                        \
+void HELPER(NAME)(void *vd, void *za, void *vg, uint32_t desc)          \
+{                                                                       \
+    int i, oprsz =3D simd_oprsz(desc);                                    \
+    for (i =3D 0; i < oprsz; ) {                                          \
+        uint16_t pg =3D *(uint16_t *)(vg + H1_2(i >> 3));                 \
+        do {                                                            \
+            if (pg & 1) {                                               \
+                *(TYPE *)(vd + H(i)) =3D *(TYPE *)(za + tile_vslice_offset=
(i)); \
+            }                                                           \
+            i +=3D sizeof(TYPE);                                          \
+            pg >>=3D sizeof(TYPE);                                        \
+        } while (i & 15);                                               \
+    }                                                                   \
+}
+
+DO_MOVA_Z(sme_mova_zc_b, uint8_t, H1)
+DO_MOVA_Z(sme_mova_zc_h, uint16_t, H1_2)
+DO_MOVA_Z(sme_mova_zc_s, uint32_t, H1_4)
+
+void HELPER(sme_mova_zc_d)(void *vd, void *za, void *vg, uint32_t desc)
+{
+    int i, oprsz =3D simd_oprsz(desc) / 8;
+    uint8_t *pg =3D vg;
+    uint64_t *d =3D vd;
+    uint64_t *a =3D za;
+
+    for (i =3D 0; i < oprsz; i++) {
+        if (pg[H1(i)] & 1) {
+            d[i] =3D a[tile_vslice_index(i)];
+        }
+    }
+}
+
+void HELPER(sme_mova_zc_q)(void *vd, void *za, void *vg, uint32_t desc)
+{
+    int i, oprsz =3D simd_oprsz(desc) / 16;
+    uint16_t *pg =3D vg;
+    Int128 *d =3D vd;
+    Int128 *a =3D za;
+
+    /*
+     * Int128 is used here simply to copy 16 bytes, and to simplify
+     * the address arithmetic.
+     */
+    for (i =3D 0; i < oprsz; i++, za +=3D sizeof(ARMVectorReg)) {
+        if (pg[H2(i)] & 1) {
+            d[i] =3D a[tile_vslice_index(i)];
+        }
+    }
+}
+
+#undef DO_MOVA_Z
diff --git a/target/arm/sve_helper.c b/target/arm/sve_helper.c
index 0c6379e6e80..df161704699 100644
--- a/target/arm/sve_helper.c
+++ b/target/arm/sve_helper.c
@@ -3565,6 +3565,18 @@ void HELPER(sve_sel_zpzz_d)(void *vd, void *vn, void=
 *vm,
     }
 }
=20
+void HELPER(sve_sel_zpzz_q)(void *vd, void *vn, void *vm,
+                            void *vg, uint32_t desc)
+{
+    intptr_t i, opr_sz =3D simd_oprsz(desc) / 16;
+    Int128 *d =3D vd, *n =3D vn, *m =3D vm;
+    uint16_t *pg =3D vg;
+
+    for (i =3D 0; i < opr_sz; i +=3D 1) {
+        d[i] =3D (pg[H2(i)] & 1 ? n : m)[i];
+    }
+}
+
 /* Two operand comparison controlled by a predicate.
  * ??? It is very tempting to want to be able to expand this inline
  * with x86 instructions, e.g.
diff --git a/target/arm/translate-sme.c b/target/arm/translate-sme.c
index 971504559b3..79c33d35c2b 100644
--- a/target/arm/translate-sme.c
+++ b/target/arm/translate-sme.c
@@ -35,6 +35,74 @@
 #include "decode-sme.c.inc"
=20
=20
+/*
+ * Resolve tile.size[index] to a host pointer, where tile and index
+ * are always decoded together, dependent on the element size.
+ */
+static TCGv_ptr get_tile_rowcol(DisasContext *s, int esz, int rs,
+                                int tile_index, bool vertical)
+{
+    int tile =3D tile_index >> (4 - esz);
+    int index =3D esz =3D=3D MO_128 ? 0 : extract32(tile_index, 0, 4 - esz=
);
+    int pos, len, offset;
+    TCGv_i32 tmp;
+    TCGv_ptr addr;
+
+    /* Compute the final index, which is Rs+imm. */
+    tmp =3D tcg_temp_new_i32();
+    tcg_gen_trunc_tl_i32(tmp, cpu_reg(s, rs));
+    tcg_gen_addi_i32(tmp, tmp, index);
+
+    /* Prepare a power-of-two modulo via extraction of @len bits. */
+    len =3D ctz32(streaming_vec_reg_size(s)) - esz;
+
+    if (vertical) {
+        /*
+         * Compute the byte offset of the index within the tile:
+         *     (index % (svl / size)) * size
+         *   =3D (index % (svl >> esz)) << esz
+         * Perform the power-of-two modulo via extraction of the low @len =
bits.
+         * Perform the multiply by shifting left by @pos bits.
+         * Perform these operations simultaneously via deposit into zero.
+         */
+        pos =3D esz;
+        tcg_gen_deposit_z_i32(tmp, tmp, pos, len);
+
+        /*
+         * For big-endian, adjust the indexed column byte offset within
+         * the uint64_t host words that make up env->zarray[].
+         */
+        if (HOST_BIG_ENDIAN && esz < MO_64) {
+            tcg_gen_xori_i32(tmp, tmp, 8 - (1 << esz));
+        }
+    } else {
+        /*
+         * Compute the byte offset of the index within the tile:
+         *     (index % (svl / size)) * (size * sizeof(row))
+         *   =3D (index % (svl >> esz)) << (esz + log2(sizeof(row)))
+         */
+        pos =3D esz + ctz32(sizeof(ARMVectorReg));
+        tcg_gen_deposit_z_i32(tmp, tmp, pos, len);
+
+        /* Row slices are always aligned and need no endian adjustment. */
+    }
+
+    /* The tile byte offset within env->zarray is the row. */
+    offset =3D tile * sizeof(ARMVectorReg);
+
+    /* Include the byte offset of zarray to make this relative to env. */
+    offset +=3D offsetof(CPUARMState, zarray);
+    tcg_gen_addi_i32(tmp, tmp, offset);
+
+    /* Add the byte offset to env to produce the final pointer. */
+    addr =3D tcg_temp_new_ptr();
+    tcg_gen_ext_i32_ptr(addr, tmp);
+    tcg_temp_free_i32(tmp);
+    tcg_gen_add_ptr(addr, addr, cpu_env);
+
+    return addr;
+}
+
 static bool trans_ZERO(DisasContext *s, arg_ZERO *a)
 {
     if (!dc_isar_feature(aa64_sme, s)) {
@@ -46,3 +114,62 @@ static bool trans_ZERO(DisasContext *s, arg_ZERO *a)
     }
     return true;
 }
+
+static bool trans_MOVA(DisasContext *s, arg_MOVA *a)
+{
+    static gen_helper_gvec_4 * const h_fns[5] =3D {
+        gen_helper_sve_sel_zpzz_b, gen_helper_sve_sel_zpzz_h,
+        gen_helper_sve_sel_zpzz_s, gen_helper_sve_sel_zpzz_d,
+        gen_helper_sve_sel_zpzz_q
+    };
+    static gen_helper_gvec_3 * const cz_fns[5] =3D {
+        gen_helper_sme_mova_cz_b, gen_helper_sme_mova_cz_h,
+        gen_helper_sme_mova_cz_s, gen_helper_sme_mova_cz_d,
+        gen_helper_sme_mova_cz_q,
+    };
+    static gen_helper_gvec_3 * const zc_fns[5] =3D {
+        gen_helper_sme_mova_zc_b, gen_helper_sme_mova_zc_h,
+        gen_helper_sme_mova_zc_s, gen_helper_sme_mova_zc_d,
+        gen_helper_sme_mova_zc_q,
+    };
+
+    TCGv_ptr t_za, t_zr, t_pg;
+    TCGv_i32 t_desc;
+    int svl;
+
+    if (!dc_isar_feature(aa64_sme, s)) {
+        return false;
+    }
+    if (!sme_smza_enabled_check(s)) {
+        return true;
+    }
+
+    t_za =3D get_tile_rowcol(s, a->esz, a->rs, a->za_imm, a->v);
+    t_zr =3D vec_full_reg_ptr(s, a->zr);
+    t_pg =3D pred_full_reg_ptr(s, a->pg);
+
+    svl =3D streaming_vec_reg_size(s);
+    t_desc =3D tcg_constant_i32(simd_desc(svl, svl, 0));
+
+    if (a->v) {
+        /* Vertical slice -- use sme mova helpers. */
+        if (a->to_vec) {
+            zc_fns[a->esz](t_zr, t_za, t_pg, t_desc);
+        } else {
+            cz_fns[a->esz](t_za, t_zr, t_pg, t_desc);
+        }
+    } else {
+        /* Horizontal slice -- reuse sve sel helpers. */
+        if (a->to_vec) {
+            h_fns[a->esz](t_zr, t_za, t_zr, t_pg, t_desc);
+        } else {
+            h_fns[a->esz](t_za, t_zr, t_za, t_pg, t_desc);
+        }
+    }
+
+    tcg_temp_free_ptr(t_za);
+    tcg_temp_free_ptr(t_zr);
+    tcg_temp_free_ptr(t_pg);
+
+    return true;
+}
--=20
2.25.1
From nobody Thu May  8 21:38:42 2025
Delivered-To: importer@patchew.org
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass(p=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1657549979; cv=none;
	d=zohomail.com; s=zohoarc;
	b=hTUygeavBHnZ+6y5jmt0fiwORoa+l2QYeGoPDR6mDeMm075DD7Zdy1s9PaB6Jp5xINb8g7mBv7hc3HPuUnjVIojftm7x/mkFP2vzH36ofsFnfCAX5JNknXSP4TlKU7sSS5VnnJqPMLGjPGEaAqYkp7w2N63HibA+FCDEAdB7Cvg=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1657549979;
 h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
	bh=ZyUf8Y8AINyya8GaLwmXsquW759D0Iw6TfD8Uk3jfYw=;
	b=VQF9acte50Y1TO6LDT0ZfQTV6WC1Vl9UPIVGmtjLmvQaJqcBc19rFyEKMhKRK7IbPAPT0ZUa7Q3b7xH9WIrP+UlSaa1/YbhNwD0w1wDw7KC59Nk5QsutjYuXpdCBXGodXOw4qwT/ssdoO+1diGaktqlIqa+xUKVd77ip1skn71c=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass header.from=<peter.maydell@linaro.org> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1657549979350617.1424922613535;
 Mon, 11 Jul 2022 07:32:59 -0700 (PDT)
Received: from localhost ([::1]:43362 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces+importer=patchew.org@nongnu.org>)
	id 1oAuT1-0007tj-TJ
	for importer@patchew.org; Mon, 11 Jul 2022 10:32:57 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:42916)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtve-0006cb-EV
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:26 -0400
Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]:51887)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvV-0002qL-Ap
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:25 -0400
Received: by mail-wm1-x32b.google.com with SMTP id ay25so3094935wmb.1
 for <qemu-devel@nongnu.org>; Mon, 11 Jul 2022 06:58:10 -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.07
 for <qemu-devel@nongnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 11 Jul 2022 06:58:08 -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=ZyUf8Y8AINyya8GaLwmXsquW759D0Iw6TfD8Uk3jfYw=;
 b=AGMLIViVqcW/K6c83ny4DWXewdf4TfgKo3bpX7VFV+DJ8fIrT++LTfWUvLxgw77UhM
 3Qwxe5E70ioDW+XtJjttwk7/2oKesYslxjSlA0acsLcUDpAufAXGWSRdqihQK0MYSQm/
 e3QyZLmTty9k6aUUukBCSMpUeN8TQ3uFfoiHn3hrEupBMgC4QXOIY3bEExDhrycYs1+Y
 TE3vklJl81dfK4Iw7rsgik1mXcLJyPz2mGiNj5QguwiaZWENTDdMlFhSVc3MtLz48XLE
 Y1qy6ToC++S7ohxvJtN4gVT3vXsdmBfZ4gXIGqChhaaRE6FWPdjLMWuyZewg9wJUBDwl
 Zw7g==
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=ZyUf8Y8AINyya8GaLwmXsquW759D0Iw6TfD8Uk3jfYw=;
 b=cTx44Vo2IOCXZTdCMXeApiGwMj4HrNAeY6L0Xp8mfwMoh+Czm6Te6w1JWz6nhh3RFi
 we4AnwEPalY+2BU6af/Q3vpfox9FsirrIwGTzfRuiHARiYL25XeRvXn4dviK+MNqG6Xt
 vWhvX80P5SpzkOnUdcHby2j3JMfyZaRKprbIgxLblJ2YQM5BTq1Pc7Okps7VUwEaX9uG
 xzicV1gQDyi/I3Vxu1vr0/VphT/Wp2x+rg8KtOuaBLc2YOjherXWxxhAa0rPdqB7qFIG
 hFmZBQ6gyKoa7F8jz1AHTM1q1QFDU+zfkwU6GVYvjuNiwkBbgjAFWdZL5X/OoVCs2CYm
 oXEA==
X-Gm-Message-State: AJIora8ZXOUxlSF7UGEP2RYYigQ0+R+WfXtQtwuC9jIFDJzxV+O0Wopp
 ZOjj/aOFZxi4HmUnAUC1XAbcoVeqIHP5Kg==
X-Google-Smtp-Source: 
 AGRyM1uoPaE97oX3nEPY8AJM+yq/7htjTA2AhN0tpsDIa+fP33vescwdDKvgStxPxpMZVIOtTrm2aw==
X-Received: by 2002:a7b:c310:0:b0:38c:f07a:e10d with SMTP id
 k16-20020a7bc310000000b0038cf07ae10dmr16441009wmj.110.1657547889167;
 Mon, 11 Jul 2022 06:58:09 -0700 (PDT)
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 20/45] target/arm: Implement SME LD1, ST1
Date: Mon, 11 Jul 2022 14:57:25 +0100
Message-Id: <20220711135750.765803-21-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
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17
 as permitted sender) client-ip=209.51.188.17;
 envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org;
 helo=lists.gnu.org;
Received-SPF: pass client-ip=2a00:1450:4864:20::32b;
 envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32b.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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>
Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org
Sender: "Qemu-devel" <qemu-devel-bounces+importer=patchew.org@nongnu.org>
X-ZohoMail-DKIM: pass (identity @linaro.org)
X-ZM-MESSAGEID: 1657549981479100001
Content-Type: text/plain; charset="utf-8"

From: Richard Henderson <richard.henderson@linaro.org>

We cannot reuse the SVE functions for LD[1-4] and ST[1-4],
because those functions accept only a Zreg register number.
For SME, we want to pass a pointer into ZA storage.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220708151540.18136-21-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 target/arm/helper-sme.h    |  82 +++++
 target/arm/sme.decode      |   9 +
 target/arm/sme_helper.c    | 595 +++++++++++++++++++++++++++++++++++++
 target/arm/translate-sme.c |  70 +++++
 4 files changed, 756 insertions(+)

diff --git a/target/arm/helper-sme.h b/target/arm/helper-sme.h
index 154bc73d2eb..95f6e88bdd4 100644
--- a/target/arm/helper-sme.h
+++ b/target/arm/helper-sme.h
@@ -33,3 +33,85 @@ DEF_HELPER_FLAGS_4(sme_mova_cz_d, TCG_CALL_NO_RWG, void,=
 ptr, ptr, ptr, i32)
 DEF_HELPER_FLAGS_4(sme_mova_zc_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i3=
2)
 DEF_HELPER_FLAGS_4(sme_mova_cz_q, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i3=
2)
 DEF_HELPER_FLAGS_4(sme_mova_zc_q, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i3=
2)
+
+DEF_HELPER_FLAGS_5(sme_ld1b_h, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i3=
2)
+DEF_HELPER_FLAGS_5(sme_ld1b_v, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i3=
2)
+DEF_HELPER_FLAGS_5(sme_ld1b_h_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl=
, i32)
+DEF_HELPER_FLAGS_5(sme_ld1b_v_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl=
, i32)
+
+DEF_HELPER_FLAGS_5(sme_ld1h_be_h, TCG_CALL_NO_WG, void, env, ptr, ptr, tl,=
 i32)
+DEF_HELPER_FLAGS_5(sme_ld1h_le_h, TCG_CALL_NO_WG, void, env, ptr, ptr, tl,=
 i32)
+DEF_HELPER_FLAGS_5(sme_ld1h_be_v, TCG_CALL_NO_WG, void, env, ptr, ptr, tl,=
 i32)
+DEF_HELPER_FLAGS_5(sme_ld1h_le_v, TCG_CALL_NO_WG, void, env, ptr, ptr, tl,=
 i32)
+DEF_HELPER_FLAGS_5(sme_ld1h_be_h_mte, TCG_CALL_NO_WG, void, env, ptr, ptr,=
 tl, i32)
+DEF_HELPER_FLAGS_5(sme_ld1h_le_h_mte, TCG_CALL_NO_WG, void, env, ptr, ptr,=
 tl, i32)
+DEF_HELPER_FLAGS_5(sme_ld1h_be_v_mte, TCG_CALL_NO_WG, void, env, ptr, ptr,=
 tl, i32)
+DEF_HELPER_FLAGS_5(sme_ld1h_le_v_mte, TCG_CALL_NO_WG, void, env, ptr, ptr,=
 tl, i32)
+
+DEF_HELPER_FLAGS_5(sme_ld1s_be_h, TCG_CALL_NO_WG, void, env, ptr, ptr, tl,=
 i32)
+DEF_HELPER_FLAGS_5(sme_ld1s_le_h, TCG_CALL_NO_WG, void, env, ptr, ptr, tl,=
 i32)
+DEF_HELPER_FLAGS_5(sme_ld1s_be_v, TCG_CALL_NO_WG, void, env, ptr, ptr, tl,=
 i32)
+DEF_HELPER_FLAGS_5(sme_ld1s_le_v, TCG_CALL_NO_WG, void, env, ptr, ptr, tl,=
 i32)
+DEF_HELPER_FLAGS_5(sme_ld1s_be_h_mte, TCG_CALL_NO_WG, void, env, ptr, ptr,=
 tl, i32)
+DEF_HELPER_FLAGS_5(sme_ld1s_le_h_mte, TCG_CALL_NO_WG, void, env, ptr, ptr,=
 tl, i32)
+DEF_HELPER_FLAGS_5(sme_ld1s_be_v_mte, TCG_CALL_NO_WG, void, env, ptr, ptr,=
 tl, i32)
+DEF_HELPER_FLAGS_5(sme_ld1s_le_v_mte, TCG_CALL_NO_WG, void, env, ptr, ptr,=
 tl, i32)
+
+DEF_HELPER_FLAGS_5(sme_ld1d_be_h, TCG_CALL_NO_WG, void, env, ptr, ptr, tl,=
 i32)
+DEF_HELPER_FLAGS_5(sme_ld1d_le_h, TCG_CALL_NO_WG, void, env, ptr, ptr, tl,=
 i32)
+DEF_HELPER_FLAGS_5(sme_ld1d_be_v, TCG_CALL_NO_WG, void, env, ptr, ptr, tl,=
 i32)
+DEF_HELPER_FLAGS_5(sme_ld1d_le_v, TCG_CALL_NO_WG, void, env, ptr, ptr, tl,=
 i32)
+DEF_HELPER_FLAGS_5(sme_ld1d_be_h_mte, TCG_CALL_NO_WG, void, env, ptr, ptr,=
 tl, i32)
+DEF_HELPER_FLAGS_5(sme_ld1d_le_h_mte, TCG_CALL_NO_WG, void, env, ptr, ptr,=
 tl, i32)
+DEF_HELPER_FLAGS_5(sme_ld1d_be_v_mte, TCG_CALL_NO_WG, void, env, ptr, ptr,=
 tl, i32)
+DEF_HELPER_FLAGS_5(sme_ld1d_le_v_mte, TCG_CALL_NO_WG, void, env, ptr, ptr,=
 tl, i32)
+
+DEF_HELPER_FLAGS_5(sme_ld1q_be_h, TCG_CALL_NO_WG, void, env, ptr, ptr, tl,=
 i32)
+DEF_HELPER_FLAGS_5(sme_ld1q_le_h, TCG_CALL_NO_WG, void, env, ptr, ptr, tl,=
 i32)
+DEF_HELPER_FLAGS_5(sme_ld1q_be_v, TCG_CALL_NO_WG, void, env, ptr, ptr, tl,=
 i32)
+DEF_HELPER_FLAGS_5(sme_ld1q_le_v, TCG_CALL_NO_WG, void, env, ptr, ptr, tl,=
 i32)
+DEF_HELPER_FLAGS_5(sme_ld1q_be_h_mte, TCG_CALL_NO_WG, void, env, ptr, ptr,=
 tl, i32)
+DEF_HELPER_FLAGS_5(sme_ld1q_le_h_mte, TCG_CALL_NO_WG, void, env, ptr, ptr,=
 tl, i32)
+DEF_HELPER_FLAGS_5(sme_ld1q_be_v_mte, TCG_CALL_NO_WG, void, env, ptr, ptr,=
 tl, i32)
+DEF_HELPER_FLAGS_5(sme_ld1q_le_v_mte, TCG_CALL_NO_WG, void, env, ptr, ptr,=
 tl, i32)
+
+DEF_HELPER_FLAGS_5(sme_st1b_h, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i3=
2)
+DEF_HELPER_FLAGS_5(sme_st1b_v, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i3=
2)
+DEF_HELPER_FLAGS_5(sme_st1b_h_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl=
, i32)
+DEF_HELPER_FLAGS_5(sme_st1b_v_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl=
, i32)
+
+DEF_HELPER_FLAGS_5(sme_st1h_be_h, TCG_CALL_NO_WG, void, env, ptr, ptr, tl,=
 i32)
+DEF_HELPER_FLAGS_5(sme_st1h_le_h, TCG_CALL_NO_WG, void, env, ptr, ptr, tl,=
 i32)
+DEF_HELPER_FLAGS_5(sme_st1h_be_v, TCG_CALL_NO_WG, void, env, ptr, ptr, tl,=
 i32)
+DEF_HELPER_FLAGS_5(sme_st1h_le_v, TCG_CALL_NO_WG, void, env, ptr, ptr, tl,=
 i32)
+DEF_HELPER_FLAGS_5(sme_st1h_be_h_mte, TCG_CALL_NO_WG, void, env, ptr, ptr,=
 tl, i32)
+DEF_HELPER_FLAGS_5(sme_st1h_le_h_mte, TCG_CALL_NO_WG, void, env, ptr, ptr,=
 tl, i32)
+DEF_HELPER_FLAGS_5(sme_st1h_be_v_mte, TCG_CALL_NO_WG, void, env, ptr, ptr,=
 tl, i32)
+DEF_HELPER_FLAGS_5(sme_st1h_le_v_mte, TCG_CALL_NO_WG, void, env, ptr, ptr,=
 tl, i32)
+
+DEF_HELPER_FLAGS_5(sme_st1s_be_h, TCG_CALL_NO_WG, void, env, ptr, ptr, tl,=
 i32)
+DEF_HELPER_FLAGS_5(sme_st1s_le_h, TCG_CALL_NO_WG, void, env, ptr, ptr, tl,=
 i32)
+DEF_HELPER_FLAGS_5(sme_st1s_be_v, TCG_CALL_NO_WG, void, env, ptr, ptr, tl,=
 i32)
+DEF_HELPER_FLAGS_5(sme_st1s_le_v, TCG_CALL_NO_WG, void, env, ptr, ptr, tl,=
 i32)
+DEF_HELPER_FLAGS_5(sme_st1s_be_h_mte, TCG_CALL_NO_WG, void, env, ptr, ptr,=
 tl, i32)
+DEF_HELPER_FLAGS_5(sme_st1s_le_h_mte, TCG_CALL_NO_WG, void, env, ptr, ptr,=
 tl, i32)
+DEF_HELPER_FLAGS_5(sme_st1s_be_v_mte, TCG_CALL_NO_WG, void, env, ptr, ptr,=
 tl, i32)
+DEF_HELPER_FLAGS_5(sme_st1s_le_v_mte, TCG_CALL_NO_WG, void, env, ptr, ptr,=
 tl, i32)
+
+DEF_HELPER_FLAGS_5(sme_st1d_be_h, TCG_CALL_NO_WG, void, env, ptr, ptr, tl,=
 i32)
+DEF_HELPER_FLAGS_5(sme_st1d_le_h, TCG_CALL_NO_WG, void, env, ptr, ptr, tl,=
 i32)
+DEF_HELPER_FLAGS_5(sme_st1d_be_v, TCG_CALL_NO_WG, void, env, ptr, ptr, tl,=
 i32)
+DEF_HELPER_FLAGS_5(sme_st1d_le_v, TCG_CALL_NO_WG, void, env, ptr, ptr, tl,=
 i32)
+DEF_HELPER_FLAGS_5(sme_st1d_be_h_mte, TCG_CALL_NO_WG, void, env, ptr, ptr,=
 tl, i32)
+DEF_HELPER_FLAGS_5(sme_st1d_le_h_mte, TCG_CALL_NO_WG, void, env, ptr, ptr,=
 tl, i32)
+DEF_HELPER_FLAGS_5(sme_st1d_be_v_mte, TCG_CALL_NO_WG, void, env, ptr, ptr,=
 tl, i32)
+DEF_HELPER_FLAGS_5(sme_st1d_le_v_mte, TCG_CALL_NO_WG, void, env, ptr, ptr,=
 tl, i32)
+
+DEF_HELPER_FLAGS_5(sme_st1q_be_h, TCG_CALL_NO_WG, void, env, ptr, ptr, tl,=
 i32)
+DEF_HELPER_FLAGS_5(sme_st1q_le_h, TCG_CALL_NO_WG, void, env, ptr, ptr, tl,=
 i32)
+DEF_HELPER_FLAGS_5(sme_st1q_be_v, TCG_CALL_NO_WG, void, env, ptr, ptr, tl,=
 i32)
+DEF_HELPER_FLAGS_5(sme_st1q_le_v, TCG_CALL_NO_WG, void, env, ptr, ptr, tl,=
 i32)
+DEF_HELPER_FLAGS_5(sme_st1q_be_h_mte, TCG_CALL_NO_WG, void, env, ptr, ptr,=
 tl, i32)
+DEF_HELPER_FLAGS_5(sme_st1q_le_h_mte, TCG_CALL_NO_WG, void, env, ptr, ptr,=
 tl, i32)
+DEF_HELPER_FLAGS_5(sme_st1q_be_v_mte, TCG_CALL_NO_WG, void, env, ptr, ptr,=
 tl, i32)
+DEF_HELPER_FLAGS_5(sme_st1q_le_v_mte, TCG_CALL_NO_WG, void, env, ptr, ptr,=
 tl, i32)
diff --git a/target/arm/sme.decode b/target/arm/sme.decode
index 241b4895b77..900e3f2a077 100644
--- a/target/arm/sme.decode
+++ b/target/arm/sme.decode
@@ -37,3 +37,12 @@ MOVA            11000000 esz:2 00001 0 v:1 .. pg:3 0 za_=
imm:4 zr:5  \
                 &mova to_vec=3D1 rs=3D%mova_rs
 MOVA            11000000 11    00001 1 v:1 .. pg:3 0 za_imm:4 zr:5  \
                 &mova to_vec=3D1 rs=3D%mova_rs esz=3D4
+
+### SME Memory
+
+&ldst           esz rs pg rn rm za_imm v:bool st:bool
+
+LDST1           1110000 0 esz:2 st:1 rm:5 v:1 .. pg:3 rn:5 0 za_imm:4  \
+                &ldst rs=3D%mova_rs
+LDST1           1110000 111     st:1 rm:5 v:1 .. pg:3 rn:5 0 za_imm:4  \
+                &ldst esz=3D4 rs=3D%mova_rs
diff --git a/target/arm/sme_helper.c b/target/arm/sme_helper.c
index e88244423d0..10fd1ed910d 100644
--- a/target/arm/sme_helper.c
+++ b/target/arm/sme_helper.c
@@ -19,10 +19,14 @@
=20
 #include "qemu/osdep.h"
 #include "cpu.h"
+#include "internals.h"
 #include "tcg/tcg-gvec-desc.h"
 #include "exec/helper-proto.h"
+#include "exec/cpu_ldst.h"
+#include "exec/exec-all.h"
 #include "qemu/int128.h"
 #include "vec_internal.h"
+#include "sve_ldst_internal.h"
=20
 /* ResetSVEState */
 void arm_reset_sve_state(CPUARMState *env)
@@ -233,3 +237,594 @@ void HELPER(sme_mova_zc_q)(void *vd, void *za, void *=
vg, uint32_t desc)
 }
=20
 #undef DO_MOVA_Z
+
+/*
+ * Clear elements in a tile slice comprising len bytes.
+ */
+
+typedef void ClearFn(void *ptr, size_t off, size_t len);
+
+static void clear_horizontal(void *ptr, size_t off, size_t len)
+{
+    memset(ptr + off, 0, len);
+}
+
+static void clear_vertical_b(void *vptr, size_t off, size_t len)
+{
+    for (size_t i =3D 0; i < len; ++i) {
+        *(uint8_t *)(vptr + tile_vslice_offset(i + off)) =3D 0;
+    }
+}
+
+static void clear_vertical_h(void *vptr, size_t off, size_t len)
+{
+    for (size_t i =3D 0; i < len; i +=3D 2) {
+        *(uint16_t *)(vptr + tile_vslice_offset(i + off)) =3D 0;
+    }
+}
+
+static void clear_vertical_s(void *vptr, size_t off, size_t len)
+{
+    for (size_t i =3D 0; i < len; i +=3D 4) {
+        *(uint32_t *)(vptr + tile_vslice_offset(i + off)) =3D 0;
+    }
+}
+
+static void clear_vertical_d(void *vptr, size_t off, size_t len)
+{
+    for (size_t i =3D 0; i < len; i +=3D 8) {
+        *(uint64_t *)(vptr + tile_vslice_offset(i + off)) =3D 0;
+    }
+}
+
+static void clear_vertical_q(void *vptr, size_t off, size_t len)
+{
+    for (size_t i =3D 0; i < len; i +=3D 16) {
+        memset(vptr + tile_vslice_offset(i + off), 0, 16);
+    }
+}
+
+/*
+ * Copy elements from an array into a tile slice comprising len bytes.
+ */
+
+typedef void CopyFn(void *dst, const void *src, size_t len);
+
+static void copy_horizontal(void *dst, const void *src, size_t len)
+{
+    memcpy(dst, src, len);
+}
+
+static void copy_vertical_b(void *vdst, const void *vsrc, size_t len)
+{
+    const uint8_t *src =3D vsrc;
+    uint8_t *dst =3D vdst;
+    size_t i;
+
+    for (i =3D 0; i < len; ++i) {
+        dst[tile_vslice_index(i)] =3D src[i];
+    }
+}
+
+static void copy_vertical_h(void *vdst, const void *vsrc, size_t len)
+{
+    const uint16_t *src =3D vsrc;
+    uint16_t *dst =3D vdst;
+    size_t i;
+
+    for (i =3D 0; i < len / 2; ++i) {
+        dst[tile_vslice_index(i)] =3D src[i];
+    }
+}
+
+static void copy_vertical_s(void *vdst, const void *vsrc, size_t len)
+{
+    const uint32_t *src =3D vsrc;
+    uint32_t *dst =3D vdst;
+    size_t i;
+
+    for (i =3D 0; i < len / 4; ++i) {
+        dst[tile_vslice_index(i)] =3D src[i];
+    }
+}
+
+static void copy_vertical_d(void *vdst, const void *vsrc, size_t len)
+{
+    const uint64_t *src =3D vsrc;
+    uint64_t *dst =3D vdst;
+    size_t i;
+
+    for (i =3D 0; i < len / 8; ++i) {
+        dst[tile_vslice_index(i)] =3D src[i];
+    }
+}
+
+static void copy_vertical_q(void *vdst, const void *vsrc, size_t len)
+{
+    for (size_t i =3D 0; i < len; i +=3D 16) {
+        memcpy(vdst + tile_vslice_offset(i), vsrc + i, 16);
+    }
+}
+
+/*
+ * Host and TLB primitives for vertical tile slice addressing.
+ */
+
+#define DO_LD(NAME, TYPE, HOST, TLB)                                      =
  \
+static inline void sme_##NAME##_v_host(void *za, intptr_t off, void *host)=
  \
+{                                                                         =
  \
+    TYPE val =3D HOST(host);                                              =
    \
+    *(TYPE *)(za + tile_vslice_offset(off)) =3D val;                      =
    \
+}                                                                         =
  \
+static inline void sme_##NAME##_v_tlb(CPUARMState *env, void *za,         =
  \
+                        intptr_t off, target_ulong addr, uintptr_t ra)    =
  \
+{                                                                         =
  \
+    TYPE val =3D TLB(env, useronly_clean_ptr(addr), ra);                  =
    \
+    *(TYPE *)(za + tile_vslice_offset(off)) =3D val;                      =
    \
+}
+
+#define DO_ST(NAME, TYPE, HOST, TLB)                                      =
  \
+static inline void sme_##NAME##_v_host(void *za, intptr_t off, void *host)=
  \
+{                                                                         =
  \
+    TYPE val =3D *(TYPE *)(za + tile_vslice_offset(off));                 =
    \
+    HOST(host, val);                                                      =
  \
+}                                                                         =
  \
+static inline void sme_##NAME##_v_tlb(CPUARMState *env, void *za,         =
  \
+                        intptr_t off, target_ulong addr, uintptr_t ra)    =
  \
+{                                                                         =
  \
+    TYPE val =3D *(TYPE *)(za + tile_vslice_offset(off));                 =
    \
+    TLB(env, useronly_clean_ptr(addr), val, ra);                          =
  \
+}
+
+/*
+ * The ARMVectorReg elements are stored in host-endian 64-bit units.
+ * For 128-bit quantities, the sequence defined by the Elem[] pseudocode
+ * corresponds to storing the two 64-bit pieces in little-endian order.
+ */
+#define DO_LDQ(HNAME, VNAME, BE, HOST, TLB)                               =
  \
+static inline void HNAME##_host(void *za, intptr_t off, void *host)       =
  \
+{                                                                         =
  \
+    uint64_t val0 =3D HOST(host), val1 =3D HOST(host + 8);                =
      \
+    uint64_t *ptr =3D za + off;                                           =
    \
+    ptr[0] =3D BE ? val1 : val0, ptr[1] =3D BE ? val0 : val1;             =
      \
+}                                                                         =
  \
+static inline void VNAME##_v_host(void *za, intptr_t off, void *host)     =
  \
+{                                                                         =
  \
+    HNAME##_host(za, tile_vslice_offset(off), host);                      =
  \
+}                                                                         =
  \
+static inline void HNAME##_tlb(CPUARMState *env, void *za, intptr_t off,  =
  \
+                               target_ulong addr, uintptr_t ra)           =
  \
+{                                                                         =
  \
+    uint64_t val0 =3D TLB(env, useronly_clean_ptr(addr), ra);             =
    \
+    uint64_t val1 =3D TLB(env, useronly_clean_ptr(addr + 8), ra);         =
    \
+    uint64_t *ptr =3D za + off;                                           =
    \
+    ptr[0] =3D BE ? val1 : val0, ptr[1] =3D BE ? val0 : val1;             =
      \
+}                                                                         =
  \
+static inline void VNAME##_v_tlb(CPUARMState *env, void *za, intptr_t off,=
  \
+                               target_ulong addr, uintptr_t ra)           =
  \
+{                                                                         =
  \
+    HNAME##_tlb(env, za, tile_vslice_offset(off), addr, ra);              =
  \
+}
+
+#define DO_STQ(HNAME, VNAME, BE, HOST, TLB)                               =
  \
+static inline void HNAME##_host(void *za, intptr_t off, void *host)       =
  \
+{                                                                         =
  \
+    uint64_t *ptr =3D za + off;                                           =
    \
+    HOST(host, ptr[BE]);                                                  =
  \
+    HOST(host + 1, ptr[!BE]);                                             =
  \
+}                                                                         =
  \
+static inline void VNAME##_v_host(void *za, intptr_t off, void *host)     =
  \
+{                                                                         =
  \
+    HNAME##_host(za, tile_vslice_offset(off), host);                      =
  \
+}                                                                         =
  \
+static inline void HNAME##_tlb(CPUARMState *env, void *za, intptr_t off,  =
  \
+                               target_ulong addr, uintptr_t ra)           =
  \
+{                                                                         =
  \
+    uint64_t *ptr =3D za + off;                                           =
    \
+    TLB(env, useronly_clean_ptr(addr), ptr[BE], ra);                      =
  \
+    TLB(env, useronly_clean_ptr(addr + 8), ptr[!BE], ra);                 =
  \
+}                                                                         =
  \
+static inline void VNAME##_v_tlb(CPUARMState *env, void *za, intptr_t off,=
  \
+                               target_ulong addr, uintptr_t ra)           =
  \
+{                                                                         =
  \
+    HNAME##_tlb(env, za, tile_vslice_offset(off), addr, ra);              =
  \
+}
+
+DO_LD(ld1b, uint8_t, ldub_p, cpu_ldub_data_ra)
+DO_LD(ld1h_be, uint16_t, lduw_be_p, cpu_lduw_be_data_ra)
+DO_LD(ld1h_le, uint16_t, lduw_le_p, cpu_lduw_le_data_ra)
+DO_LD(ld1s_be, uint32_t, ldl_be_p, cpu_ldl_be_data_ra)
+DO_LD(ld1s_le, uint32_t, ldl_le_p, cpu_ldl_le_data_ra)
+DO_LD(ld1d_be, uint64_t, ldq_be_p, cpu_ldq_be_data_ra)
+DO_LD(ld1d_le, uint64_t, ldq_le_p, cpu_ldq_le_data_ra)
+
+DO_LDQ(sve_ld1qq_be, sme_ld1q_be, 1, ldq_be_p, cpu_ldq_be_data_ra)
+DO_LDQ(sve_ld1qq_le, sme_ld1q_le, 0, ldq_le_p, cpu_ldq_le_data_ra)
+
+DO_ST(st1b, uint8_t, stb_p, cpu_stb_data_ra)
+DO_ST(st1h_be, uint16_t, stw_be_p, cpu_stw_be_data_ra)
+DO_ST(st1h_le, uint16_t, stw_le_p, cpu_stw_le_data_ra)
+DO_ST(st1s_be, uint32_t, stl_be_p, cpu_stl_be_data_ra)
+DO_ST(st1s_le, uint32_t, stl_le_p, cpu_stl_le_data_ra)
+DO_ST(st1d_be, uint64_t, stq_be_p, cpu_stq_be_data_ra)
+DO_ST(st1d_le, uint64_t, stq_le_p, cpu_stq_le_data_ra)
+
+DO_STQ(sve_st1qq_be, sme_st1q_be, 1, stq_be_p, cpu_stq_be_data_ra)
+DO_STQ(sve_st1qq_le, sme_st1q_le, 0, stq_le_p, cpu_stq_le_data_ra)
+
+#undef DO_LD
+#undef DO_ST
+#undef DO_LDQ
+#undef DO_STQ
+
+/*
+ * Common helper for all contiguous predicated loads.
+ */
+
+static inline QEMU_ALWAYS_INLINE
+void sme_ld1(CPUARMState *env, void *za, uint64_t *vg,
+             const target_ulong addr, uint32_t desc, const uintptr_t ra,
+             const int esz, uint32_t mtedesc, bool vertical,
+             sve_ldst1_host_fn *host_fn,
+             sve_ldst1_tlb_fn *tlb_fn,
+             ClearFn *clr_fn,
+             CopyFn *cpy_fn)
+{
+    const intptr_t reg_max =3D simd_oprsz(desc);
+    const intptr_t esize =3D 1 << esz;
+    intptr_t reg_off, reg_last;
+    SVEContLdSt info;
+    void *host;
+    int flags;
+
+    /* Find the active elements.  */
+    if (!sve_cont_ldst_elements(&info, addr, vg, reg_max, esz, esize)) {
+        /* The entire predicate was false; no load occurs.  */
+        clr_fn(za, 0, reg_max);
+        return;
+    }
+
+    /* Probe the page(s).  Exit with exception for any invalid page. */
+    sve_cont_ldst_pages(&info, FAULT_ALL, env, addr, MMU_DATA_LOAD, ra);
+
+    /* Handle watchpoints for all active elements. */
+    sve_cont_ldst_watchpoints(&info, env, vg, addr, esize, esize,
+                              BP_MEM_READ, ra);
+
+    /*
+     * Handle mte checks for all active elements.
+     * Since TBI must be set for MTE, !mtedesc =3D> !mte_active.
+     */
+    if (mtedesc) {
+        sve_cont_ldst_mte_check(&info, env, vg, addr, esize, esize,
+                                mtedesc, ra);
+    }
+
+    flags =3D info.page[0].flags | info.page[1].flags;
+    if (unlikely(flags !=3D 0)) {
+#ifdef CONFIG_USER_ONLY
+        g_assert_not_reached();
+#else
+        /*
+         * At least one page includes MMIO.
+         * Any bus operation can fail with cpu_transaction_failed,
+         * which for ARM will raise SyncExternal.  Perform the load
+         * into scratch memory to preserve register state until the end.
+         */
+        ARMVectorReg scratch =3D { };
+
+        reg_off =3D info.reg_off_first[0];
+        reg_last =3D info.reg_off_last[1];
+        if (reg_last < 0) {
+            reg_last =3D info.reg_off_split;
+            if (reg_last < 0) {
+                reg_last =3D info.reg_off_last[0];
+            }
+        }
+
+        do {
+            uint64_t pg =3D vg[reg_off >> 6];
+            do {
+                if ((pg >> (reg_off & 63)) & 1) {
+                    tlb_fn(env, &scratch, reg_off, addr + reg_off, ra);
+                }
+                reg_off +=3D esize;
+            } while (reg_off & 63);
+        } while (reg_off <=3D reg_last);
+
+        cpy_fn(za, &scratch, reg_max);
+        return;
+#endif
+    }
+
+    /* The entire operation is in RAM, on valid pages. */
+
+    reg_off =3D info.reg_off_first[0];
+    reg_last =3D info.reg_off_last[0];
+    host =3D info.page[0].host;
+
+    if (!vertical) {
+        memset(za, 0, reg_max);
+    } else if (reg_off) {
+        clr_fn(za, 0, reg_off);
+    }
+
+    while (reg_off <=3D reg_last) {
+        uint64_t pg =3D vg[reg_off >> 6];
+        do {
+            if ((pg >> (reg_off & 63)) & 1) {
+                host_fn(za, reg_off, host + reg_off);
+            } else if (vertical) {
+                clr_fn(za, reg_off, esize);
+            }
+            reg_off +=3D esize;
+        } while (reg_off <=3D reg_last && (reg_off & 63));
+    }
+
+    /*
+     * Use the slow path to manage the cross-page misalignment.
+     * But we know this is RAM and cannot trap.
+     */
+    reg_off =3D info.reg_off_split;
+    if (unlikely(reg_off >=3D 0)) {
+        tlb_fn(env, za, reg_off, addr + reg_off, ra);
+    }
+
+    reg_off =3D info.reg_off_first[1];
+    if (unlikely(reg_off >=3D 0)) {
+        reg_last =3D info.reg_off_last[1];
+        host =3D info.page[1].host;
+
+        do {
+            uint64_t pg =3D vg[reg_off >> 6];
+            do {
+                if ((pg >> (reg_off & 63)) & 1) {
+                    host_fn(za, reg_off, host + reg_off);
+                } else if (vertical) {
+                    clr_fn(za, reg_off, esize);
+                }
+                reg_off +=3D esize;
+            } while (reg_off & 63);
+        } while (reg_off <=3D reg_last);
+    }
+}
+
+static inline QEMU_ALWAYS_INLINE
+void sme_ld1_mte(CPUARMState *env, void *za, uint64_t *vg,
+                 target_ulong addr, uint32_t desc, uintptr_t ra,
+                 const int esz, bool vertical,
+                 sve_ldst1_host_fn *host_fn,
+                 sve_ldst1_tlb_fn *tlb_fn,
+                 ClearFn *clr_fn,
+                 CopyFn *cpy_fn)
+{
+    uint32_t mtedesc =3D desc >> (SIMD_DATA_SHIFT + SVE_MTEDESC_SHIFT);
+    int bit55 =3D extract64(addr, 55, 1);
+
+    /* Remove mtedesc from the normal sve descriptor. */
+    desc =3D extract32(desc, 0, SIMD_DATA_SHIFT + SVE_MTEDESC_SHIFT);
+
+    /* Perform gross MTE suppression early. */
+    if (!tbi_check(desc, bit55) ||
+        tcma_check(desc, bit55, allocation_tag_from_addr(addr))) {
+        mtedesc =3D 0;
+    }
+
+    sme_ld1(env, za, vg, addr, desc, ra, esz, mtedesc, vertical,
+            host_fn, tlb_fn, clr_fn, cpy_fn);
+}
+
+#define DO_LD(L, END, ESZ)                                                =
 \
+void HELPER(sme_ld1##L##END##_h)(CPUARMState *env, void *za, void *vg,    =
 \
+                                 target_ulong addr, uint32_t desc)        =
 \
+{                                                                         =
 \
+    sme_ld1(env, za, vg, addr, desc, GETPC(), ESZ, 0, false,              =
 \
+            sve_ld1##L##L##END##_host, sve_ld1##L##L##END##_tlb,          =
 \
+            clear_horizontal, copy_horizontal);                           =
 \
+}                                                                         =
 \
+void HELPER(sme_ld1##L##END##_v)(CPUARMState *env, void *za, void *vg,    =
 \
+                                 target_ulong addr, uint32_t desc)        =
 \
+{                                                                         =
 \
+    sme_ld1(env, za, vg, addr, desc, GETPC(), ESZ, 0, true,               =
 \
+            sme_ld1##L##END##_v_host, sme_ld1##L##END##_v_tlb,            =
 \
+            clear_vertical_##L, copy_vertical_##L);                       =
 \
+}                                                                         =
 \
+void HELPER(sme_ld1##L##END##_h_mte)(CPUARMState *env, void *za, void *vg,=
 \
+                                     target_ulong addr, uint32_t desc)    =
 \
+{                                                                         =
 \
+    sme_ld1_mte(env, za, vg, addr, desc, GETPC(), ESZ, false,             =
 \
+                sve_ld1##L##L##END##_host, sve_ld1##L##L##END##_tlb,      =
 \
+                clear_horizontal, copy_horizontal);                       =
 \
+}                                                                         =
 \
+void HELPER(sme_ld1##L##END##_v_mte)(CPUARMState *env, void *za, void *vg,=
 \
+                                     target_ulong addr, uint32_t desc)    =
 \
+{                                                                         =
 \
+    sme_ld1_mte(env, za, vg, addr, desc, GETPC(), ESZ, true,              =
 \
+                sme_ld1##L##END##_v_host, sme_ld1##L##END##_v_tlb,        =
 \
+                clear_vertical_##L, copy_vertical_##L);                   =
 \
+}
+
+DO_LD(b, , MO_8)
+DO_LD(h, _be, MO_16)
+DO_LD(h, _le, MO_16)
+DO_LD(s, _be, MO_32)
+DO_LD(s, _le, MO_32)
+DO_LD(d, _be, MO_64)
+DO_LD(d, _le, MO_64)
+DO_LD(q, _be, MO_128)
+DO_LD(q, _le, MO_128)
+
+#undef DO_LD
+
+/*
+ * Common helper for all contiguous predicated stores.
+ */
+
+static inline QEMU_ALWAYS_INLINE
+void sme_st1(CPUARMState *env, void *za, uint64_t *vg,
+             const target_ulong addr, uint32_t desc, const uintptr_t ra,
+             const int esz, uint32_t mtedesc, bool vertical,
+             sve_ldst1_host_fn *host_fn,
+             sve_ldst1_tlb_fn *tlb_fn)
+{
+    const intptr_t reg_max =3D simd_oprsz(desc);
+    const intptr_t esize =3D 1 << esz;
+    intptr_t reg_off, reg_last;
+    SVEContLdSt info;
+    void *host;
+    int flags;
+
+    /* Find the active elements.  */
+    if (!sve_cont_ldst_elements(&info, addr, vg, reg_max, esz, esize)) {
+        /* The entire predicate was false; no store occurs.  */
+        return;
+    }
+
+    /* Probe the page(s).  Exit with exception for any invalid page. */
+    sve_cont_ldst_pages(&info, FAULT_ALL, env, addr, MMU_DATA_STORE, ra);
+
+    /* Handle watchpoints for all active elements. */
+    sve_cont_ldst_watchpoints(&info, env, vg, addr, esize, esize,
+                              BP_MEM_WRITE, ra);
+
+    /*
+     * Handle mte checks for all active elements.
+     * Since TBI must be set for MTE, !mtedesc =3D> !mte_active.
+     */
+    if (mtedesc) {
+        sve_cont_ldst_mte_check(&info, env, vg, addr, esize, esize,
+                                mtedesc, ra);
+    }
+
+    flags =3D info.page[0].flags | info.page[1].flags;
+    if (unlikely(flags !=3D 0)) {
+#ifdef CONFIG_USER_ONLY
+        g_assert_not_reached();
+#else
+        /*
+         * At least one page includes MMIO.
+         * Any bus operation can fail with cpu_transaction_failed,
+         * which for ARM will raise SyncExternal.  We cannot avoid
+         * this fault and will leave with the store incomplete.
+         */
+        reg_off =3D info.reg_off_first[0];
+        reg_last =3D info.reg_off_last[1];
+        if (reg_last < 0) {
+            reg_last =3D info.reg_off_split;
+            if (reg_last < 0) {
+                reg_last =3D info.reg_off_last[0];
+            }
+        }
+
+        do {
+            uint64_t pg =3D vg[reg_off >> 6];
+            do {
+                if ((pg >> (reg_off & 63)) & 1) {
+                    tlb_fn(env, za, reg_off, addr + reg_off, ra);
+                }
+                reg_off +=3D esize;
+            } while (reg_off & 63);
+        } while (reg_off <=3D reg_last);
+        return;
+#endif
+    }
+
+    reg_off =3D info.reg_off_first[0];
+    reg_last =3D info.reg_off_last[0];
+    host =3D info.page[0].host;
+
+    while (reg_off <=3D reg_last) {
+        uint64_t pg =3D vg[reg_off >> 6];
+        do {
+            if ((pg >> (reg_off & 63)) & 1) {
+                host_fn(za, reg_off, host + reg_off);
+            }
+            reg_off +=3D 1 << esz;
+        } while (reg_off <=3D reg_last && (reg_off & 63));
+    }
+
+    /*
+     * Use the slow path to manage the cross-page misalignment.
+     * But we know this is RAM and cannot trap.
+     */
+    reg_off =3D info.reg_off_split;
+    if (unlikely(reg_off >=3D 0)) {
+        tlb_fn(env, za, reg_off, addr + reg_off, ra);
+    }
+
+    reg_off =3D info.reg_off_first[1];
+    if (unlikely(reg_off >=3D 0)) {
+        reg_last =3D info.reg_off_last[1];
+        host =3D info.page[1].host;
+
+        do {
+            uint64_t pg =3D vg[reg_off >> 6];
+            do {
+                if ((pg >> (reg_off & 63)) & 1) {
+                    host_fn(za, reg_off, host + reg_off);
+                }
+                reg_off +=3D 1 << esz;
+            } while (reg_off & 63);
+        } while (reg_off <=3D reg_last);
+    }
+}
+
+static inline QEMU_ALWAYS_INLINE
+void sme_st1_mte(CPUARMState *env, void *za, uint64_t *vg, target_ulong ad=
dr,
+                 uint32_t desc, uintptr_t ra, int esz, bool vertical,
+                 sve_ldst1_host_fn *host_fn,
+                 sve_ldst1_tlb_fn *tlb_fn)
+{
+    uint32_t mtedesc =3D desc >> (SIMD_DATA_SHIFT + SVE_MTEDESC_SHIFT);
+    int bit55 =3D extract64(addr, 55, 1);
+
+    /* Remove mtedesc from the normal sve descriptor. */
+    desc =3D extract32(desc, 0, SIMD_DATA_SHIFT + SVE_MTEDESC_SHIFT);
+
+    /* Perform gross MTE suppression early. */
+    if (!tbi_check(desc, bit55) ||
+        tcma_check(desc, bit55, allocation_tag_from_addr(addr))) {
+        mtedesc =3D 0;
+    }
+
+    sme_st1(env, za, vg, addr, desc, ra, esz, mtedesc,
+            vertical, host_fn, tlb_fn);
+}
+
+#define DO_ST(L, END, ESZ)                                                =
 \
+void HELPER(sme_st1##L##END##_h)(CPUARMState *env, void *za, void *vg,    =
 \
+                                 target_ulong addr, uint32_t desc)        =
 \
+{                                                                         =
 \
+    sme_st1(env, za, vg, addr, desc, GETPC(), ESZ, 0, false,              =
 \
+            sve_st1##L##L##END##_host, sve_st1##L##L##END##_tlb);         =
 \
+}                                                                         =
 \
+void HELPER(sme_st1##L##END##_v)(CPUARMState *env, void *za, void *vg,    =
 \
+                                 target_ulong addr, uint32_t desc)        =
 \
+{                                                                         =
 \
+    sme_st1(env, za, vg, addr, desc, GETPC(), ESZ, 0, true,               =
 \
+            sme_st1##L##END##_v_host, sme_st1##L##END##_v_tlb);           =
 \
+}                                                                         =
 \
+void HELPER(sme_st1##L##END##_h_mte)(CPUARMState *env, void *za, void *vg,=
 \
+                                     target_ulong addr, uint32_t desc)    =
 \
+{                                                                         =
 \
+    sme_st1_mte(env, za, vg, addr, desc, GETPC(), ESZ, false,             =
 \
+                sve_st1##L##L##END##_host, sve_st1##L##L##END##_tlb);     =
 \
+}                                                                         =
 \
+void HELPER(sme_st1##L##END##_v_mte)(CPUARMState *env, void *za, void *vg,=
 \
+                                     target_ulong addr, uint32_t desc)    =
 \
+{                                                                         =
 \
+    sme_st1_mte(env, za, vg, addr, desc, GETPC(), ESZ, true,              =
 \
+                sme_st1##L##END##_v_host, sme_st1##L##END##_v_tlb);       =
 \
+}
+
+DO_ST(b, , MO_8)
+DO_ST(h, _be, MO_16)
+DO_ST(h, _le, MO_16)
+DO_ST(s, _be, MO_32)
+DO_ST(s, _le, MO_32)
+DO_ST(d, _be, MO_64)
+DO_ST(d, _le, MO_64)
+DO_ST(q, _be, MO_128)
+DO_ST(q, _le, MO_128)
+
+#undef DO_ST
diff --git a/target/arm/translate-sme.c b/target/arm/translate-sme.c
index 79c33d35c2b..42d14b883ab 100644
--- a/target/arm/translate-sme.c
+++ b/target/arm/translate-sme.c
@@ -173,3 +173,73 @@ static bool trans_MOVA(DisasContext *s, arg_MOVA *a)
=20
     return true;
 }
+
+static bool trans_LDST1(DisasContext *s, arg_LDST1 *a)
+{
+    typedef void GenLdSt1(TCGv_env, TCGv_ptr, TCGv_ptr, TCGv, TCGv_i32);
+
+    /*
+     * Indexed by [esz][be][v][mte][st], which is (except for load/store)
+     * also the order in which the elements appear in the function names,
+     * and so how we must concatenate the pieces.
+     */
+
+#define FN_LS(F)     { gen_helper_sme_ld1##F, gen_helper_sme_st1##F }
+#define FN_MTE(F)    { FN_LS(F), FN_LS(F##_mte) }
+#define FN_HV(F)     { FN_MTE(F##_h), FN_MTE(F##_v) }
+#define FN_END(L, B) { FN_HV(L), FN_HV(B) }
+
+    static GenLdSt1 * const fns[5][2][2][2][2] =3D {
+        FN_END(b, b),
+        FN_END(h_le, h_be),
+        FN_END(s_le, s_be),
+        FN_END(d_le, d_be),
+        FN_END(q_le, q_be),
+    };
+
+#undef FN_LS
+#undef FN_MTE
+#undef FN_HV
+#undef FN_END
+
+    TCGv_ptr t_za, t_pg;
+    TCGv_i64 addr;
+    int svl, desc =3D 0;
+    bool be =3D s->be_data =3D=3D MO_BE;
+    bool mte =3D s->mte_active[0];
+
+    if (!dc_isar_feature(aa64_sme, s)) {
+        return false;
+    }
+    if (!sme_smza_enabled_check(s)) {
+        return true;
+    }
+
+    t_za =3D get_tile_rowcol(s, a->esz, a->rs, a->za_imm, a->v);
+    t_pg =3D pred_full_reg_ptr(s, a->pg);
+    addr =3D tcg_temp_new_i64();
+
+    tcg_gen_shli_i64(addr, cpu_reg(s, a->rm), a->esz);
+    tcg_gen_add_i64(addr, addr, cpu_reg_sp(s, a->rn));
+
+    if (mte) {
+        desc =3D FIELD_DP32(desc, MTEDESC, MIDX, get_mem_index(s));
+        desc =3D FIELD_DP32(desc, MTEDESC, TBI, s->tbid);
+        desc =3D FIELD_DP32(desc, MTEDESC, TCMA, s->tcma);
+        desc =3D FIELD_DP32(desc, MTEDESC, WRITE, a->st);
+        desc =3D FIELD_DP32(desc, MTEDESC, SIZEM1, (1 << a->esz) - 1);
+        desc <<=3D SVE_MTEDESC_SHIFT;
+    } else {
+        addr =3D clean_data_tbi(s, addr);
+    }
+    svl =3D streaming_vec_reg_size(s);
+    desc =3D simd_desc(svl, svl, desc);
+
+    fns[a->esz][be][a->v][mte][a->st](cpu_env, t_za, t_pg, addr,
+                                      tcg_constant_i32(desc));
+
+    tcg_temp_free_ptr(t_za);
+    tcg_temp_free_ptr(t_pg);
+    tcg_temp_free_i64(addr);
+    return true;
+}
--=20
2.25.1
From nobody Thu May  8 21:38:42 2025
Delivered-To: importer@patchew.org
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass(p=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1657548526; cv=none;
	d=zohomail.com; s=zohoarc;
	b=DEnJ0vZR1DQ6KtIFSKrkNgzAMs2Z5Fv0CYV36gUOphchncabkRfCQiIcMUIhFn5HSsPrX7PAcis+b82mjWPW8YJgC1YaKwAV5QBx52iOgCmfvtQQUQBIFKNsOpqjaD6IYbobJzkRumMkehDJzo1Y130BOzcvBqYbBGHFUsF/hHY=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1657548526;
 h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
	bh=R6i7MnDmgZ9TGTFifqojFktd9bEi6hBbq+TpHvZPZLY=;
	b=fns90n0JssB/WgMTJN8QhgOZwVPrEhamMlPh9pz5WPe0e1IE58V2aDSs3Y+qINMP36kSJzT6dRAVjokSRXILkJRsegFfeWcDYuY204nM7batAHgRo0VkNTZglx6g8F5JQFGyUhBhbE20qbAGmifMhtvfEkWqQ8l9TLGCOSLPv0M=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass header.from=<peter.maydell@linaro.org> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1657548526069673.0802224791763;
 Mon, 11 Jul 2022 07:08:46 -0700 (PDT)
Received: from localhost ([::1]:33514 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces+importer=patchew.org@nongnu.org>)
	id 1oAu5c-0004mH-7r
	for importer@patchew.org; Mon, 11 Jul 2022 10:08:44 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:42752)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvV-0006Z4-Qh
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:18 -0400
Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]:35646)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvS-0002qO-DW
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:17 -0400
Received: by mail-wm1-x32f.google.com with SMTP id
 v67-20020a1cac46000000b003a1888b9d36so5082456wme.0
 for <qemu-devel@nongnu.org>; Mon, 11 Jul 2022 06:58:11 -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.09
 for <qemu-devel@nongnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 11 Jul 2022 06:58:09 -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=R6i7MnDmgZ9TGTFifqojFktd9bEi6hBbq+TpHvZPZLY=;
 b=euk51xoMJ8RP9V4l8neZXjW/NGZAlvlIeId+35IU2KS3yW0oDg05j1iNjOuJbGcLKv
 s/jghaAfkFKsbjG2EYYr5wb8XfC1VLl5QUX1/bj9zjN0264FrId6E7Fke6q/td7c1skZ
 Hn40kYMTdMJKCfKfBS5dDLgMugIL/FxgpAo48YhiUQWAttzBw41Y1ZikTfq1oeBN/8hg
 Zbk9FURlct73gnGh1oJrMFNX07epw+kfclsX6Xuiqg8egiKaNibVlz/OEQx1K+S6RSx8
 gJiEFVn4A+1h5FtFNaabO30YXzkpJsGm13Jlx3TAjbDybWa+8KVC7mGw49pMOWyhzkgZ
 sNRw==
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=R6i7MnDmgZ9TGTFifqojFktd9bEi6hBbq+TpHvZPZLY=;
 b=BvGRBJA9OQITabvZNUzMFrZw7dHrPTn2YJjWR4AniDdNBJmYp2fCWh3eG0lfK/+q7D
 AVXcb08p2kEYMBgyS18LDGGS+nUTc+5xNXQW4gwsil+DJ0PWPKCkYpX+yi5/37JDVeAw
 XcT5Mv25ONuUsO3DRlDvu3bJxZllZx4fu/PV8sjWvctQ6IizLUtUNXCeydLYn7GjZiLb
 k/5+PNSPnadDDj9aoofHLk03AGrgkmjWpo/PSkdtKa8YXKlq8WnYz9RdkeXL+MwoV530
 qnUOxRkEsVHy0Cj5LmIbQnqvBLbP7G2+BvTKTvmhy+ZTSO7n/BDknPbN0HBx0SQyhjU3
 1MSg==
X-Gm-Message-State: AJIora98mx1uZhX290SWmaUpUxjMeYoUjBYv1eQh+MLds74WgysNnLEv
 DRYlvYhbhZYyPcUuhtdre0EV0BFBAvhWyg==
X-Google-Smtp-Source: 
 AGRyM1ulvWmtunbRIqZ3KQc8aBiBQs7FVHWsYxD5geEPVw4lYVzTlt+NTAtcISuH4tbuCiVOHFd83Q==
X-Received: by 2002:a05:600c:3b8d:b0:3a2:ea2b:d0f9 with SMTP id
 n13-20020a05600c3b8d00b003a2ea2bd0f9mr1572938wms.120.1657547890184;
 Mon, 11 Jul 2022 06:58:10 -0700 (PDT)
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 21/45] target/arm: Export unpredicated ld/st from
 translate-sve.c
Date: Mon, 11 Jul 2022 14:57:26 +0100
Message-Id: <20220711135750.765803-22-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
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17
 as permitted sender) client-ip=209.51.188.17;
 envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org;
 helo=lists.gnu.org;
Received-SPF: pass client-ip=2a00:1450:4864:20::32f;
 envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32f.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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>
Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org
Sender: "Qemu-devel" <qemu-devel-bounces+importer=patchew.org@nongnu.org>
X-ZohoMail-DKIM: pass (identity @linaro.org)
X-ZM-MESSAGEID: 1657548527450100001
Content-Type: text/plain; charset="utf-8"

From: Richard Henderson <richard.henderson@linaro.org>

Add a TCGv_ptr base argument, which will be cpu_env for SVE.
We will reuse this for SME save and restore array insns.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220708151540.18136-22-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 target/arm/translate-a64.h |  3 +++
 target/arm/translate-sve.c | 48 ++++++++++++++++++++++++++++----------
 2 files changed, 39 insertions(+), 12 deletions(-)

diff --git a/target/arm/translate-a64.h b/target/arm/translate-a64.h
index 2a7fe6e9e7f..ad3762d1acf 100644
--- a/target/arm/translate-a64.h
+++ b/target/arm/translate-a64.h
@@ -195,4 +195,7 @@ void gen_gvec_xar(unsigned vece, uint32_t rd_ofs, uint3=
2_t rn_ofs,
                   uint32_t rm_ofs, int64_t shift,
                   uint32_t opr_sz, uint32_t max_sz);
=20
+void gen_sve_ldr(DisasContext *s, TCGv_ptr, int vofs, int len, int rn, int=
 imm);
+void gen_sve_str(DisasContext *s, TCGv_ptr, int vofs, int len, int rn, int=
 imm);
+
 #endif /* TARGET_ARM_TRANSLATE_A64_H */
diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c
index 95016e49e9d..fd1a1736374 100644
--- a/target/arm/translate-sve.c
+++ b/target/arm/translate-sve.c
@@ -4306,7 +4306,8 @@ TRANS_FEAT(UCVTF_dd, aa64_sve, gen_gvec_fpst_arg_zpz,
  * The load should begin at the address Rn + IMM.
  */
=20
-static void do_ldr(DisasContext *s, uint32_t vofs, int len, int rn, int im=
m)
+void gen_sve_ldr(DisasContext *s, TCGv_ptr base, int vofs,
+                 int len, int rn, int imm)
 {
     int len_align =3D QEMU_ALIGN_DOWN(len, 8);
     int len_remain =3D len % 8;
@@ -4332,7 +4333,7 @@ static void do_ldr(DisasContext *s, uint32_t vofs, in=
t len, int rn, int imm)
         t0 =3D tcg_temp_new_i64();
         for (i =3D 0; i < len_align; i +=3D 8) {
             tcg_gen_qemu_ld_i64(t0, clean_addr, midx, MO_LEUQ);
-            tcg_gen_st_i64(t0, cpu_env, vofs + i);
+            tcg_gen_st_i64(t0, base, vofs + i);
             tcg_gen_addi_i64(clean_addr, clean_addr, 8);
         }
         tcg_temp_free_i64(t0);
@@ -4345,6 +4346,12 @@ static void do_ldr(DisasContext *s, uint32_t vofs, i=
nt len, int rn, int imm)
         clean_addr =3D new_tmp_a64_local(s);
         tcg_gen_mov_i64(clean_addr, t0);
=20
+        if (base !=3D cpu_env) {
+            TCGv_ptr b =3D tcg_temp_local_new_ptr();
+            tcg_gen_mov_ptr(b, base);
+            base =3D b;
+        }
+
         gen_set_label(loop);
=20
         t0 =3D tcg_temp_new_i64();
@@ -4352,7 +4359,7 @@ static void do_ldr(DisasContext *s, uint32_t vofs, in=
t len, int rn, int imm)
         tcg_gen_addi_i64(clean_addr, clean_addr, 8);
=20
         tp =3D tcg_temp_new_ptr();
-        tcg_gen_add_ptr(tp, cpu_env, i);
+        tcg_gen_add_ptr(tp, base, i);
         tcg_gen_addi_ptr(i, i, 8);
         tcg_gen_st_i64(t0, tp, vofs);
         tcg_temp_free_ptr(tp);
@@ -4360,6 +4367,11 @@ static void do_ldr(DisasContext *s, uint32_t vofs, i=
nt len, int rn, int imm)
=20
         tcg_gen_brcondi_ptr(TCG_COND_LTU, i, len_align, loop);
         tcg_temp_free_ptr(i);
+
+        if (base !=3D cpu_env) {
+            tcg_temp_free_ptr(base);
+            assert(len_remain =3D=3D 0);
+        }
     }
=20
     /*
@@ -4388,13 +4400,14 @@ static void do_ldr(DisasContext *s, uint32_t vofs, =
int len, int rn, int imm)
         default:
             g_assert_not_reached();
         }
-        tcg_gen_st_i64(t0, cpu_env, vofs + len_align);
+        tcg_gen_st_i64(t0, base, vofs + len_align);
         tcg_temp_free_i64(t0);
     }
 }
=20
 /* Similarly for stores.  */
-static void do_str(DisasContext *s, uint32_t vofs, int len, int rn, int im=
m)
+void gen_sve_str(DisasContext *s, TCGv_ptr base, int vofs,
+                 int len, int rn, int imm)
 {
     int len_align =3D QEMU_ALIGN_DOWN(len, 8);
     int len_remain =3D len % 8;
@@ -4420,7 +4433,7 @@ static void do_str(DisasContext *s, uint32_t vofs, in=
t len, int rn, int imm)
=20
         t0 =3D tcg_temp_new_i64();
         for (i =3D 0; i < len_align; i +=3D 8) {
-            tcg_gen_ld_i64(t0, cpu_env, vofs + i);
+            tcg_gen_ld_i64(t0, base, vofs + i);
             tcg_gen_qemu_st_i64(t0, clean_addr, midx, MO_LEUQ);
             tcg_gen_addi_i64(clean_addr, clean_addr, 8);
         }
@@ -4434,11 +4447,17 @@ static void do_str(DisasContext *s, uint32_t vofs, =
int len, int rn, int imm)
         clean_addr =3D new_tmp_a64_local(s);
         tcg_gen_mov_i64(clean_addr, t0);
=20
+        if (base !=3D cpu_env) {
+            TCGv_ptr b =3D tcg_temp_local_new_ptr();
+            tcg_gen_mov_ptr(b, base);
+            base =3D b;
+        }
+
         gen_set_label(loop);
=20
         t0 =3D tcg_temp_new_i64();
         tp =3D tcg_temp_new_ptr();
-        tcg_gen_add_ptr(tp, cpu_env, i);
+        tcg_gen_add_ptr(tp, base, i);
         tcg_gen_ld_i64(t0, tp, vofs);
         tcg_gen_addi_ptr(i, i, 8);
         tcg_temp_free_ptr(tp);
@@ -4449,12 +4468,17 @@ static void do_str(DisasContext *s, uint32_t vofs, =
int len, int rn, int imm)
=20
         tcg_gen_brcondi_ptr(TCG_COND_LTU, i, len_align, loop);
         tcg_temp_free_ptr(i);
+
+        if (base !=3D cpu_env) {
+            tcg_temp_free_ptr(base);
+            assert(len_remain =3D=3D 0);
+        }
     }
=20
     /* Predicate register stores can be any multiple of 2.  */
     if (len_remain) {
         t0 =3D tcg_temp_new_i64();
-        tcg_gen_ld_i64(t0, cpu_env, vofs + len_align);
+        tcg_gen_ld_i64(t0, base, vofs + len_align);
=20
         switch (len_remain) {
         case 2:
@@ -4486,7 +4510,7 @@ static bool trans_LDR_zri(DisasContext *s, arg_rri *a)
     if (sve_access_check(s)) {
         int size =3D vec_full_reg_size(s);
         int off =3D vec_full_reg_offset(s, a->rd);
-        do_ldr(s, off, size, a->rn, a->imm * size);
+        gen_sve_ldr(s, cpu_env, off, size, a->rn, a->imm * size);
     }
     return true;
 }
@@ -4499,7 +4523,7 @@ static bool trans_LDR_pri(DisasContext *s, arg_rri *a)
     if (sve_access_check(s)) {
         int size =3D pred_full_reg_size(s);
         int off =3D pred_full_reg_offset(s, a->rd);
-        do_ldr(s, off, size, a->rn, a->imm * size);
+        gen_sve_ldr(s, cpu_env, off, size, a->rn, a->imm * size);
     }
     return true;
 }
@@ -4512,7 +4536,7 @@ static bool trans_STR_zri(DisasContext *s, arg_rri *a)
     if (sve_access_check(s)) {
         int size =3D vec_full_reg_size(s);
         int off =3D vec_full_reg_offset(s, a->rd);
-        do_str(s, off, size, a->rn, a->imm * size);
+        gen_sve_str(s, cpu_env, off, size, a->rn, a->imm * size);
     }
     return true;
 }
@@ -4525,7 +4549,7 @@ static bool trans_STR_pri(DisasContext *s, arg_rri *a)
     if (sve_access_check(s)) {
         int size =3D pred_full_reg_size(s);
         int off =3D pred_full_reg_offset(s, a->rd);
-        do_str(s, off, size, a->rn, a->imm * size);
+        gen_sve_str(s, cpu_env, off, size, a->rn, a->imm * size);
     }
     return true;
 }
--=20
2.25.1
From nobody Thu May  8 21:38:42 2025
Delivered-To: importer@patchew.org
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass(p=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1657551210; cv=none;
	d=zohomail.com; s=zohoarc;
	b=Js63xyj4/nLneQkTbBmrHA69htakahs7dpQF+qkunojbdqoLoDPfOBzFpbLPXExzjPgyNZj4y1Zkscy3rqVafUQj6vA1Nc16pWTAfoc+dMpgJN2dVvSHrCUA3/zHqkuVHfVUQyf8gDygouqOgQK4aXOo/tBcBOKZ7JT+BKasdi4=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1657551210;
 h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
	bh=RmOk6nsqmajD+IRJZhKUc2IWWgl+LIcAbHluvdhJCZg=;
	b=jrzSUIFhaQ0lAZTp5CKxSU6FY/gPAIvIh4n1LcNWO4Eqn3wtvlF/nfL4luhHhNL+fP3aF4IjrTuJkdBmfmxV0dWtFDXvRrd5fjeriet83SN3zvR/vCA3LdaFKG+cAXHHbG/E6Rj8+q+JV3ZqOHK+UQzEo2/gGXy4tb91anPLwuI=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass header.from=<peter.maydell@linaro.org> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1657551210269148.75976281175508;
 Mon, 11 Jul 2022 07:53:30 -0700 (PDT)
Received: from localhost ([::1]:56432 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces+importer=patchew.org@nongnu.org>)
	id 1oAumv-0003nD-6F
	for importer@patchew.org; Mon, 11 Jul 2022 10:53:29 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:42858)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvd-0006c4-De
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:26 -0400
Received: from mail-wm1-x335.google.com ([2a00:1450:4864:20::335]:37869)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvT-0002qT-RF
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:18 -0400
Received: by mail-wm1-x335.google.com with SMTP id
 c131-20020a1c3589000000b003a2cc290135so3524740wma.2
 for <qemu-devel@nongnu.org>; Mon, 11 Jul 2022 06:58:11 -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.10
 for <qemu-devel@nongnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 11 Jul 2022 06:58:10 -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=RmOk6nsqmajD+IRJZhKUc2IWWgl+LIcAbHluvdhJCZg=;
 b=WFmiku2RxPc/Ex7qXbhnxE5HDk9OEiJxNpj0VhwMkFOd8uee5o9nnLTPKVOCiesY9z
 8jsqcOOKi3dBzPgraQwVw/gSf8gn/jTO2EQpiXoZ8oKlvfaiymfWCmDeB7bgritmJzIg
 V6SWxjCyjCCIv1qhEDBn8TmbmQ9Kgrnj9FKe9CubGFmC5ozjAuwwYi8dvZqQQ/9tMBOO
 oIRuYUu1aqQi76VSmywLKRnn8yPvnm3Dh2y1cmNfXkIF5iWO67M1tE+iOryRkPPtvIWN
 HsOPdhjakL+euD42J6dZcM+4n8TeLq+8kHfyPbwG3AYELDDhlU5oDY0S0VMk8gV3EWVs
 GzzA==
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=RmOk6nsqmajD+IRJZhKUc2IWWgl+LIcAbHluvdhJCZg=;
 b=xcLuaIvqtudfysE9a54VGBoV1ShVn39TtLnGJ6IBH7XYJ0cia24MzGRe37qDBWAi5P
 5kaLHCF2C5B1q5gSqE9VreBzZddqZp46bCoevl6mwl7zB+JS7kq1xRI518oO4rDJtlY8
 YrJVtRSnWwEm9tlgj6DIth9QmgO/kgVNGURdsoxKDTbQkVCZYpWO8w2ajIZuXt/+Qa5I
 nij9XEkaJvbDve1AvChiAG9WPA8273RIrZo+4RwLj1mJ0t9uFm+L925c+ts71VIq9FMJ
 AEe0B1NP1dj9j4jljCJ05oVCMNBMZ9iuA8LkJ8kliyE3uiAdQPA2gAg9MSWsfFq3yYPy
 iaLA==
X-Gm-Message-State: AJIora97JEIp/RlTBlTCawcjp6OKquu6tHmSKiipC0koRAu49HV9oHYe
 16hpVhkpTXKOXniGZ1aMGFwjGLLqS1lnIw==
X-Google-Smtp-Source: 
 AGRyM1s1KYz7cEURiOmgbnOCZk3xN9qmdOS5YM3xtk5jD73YH3WNJ9p1E97ab6HHWNqfKIHd+xNe6g==
X-Received: by 2002:a05:600c:2d45:b0:3a2:de59:ed0a with SMTP id
 a5-20020a05600c2d4500b003a2de59ed0amr16458445wmg.163.1657547890940;
 Mon, 11 Jul 2022 06:58:10 -0700 (PDT)
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 22/45] target/arm: Implement SME LDR, STR
Date: Mon, 11 Jul 2022 14:57:27 +0100
Message-Id: <20220711135750.765803-23-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
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17
 as permitted sender) client-ip=209.51.188.17;
 envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org;
 helo=lists.gnu.org;
Received-SPF: pass client-ip=2a00:1450:4864:20::335;
 envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x335.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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>
Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org
Sender: "Qemu-devel" <qemu-devel-bounces+importer=patchew.org@nongnu.org>
X-ZohoMail-DKIM: pass (identity @linaro.org)
X-ZM-MESSAGEID: 1657551211191100001
Content-Type: text/plain; charset="utf-8"

From: Richard Henderson <richard.henderson@linaro.org>

We can reuse the SVE functions for LDR and STR, passing in the
base of the ZA vector and a zero offset.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220708151540.18136-23-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 target/arm/sme.decode      |  7 +++++++
 target/arm/translate-sme.c | 24 ++++++++++++++++++++++++
 2 files changed, 31 insertions(+)

diff --git a/target/arm/sme.decode b/target/arm/sme.decode
index 900e3f2a077..f1ebd857a57 100644
--- a/target/arm/sme.decode
+++ b/target/arm/sme.decode
@@ -46,3 +46,10 @@ LDST1           1110000 0 esz:2 st:1 rm:5 v:1 .. pg:3 rn=
:5 0 za_imm:4  \
                 &ldst rs=3D%mova_rs
 LDST1           1110000 111     st:1 rm:5 v:1 .. pg:3 rn:5 0 za_imm:4  \
                 &ldst esz=3D4 rs=3D%mova_rs
+
+&ldstr          rv rn imm
+@ldstr          ....... ... . ...... .. ... rn:5 . imm:4 \
+                &ldstr rv=3D%mova_rs
+
+LDR             1110000 100 0 000000 .. 000 ..... 0 ....        @ldstr
+STR             1110000 100 1 000000 .. 000 ..... 0 ....        @ldstr
diff --git a/target/arm/translate-sme.c b/target/arm/translate-sme.c
index 42d14b883ab..35c26448125 100644
--- a/target/arm/translate-sme.c
+++ b/target/arm/translate-sme.c
@@ -243,3 +243,27 @@ static bool trans_LDST1(DisasContext *s, arg_LDST1 *a)
     tcg_temp_free_i64(addr);
     return true;
 }
+
+typedef void GenLdStR(DisasContext *, TCGv_ptr, int, int, int, int);
+
+static bool do_ldst_r(DisasContext *s, arg_ldstr *a, GenLdStR *fn)
+{
+    int svl =3D streaming_vec_reg_size(s);
+    int imm =3D a->imm;
+    TCGv_ptr base;
+
+    if (!sme_za_enabled_check(s)) {
+        return true;
+    }
+
+    /* ZA[n] equates to ZA0H.B[n]. */
+    base =3D get_tile_rowcol(s, MO_8, a->rv, imm, false);
+
+    fn(s, base, 0, svl, a->rn, imm * svl);
+
+    tcg_temp_free_ptr(base);
+    return true;
+}
+
+TRANS_FEAT(LDR, aa64_sme, do_ldst_r, a, gen_sve_ldr)
+TRANS_FEAT(STR, aa64_sme, do_ldst_r, a, gen_sve_str)
--=20
2.25.1
From nobody Thu May  8 21:38:42 2025
Delivered-To: importer@patchew.org
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass(p=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1657549864; cv=none;
	d=zohomail.com; s=zohoarc;
	b=A8oIzi35DR4a9AlZiZbVEwHN2OAAepwFEDZNy9Rw3trnVFN7Z/uawie5UajOGSJBmZeYadM2XDr/+sXCz0sxUYgvbfD3Ml1FppGPDP573aPBq1N41ouhE/J7PnbSyb2a1HEafUkRO4SBqE0rEPxg8zCXngYFR3Thd9+M05pdr+o=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1657549864;
 h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
	bh=Jrs2Elt6zkurq1tlTCd5KnpdSWVFVT+ucLNxgSmBuew=;
	b=Wgyyggp8ebfIi5GJcbzxgOAtHUU16nG0l2ZWaI5NKuAbuuIKjJF3BPR37czR0a9TSwLd7cGuwiTQFymrLaNsrmQWS1euZdyRyL4WcRXwPbC4CHCJPq5gszhb+Nj57SmXakExF/OQNghlfq7AmIkBlWgj+9KTvxWqOvfLN4a64ak=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass header.from=<peter.maydell@linaro.org> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1657549864040910.2633431231704;
 Mon, 11 Jul 2022 07:31:04 -0700 (PDT)
Received: from localhost ([::1]:41904 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces+importer=patchew.org@nongnu.org>)
	id 1oAuRC-0006qp-TV
	for importer@patchew.org; Mon, 11 Jul 2022 10:31:02 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:42750)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvV-0006Z1-PA
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:18 -0400
Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]:37550)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvS-0002qz-CY
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:17 -0400
Received: by mail-wr1-x432.google.com with SMTP id r10so971997wrv.4
 for <qemu-devel@nongnu.org>; Mon, 11 Jul 2022 06:58:12 -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.11
 for <qemu-devel@nongnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 11 Jul 2022 06:58:11 -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=Jrs2Elt6zkurq1tlTCd5KnpdSWVFVT+ucLNxgSmBuew=;
 b=GT8KSd6fxDz6IApczFfCTGtQBw2Q7iijiLM2gM6E+KAiHsOH9986wGqM8SF816/rDA
 XgNwqpblKttN+tW6TjyaTRpuMy40MsHSeo1+NTpZxSB7qR9Xgxh0hrtWUl8rfqZAI3ZU
 ZMd72BVY/3Ig3fZCZaPxdKvz/y1Am2Dn7IEvbGr4rxYkjC3k1ItH8/npd6DzjxBBea68
 M2k+cEo+/lsuQkMghiMrdVVtccO6tGxstvO8+gEqWVZqkgCkrABZctcozwndvl11S9yC
 xA8GeaTvbApvWXA/iJqv6miJX1vwhiOcxU/mQxlUcnHkGWwuguhpWjvWLQlK2ojV62Nb
 /Grw==
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=Jrs2Elt6zkurq1tlTCd5KnpdSWVFVT+ucLNxgSmBuew=;
 b=e0/mNvSRAu0uaPr1JloSQyF+ArM1a4wsYze5bmKPaz20RP2jZtR2brmLhXu5W68Jb5
 ewFOXRMHy5Dl+WGCNjwyKEqBPrqLI+PyZzMEJgTBJx0MUTYWFBD3E4qX6cLB0a/CjhlK
 vtrtnnyGTkbnZcFZizn6R4TMi9tTyNUOWv0zt3CO9oOvkjB0YOHs8oJdpiXlTH0X11Am
 8dufvjsQkcqjZ3f265i5Y//AZKChW8/drLpQiNgKGPLnvx1bk1ugQUs8+awOnjNYyGPP
 yghhsVwwS+Fhc8ePHjIIq38TNRYjuf9RLmvaYZBNlyPrzjAQLzukYTj0tFFeIH22DZC5
 sPJg==
X-Gm-Message-State: AJIora/uxapHApd8LeeBTNIUk/HmbeSi1vCrIu+WRTbxNubCy0NJa0A5
 uGL0zDvlSxigtEjLo42pURbcV8b8z1AmZA==
X-Google-Smtp-Source: 
 AGRyM1vQJZtokbRVFd7CGK6XAvJxHWWY3rvIdlhxh0QVIT8WIMWhgAXu0Ru1DQxmhPzm8/I+wdsSyQ==
X-Received: by 2002:a05:6000:81e:b0:21d:8811:777b with SMTP id
 bt30-20020a056000081e00b0021d8811777bmr17166950wrb.647.1657547891731;
 Mon, 11 Jul 2022 06:58:11 -0700 (PDT)
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 23/45] target/arm: Implement SME ADDHA, ADDVA
Date: Mon, 11 Jul 2022 14:57:28 +0100
Message-Id: <20220711135750.765803-24-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
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17
 as permitted sender) client-ip=209.51.188.17;
 envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org;
 helo=lists.gnu.org;
Received-SPF: pass client-ip=2a00:1450:4864:20::432;
 envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x432.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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>
Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org
Sender: "Qemu-devel" <qemu-devel-bounces+importer=patchew.org@nongnu.org>
X-ZohoMail-DKIM: pass (identity @linaro.org)
X-ZM-MESSAGEID: 1657549865985100001
Content-Type: text/plain; charset="utf-8"

From: Richard Henderson <richard.henderson@linaro.org>

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220708151540.18136-24-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 target/arm/helper-sme.h    |  5 +++
 target/arm/sme.decode      | 11 +++++
 target/arm/sme_helper.c    | 90 ++++++++++++++++++++++++++++++++++++++
 target/arm/translate-sme.c | 31 +++++++++++++
 4 files changed, 137 insertions(+)

diff --git a/target/arm/helper-sme.h b/target/arm/helper-sme.h
index 95f6e88bdd4..753e9e624cc 100644
--- a/target/arm/helper-sme.h
+++ b/target/arm/helper-sme.h
@@ -115,3 +115,8 @@ DEF_HELPER_FLAGS_5(sme_st1q_be_h_mte, TCG_CALL_NO_WG, v=
oid, env, ptr, ptr, tl, i
 DEF_HELPER_FLAGS_5(sme_st1q_le_h_mte, TCG_CALL_NO_WG, void, env, ptr, ptr,=
 tl, i32)
 DEF_HELPER_FLAGS_5(sme_st1q_be_v_mte, TCG_CALL_NO_WG, void, env, ptr, ptr,=
 tl, i32)
 DEF_HELPER_FLAGS_5(sme_st1q_le_v_mte, TCG_CALL_NO_WG, void, env, ptr, ptr,=
 tl, i32)
+
+DEF_HELPER_FLAGS_5(sme_addha_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr,=
 i32)
+DEF_HELPER_FLAGS_5(sme_addva_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr,=
 i32)
+DEF_HELPER_FLAGS_5(sme_addha_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr,=
 i32)
+DEF_HELPER_FLAGS_5(sme_addva_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr,=
 i32)
diff --git a/target/arm/sme.decode b/target/arm/sme.decode
index f1ebd857a57..8cb6c4053c3 100644
--- a/target/arm/sme.decode
+++ b/target/arm/sme.decode
@@ -53,3 +53,14 @@ LDST1           1110000 111     st:1 rm:5 v:1 .. pg:3 rn=
:5 0 za_imm:4  \
=20
 LDR             1110000 100 0 000000 .. 000 ..... 0 ....        @ldstr
 STR             1110000 100 1 000000 .. 000 ..... 0 ....        @ldstr
+
+### SME Add Vector to Array
+
+&adda           zad zn pm pn
+@adda_32        ........ .. ..... . pm:3 pn:3 zn:5 ... zad:2    &adda
+@adda_64        ........ .. ..... . pm:3 pn:3 zn:5 ..  zad:3    &adda
+
+ADDHA_s         11000000 10 01000 0 ... ... ..... 000 ..        @adda_32
+ADDVA_s         11000000 10 01000 1 ... ... ..... 000 ..        @adda_32
+ADDHA_d         11000000 11 01000 0 ... ... ..... 00 ...        @adda_64
+ADDVA_d         11000000 11 01000 1 ... ... ..... 00 ...        @adda_64
diff --git a/target/arm/sme_helper.c b/target/arm/sme_helper.c
index 10fd1ed910d..f1e924db748 100644
--- a/target/arm/sme_helper.c
+++ b/target/arm/sme_helper.c
@@ -828,3 +828,93 @@ DO_ST(q, _be, MO_128)
 DO_ST(q, _le, MO_128)
=20
 #undef DO_ST
+
+void HELPER(sme_addha_s)(void *vzda, void *vzn, void *vpn,
+                         void *vpm, uint32_t desc)
+{
+    intptr_t row, col, oprsz =3D simd_oprsz(desc) / 4;
+    uint64_t *pn =3D vpn, *pm =3D vpm;
+    uint32_t *zda =3D vzda, *zn =3D vzn;
+
+    for (row =3D 0; row < oprsz; ) {
+        uint64_t pa =3D pn[row >> 4];
+        do {
+            if (pa & 1) {
+                for (col =3D 0; col < oprsz; ) {
+                    uint64_t pb =3D pm[col >> 4];
+                    do {
+                        if (pb & 1) {
+                            zda[tile_vslice_index(row) + H4(col)] +=3D zn[=
H4(col)];
+                        }
+                        pb >>=3D 4;
+                    } while (++col & 15);
+                }
+            }
+            pa >>=3D 4;
+        } while (++row & 15);
+    }
+}
+
+void HELPER(sme_addha_d)(void *vzda, void *vzn, void *vpn,
+                         void *vpm, uint32_t desc)
+{
+    intptr_t row, col, oprsz =3D simd_oprsz(desc) / 8;
+    uint8_t *pn =3D vpn, *pm =3D vpm;
+    uint64_t *zda =3D vzda, *zn =3D vzn;
+
+    for (row =3D 0; row < oprsz; ++row) {
+        if (pn[H1(row)] & 1) {
+            for (col =3D 0; col < oprsz; ++col) {
+                if (pm[H1(col)] & 1) {
+                    zda[tile_vslice_index(row) + col] +=3D zn[col];
+                }
+            }
+        }
+    }
+}
+
+void HELPER(sme_addva_s)(void *vzda, void *vzn, void *vpn,
+                         void *vpm, uint32_t desc)
+{
+    intptr_t row, col, oprsz =3D simd_oprsz(desc) / 4;
+    uint64_t *pn =3D vpn, *pm =3D vpm;
+    uint32_t *zda =3D vzda, *zn =3D vzn;
+
+    for (row =3D 0; row < oprsz; ) {
+        uint64_t pa =3D pn[row >> 4];
+        do {
+            if (pa & 1) {
+                uint32_t zn_row =3D zn[H4(row)];
+                for (col =3D 0; col < oprsz; ) {
+                    uint64_t pb =3D pm[col >> 4];
+                    do {
+                        if (pb & 1) {
+                            zda[tile_vslice_index(row) + H4(col)] +=3D zn_=
row;
+                        }
+                        pb >>=3D 4;
+                    } while (++col & 15);
+                }
+            }
+            pa >>=3D 4;
+        } while (++row & 15);
+    }
+}
+
+void HELPER(sme_addva_d)(void *vzda, void *vzn, void *vpn,
+                         void *vpm, uint32_t desc)
+{
+    intptr_t row, col, oprsz =3D simd_oprsz(desc) / 8;
+    uint8_t *pn =3D vpn, *pm =3D vpm;
+    uint64_t *zda =3D vzda, *zn =3D vzn;
+
+    for (row =3D 0; row < oprsz; ++row) {
+        if (pn[H1(row)] & 1) {
+            uint64_t zn_row =3D zn[row];
+            for (col =3D 0; col < oprsz; ++col) {
+                if (pm[H1(col)] & 1) {
+                    zda[tile_vslice_index(row) + col] +=3D zn_row;
+                }
+            }
+        }
+    }
+}
diff --git a/target/arm/translate-sme.c b/target/arm/translate-sme.c
index 35c26448125..d3b9cdd5c4b 100644
--- a/target/arm/translate-sme.c
+++ b/target/arm/translate-sme.c
@@ -267,3 +267,34 @@ static bool do_ldst_r(DisasContext *s, arg_ldstr *a, G=
enLdStR *fn)
=20
 TRANS_FEAT(LDR, aa64_sme, do_ldst_r, a, gen_sve_ldr)
 TRANS_FEAT(STR, aa64_sme, do_ldst_r, a, gen_sve_str)
+
+static bool do_adda(DisasContext *s, arg_adda *a, MemOp esz,
+                    gen_helper_gvec_4 *fn)
+{
+    int svl =3D streaming_vec_reg_size(s);
+    uint32_t desc =3D simd_desc(svl, svl, 0);
+    TCGv_ptr za, zn, pn, pm;
+
+    if (!sme_smza_enabled_check(s)) {
+        return true;
+    }
+
+    /* Sum XZR+zad to find ZAd. */
+    za =3D get_tile_rowcol(s, esz, 31, a->zad, false);
+    zn =3D vec_full_reg_ptr(s, a->zn);
+    pn =3D pred_full_reg_ptr(s, a->pn);
+    pm =3D pred_full_reg_ptr(s, a->pm);
+
+    fn(za, zn, pn, pm, tcg_constant_i32(desc));
+
+    tcg_temp_free_ptr(za);
+    tcg_temp_free_ptr(zn);
+    tcg_temp_free_ptr(pn);
+    tcg_temp_free_ptr(pm);
+    return true;
+}
+
+TRANS_FEAT(ADDHA_s, aa64_sme, do_adda, a, MO_32, gen_helper_sme_addha_s)
+TRANS_FEAT(ADDVA_s, aa64_sme, do_adda, a, MO_32, gen_helper_sme_addva_s)
+TRANS_FEAT(ADDHA_d, aa64_sme_i16i64, do_adda, a, MO_64, gen_helper_sme_add=
ha_d)
+TRANS_FEAT(ADDVA_d, aa64_sme_i16i64, do_adda, a, MO_64, gen_helper_sme_add=
va_d)
--=20
2.25.1
From nobody Thu May  8 21:38:42 2025
Delivered-To: importer@patchew.org
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass(p=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1657551034; cv=none;
	d=zohomail.com; s=zohoarc;
	b=XqpAOG8xuzU8v1XkRbpmLHGJ3e5Yqs4CEaN27LJABbNDis5J37k9ROhTckAhZiHGTWsKJW2kpFkxGaw8BgHp/w1lUp/vGPIMHyvQe3e5A1GZ6v4CgEYh0KszlEY3NgHierdokchjQ/iT3gVMYaKKyobpJMAWHfoTDSzz1aLrlL0=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1657551034;
 h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
	bh=cR0PvnQKG0XfbYb9xus9rRJ6s/0aSnCTWRG0QGmXr4w=;
	b=gxjKO+WjXysGvcmivHX9BGdu2K2fNMu7/1OgMbEAN6+Rp3C4d+hNRh4BxxG15ctg1PUAQfO0pST3r3HtH31aNpd+PI1VnxnMNmo4LpRrE2jf0+boXIP9OR2h3M6gOgUaXh1YgQ1/CueeVghelw7ZQI5Xmx3UGki8XkkBwg/ikgI=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass header.from=<peter.maydell@linaro.org> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1657551034318366.3350817805863;
 Mon, 11 Jul 2022 07:50:34 -0700 (PDT)
Received: from localhost ([::1]:48316 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces+importer=patchew.org@nongnu.org>)
	id 1oAuk4-0006TV-Ur
	for importer@patchew.org; Mon, 11 Jul 2022 10:50:32 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:42780)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvW-0006Zq-GM
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:19 -0400
Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]:53118)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvT-0002rT-J9
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:17 -0400
Received: by mail-wm1-x32e.google.com with SMTP id o8so3086158wms.2
 for <qemu-devel@nongnu.org>; Mon, 11 Jul 2022 06:58:13 -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.11
 for <qemu-devel@nongnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 11 Jul 2022 06:58:12 -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=cR0PvnQKG0XfbYb9xus9rRJ6s/0aSnCTWRG0QGmXr4w=;
 b=iqQk8F2xsaV4i1VVN7W8K8HT+bnzR5juzxYOwX7mbjXOcFONGHwSXCK2YoXACpUV+o
 y61yBqFqOT9fv9aL6Tsr0ofRC/LFnZCTujyi8i75I4WEN07hMkL8taxB80H57Bw8sDwJ
 czEJLY59sbyeW6aeXWVGN5Osruu29bIGXs0SgAMQMBmUbEkZJ+4aHpnoPxVx5pUKo3zt
 7sfU9uz1aRbUHMlAveD6YJHqqGWJNGhtD4BDHc0DKNknIUpEty3F56F/byghLsgTB/mR
 MzCP/04LYmvX/N+UPHiB+0mVki8KmFXrPzN91cJM4LKFeFR+8od3JJOU0RZjLPOHrwiq
 2KiQ==
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=cR0PvnQKG0XfbYb9xus9rRJ6s/0aSnCTWRG0QGmXr4w=;
 b=2fFQ6M0lSh1dM1Nn4bI+TNFQ2M1VEtvxxjpfjhHnLM6hQWbtpcLiS1YL24Jqs1FbmD
 QXqNfORd1utri6xnLf7hynYWIoHNwR9JNhSLHT4TAzg9lU1au6G4HbKQFAMPB5NDe7rN
 svUH80SH+I6Y4NoJmOIORj8+D3Fgf5gGW91avZZ7NZFihDD0rBxyg+MpEkULAZE66UEk
 ui8o97rEqwlAb6NqWcCQKQEoaLtK34UqFUrMTJtuiIN5GqCUng79gzJL3ZPZMWjwWgWg
 nR3hikwhPLWpwoHsaxkUdHuA10+Via/wqGFWAx13MWkbDwGDwc/SSWXkB42dZ9swjltp
 9R4g==
X-Gm-Message-State: AJIora+wxFnjac754fSolzwv6Sc5AeQVIfA5p14FiSf66ritd6T1jOQd
 2q8FLqdu3kIjjqaj10mohU3NEg96B4dN0Q==
X-Google-Smtp-Source: 
 AGRyM1sczBnig7+K3WSbMT1shm40oSw5Mx6AnUamTfMDd4PLHq0WLczMnauukdi0dS7FvG8JQzF4Dg==
X-Received: by 2002:a05:600c:42d3:b0:3a2:e7b8:8430 with SMTP id
 j19-20020a05600c42d300b003a2e7b88430mr6371997wme.42.1657547892517;
 Mon, 11 Jul 2022 06:58:12 -0700 (PDT)
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 24/45] target/arm: Implement FMOPA, FMOPS (non-widening)
Date: Mon, 11 Jul 2022 14:57:29 +0100
Message-Id: <20220711135750.765803-25-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
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17
 as permitted sender) client-ip=209.51.188.17;
 envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org;
 helo=lists.gnu.org;
Received-SPF: pass client-ip=2a00:1450:4864:20::32e;
 envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32e.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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>
Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org
Sender: "Qemu-devel" <qemu-devel-bounces+importer=patchew.org@nongnu.org>
X-ZohoMail-DKIM: pass (identity @linaro.org)
X-ZM-MESSAGEID: 1657551036044100001
Content-Type: text/plain; charset="utf-8"

From: Richard Henderson <richard.henderson@linaro.org>

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220708151540.18136-25-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
---
 target/arm/helper-sme.h    |  5 +++
 target/arm/sme.decode      |  9 +++++
 target/arm/sme_helper.c    | 69 ++++++++++++++++++++++++++++++++++++++
 target/arm/translate-sme.c | 32 ++++++++++++++++++
 4 files changed, 115 insertions(+)

diff --git a/target/arm/helper-sme.h b/target/arm/helper-sme.h
index 753e9e624cc..f50d0fe1d62 100644
--- a/target/arm/helper-sme.h
+++ b/target/arm/helper-sme.h
@@ -120,3 +120,8 @@ DEF_HELPER_FLAGS_5(sme_addha_s, TCG_CALL_NO_RWG, void, =
ptr, ptr, ptr, ptr, i32)
 DEF_HELPER_FLAGS_5(sme_addva_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr,=
 i32)
 DEF_HELPER_FLAGS_5(sme_addha_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr,=
 i32)
 DEF_HELPER_FLAGS_5(sme_addva_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr,=
 i32)
+
+DEF_HELPER_FLAGS_7(sme_fmopa_s, TCG_CALL_NO_RWG,
+                   void, ptr, ptr, ptr, ptr, ptr, ptr, i32)
+DEF_HELPER_FLAGS_7(sme_fmopa_d, TCG_CALL_NO_RWG,
+                   void, ptr, ptr, ptr, ptr, ptr, ptr, i32)
diff --git a/target/arm/sme.decode b/target/arm/sme.decode
index 8cb6c4053c3..ba4774d1746 100644
--- a/target/arm/sme.decode
+++ b/target/arm/sme.decode
@@ -64,3 +64,12 @@ ADDHA_s         11000000 10 01000 0 ... ... ..... 000 ..=
        @adda_32
 ADDVA_s         11000000 10 01000 1 ... ... ..... 000 ..        @adda_32
 ADDHA_d         11000000 11 01000 0 ... ... ..... 00 ...        @adda_64
 ADDVA_d         11000000 11 01000 1 ... ... ..... 00 ...        @adda_64
+
+### SME Outer Product
+
+&op             zad zn zm pm pn sub:bool
+@op_32          ........ ... zm:5 pm:3 pn:3 zn:5 sub:1 .. zad:2 &op
+@op_64          ........ ... zm:5 pm:3 pn:3 zn:5 sub:1 .  zad:3 &op
+
+FMOPA_s         10000000 100 ..... ... ... ..... . 00 ..        @op_32
+FMOPA_d         10000000 110 ..... ... ... ..... . 0 ...        @op_64
diff --git a/target/arm/sme_helper.c b/target/arm/sme_helper.c
index f1e924db748..7dc76b6a1c3 100644
--- a/target/arm/sme_helper.c
+++ b/target/arm/sme_helper.c
@@ -25,6 +25,7 @@
 #include "exec/cpu_ldst.h"
 #include "exec/exec-all.h"
 #include "qemu/int128.h"
+#include "fpu/softfloat.h"
 #include "vec_internal.h"
 #include "sve_ldst_internal.h"
=20
@@ -918,3 +919,71 @@ void HELPER(sme_addva_d)(void *vzda, void *vzn, void *=
vpn,
         }
     }
 }
+
+void HELPER(sme_fmopa_s)(void *vza, void *vzn, void *vzm, void *vpn,
+                         void *vpm, void *vst, uint32_t desc)
+{
+    intptr_t row, col, oprsz =3D simd_maxsz(desc);
+    uint32_t neg =3D simd_data(desc) << 31;
+    uint16_t *pn =3D vpn, *pm =3D vpm;
+    float_status fpst;
+
+    /*
+     * Make a copy of float_status because this operation does not
+     * update the cumulative fp exception status.  It also produces
+     * default nans.
+     */
+    fpst =3D *(float_status *)vst;
+    set_default_nan_mode(true, &fpst);
+
+    for (row =3D 0; row < oprsz; ) {
+        uint16_t pa =3D pn[H2(row >> 4)];
+        do {
+            if (pa & 1) {
+                void *vza_row =3D vza + tile_vslice_offset(row);
+                uint32_t n =3D *(uint32_t *)(vzn + H1_4(row)) ^ neg;
+
+                for (col =3D 0; col < oprsz; ) {
+                    uint16_t pb =3D pm[H2(col >> 4)];
+                    do {
+                        if (pb & 1) {
+                            uint32_t *a =3D vza_row + H1_4(col);
+                            uint32_t *m =3D vzm + H1_4(col);
+                            *a =3D float32_muladd(n, *m, *a, 0, vst);
+                        }
+                        col +=3D 4;
+                        pb >>=3D 4;
+                    } while (col & 15);
+                }
+            }
+            row +=3D 4;
+            pa >>=3D 4;
+        } while (row & 15);
+    }
+}
+
+void HELPER(sme_fmopa_d)(void *vza, void *vzn, void *vzm, void *vpn,
+                         void *vpm, void *vst, uint32_t desc)
+{
+    intptr_t row, col, oprsz =3D simd_oprsz(desc) / 8;
+    uint64_t neg =3D (uint64_t)simd_data(desc) << 63;
+    uint64_t *za =3D vza, *zn =3D vzn, *zm =3D vzm;
+    uint8_t *pn =3D vpn, *pm =3D vpm;
+    float_status fpst =3D *(float_status *)vst;
+
+    set_default_nan_mode(true, &fpst);
+
+    for (row =3D 0; row < oprsz; ++row) {
+        if (pn[H1(row)] & 1) {
+            uint64_t *za_row =3D &za[tile_vslice_index(row)];
+            uint64_t n =3D zn[row] ^ neg;
+
+            for (col =3D 0; col < oprsz; ++col) {
+                if (pm[H1(col)] & 1) {
+                    uint64_t *a =3D &za_row[col];
+                    *a =3D float64_muladd(n, zm[col], *a, 0, &fpst);
+                }
+            }
+        }
+    }
+}
diff --git a/target/arm/translate-sme.c b/target/arm/translate-sme.c
index d3b9cdd5c4b..fa8f343a7d6 100644
--- a/target/arm/translate-sme.c
+++ b/target/arm/translate-sme.c
@@ -298,3 +298,35 @@ TRANS_FEAT(ADDHA_s, aa64_sme, do_adda, a, MO_32, gen_h=
elper_sme_addha_s)
 TRANS_FEAT(ADDVA_s, aa64_sme, do_adda, a, MO_32, gen_helper_sme_addva_s)
 TRANS_FEAT(ADDHA_d, aa64_sme_i16i64, do_adda, a, MO_64, gen_helper_sme_add=
ha_d)
 TRANS_FEAT(ADDVA_d, aa64_sme_i16i64, do_adda, a, MO_64, gen_helper_sme_add=
va_d)
+
+static bool do_outprod_fpst(DisasContext *s, arg_op *a, MemOp esz,
+                            gen_helper_gvec_5_ptr *fn)
+{
+    int svl =3D streaming_vec_reg_size(s);
+    uint32_t desc =3D simd_desc(svl, svl, a->sub);
+    TCGv_ptr za, zn, zm, pn, pm, fpst;
+
+    if (!sme_smza_enabled_check(s)) {
+        return true;
+    }
+
+    /* Sum XZR+zad to find ZAd. */
+    za =3D get_tile_rowcol(s, esz, 31, a->zad, false);
+    zn =3D vec_full_reg_ptr(s, a->zn);
+    zm =3D vec_full_reg_ptr(s, a->zm);
+    pn =3D pred_full_reg_ptr(s, a->pn);
+    pm =3D pred_full_reg_ptr(s, a->pm);
+    fpst =3D fpstatus_ptr(FPST_FPCR);
+
+    fn(za, zn, zm, pn, pm, fpst, tcg_constant_i32(desc));
+
+    tcg_temp_free_ptr(za);
+    tcg_temp_free_ptr(zn);
+    tcg_temp_free_ptr(pn);
+    tcg_temp_free_ptr(pm);
+    tcg_temp_free_ptr(fpst);
+    return true;
+}
+
+TRANS_FEAT(FMOPA_s, aa64_sme, do_outprod_fpst, a, MO_32, gen_helper_sme_fm=
opa_s)
+TRANS_FEAT(FMOPA_d, aa64_sme_f64f64, do_outprod_fpst, a, MO_64, gen_helper=
_sme_fmopa_d)
--=20
2.25.1
From nobody Thu May  8 21:38:42 2025
Delivered-To: importer@patchew.org
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass(p=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1657548824; cv=none;
	d=zohomail.com; s=zohoarc;
	b=U3+C8dEzU8LmAGyz6eEpJDykHUa54juDBq3xR3KEWnpfgLxsKG6RLMEHRp0bO3x7l9rgnRaCvkkB+C50m8F8JRhj7O9/YuhxIQIJ/1uSbQYC/+JPSDj23kCGC2NvSIhAH7vJ88EPJPnIEoIGF0hZaL7MmPqe1YwY7z+Y1qdJbSQ=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1657548824;
 h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
	bh=JqTdKTDdhhvQtZZBygtrOEZ/plp0svP5Se/zJYrh/p8=;
	b=jMCGlO2UxXkEItSy9FrerHVPH/smIVTk7o0qlAJsyfFJFlP3gYD708ET6cOk+D7oWTQRUd5mXCugxONUq8an5sgL0prq0YkRFKYpVFKZeFIjT5wVW+0nRgVmd4ZLyKNhpWJNWL1yJGcV95kCIIUmlGoWDZmfUQi0VnGhoK4Rjxw=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass header.from=<peter.maydell@linaro.org> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1657548824421507.74852996966604;
 Mon, 11 Jul 2022 07:13:44 -0700 (PDT)
Received: from localhost ([::1]:41820 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces+importer=patchew.org@nongnu.org>)
	id 1oAuAR-0002Ce-Du
	for importer@patchew.org; Mon, 11 Jul 2022 10:13:43 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:42782)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvW-0006aC-ID
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:19 -0400
Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]:36545)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvT-0002ri-J1
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:18 -0400
Received: by mail-wr1-x429.google.com with SMTP id o4so7143027wrh.3
 for <qemu-devel@nongnu.org>; Mon, 11 Jul 2022 06:58:14 -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.12
 for <qemu-devel@nongnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 11 Jul 2022 06:58:12 -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=JqTdKTDdhhvQtZZBygtrOEZ/plp0svP5Se/zJYrh/p8=;
 b=oGzAxBqlp+PfV1WkV+Lxl0Zc9usZ34rz+JWUZOABf472hmZf5GfiDWvbTT0cYF7TAt
 zz9na2cRDkZrJ0UXFMJmKZnHXJHg2Er5zj8kJ4bsnM78u6dEzsBvYEkVGmcmTC9Usklk
 j3aroRfgXeJiKGT8wXy0TcIEQ52FJTU2lOfnFQECoVJ21tUTEi65O7aIWYUQ9kNlJ6qr
 /DQdNWTCMvdGs2h4HDBg1ubuZBVkJ6q7Z/Y7S+Szcy31OrXJsChX/03fFPUgXOelsEx2
 byyWpHhH/H1KclCp6IZ5HFypwiiaeW55RWSPMDEL1IKpII4lLupy28MUheYndns2ETN7
 K2/A==
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=JqTdKTDdhhvQtZZBygtrOEZ/plp0svP5Se/zJYrh/p8=;
 b=vlY/6LVq7So1v0O/9jUyZ4nBOYXVjhT9cbXF4ZkW1kwQtl995LOXJAi5rtYpg0bzA3
 yrc5TG+67DrXU6zZcCe01VWeeuOfAsvQlJu7aMsxu8l40YxAw6wCHbVW+7ueriRrx4sK
 +WYd9kzDcGD8nz/vcfw6NdFSZtTrv/Ww4LYkL2PJHPSs8k3KfANafbTBaQNsmtbfYNYR
 nw9mv8jbhsdLYo0cr+h4Rs5iqImUmCWCMWtwFv9UiZD4pl7qTIu75EmF5tyv/2Uy7bWt
 aosueef5pA11vXUdhgwaBWXSx/QWdvtNpw9EYpcHVlDUgWjwxwFZYZvjNHOR+Q9tdAH2
 zOZQ==
X-Gm-Message-State: AJIora/an1Gq7tq2YU24pkNUOIM7/lgqtRg6aV4d07f4pFAV2zmoBcqa
 qVHlx3KpRfDB6fCZhQ03Y4D08cE3Bdnc/Q==
X-Google-Smtp-Source: 
 AGRyM1sgbKr8/yOTHhVGBnu1y+gh/meuozpEq6dxwfaBGFoF4AOcs8oLS34Q+KMUZ3ZTDzetcOidXQ==
X-Received: by 2002:adf:b613:0:b0:21d:6da6:d541 with SMTP id
 f19-20020adfb613000000b0021d6da6d541mr16666040wre.485.1657547893284;
 Mon, 11 Jul 2022 06:58:13 -0700 (PDT)
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 25/45] target/arm: Implement BFMOPA, BFMOPS
Date: Mon, 11 Jul 2022 14:57:30 +0100
Message-Id: <20220711135750.765803-26-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
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17
 as permitted sender) client-ip=209.51.188.17;
 envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org;
 helo=lists.gnu.org;
Received-SPF: pass client-ip=2a00:1450:4864:20::429;
 envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x429.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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>
Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org
Sender: "Qemu-devel" <qemu-devel-bounces+importer=patchew.org@nongnu.org>
X-ZohoMail-DKIM: pass (identity @linaro.org)
X-ZM-MESSAGEID: 1657548825869100001
Content-Type: text/plain; charset="utf-8"

From: Richard Henderson <richard.henderson@linaro.org>

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220708151540.18136-26-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
---
 target/arm/helper-sme.h    |  2 ++
 target/arm/sme.decode      |  2 ++
 target/arm/sme_helper.c    | 56 ++++++++++++++++++++++++++++++++++++++
 target/arm/translate-sme.c | 30 ++++++++++++++++++++
 4 files changed, 90 insertions(+)

diff --git a/target/arm/helper-sme.h b/target/arm/helper-sme.h
index f50d0fe1d62..1d68fb8c74f 100644
--- a/target/arm/helper-sme.h
+++ b/target/arm/helper-sme.h
@@ -125,3 +125,5 @@ DEF_HELPER_FLAGS_7(sme_fmopa_s, TCG_CALL_NO_RWG,
                    void, ptr, ptr, ptr, ptr, ptr, ptr, i32)
 DEF_HELPER_FLAGS_7(sme_fmopa_d, TCG_CALL_NO_RWG,
                    void, ptr, ptr, ptr, ptr, ptr, ptr, i32)
+DEF_HELPER_FLAGS_6(sme_bfmopa, TCG_CALL_NO_RWG,
+                   void, ptr, ptr, ptr, ptr, ptr, i32)
diff --git a/target/arm/sme.decode b/target/arm/sme.decode
index ba4774d1746..afd9c0dffda 100644
--- a/target/arm/sme.decode
+++ b/target/arm/sme.decode
@@ -73,3 +73,5 @@ ADDVA_d         11000000 11 01000 1 ... ... ..... 00 ... =
       @adda_64
=20
 FMOPA_s         10000000 100 ..... ... ... ..... . 00 ..        @op_32
 FMOPA_d         10000000 110 ..... ... ... ..... . 0 ...        @op_64
+
+BFMOPA          10000001 100 ..... ... ... ..... . 00 ..        @op_32
diff --git a/target/arm/sme_helper.c b/target/arm/sme_helper.c
index 7dc76b6a1c3..690a53eee2d 100644
--- a/target/arm/sme_helper.c
+++ b/target/arm/sme_helper.c
@@ -987,3 +987,59 @@ void HELPER(sme_fmopa_d)(void *vza, void *vzn, void *v=
zm, void *vpn,
         }
     }
 }
+
+/*
+ * Alter PAIR as needed for controlling predicates being false,
+ * and for NEG on an enabled row element.
+ */
+static inline uint32_t f16mop_adj_pair(uint32_t pair, uint32_t pg, uint32_=
t neg)
+{
+    /*
+     * The pseudocode uses a conditional negate after the conditional zero.
+     * It is simpler here to unconditionally negate before conditional zer=
o.
+     */
+    pair ^=3D neg;
+    if (!(pg & 1)) {
+        pair &=3D 0xffff0000u;
+    }
+    if (!(pg & 4)) {
+        pair &=3D 0x0000ffffu;
+    }
+    return pair;
+}
+
+void HELPER(sme_bfmopa)(void *vza, void *vzn, void *vzm, void *vpn,
+                        void *vpm, uint32_t desc)
+{
+    intptr_t row, col, oprsz =3D simd_maxsz(desc);
+    uint32_t neg =3D simd_data(desc) * 0x80008000u;
+    uint16_t *pn =3D vpn, *pm =3D vpm;
+
+    for (row =3D 0; row < oprsz; ) {
+        uint16_t prow =3D pn[H2(row >> 4)];
+        do {
+            void *vza_row =3D vza + tile_vslice_offset(row);
+            uint32_t n =3D *(uint32_t *)(vzn + H1_4(row));
+
+            n =3D f16mop_adj_pair(n, prow, neg);
+
+            for (col =3D 0; col < oprsz; ) {
+                uint16_t pcol =3D pm[H2(col >> 4)];
+                do {
+                    if (prow & pcol & 0b0101) {
+                        uint32_t *a =3D vza_row + H1_4(col);
+                        uint32_t m =3D *(uint32_t *)(vzm + H1_4(col));
+
+                        m =3D f16mop_adj_pair(m, pcol, 0);
+                        *a =3D bfdotadd(*a, n, m);
+
+                        col +=3D 4;
+                        pcol >>=3D 4;
+                    }
+                } while (col & 15);
+            }
+            row +=3D 4;
+            prow >>=3D 4;
+        } while (row & 15);
+    }
+}
diff --git a/target/arm/translate-sme.c b/target/arm/translate-sme.c
index fa8f343a7d6..ecb7583c559 100644
--- a/target/arm/translate-sme.c
+++ b/target/arm/translate-sme.c
@@ -299,6 +299,33 @@ TRANS_FEAT(ADDVA_s, aa64_sme, do_adda, a, MO_32, gen_h=
elper_sme_addva_s)
 TRANS_FEAT(ADDHA_d, aa64_sme_i16i64, do_adda, a, MO_64, gen_helper_sme_add=
ha_d)
 TRANS_FEAT(ADDVA_d, aa64_sme_i16i64, do_adda, a, MO_64, gen_helper_sme_add=
va_d)
=20
+static bool do_outprod(DisasContext *s, arg_op *a, MemOp esz,
+                       gen_helper_gvec_5 *fn)
+{
+    int svl =3D streaming_vec_reg_size(s);
+    uint32_t desc =3D simd_desc(svl, svl, a->sub);
+    TCGv_ptr za, zn, zm, pn, pm;
+
+    if (!sme_smza_enabled_check(s)) {
+        return true;
+    }
+
+    /* Sum XZR+zad to find ZAd. */
+    za =3D get_tile_rowcol(s, esz, 31, a->zad, false);
+    zn =3D vec_full_reg_ptr(s, a->zn);
+    zm =3D vec_full_reg_ptr(s, a->zm);
+    pn =3D pred_full_reg_ptr(s, a->pn);
+    pm =3D pred_full_reg_ptr(s, a->pm);
+
+    fn(za, zn, zm, pn, pm, tcg_constant_i32(desc));
+
+    tcg_temp_free_ptr(za);
+    tcg_temp_free_ptr(zn);
+    tcg_temp_free_ptr(pn);
+    tcg_temp_free_ptr(pm);
+    return true;
+}
+
 static bool do_outprod_fpst(DisasContext *s, arg_op *a, MemOp esz,
                             gen_helper_gvec_5_ptr *fn)
 {
@@ -330,3 +357,6 @@ static bool do_outprod_fpst(DisasContext *s, arg_op *a,=
 MemOp esz,
=20
 TRANS_FEAT(FMOPA_s, aa64_sme, do_outprod_fpst, a, MO_32, gen_helper_sme_fm=
opa_s)
 TRANS_FEAT(FMOPA_d, aa64_sme_f64f64, do_outprod_fpst, a, MO_64, gen_helper=
_sme_fmopa_d)
+
+/* TODO: FEAT_EBF16 */
+TRANS_FEAT(BFMOPA, aa64_sme, do_outprod, a, MO_32, gen_helper_sme_bfmopa)
--=20
2.25.1
From nobody Thu May  8 21:38:42 2025
Delivered-To: importer@patchew.org
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass(p=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1657549541; cv=none;
	d=zohomail.com; s=zohoarc;
	b=mp5nsM6l2WfjVe5yM5BRhcjhUUjBN4VGrB3cca0G0Cn7nxqbTwkep3HrytXxuaAUGgEvR/krN7ooAlspa2mpTIXIlquYIbqpuWmX1Y69QNxBL2lVvXlBrAZN+G2TSho3pDuCzjP7jkxKJRs9WcuUKtFjlhNqxLchJ4b3J/An9FE=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1657549541;
 h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
	bh=rdPq6uSChyhiVf54BW91Z5hNyR78/N5QUsEASqtPQEU=;
	b=Kecht6S7hhCFirzRmQs33vRKJrbI/5e1761E0/ttJ2WCmfzwtVJSFWhem03Aq7V7n+VnVxSN9xWm6tKQa21ASf0DpDxaowYaxkvD8n7I23LpxEHB50SgEbTKz5OD0ymjyVV/f0c7dG9h40mQ8HXzFKokGT9rYX3/N7NP+DrTQ24=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass header.from=<peter.maydell@linaro.org> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1657549541911301.23220358311266;
 Mon, 11 Jul 2022 07:25:41 -0700 (PDT)
Received: from localhost ([::1]:34832 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces+importer=patchew.org@nongnu.org>)
	id 1oAuM0-000172-5K
	for importer@patchew.org; Mon, 11 Jul 2022 10:25:40 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:42918)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtve-0006cc-FA
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:26 -0400
Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]:54929)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvT-0002oE-RW
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:25 -0400
Received: by mail-wm1-x331.google.com with SMTP id n185so3088970wmn.4
 for <qemu-devel@nongnu.org>; Mon, 11 Jul 2022 06:58:14 -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.13
 for <qemu-devel@nongnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 11 Jul 2022 06:58:13 -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=rdPq6uSChyhiVf54BW91Z5hNyR78/N5QUsEASqtPQEU=;
 b=YzbXPtF1TvUA9ew7yBXawqoZTg4RXJ1kjCc/f8l7mUrlChfZbu6VRuOL8mvfVBkWfA
 JVJ5uQvkAk8jKFn8mmnG9gj7VjmwrgnfTYww8l/fwI94E8edEo9qjI2eztw5TkNfSF/3
 TPoD/lapfdm9lWGc7jKy5WuU+0Z9D1TJUV59S8V994OU5EnkI2hdkdxCH6Ht5HoKh48M
 a8dijUOKZjGnqLC78gITYP4qcl0uabPWubmgtGlWd+svImLB5zDcxUdJ+cRy5yN1FaGe
 LBvAip8Ub5vhO8OiqqYZ5IR7aFvAxCq52E2TZyYM7ZRSfFa1vYETibORqhpftW9kVhm6
 b4MQ==
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=rdPq6uSChyhiVf54BW91Z5hNyR78/N5QUsEASqtPQEU=;
 b=hvryrXBYSiNRnDSoXxzU6oJNbxL9R6kf/jQTUrUJGPZNRawBijtDPKG9Wp4JFRi27R
 ZoS8HcUNB5QDmu5SAdJoPrhUdxFMVAO0v2CMXl9oorbkD6w0RFkLepN/SBMsBO/d6IL6
 kO9ttMDkD5NZ37w/157J1AP6g799cbRz4HC7nY4YoCzDYwWt0BL4+eb4h5kc8fCV5yth
 iQ/2v1T6fovZP3Qvn/Qf0oJTTniN23OXmVeL9YsqF4RLpFG1DP0pGz14G560u6MQ5ori
 Pqg37sEHSvdrrNfnaTQvX5OP+fb4+b9dvMP6Yi3Ilt4J1fsMcgxNpwGWG3h8RjVHm+DB
 HKTA==
X-Gm-Message-State: AJIora+LW6W/4giSnRIYwd6tzpofCHI2HSWQTsWa1L2NvUVYSqf3Qulo
 DKW6+48cW+nJYuvhsrzTSzfSK6fT679nhA==
X-Google-Smtp-Source: 
 AGRyM1sElvFC/i0hZPWOm0CS+JWUaED1gEoTx12BKDaHTeX2NEMjP2/39o3N7r18bOohSqVg0YJH5A==
X-Received: by 2002:a05:600c:c2:b0:3a2:e51a:78aa with SMTP id
 u2-20020a05600c00c200b003a2e51a78aamr9164467wmm.48.1657547894086;
 Mon, 11 Jul 2022 06:58:14 -0700 (PDT)
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 26/45] target/arm: Implement FMOPA, FMOPS (widening)
Date: Mon, 11 Jul 2022 14:57:31 +0100
Message-Id: <20220711135750.765803-27-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
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17
 as permitted sender) client-ip=209.51.188.17;
 envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org;
 helo=lists.gnu.org;
Received-SPF: pass client-ip=2a00:1450:4864:20::331;
 envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x331.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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>
Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org
Sender: "Qemu-devel" <qemu-devel-bounces+importer=patchew.org@nongnu.org>
X-ZohoMail-DKIM: pass (identity @linaro.org)
X-ZM-MESSAGEID: 1657549543864100001
Content-Type: text/plain; charset="utf-8"

From: Richard Henderson <richard.henderson@linaro.org>

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220708151540.18136-27-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
---
 target/arm/helper-sme.h    |  2 ++
 target/arm/sme.decode      |  1 +
 target/arm/sme_helper.c    | 74 ++++++++++++++++++++++++++++++++++++++
 target/arm/translate-sme.c |  1 +
 4 files changed, 78 insertions(+)

diff --git a/target/arm/helper-sme.h b/target/arm/helper-sme.h
index 1d68fb8c74f..4d5d05db3a0 100644
--- a/target/arm/helper-sme.h
+++ b/target/arm/helper-sme.h
@@ -121,6 +121,8 @@ DEF_HELPER_FLAGS_5(sme_addva_s, TCG_CALL_NO_RWG, void, =
ptr, ptr, ptr, ptr, i32)
 DEF_HELPER_FLAGS_5(sme_addha_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr,=
 i32)
 DEF_HELPER_FLAGS_5(sme_addva_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr,=
 i32)
=20
+DEF_HELPER_FLAGS_7(sme_fmopa_h, TCG_CALL_NO_RWG,
+                   void, ptr, ptr, ptr, ptr, ptr, ptr, i32)
 DEF_HELPER_FLAGS_7(sme_fmopa_s, TCG_CALL_NO_RWG,
                    void, ptr, ptr, ptr, ptr, ptr, ptr, i32)
 DEF_HELPER_FLAGS_7(sme_fmopa_d, TCG_CALL_NO_RWG,
diff --git a/target/arm/sme.decode b/target/arm/sme.decode
index afd9c0dffda..e8d27fd8a0e 100644
--- a/target/arm/sme.decode
+++ b/target/arm/sme.decode
@@ -75,3 +75,4 @@ FMOPA_s         10000000 100 ..... ... ... ..... . 00 .. =
       @op_32
 FMOPA_d         10000000 110 ..... ... ... ..... . 0 ...        @op_64
=20
 BFMOPA          10000001 100 ..... ... ... ..... . 00 ..        @op_32
+FMOPA_h         10000001 101 ..... ... ... ..... . 00 ..        @op_32
diff --git a/target/arm/sme_helper.c b/target/arm/sme_helper.c
index 690a53eee2d..302f89c30b3 100644
--- a/target/arm/sme_helper.c
+++ b/target/arm/sme_helper.c
@@ -1008,6 +1008,80 @@ static inline uint32_t f16mop_adj_pair(uint32_t pair=
, uint32_t pg, uint32_t neg)
     return pair;
 }
=20
+static float32 f16_dotadd(float32 sum, uint32_t e1, uint32_t e2,
+                          float_status *s_std, float_status *s_odd)
+{
+    float64 e1r =3D float16_to_float64(e1 & 0xffff, true, s_std);
+    float64 e1c =3D float16_to_float64(e1 >> 16, true, s_std);
+    float64 e2r =3D float16_to_float64(e2 & 0xffff, true, s_std);
+    float64 e2c =3D float16_to_float64(e2 >> 16, true, s_std);
+    float64 t64;
+    float32 t32;
+
+    /*
+     * The ARM pseudocode function FPDot performs both multiplies
+     * and the add with a single rounding operation.  Emulate this
+     * by performing the first multiply in round-to-odd, then doing
+     * the second multiply as fused multiply-add, and rounding to
+     * float32 all in one step.
+     */
+    t64 =3D float64_mul(e1r, e2r, s_odd);
+    t64 =3D float64r32_muladd(e1c, e2c, t64, 0, s_std);
+
+    /* This conversion is exact, because we've already rounded. */
+    t32 =3D float64_to_float32(t64, s_std);
+
+    /* The final accumulation step is not fused. */
+    return float32_add(sum, t32, s_std);
+}
+
+void HELPER(sme_fmopa_h)(void *vza, void *vzn, void *vzm, void *vpn,
+                         void *vpm, void *vst, uint32_t desc)
+{
+    intptr_t row, col, oprsz =3D simd_maxsz(desc);
+    uint32_t neg =3D simd_data(desc) * 0x80008000u;
+    uint16_t *pn =3D vpn, *pm =3D vpm;
+    float_status fpst_odd, fpst_std;
+
+    /*
+     * Make a copy of float_status because this operation does not
+     * update the cumulative fp exception status.  It also produces
+     * default nans.  Make a second copy with round-to-odd -- see above.
+     */
+    fpst_std =3D *(float_status *)vst;
+    set_default_nan_mode(true, &fpst_std);
+    fpst_odd =3D fpst_std;
+    set_float_rounding_mode(float_round_to_odd, &fpst_odd);
+
+    for (row =3D 0; row < oprsz; ) {
+        uint16_t prow =3D pn[H2(row >> 4)];
+        do {
+            void *vza_row =3D vza + tile_vslice_offset(row);
+            uint32_t n =3D *(uint32_t *)(vzn + H1_4(row));
+
+            n =3D f16mop_adj_pair(n, prow, neg);
+
+            for (col =3D 0; col < oprsz; ) {
+                uint16_t pcol =3D pm[H2(col >> 4)];
+                do {
+                    if (prow & pcol & 0b0101) {
+                        uint32_t *a =3D vza_row + H1_4(col);
+                        uint32_t m =3D *(uint32_t *)(vzm + H1_4(col));
+
+                        m =3D f16mop_adj_pair(m, pcol, 0);
+                        *a =3D f16_dotadd(*a, n, m, &fpst_std, &fpst_odd);
+
+                        col +=3D 4;
+                        pcol >>=3D 4;
+                    }
+                } while (col & 15);
+            }
+            row +=3D 4;
+            prow >>=3D 4;
+        } while (row & 15);
+    }
+}
+
 void HELPER(sme_bfmopa)(void *vza, void *vzn, void *vzm, void *vpn,
                         void *vpm, uint32_t desc)
 {
diff --git a/target/arm/translate-sme.c b/target/arm/translate-sme.c
index ecb7583c559..c2953b22ce3 100644
--- a/target/arm/translate-sme.c
+++ b/target/arm/translate-sme.c
@@ -355,6 +355,7 @@ static bool do_outprod_fpst(DisasContext *s, arg_op *a,=
 MemOp esz,
     return true;
 }
=20
+TRANS_FEAT(FMOPA_h, aa64_sme, do_outprod_fpst, a, MO_32, gen_helper_sme_fm=
opa_h)
 TRANS_FEAT(FMOPA_s, aa64_sme, do_outprod_fpst, a, MO_32, gen_helper_sme_fm=
opa_s)
 TRANS_FEAT(FMOPA_d, aa64_sme_f64f64, do_outprod_fpst, a, MO_64, gen_helper=
_sme_fmopa_d)
=20
--=20
2.25.1
From nobody Thu May  8 21:38:42 2025
Delivered-To: importer@patchew.org
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass(p=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1657549430; cv=none;
	d=zohomail.com; s=zohoarc;
	b=Cqogn/qrqff+bwlFJBv8I4NcP7SAyIf7WKgpiv3Rx5z8zdj5uM/K9kka1Ndc7fO8050WNAqD/WXSJ92f3mt38XvAiXZgtyznjSf5GZrPMtwzZOEE7gIFZTf4H5d0915Ds4dm5XEDsvHaNh5cCh+f5Csf/yeHKJ43dGdzKHwglpc=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1657549430;
 h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
	bh=wLF084Ezdzf2ZLeUWRpU2I0inK+HajABcj7tU1hY7is=;
	b=SkXP242R9EW9XG9/kWLYNTyVgHvg8dRuVBW+MeZ5uUjV51ph3UQMxC0kDO0ckv4Fj/Ac6Try5jGseBoeJ/xLzFmlWQKtQCK9Box5pFFv6qMMZsIr8G7jHZpThgBtygZDOAHX/GNBESjI65DY5NKmdSyRHtRnsYSIeZFjeC9Fis0=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass header.from=<peter.maydell@linaro.org> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 16575494303921021.509591495095;
 Mon, 11 Jul 2022 07:23:50 -0700 (PDT)
Received: from localhost ([::1]:58318 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces+importer=patchew.org@nongnu.org>)
	id 1oAuKD-0005jo-A7
	for importer@patchew.org; Mon, 11 Jul 2022 10:23:49 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:42956)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvf-0006dg-5w
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:28 -0400
Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]:37551)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvV-0002sV-EH
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:25 -0400
Received: by mail-wr1-x432.google.com with SMTP id r10so972173wrv.4
 for <qemu-devel@nongnu.org>; Mon, 11 Jul 2022 06:58:15 -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.14
 for <qemu-devel@nongnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 11 Jul 2022 06:58:14 -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=wLF084Ezdzf2ZLeUWRpU2I0inK+HajABcj7tU1hY7is=;
 b=g1lx7ooML7P7W/t+Y9qQnAL5svtDlOKVmWuwWkfpQyX/UtjLhUBzUNtAdZ7QYAM9hJ
 iFaQOKccnc1iFqGtsrbsYc/nVhgBKv8FCtvtnGRqHCwOTB/75y3Sk1oQ/ML7Do79eM9V
 U7RlPh7CxCveDGFVs9c+oRtnNZQYFnUHgcqKEDkt0y3ZA4RBCNfqS49NtfIYNS5i/LDR
 WlQWAWpW5qSRWuVKXFOYDf4tZFlTQug4mEGZCWJrolSji7u0PBT3+7CY8pKBaLTqGiNF
 TbYEC/9v7NkOnDyM9C2PB9Wy2joH3X4SPCY8cfyJzVbhC26kzadMFLbKFUUsq2Hp/9N6
 hr8A==
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=wLF084Ezdzf2ZLeUWRpU2I0inK+HajABcj7tU1hY7is=;
 b=M6QUq7Z5OlOt2bfcACB2N1yV2K+0bdGfldKFX9XtmgP8BS/wWiRK5DxMG2+QAfjndt
 OYWrVBdDgspKnC0xVjcd5LCv1qwbeV/719bcS0wJOD42kyAYVcTOYJknSNWfB7TIUPIH
 hyMv4L/alULsKveqJ12ICXIYVWuPLc3Ltf5F6NLRf/oopV4Oa5OdsXf0a0NwUwwoW0X2
 4/LwIU0xZgBqCAZWhpJKH7F6kL2eJoQKPN+ad8DY89jH+O9LPrQufas4T538nbBEarzT
 Hfbqz9g+EqELQ4bHKSgPfZV0tYQZ4OVwu9eutZrag3ErdEYPUCHhMWS48xx+pB+y3o7y
 uxkw==
X-Gm-Message-State: AJIora93p6sEF2RGfcFJcgdQ8gVm8zN8gdkA0SN1X4XnlxNtxJUz00YR
 usjQchYybCyQPc9oQxRuOgnLbhpVxZcSsg==
X-Google-Smtp-Source: 
 AGRyM1t2ctr0VeBu2ljQnwkLJKkLLG776zaOfo+jOk+tlP3b2Tof5i4/td2Zs8qQn9uLsKP+IJHQjQ==
X-Received: by 2002:adf:dc0d:0:b0:21d:ea5:710f with SMTP id
 t13-20020adfdc0d000000b0021d0ea5710fmr17031328wri.48.1657547894981;
 Mon, 11 Jul 2022 06:58:14 -0700 (PDT)
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 27/45] target/arm: Implement SME integer outer product
Date: Mon, 11 Jul 2022 14:57:32 +0100
Message-Id: <20220711135750.765803-28-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
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17
 as permitted sender) client-ip=209.51.188.17;
 envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org;
 helo=lists.gnu.org;
Received-SPF: pass client-ip=2a00:1450:4864:20::432;
 envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x432.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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>
Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org
Sender: "Qemu-devel" <qemu-devel-bounces+importer=patchew.org@nongnu.org>
X-ZohoMail-DKIM: pass (identity @linaro.org)
X-ZM-MESSAGEID: 1657549431303100002
Content-Type: text/plain; charset="utf-8"

From: Richard Henderson <richard.henderson@linaro.org>

This is SMOPA, SUMOPA, USMOPA_s, UMOPA, for both Int8 and Int16.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220708151540.18136-28-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 target/arm/helper-sme.h    | 16 ++++++++
 target/arm/sme.decode      | 10 +++++
 target/arm/sme_helper.c    | 82 ++++++++++++++++++++++++++++++++++++++
 target/arm/translate-sme.c | 10 +++++
 4 files changed, 118 insertions(+)

diff --git a/target/arm/helper-sme.h b/target/arm/helper-sme.h
index 4d5d05db3a0..d2d544a6961 100644
--- a/target/arm/helper-sme.h
+++ b/target/arm/helper-sme.h
@@ -129,3 +129,19 @@ DEF_HELPER_FLAGS_7(sme_fmopa_d, TCG_CALL_NO_RWG,
                    void, ptr, ptr, ptr, ptr, ptr, ptr, i32)
 DEF_HELPER_FLAGS_6(sme_bfmopa, TCG_CALL_NO_RWG,
                    void, ptr, ptr, ptr, ptr, ptr, i32)
+DEF_HELPER_FLAGS_6(sme_smopa_s, TCG_CALL_NO_RWG,
+                   void, ptr, ptr, ptr, ptr, ptr, i32)
+DEF_HELPER_FLAGS_6(sme_umopa_s, TCG_CALL_NO_RWG,
+                   void, ptr, ptr, ptr, ptr, ptr, i32)
+DEF_HELPER_FLAGS_6(sme_sumopa_s, TCG_CALL_NO_RWG,
+                   void, ptr, ptr, ptr, ptr, ptr, i32)
+DEF_HELPER_FLAGS_6(sme_usmopa_s, TCG_CALL_NO_RWG,
+                   void, ptr, ptr, ptr, ptr, ptr, i32)
+DEF_HELPER_FLAGS_6(sme_smopa_d, TCG_CALL_NO_RWG,
+                   void, ptr, ptr, ptr, ptr, ptr, i32)
+DEF_HELPER_FLAGS_6(sme_umopa_d, TCG_CALL_NO_RWG,
+                   void, ptr, ptr, ptr, ptr, ptr, i32)
+DEF_HELPER_FLAGS_6(sme_sumopa_d, TCG_CALL_NO_RWG,
+                   void, ptr, ptr, ptr, ptr, ptr, i32)
+DEF_HELPER_FLAGS_6(sme_usmopa_d, TCG_CALL_NO_RWG,
+                   void, ptr, ptr, ptr, ptr, ptr, i32)
diff --git a/target/arm/sme.decode b/target/arm/sme.decode
index e8d27fd8a0e..628804e37a8 100644
--- a/target/arm/sme.decode
+++ b/target/arm/sme.decode
@@ -76,3 +76,13 @@ FMOPA_d         10000000 110 ..... ... ... ..... . 0 ...=
        @op_64
=20
 BFMOPA          10000001 100 ..... ... ... ..... . 00 ..        @op_32
 FMOPA_h         10000001 101 ..... ... ... ..... . 00 ..        @op_32
+
+SMOPA_s         1010000 0 10 0 ..... ... ... ..... . 00 ..      @op_32
+SUMOPA_s        1010000 0 10 1 ..... ... ... ..... . 00 ..      @op_32
+USMOPA_s        1010000 1 10 0 ..... ... ... ..... . 00 ..      @op_32
+UMOPA_s         1010000 1 10 1 ..... ... ... ..... . 00 ..      @op_32
+
+SMOPA_d         1010000 0 11 0 ..... ... ... ..... . 0 ...      @op_64
+SUMOPA_d        1010000 0 11 1 ..... ... ... ..... . 0 ...      @op_64
+USMOPA_d        1010000 1 11 0 ..... ... ... ..... . 0 ...      @op_64
+UMOPA_d         1010000 1 11 1 ..... ... ... ..... . 0 ...      @op_64
diff --git a/target/arm/sme_helper.c b/target/arm/sme_helper.c
index 302f89c30b3..f891306bb98 100644
--- a/target/arm/sme_helper.c
+++ b/target/arm/sme_helper.c
@@ -1117,3 +1117,85 @@ void HELPER(sme_bfmopa)(void *vza, void *vzn, void *=
vzm, void *vpn,
         } while (row & 15);
     }
 }
+
+typedef uint64_t IMOPFn(uint64_t, uint64_t, uint64_t, uint8_t, bool);
+
+static inline void do_imopa(uint64_t *za, uint64_t *zn, uint64_t *zm,
+                            uint8_t *pn, uint8_t *pm,
+                            uint32_t desc, IMOPFn *fn)
+{
+    intptr_t row, col, oprsz =3D simd_oprsz(desc) / 8;
+    bool neg =3D simd_data(desc);
+
+    for (row =3D 0; row < oprsz; ++row) {
+        uint8_t pa =3D pn[H1(row)];
+        uint64_t *za_row =3D &za[tile_vslice_index(row)];
+        uint64_t n =3D zn[row];
+
+        for (col =3D 0; col < oprsz; ++col) {
+            uint8_t pb =3D pm[H1(col)];
+            uint64_t *a =3D &za_row[col];
+
+            *a =3D fn(n, zm[col], *a, pa & pb, neg);
+        }
+    }
+}
+
+#define DEF_IMOP_32(NAME, NTYPE, MTYPE) \
+static uint64_t NAME(uint64_t n, uint64_t m, uint64_t a, uint8_t p, bool n=
eg) \
+{                                                                         =
  \
+    uint32_t sum0 =3D 0, sum1 =3D 0;                                      =
      \
+    /* Apply P to N as a mask, making the inactive elements 0. */         =
  \
+    n &=3D expand_pred_b(p);                                              =
    \
+    sum0 +=3D (NTYPE)(n >> 0) * (MTYPE)(m >> 0);                          =
    \
+    sum0 +=3D (NTYPE)(n >> 8) * (MTYPE)(m >> 8);                          =
    \
+    sum0 +=3D (NTYPE)(n >> 16) * (MTYPE)(m >> 16);                        =
    \
+    sum0 +=3D (NTYPE)(n >> 24) * (MTYPE)(m >> 24);                        =
    \
+    sum1 +=3D (NTYPE)(n >> 32) * (MTYPE)(m >> 32);                        =
    \
+    sum1 +=3D (NTYPE)(n >> 40) * (MTYPE)(m >> 40);                        =
    \
+    sum1 +=3D (NTYPE)(n >> 48) * (MTYPE)(m >> 48);                        =
    \
+    sum1 +=3D (NTYPE)(n >> 56) * (MTYPE)(m >> 56);                        =
    \
+    if (neg) {                                                            =
  \
+        sum0 =3D (uint32_t)a - sum0, sum1 =3D (uint32_t)(a >> 32) - sum1; =
      \
+    } else {                                                              =
  \
+        sum0 =3D (uint32_t)a + sum0, sum1 =3D (uint32_t)(a >> 32) + sum1; =
      \
+    }                                                                     =
  \
+    return ((uint64_t)sum1 << 32) | sum0;                                 =
  \
+}
+
+#define DEF_IMOP_64(NAME, NTYPE, MTYPE) \
+static uint64_t NAME(uint64_t n, uint64_t m, uint64_t a, uint8_t p, bool n=
eg) \
+{                                                                         =
  \
+    uint64_t sum =3D 0;                                                   =
    \
+    /* Apply P to N as a mask, making the inactive elements 0. */         =
  \
+    n &=3D expand_pred_h(p);                                              =
    \
+    sum +=3D (NTYPE)(n >> 0) * (MTYPE)(m >> 0);                           =
    \
+    sum +=3D (NTYPE)(n >> 16) * (MTYPE)(m >> 16);                         =
    \
+    sum +=3D (NTYPE)(n >> 32) * (MTYPE)(m >> 32);                         =
    \
+    sum +=3D (NTYPE)(n >> 48) * (MTYPE)(m >> 48);                         =
    \
+    return neg ? a - sum : a + sum;                                       =
  \
+}
+
+DEF_IMOP_32(smopa_s, int8_t, int8_t)
+DEF_IMOP_32(umopa_s, uint8_t, uint8_t)
+DEF_IMOP_32(sumopa_s, int8_t, uint8_t)
+DEF_IMOP_32(usmopa_s, uint8_t, int8_t)
+
+DEF_IMOP_64(smopa_d, int16_t, int16_t)
+DEF_IMOP_64(umopa_d, uint16_t, uint16_t)
+DEF_IMOP_64(sumopa_d, int16_t, uint16_t)
+DEF_IMOP_64(usmopa_d, uint16_t, int16_t)
+
+#define DEF_IMOPH(NAME) \
+    void HELPER(sme_##NAME)(void *vza, void *vzn, void *vzm, void *vpn,   =
   \
+                            void *vpm, uint32_t desc)                     =
   \
+    { do_imopa(vza, vzn, vzm, vpn, vpm, desc, NAME); }
+
+DEF_IMOPH(smopa_s)
+DEF_IMOPH(umopa_s)
+DEF_IMOPH(sumopa_s)
+DEF_IMOPH(usmopa_s)
+DEF_IMOPH(smopa_d)
+DEF_IMOPH(umopa_d)
+DEF_IMOPH(sumopa_d)
+DEF_IMOPH(usmopa_d)
diff --git a/target/arm/translate-sme.c b/target/arm/translate-sme.c
index c2953b22ce3..7b87a9df63c 100644
--- a/target/arm/translate-sme.c
+++ b/target/arm/translate-sme.c
@@ -361,3 +361,13 @@ TRANS_FEAT(FMOPA_d, aa64_sme_f64f64, do_outprod_fpst, =
a, MO_64, gen_helper_sme_f
=20
 /* TODO: FEAT_EBF16 */
 TRANS_FEAT(BFMOPA, aa64_sme, do_outprod, a, MO_32, gen_helper_sme_bfmopa)
+
+TRANS_FEAT(SMOPA_s, aa64_sme, do_outprod, a, MO_32, gen_helper_sme_smopa_s)
+TRANS_FEAT(UMOPA_s, aa64_sme, do_outprod, a, MO_32, gen_helper_sme_umopa_s)
+TRANS_FEAT(SUMOPA_s, aa64_sme, do_outprod, a, MO_32, gen_helper_sme_sumopa=
_s)
+TRANS_FEAT(USMOPA_s, aa64_sme, do_outprod, a, MO_32, gen_helper_sme_usmopa=
_s)
+
+TRANS_FEAT(SMOPA_d, aa64_sme_i16i64, do_outprod, a, MO_64, gen_helper_sme_=
smopa_d)
+TRANS_FEAT(UMOPA_d, aa64_sme_i16i64, do_outprod, a, MO_64, gen_helper_sme_=
umopa_d)
+TRANS_FEAT(SUMOPA_d, aa64_sme_i16i64, do_outprod, a, MO_64, gen_helper_sme=
_sumopa_d)
+TRANS_FEAT(USMOPA_d, aa64_sme_i16i64, do_outprod, a, MO_64, gen_helper_sme=
_usmopa_d)
--=20
2.25.1
From nobody Thu May  8 21:38:42 2025
Delivered-To: importer@patchew.org
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass(p=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1657549341; cv=none;
	d=zohomail.com; s=zohoarc;
	b=P6IliVOyIGwVKqMkKWU/enT6yB8cKjSNvgxDfCY7NE7q5u0MacVBbmgG4O6Mhu2jUsq8g/L++n/rkPd0vQ9Pr/9sw11zV7//Z0yWXLgG454ZptN7CCOW2tgLl1RzFlPt7Frz+KIski6hdtAGuez8xTvWhm1ZUGaW2qrCIs5XCb4=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1657549341;
 h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
	bh=xJStjhVhh8lM0KlESTH9cBr5cEkP8jOBDsIB6MUlD9s=;
	b=JgLsfU2dxaC6h28v1DKPF2ASupKEmVcCAtP8beNb7wUcOHQsNttebn+6z3WaPyCedROtT5JYysLnYz6L5yVEK8em/3nk8wTFsBP2lYMxWOsGtNR2ZsT5HkTVLh/2R1VEXhBfCKZ//P04qgAQE53lTr1DgN05Iry3bPz4Dr9G0eE=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass header.from=<peter.maydell@linaro.org> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1657549341776936.2108172550284;
 Mon, 11 Jul 2022 07:22:21 -0700 (PDT)
Received: from localhost ([::1]:54762 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces+importer=patchew.org@nongnu.org>)
	id 1oAuIm-00038H-Ov
	for importer@patchew.org; Mon, 11 Jul 2022 10:22:20 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:42912)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtve-0006cZ-EY
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:26 -0400
Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]:33723)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvV-0002ng-BZ
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:25 -0400
Received: by mail-wr1-x432.google.com with SMTP id h17so7182447wrx.0
 for <qemu-devel@nongnu.org>; Mon, 11 Jul 2022 06:58:16 -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.15
 for <qemu-devel@nongnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 11 Jul 2022 06:58:15 -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=xJStjhVhh8lM0KlESTH9cBr5cEkP8jOBDsIB6MUlD9s=;
 b=HHVnnJSlx6xN1zGM4glZYgv1m5yq5EiqJ2ZMVyy8R0cYoYi51gPvg0Da4UcPWUJ6N4
 3AqPa7MfST3004KSu2IcBkPVpfw9Vmz8LEM2OqrnvKEBDCUGed5PgXaANbTJxvzWrDnC
 c26d0lDxoSVfDbKm8ShkYa2u00ND+3JZtsnWtldiYu5+3VFmPLH8Bg2j2ZF0WVx0Y23n
 5hjCC0m/17bG+jQeh8TM4gMLYlCREZRbqlPvm5gNNWJTvyNK7KL2bx0obH6kLPI5mM+B
 0FIdwsg0jSB6neIveOc63mZqHvPpIdkRIMmvkSIYRBEkghUlgySSQm8xQes+cPSL284P
 NFaA==
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=xJStjhVhh8lM0KlESTH9cBr5cEkP8jOBDsIB6MUlD9s=;
 b=JNt9olDRDouGafj1eeCunTIIf168pTJmVobz4dXXNxVjjREMgZc8D8C+B4nkI1jX3+
 LqYjvL7WMVrc/Jdzkzz4cBvTtPuG1vv/CD8auyYR81KAHbGalj8hWJmC9i01UNlwgmty
 EkiJTFfMLyg9is0CeccgkctQrbrvDK5qFT+19YQZXL39MryJB7V200/+JFKzZukOdCaz
 aJE/PCLIyK0EqY7ktsxmyOZ0hbtSVkiM4oR+Ls7+F4v6+FqYiyUUD6XUdBHdxGmJZ3Ot
 L41mA9FAWrVhTt/LB5UPIdvL2LrJ0zrvMaGmabK8ai8OAdeOXt+olo6xhOdxU0xDOJMg
 czWg==
X-Gm-Message-State: AJIora+R46Z1+ODbYLGbWNZG2ZGAqnoj0jDeczx+AxQtGbFpz91wcE0L
 XD7bet+w9qC73e6AKaKODYNZL3Y1sHWU1A==
X-Google-Smtp-Source: 
 AGRyM1vD0vqGuzTk/lzSmsN7bFK96RRbLQ3stwCWAW5Dq5Hq+QEjhunqfMdWYSOUBT641s3c61WQeg==
X-Received: by 2002:a5d:6149:0:b0:21d:6ba7:6095 with SMTP id
 y9-20020a5d6149000000b0021d6ba76095mr16721785wrt.680.1657547895716;
 Mon, 11 Jul 2022 06:58:15 -0700 (PDT)
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 28/45] target/arm: Implement PSEL
Date: Mon, 11 Jul 2022 14:57:33 +0100
Message-Id: <20220711135750.765803-29-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
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17
 as permitted sender) client-ip=209.51.188.17;
 envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org;
 helo=lists.gnu.org;
Received-SPF: pass client-ip=2a00:1450:4864:20::432;
 envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x432.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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>
Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org
Sender: "Qemu-devel" <qemu-devel-bounces+importer=patchew.org@nongnu.org>
X-ZohoMail-DKIM: pass (identity @linaro.org)
X-ZM-MESSAGEID: 1657549342559100001
Content-Type: text/plain; charset="utf-8"

From: Richard Henderson <richard.henderson@linaro.org>

This is an SVE instruction that operates using the SVE vector
length but that it is present only if SME is implemented.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220708151540.18136-29-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 target/arm/sve.decode      | 20 +++++++++++++
 target/arm/translate-sve.c | 57 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 77 insertions(+)

diff --git a/target/arm/sve.decode b/target/arm/sve.decode
index 95af08c139f..966803cbb78 100644
--- a/target/arm/sve.decode
+++ b/target/arm/sve.decode
@@ -1674,3 +1674,23 @@ BFMLALT_zzxw    01100100 11 1 ..... 0100.1 ..... ...=
..     @rrxr_3a esz=3D2
=20
 ### SVE2 floating-point bfloat16 dot-product (indexed)
 BFDOT_zzxz      01100100 01 1 ..... 010000 ..... .....     @rrxr_2 esz=3D2
+
+### SVE broadcast predicate element
+
+&psel           esz pd pn pm rv imm
+%psel_rv        16:2 !function=3Dplus_12
+%psel_imm_b     22:2 19:2
+%psel_imm_h     22:2 20:1
+%psel_imm_s     22:2
+%psel_imm_d     23:1
+@psel           ........ .. . ... .. .. pn:4 . pm:4 . pd:4  \
+                &psel rv=3D%psel_rv
+
+PSEL            00100101 .. 1 ..1 .. 01 .... 0 .... 0 ....  \
+                @psel esz=3D0 imm=3D%psel_imm_b
+PSEL            00100101 .. 1 .10 .. 01 .... 0 .... 0 ....  \
+                @psel esz=3D1 imm=3D%psel_imm_h
+PSEL            00100101 .. 1 100 .. 01 .... 0 .... 0 ....  \
+                @psel esz=3D2 imm=3D%psel_imm_s
+PSEL            00100101 .1 1 000 .. 01 .... 0 .... 0 ....  \
+                @psel esz=3D3 imm=3D%psel_imm_d
diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c
index fd1a1736374..24ffb69a2af 100644
--- a/target/arm/translate-sve.c
+++ b/target/arm/translate-sve.c
@@ -7419,3 +7419,60 @@ static bool do_BFMLAL_zzxw(DisasContext *s, arg_rrxr=
_esz *a, bool sel)
=20
 TRANS_FEAT(BFMLALB_zzxw, aa64_sve_bf16, do_BFMLAL_zzxw, a, false)
 TRANS_FEAT(BFMLALT_zzxw, aa64_sve_bf16, do_BFMLAL_zzxw, a, true)
+
+static bool trans_PSEL(DisasContext *s, arg_psel *a)
+{
+    int vl =3D vec_full_reg_size(s);
+    int pl =3D pred_gvec_reg_size(s);
+    int elements =3D vl >> a->esz;
+    TCGv_i64 tmp, didx, dbit;
+    TCGv_ptr ptr;
+
+    if (!dc_isar_feature(aa64_sme, s)) {
+        return false;
+    }
+    if (!sve_access_check(s)) {
+        return true;
+    }
+
+    tmp =3D tcg_temp_new_i64();
+    dbit =3D tcg_temp_new_i64();
+    didx =3D tcg_temp_new_i64();
+    ptr =3D tcg_temp_new_ptr();
+
+    /* Compute the predicate element. */
+    tcg_gen_addi_i64(tmp, cpu_reg(s, a->rv), a->imm);
+    if (is_power_of_2(elements)) {
+        tcg_gen_andi_i64(tmp, tmp, elements - 1);
+    } else {
+        tcg_gen_remu_i64(tmp, tmp, tcg_constant_i64(elements));
+    }
+
+    /* Extract the predicate byte and bit indices. */
+    tcg_gen_shli_i64(tmp, tmp, a->esz);
+    tcg_gen_andi_i64(dbit, tmp, 7);
+    tcg_gen_shri_i64(didx, tmp, 3);
+    if (HOST_BIG_ENDIAN) {
+        tcg_gen_xori_i64(didx, didx, 7);
+    }
+
+    /* Load the predicate word. */
+    tcg_gen_trunc_i64_ptr(ptr, didx);
+    tcg_gen_add_ptr(ptr, ptr, cpu_env);
+    tcg_gen_ld8u_i64(tmp, ptr, pred_full_reg_offset(s, a->pm));
+
+    /* Extract the predicate bit and replicate to MO_64. */
+    tcg_gen_shr_i64(tmp, tmp, dbit);
+    tcg_gen_andi_i64(tmp, tmp, 1);
+    tcg_gen_neg_i64(tmp, tmp);
+
+    /* Apply to either copy the source, or write zeros. */
+    tcg_gen_gvec_ands(MO_64, pred_full_reg_offset(s, a->pd),
+                      pred_full_reg_offset(s, a->pn), tmp, pl, pl);
+
+    tcg_temp_free_i64(tmp);
+    tcg_temp_free_i64(dbit);
+    tcg_temp_free_i64(didx);
+    tcg_temp_free_ptr(ptr);
+    return true;
+}
--=20
2.25.1
From nobody Thu May  8 21:38:42 2025
Delivered-To: importer@patchew.org
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass(p=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1657549634; cv=none;
	d=zohomail.com; s=zohoarc;
	b=H7c1XSGrQ+uxlEsJZWhnmX76qUunKQ/C7hRP7LacMUmUR6Ko6l5XlnKcLaUAxtTiIyCr/eJNlw9hZkAmXkxzFrv2ZasjA6MCx4Cz0hAmd4x9FdDmuGn4VTrBuN3Mr81yd5hCz34eeRP152ajmj4HQppKfsaw3kwRryoEvSQGPkg=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1657549634;
 h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
	bh=q781D2NAiISZsnf5qYib8iLZW0xTOuik/EP0N0QqMfE=;
	b=OeBUUoDxJtDPDzSPH+f9uAIBr/G86FbCoOOwFZ7xIB8xrYUjIoHUf4QcxIVkHL9KmJ/aMTqqrEd93Z+XVSp/EnBN8FsvIpiVLM6cKQ/M0EoyfJoBJWAGP47FMf8NXINgO09LEtm9CWgYDyg8iAzMJ8lGPkYUY1l/dRxoC/vXmYk=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass header.from=<peter.maydell@linaro.org> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1657549634147759.2880208767995;
 Mon, 11 Jul 2022 07:27:14 -0700 (PDT)
Received: from localhost ([::1]:38082 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces+importer=patchew.org@nongnu.org>)
	id 1oAuNU-0003cJ-V5
	for importer@patchew.org; Mon, 11 Jul 2022 10:27:13 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:42958)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvf-0006dp-5c
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:28 -0400
Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]:37554)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvW-0002sz-8I
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:26 -0400
Received: by mail-wr1-x435.google.com with SMTP id r10so972271wrv.4
 for <qemu-devel@nongnu.org>; Mon, 11 Jul 2022 06:58:17 -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.15
 for <qemu-devel@nongnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 11 Jul 2022 06:58:16 -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=q781D2NAiISZsnf5qYib8iLZW0xTOuik/EP0N0QqMfE=;
 b=KsFPEzamOvb4/zc8bvrJbP6jAbLYBerRSGsn1glXChXYlW93n9h/ih60+0RDdBOriO
 kyIxB1lL7RzTSjdhmsLKCgvisR9uX7cWRosJ7d7NWAC1hhl8z0OSTpYsHRTpeUQwWZIW
 c2tD4ID8C/xGqfjNo2NyQgVCi+619rcy0hUM7EcTvTI/x50Yq6P416X42YkLccsoUe0w
 0fyo3EXNPnPbsD6DxB0bB8STqCFfw5bOLU5e4T48pTtlyBTESUIMIlq8LCQlv3IXegix
 qGFyFq6wqnW9PCpU9pRqS9luXllis6UogSrQo73qSKVkZ2r0+CJr9kCGYkIDajrVLUR6
 4yvw==
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=q781D2NAiISZsnf5qYib8iLZW0xTOuik/EP0N0QqMfE=;
 b=JXJXxv2cqbuFavbpaW1oSbl84FzV2lYLwOxTENcfBqOTHLC0MMvwu6ybl15XFxHQiV
 v6VtriDLkPM6zLJ2pmgeGlGXSLnKit5OVNc7Ya8hhpSJbPk2vlxjOu9dbfUBUa16oowj
 NmlhlT9e4+AxslQAlc9QJDXVD5iP2urUXaU2PAhs9p9nwe6wg9c5QDeCeURi1a5vN3cT
 K21KSM9oRj4X1heAoo4JlHzcYIV7v5Of9+ELX82FkNmWaCrdcdHaHgDxDEMwjJsutLzi
 JWxPwEgJrr6tLV2B/L9F62JyUzyB4mK5N9q1vdMpsjlgWOydMb+WuxsQvQHkZBsh442A
 vzTQ==
X-Gm-Message-State: AJIora+junIWtyAQLTBEJKnBgTiBu/NBq1e9N45ZblQMOF+4jydMFOWg
 LehlmxopZzqc32t2ivMXZ8MbuxUOdBAfNQ==
X-Google-Smtp-Source: 
 AGRyM1vtizx4tIak6MxH5QPbSrmQau6vkrYRk9ALJ5M23IB0xoKKrG/om7PS7hnvW4GO1OI2MC6tMw==
X-Received: by 2002:a5d:4aca:0:b0:21d:6793:1c11 with SMTP id
 y10-20020a5d4aca000000b0021d67931c11mr16516916wrs.202.1657547896511;
 Mon, 11 Jul 2022 06:58:16 -0700 (PDT)
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 29/45] target/arm: Implement REVD
Date: Mon, 11 Jul 2022 14:57:34 +0100
Message-Id: <20220711135750.765803-30-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
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17
 as permitted sender) client-ip=209.51.188.17;
 envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org;
 helo=lists.gnu.org;
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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>
Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org
Sender: "Qemu-devel" <qemu-devel-bounces+importer=patchew.org@nongnu.org>
X-ZohoMail-DKIM: pass (identity @linaro.org)
X-ZM-MESSAGEID: 1657549634796100001
Content-Type: text/plain; charset="utf-8"

From: Richard Henderson <richard.henderson@linaro.org>

This is an SVE instruction that operates using the SVE vector
length but that it is present only if SME is implemented.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220708151540.18136-30-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 target/arm/helper-sve.h    |  2 ++
 target/arm/sve.decode      |  1 +
 target/arm/sve_helper.c    | 16 ++++++++++++++++
 target/arm/translate-sve.c |  2 ++
 4 files changed, 21 insertions(+)

diff --git a/target/arm/helper-sve.h b/target/arm/helper-sve.h
index ab0333400f0..cc4e1d89481 100644
--- a/target/arm/helper-sve.h
+++ b/target/arm/helper-sve.h
@@ -719,6 +719,8 @@ DEF_HELPER_FLAGS_4(sve_revh_d, TCG_CALL_NO_RWG, void, p=
tr, ptr, ptr, i32)
=20
 DEF_HELPER_FLAGS_4(sve_revw_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
=20
+DEF_HELPER_FLAGS_4(sme_revd_q, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
+
 DEF_HELPER_FLAGS_4(sve_rbit_b, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 DEF_HELPER_FLAGS_4(sve_rbit_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
 DEF_HELPER_FLAGS_4(sve_rbit_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32)
diff --git a/target/arm/sve.decode b/target/arm/sve.decode
index 966803cbb78..a9e48f07b44 100644
--- a/target/arm/sve.decode
+++ b/target/arm/sve.decode
@@ -652,6 +652,7 @@ REVB            00000101 .. 1001 00 100 ... ..... .....=
         @rd_pg_rn
 REVH            00000101 .. 1001 01 100 ... ..... .....         @rd_pg_rn
 REVW            00000101 .. 1001 10 100 ... ..... .....         @rd_pg_rn
 RBIT            00000101 .. 1001 11 100 ... ..... .....         @rd_pg_rn
+REVD            00000101 00 1011 10 100 ... ..... .....         @rd_pg_rn_=
e0
=20
 # SVE vector splice (predicated, destructive)
 SPLICE          00000101 .. 101 100 100 ... ..... .....         @rdn_pg_rm
diff --git a/target/arm/sve_helper.c b/target/arm/sve_helper.c
index df161704699..d6f7ef94fe6 100644
--- a/target/arm/sve_helper.c
+++ b/target/arm/sve_helper.c
@@ -931,6 +931,22 @@ DO_ZPZ_D(sve_revh_d, uint64_t, hswap64)
=20
 DO_ZPZ_D(sve_revw_d, uint64_t, wswap64)
=20
+void HELPER(sme_revd_q)(void *vd, void *vn, void *vg, uint32_t desc)
+{
+    intptr_t i, opr_sz =3D simd_oprsz(desc) / 8;
+    uint64_t *d =3D vd, *n =3D vn;
+    uint8_t *pg =3D vg;
+
+    for (i =3D 0; i < opr_sz; i +=3D 2) {
+        if (pg[H1(i)] & 1) {
+            uint64_t n0 =3D n[i + 0];
+            uint64_t n1 =3D n[i + 1];
+            d[i + 0] =3D n1;
+            d[i + 1] =3D n0;
+        }
+    }
+}
+
 DO_ZPZ(sve_rbit_b, uint8_t, H1, revbit8)
 DO_ZPZ(sve_rbit_h, uint16_t, H1_2, revbit16)
 DO_ZPZ(sve_rbit_s, uint32_t, H1_4, revbit32)
diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c
index 24ffb69a2af..9ed3b267fdb 100644
--- a/target/arm/translate-sve.c
+++ b/target/arm/translate-sve.c
@@ -2901,6 +2901,8 @@ TRANS_FEAT(REVH, aa64_sve, gen_gvec_ool_arg_zpz, revh=
_fns[a->esz], a, 0)
 TRANS_FEAT(REVW, aa64_sve, gen_gvec_ool_arg_zpz,
            a->esz =3D=3D 3 ? gen_helper_sve_revw_d : NULL, a, 0)
=20
+TRANS_FEAT(REVD, aa64_sme, gen_gvec_ool_arg_zpz, gen_helper_sme_revd_q, a,=
 0)
+
 TRANS_FEAT(SPLICE, aa64_sve, gen_gvec_ool_arg_zpzz,
            gen_helper_sve_splice, a, a->esz)
=20
--=20
2.25.1
From nobody Thu May  8 21:38:42 2025
Delivered-To: importer@patchew.org
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass(p=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1657550616; cv=none;
	d=zohomail.com; s=zohoarc;
	b=UqRoKHatZO8axVG56dCeBZM0kPmQvWD90oZ3wlbPLQK6ui63XbIdHwl3rw1KQCAizBX9zFoDtJ4gGzah/an4LQzDijn78ZRvTGqTO7m1paRdRQRBfsx8hx2nWhahkjBS2EndiIZMUu/pToE2HF9uoadO/LMZm27CJspKTeIpVLA=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1657550616;
 h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
	bh=NefM+zE4IIZS4r9ntXfwlEBdnRvPOEaUwHvQJzfMAXc=;
	b=i/65Il6gs+aeiVhCuloAmG4KyHkmVeKollGXzkk/HCr7Q48AHyQizNS3kuKNJrC2a/3NH34q/WFOH9NuEv+CJrf8APRLm3lkHAg5qWz4RTkRj53FBK+YP2Per4NJD1g1pvo7EKTt8UlRPr4AzaxPbgyMAgJGZUDn89oV1jlhJQA=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass header.from=<peter.maydell@linaro.org> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1657550616575945.8678895218411;
 Mon, 11 Jul 2022 07:43:36 -0700 (PDT)
Received: from localhost ([::1]:32954 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces+importer=patchew.org@nongnu.org>)
	id 1oAudK-0004Qe-OR
	for importer@patchew.org; Mon, 11 Jul 2022 10:43:34 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:43176)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvm-0006ic-Da
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:35 -0400
Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]:38728)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvd-0002p0-5B
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:34 -0400
Received: by mail-wm1-x32f.google.com with SMTP id
 9-20020a1c0209000000b003a2dfdebe47so2267889wmc.3
 for <qemu-devel@nongnu.org>; Mon, 11 Jul 2022 06:58:18 -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.16
 for <qemu-devel@nongnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 11 Jul 2022 06:58:17 -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=NefM+zE4IIZS4r9ntXfwlEBdnRvPOEaUwHvQJzfMAXc=;
 b=HaTW4r/nTbwmquA7q2IVbCy4iZOCvgEB0rwgvba8hVmaBuUGGC8Efya2z9lFUKTQp4
 2gADb/qCEiUjs9cgvpnZ9tR2g5VsDbCk38E3kHjh5pQJq+Z9YCd6e2Jvj2lWC9glmyOB
 4n5IidXLziQpZb1cGmK9Z1LHq7IA1ZfAqQn/BWsFT2HTP+YwdJ4rF9FibuztqNZ6Sc++
 JdjpfQtYF5vP97j1DqVp8iCm8KzXXdH1mfR+pEg+oNx9ya5Xd1kA5+miVM183cm+g0Xo
 KdLBn5Fq7LGXFIJZloucSTZ8gAfLMRvBsj2mhnPWAZ8yPIOGI6iuCT5RxIdM2dhk9K6F
 L98w==
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=NefM+zE4IIZS4r9ntXfwlEBdnRvPOEaUwHvQJzfMAXc=;
 b=blzWN0jJn6188SG18WDYoiPugpQuP9PM+WO1XKnVXGCmwabecPKqU7nJwjhR1LXkoV
 VYLnXRkUS4vIGlC2CpHHQlgpYcyl/TuZnoYu/bfzAiS58lkQqfLmY27LJQbj8VKHgq9p
 Co/IEX9G4x8gv58bQdnoBWnms+rIG0fDLGZh0yov4B2t2TPxyzymzx/TogV539KWg0lI
 LjFpnZxQRg7XfikkHIq2/wXle8XqT3C2dNTxsgOWELYT6/EHxC3bECO2DG58x7osTWF0
 B/tWnr7bs2ABDK1gUJbWVnEpdQgnFZowZlchwlXEksAvnBDSO9T0GB6FJwSy2TN4Z6tZ
 JLpw==
X-Gm-Message-State: AJIora+IuocNEnwH/9E6vlOEqjnIqAMrQ86UWjK7CaslfoJvFYjejPvJ
 TTHvk1DiWP7LkCTZr941eOTeWEwbGgl2Uw==
X-Google-Smtp-Source: 
 AGRyM1synqXwNDxDfBJUqCnY/aXcmYdzNRk9iBiRDobFuSQfxA32GqL1s7SKKAz46m+hRQacN4PrUw==
X-Received: by 2002:a7b:cb8e:0:b0:3a2:da0f:d8ae with SMTP id
 m14-20020a7bcb8e000000b003a2da0fd8aemr15982125wmi.23.1657547897919;
 Mon, 11 Jul 2022 06:58:17 -0700 (PDT)
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 30/45] target/arm: Implement SCLAMP, UCLAMP
Date: Mon, 11 Jul 2022 14:57:35 +0100
Message-Id: <20220711135750.765803-31-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
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17
 as permitted sender) client-ip=209.51.188.17;
 envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org;
 helo=lists.gnu.org;
Received-SPF: pass client-ip=2a00:1450:4864:20::32f;
 envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32f.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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>
Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org
Sender: "Qemu-devel" <qemu-devel-bounces+importer=patchew.org@nongnu.org>
X-ZohoMail-DKIM: pass (identity @linaro.org)
X-ZM-MESSAGEID: 1657550618725100001
Content-Type: text/plain; charset="utf-8"

From: Richard Henderson <richard.henderson@linaro.org>

This is an SVE instruction that operates using the SVE vector
length but that it is present only if SME is implemented.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220708151540.18136-31-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 target/arm/helper.h        |  18 +++++++
 target/arm/sve.decode      |   5 ++
 target/arm/translate-sve.c | 102 +++++++++++++++++++++++++++++++++++++
 target/arm/vec_helper.c    |  24 +++++++++
 4 files changed, 149 insertions(+)

diff --git a/target/arm/helper.h b/target/arm/helper.h
index 3a8ce42ab01..92f36d9dbb7 100644
--- a/target/arm/helper.h
+++ b/target/arm/helper.h
@@ -1019,6 +1019,24 @@ DEF_HELPER_FLAGS_6(gvec_bfmlal, TCG_CALL_NO_RWG,
 DEF_HELPER_FLAGS_6(gvec_bfmlal_idx, TCG_CALL_NO_RWG,
                    void, ptr, ptr, ptr, ptr, ptr, i32)
=20
+DEF_HELPER_FLAGS_5(gvec_sclamp_b, TCG_CALL_NO_RWG,
+                   void, ptr, ptr, ptr, ptr, i32)
+DEF_HELPER_FLAGS_5(gvec_sclamp_h, TCG_CALL_NO_RWG,
+                   void, ptr, ptr, ptr, ptr, i32)
+DEF_HELPER_FLAGS_5(gvec_sclamp_s, TCG_CALL_NO_RWG,
+                   void, ptr, ptr, ptr, ptr, i32)
+DEF_HELPER_FLAGS_5(gvec_sclamp_d, TCG_CALL_NO_RWG,
+                   void, ptr, ptr, ptr, ptr, i32)
+
+DEF_HELPER_FLAGS_5(gvec_uclamp_b, TCG_CALL_NO_RWG,
+                   void, ptr, ptr, ptr, ptr, i32)
+DEF_HELPER_FLAGS_5(gvec_uclamp_h, TCG_CALL_NO_RWG,
+                   void, ptr, ptr, ptr, ptr, i32)
+DEF_HELPER_FLAGS_5(gvec_uclamp_s, TCG_CALL_NO_RWG,
+                   void, ptr, ptr, ptr, ptr, i32)
+DEF_HELPER_FLAGS_5(gvec_uclamp_d, TCG_CALL_NO_RWG,
+                   void, ptr, ptr, ptr, ptr, i32)
+
 #ifdef TARGET_AARCH64
 #include "helper-a64.h"
 #include "helper-sve.h"
diff --git a/target/arm/sve.decode b/target/arm/sve.decode
index a9e48f07b44..14b3a69c364 100644
--- a/target/arm/sve.decode
+++ b/target/arm/sve.decode
@@ -1695,3 +1695,8 @@ PSEL            00100101 .. 1 100 .. 01 .... 0 .... 0=
 ....  \
                 @psel esz=3D2 imm=3D%psel_imm_s
 PSEL            00100101 .1 1 000 .. 01 .... 0 .... 0 ....  \
                 @psel esz=3D3 imm=3D%psel_imm_d
+
+### SVE clamp
+
+SCLAMP          01000100 .. 0 ..... 110000 ..... .....          @rda_rn_rm
+UCLAMP          01000100 .. 0 ..... 110001 ..... .....          @rda_rn_rm
diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c
index 9ed3b267fdb..41f8b12259e 100644
--- a/target/arm/translate-sve.c
+++ b/target/arm/translate-sve.c
@@ -7478,3 +7478,105 @@ static bool trans_PSEL(DisasContext *s, arg_psel *a)
     tcg_temp_free_ptr(ptr);
     return true;
 }
+
+static void gen_sclamp_i32(TCGv_i32 d, TCGv_i32 n, TCGv_i32 m, TCGv_i32 a)
+{
+    tcg_gen_smax_i32(d, a, n);
+    tcg_gen_smin_i32(d, d, m);
+}
+
+static void gen_sclamp_i64(TCGv_i64 d, TCGv_i64 n, TCGv_i64 m, TCGv_i64 a)
+{
+    tcg_gen_smax_i64(d, a, n);
+    tcg_gen_smin_i64(d, d, m);
+}
+
+static void gen_sclamp_vec(unsigned vece, TCGv_vec d, TCGv_vec n,
+                           TCGv_vec m, TCGv_vec a)
+{
+    tcg_gen_smax_vec(vece, d, a, n);
+    tcg_gen_smin_vec(vece, d, d, m);
+}
+
+static void gen_sclamp(unsigned vece, uint32_t d, uint32_t n, uint32_t m,
+                       uint32_t a, uint32_t oprsz, uint32_t maxsz)
+{
+    static const TCGOpcode vecop[] =3D {
+        INDEX_op_smin_vec, INDEX_op_smax_vec, 0
+    };
+    static const GVecGen4 ops[4] =3D {
+        { .fniv =3D gen_sclamp_vec,
+          .fno  =3D gen_helper_gvec_sclamp_b,
+          .opt_opc =3D vecop,
+          .vece =3D MO_8 },
+        { .fniv =3D gen_sclamp_vec,
+          .fno  =3D gen_helper_gvec_sclamp_h,
+          .opt_opc =3D vecop,
+          .vece =3D MO_16 },
+        { .fni4 =3D gen_sclamp_i32,
+          .fniv =3D gen_sclamp_vec,
+          .fno  =3D gen_helper_gvec_sclamp_s,
+          .opt_opc =3D vecop,
+          .vece =3D MO_32 },
+        { .fni8 =3D gen_sclamp_i64,
+          .fniv =3D gen_sclamp_vec,
+          .fno  =3D gen_helper_gvec_sclamp_d,
+          .opt_opc =3D vecop,
+          .vece =3D MO_64,
+          .prefer_i64 =3D TCG_TARGET_REG_BITS =3D=3D 64 }
+    };
+    tcg_gen_gvec_4(d, n, m, a, oprsz, maxsz, &ops[vece]);
+}
+
+TRANS_FEAT(SCLAMP, aa64_sme, gen_gvec_fn_arg_zzzz, gen_sclamp, a)
+
+static void gen_uclamp_i32(TCGv_i32 d, TCGv_i32 n, TCGv_i32 m, TCGv_i32 a)
+{
+    tcg_gen_umax_i32(d, a, n);
+    tcg_gen_umin_i32(d, d, m);
+}
+
+static void gen_uclamp_i64(TCGv_i64 d, TCGv_i64 n, TCGv_i64 m, TCGv_i64 a)
+{
+    tcg_gen_umax_i64(d, a, n);
+    tcg_gen_umin_i64(d, d, m);
+}
+
+static void gen_uclamp_vec(unsigned vece, TCGv_vec d, TCGv_vec n,
+                           TCGv_vec m, TCGv_vec a)
+{
+    tcg_gen_umax_vec(vece, d, a, n);
+    tcg_gen_umin_vec(vece, d, d, m);
+}
+
+static void gen_uclamp(unsigned vece, uint32_t d, uint32_t n, uint32_t m,
+                       uint32_t a, uint32_t oprsz, uint32_t maxsz)
+{
+    static const TCGOpcode vecop[] =3D {
+        INDEX_op_umin_vec, INDEX_op_umax_vec, 0
+    };
+    static const GVecGen4 ops[4] =3D {
+        { .fniv =3D gen_uclamp_vec,
+          .fno  =3D gen_helper_gvec_uclamp_b,
+          .opt_opc =3D vecop,
+          .vece =3D MO_8 },
+        { .fniv =3D gen_uclamp_vec,
+          .fno  =3D gen_helper_gvec_uclamp_h,
+          .opt_opc =3D vecop,
+          .vece =3D MO_16 },
+        { .fni4 =3D gen_uclamp_i32,
+          .fniv =3D gen_uclamp_vec,
+          .fno  =3D gen_helper_gvec_uclamp_s,
+          .opt_opc =3D vecop,
+          .vece =3D MO_32 },
+        { .fni8 =3D gen_uclamp_i64,
+          .fniv =3D gen_uclamp_vec,
+          .fno  =3D gen_helper_gvec_uclamp_d,
+          .opt_opc =3D vecop,
+          .vece =3D MO_64,
+          .prefer_i64 =3D TCG_TARGET_REG_BITS =3D=3D 64 }
+    };
+    tcg_gen_gvec_4(d, n, m, a, oprsz, maxsz, &ops[vece]);
+}
+
+TRANS_FEAT(UCLAMP, aa64_sme, gen_gvec_fn_arg_zzzz, gen_uclamp, a)
diff --git a/target/arm/vec_helper.c b/target/arm/vec_helper.c
index 9a9c034e36f..f59d3b26eac 100644
--- a/target/arm/vec_helper.c
+++ b/target/arm/vec_helper.c
@@ -2690,3 +2690,27 @@ void HELPER(gvec_bfmlal_idx)(void *vd, void *vn, voi=
d *vm,
     }
     clear_tail(d, opr_sz, simd_maxsz(desc));
 }
+
+#define DO_CLAMP(NAME, TYPE) \
+void HELPER(NAME)(void *d, void *n, void *m, void *a, uint32_t desc)    \
+{                                                                       \
+    intptr_t i, opr_sz =3D simd_oprsz(desc);                              \
+    for (i =3D 0; i < opr_sz; i +=3D sizeof(TYPE)) {                      =
  \
+        TYPE aa =3D *(TYPE *)(a + i);                                     \
+        TYPE nn =3D *(TYPE *)(n + i);                                     \
+        TYPE mm =3D *(TYPE *)(m + i);                                     \
+        TYPE dd =3D MIN(MAX(aa, nn), mm);                                 \
+        *(TYPE *)(d + i) =3D dd;                                          \
+    }                                                                   \
+    clear_tail(d, opr_sz, simd_maxsz(desc));                            \
+}
+
+DO_CLAMP(gvec_sclamp_b, int8_t)
+DO_CLAMP(gvec_sclamp_h, int16_t)
+DO_CLAMP(gvec_sclamp_s, int32_t)
+DO_CLAMP(gvec_sclamp_d, int64_t)
+
+DO_CLAMP(gvec_uclamp_b, uint8_t)
+DO_CLAMP(gvec_uclamp_h, uint16_t)
+DO_CLAMP(gvec_uclamp_s, uint32_t)
+DO_CLAMP(gvec_uclamp_d, uint64_t)
--=20
2.25.1
From nobody Thu May  8 21:38:42 2025
Delivered-To: importer@patchew.org
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass(p=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1657550173; cv=none;
	d=zohomail.com; s=zohoarc;
	b=JcxP1tmuWAo3QFWtCt3qlwVIdUUaQCFB5gvFtjzdbhyW3mL3V+dj0iGIDlar0Bm93i8/dnvJo2TPHMtmfwZHoCauv6T/dNqa9q9xATog1QBarNEJwczwmLqd2pLimOduZN0vwW3YmLhmgJbqYImt3yCLetKvJZ4M0O2jkcnHZ5w=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1657550173;
 h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
	bh=HEJdzVygGY0s6uguuLvn1wUd1JpqYr/BZXBoM1CiCf4=;
	b=SXQf4eqV3YPVsBfuI0HHdL3jyxVQqZBE9cvS3y1QaOtR/aY7+3Zhbmppumb/Wtlj1YjmJ19pjw9f3JGI2+LkUaiYroIV0OItggZWolIoHFjL055nKHeL6/VJyZrNewWDfP/2zr99XbZMAmpyBFasB5sCMmzIsdyqjDEZgOLDZFk=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass header.from=<peter.maydell@linaro.org> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1657550173932237.48007390340945;
 Mon, 11 Jul 2022 07:36:13 -0700 (PDT)
Received: from localhost ([::1]:46634 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces+importer=patchew.org@nongnu.org>)
	id 1oAuWB-0002LI-RH
	for importer@patchew.org; Mon, 11 Jul 2022 10:36:11 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:43062)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvi-0006h6-Hp
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:31 -0400
Received: from mail-wr1-x42a.google.com ([2a00:1450:4864:20::42a]:38514)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvd-0002kD-56
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:30 -0400
Received: by mail-wr1-x42a.google.com with SMTP id v14so7135985wra.5
 for <qemu-devel@nongnu.org>; Mon, 11 Jul 2022 06:58:19 -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.18
 for <qemu-devel@nongnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 11 Jul 2022 06:58:18 -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=HEJdzVygGY0s6uguuLvn1wUd1JpqYr/BZXBoM1CiCf4=;
 b=d1KW+XGJCSbxzHD6ARnb2fXE0hJnIsFh4TZBWaPuGef+vJTtFbqpPO0KgWMlNdGDS/
 ffRQEu5JQjj8O+Xaddel2jf/p5bZRQCUfIyWUXlsSWnC3Q/ZzMApMeoPW11yWk+33inO
 dmAoU3Ys714bmLiRZLuxBbwT4c9n4nL8JvfVy9BxPEeB/oAzpxNGsbc7QRb8yHfFBtas
 qVFkATwTHr+HfPm+b2Gm/Ao+gtZblpbMecMThgCNpn/XIkDSCC/TfciWzGY3kyUKCJb1
 WBXz8NGm6iuWTTObvH5Q2tFZkCo3Ploo3fQNAYeouegWSDK5uB0/MEzEiixIepS0z6/b
 SG+g==
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=HEJdzVygGY0s6uguuLvn1wUd1JpqYr/BZXBoM1CiCf4=;
 b=peiWbs8w9V2aL1UwOHiaIaUlXTsVVcnXhNsS/LdFLXCssQcruPq0iXDX5jI9BiPqC9
 Onmul3cBPFv4RxTPbH9/cAB6oI0PV7tkpAE/vFSWdVDVRTDT9VmRTe+yMnOcJR7v/sGE
 +r0MTOHt9yObh2fl/VEB271odPoXD7Lb/eDMhvv6BjWf/vnXTxOM05RAhl5gCty36J5b
 HCDAx9bgUngdR34jnmGODM/HBCk+zs3cJUZ4iyoVJUGsgxOU0css+gh/dHYXToIxfg3y
 HqOCdusS3UsHnOpr8cJ50tYa+SroIWi4fVyRFQjR7YqjjciZKiN0NuMYDW1CIDz9I1GI
 wD7g==
X-Gm-Message-State: AJIora/eWsKwCN4JkGql9F2hNouVK5mgU37fiuAdU3UGf2HRlWoK9Xhl
 0pmGCh8zR71V7Li5ZXOrpZKRj663G5vqyg==
X-Google-Smtp-Source: 
 AGRyM1ulgtih+V+8sDMhHXnc8BfceDJsCByzRxI3TLBOlfj4ylkWfbo7gNQSUM09+oGFNPvym40S+Q==
X-Received: by 2002:a05:6000:1ac8:b0:21b:9236:6207 with SMTP id
 i8-20020a0560001ac800b0021b92366207mr16684793wry.123.1657547898694;
 Mon, 11 Jul 2022 06:58:18 -0700 (PDT)
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 31/45] target/arm: Reset streaming sve state on exception
 boundaries
Date: Mon, 11 Jul 2022 14:57:36 +0100
Message-Id: <20220711135750.765803-32-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
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17
 as permitted sender) client-ip=209.51.188.17;
 envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org;
 helo=lists.gnu.org;
Received-SPF: pass client-ip=2a00:1450:4864:20::42a;
 envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42a.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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>
Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org
Sender: "Qemu-devel" <qemu-devel-bounces+importer=patchew.org@nongnu.org>
X-ZohoMail-DKIM: pass (identity @linaro.org)
X-ZM-MESSAGEID: 1657550175364100001
Content-Type: text/plain; charset="utf-8"

From: Richard Henderson <richard.henderson@linaro.org>

We can handle both exception entry and exception return by
hooking into aarch64_sve_change_el.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220708151540.18136-32-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 target/arm/helper.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/target/arm/helper.c b/target/arm/helper.c
index 73a5b2b86d9..cfcad97ce07 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -11242,6 +11242,19 @@ void aarch64_sve_change_el(CPUARMState *env, int o=
ld_el,
         return;
     }
=20
+    old_a64 =3D old_el ? arm_el_is_aa64(env, old_el) : el0_a64;
+    new_a64 =3D new_el ? arm_el_is_aa64(env, new_el) : el0_a64;
+
+    /*
+     * Both AArch64.TakeException and AArch64.ExceptionReturn
+     * invoke ResetSVEState when taking an exception from, or
+     * returning to, AArch32 state when PSTATE.SM is enabled.
+     */
+    if (old_a64 !=3D new_a64 && FIELD_EX64(env->svcr, SVCR, SM)) {
+        arm_reset_sve_state(env);
+        return;
+    }
+
     /*
      * DDI0584A.d sec 3.2: "If SVE instructions are disabled or trapped
      * at ELx, or not available because the EL is in AArch32 state, then
@@ -11254,10 +11267,8 @@ void aarch64_sve_change_el(CPUARMState *env, int o=
ld_el,
      * we already have the correct register contents when encountering the
      * vq0->vq0 transition between EL0->EL1.
      */
-    old_a64 =3D old_el ? arm_el_is_aa64(env, old_el) : el0_a64;
     old_len =3D (old_a64 && !sve_exception_el(env, old_el)
                ? sve_vqm1_for_el(env, old_el) : 0);
-    new_a64 =3D new_el ? arm_el_is_aa64(env, new_el) : el0_a64;
     new_len =3D (new_a64 && !sve_exception_el(env, new_el)
                ? sve_vqm1_for_el(env, new_el) : 0);
=20
--=20
2.25.1
From nobody Thu May  8 21:38:42 2025
Delivered-To: importer@patchew.org
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass(p=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1657550865; cv=none;
	d=zohomail.com; s=zohoarc;
	b=IYefLhYcJjyGKVR3sHNQWooF43S+/HDbbg9BIfQsAi9LUsTtCztTU2RMtp3jfX7v76iuYnbzdUIvnIUB4MPNyQ12YmDI9qH9UxyxwFh/ljHNCWjnPvC9/8+PeJMP9UoH6L+FodlDRKFp99+Wa5n/WPHb1R1OZ9pMs4MR4Ms0Ssw=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1657550865;
 h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
	bh=ZwtZ0mOyj+i0qaAFT/4uFTt0YWVAMrJV8kc5O+TbtwE=;
	b=CR2Lq7VZrzug9q4/73qGQE6A9ZTW8sijgK+qZAAJdnZzJ4DdPifNpJevBd/Pc+mNRu5n8ty29NWV0G7tigHry8NhGZcHJqR+I6LdcDUROYn0Bk20zkm1Au+QlsdGC04TbJyQdqjQNG+w9GMOrv727GFap/xmtxK60bdSnjgQJ7A=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass header.from=<peter.maydell@linaro.org> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1657550865487816.7138424392858;
 Mon, 11 Jul 2022 07:47:45 -0700 (PDT)
Received: from localhost ([::1]:41736 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces+importer=patchew.org@nongnu.org>)
	id 1oAuhL-00022m-Mj
	for importer@patchew.org; Mon, 11 Jul 2022 10:47:43 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:43210)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvn-0006ld-Rt
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:35 -0400
Received: from mail-wr1-x429.google.com ([2a00:1450:4864:20::429]:40761)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtve-0002tx-QA
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:35 -0400
Received: by mail-wr1-x429.google.com with SMTP id z12so7128287wrq.7
 for <qemu-devel@nongnu.org>; Mon, 11 Jul 2022 06:58:20 -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.18
 for <qemu-devel@nongnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 11 Jul 2022 06:58:19 -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=ZwtZ0mOyj+i0qaAFT/4uFTt0YWVAMrJV8kc5O+TbtwE=;
 b=QGTTcMZmkej+fjiCrxJvx4aYKpCuXmizgk0d9HxtBzDZhElvj0tWboQIz5hxRWexbw
 LzJJRUBfHnW9/KnOjzW16Nf113iN4gXahguzh8cGbguioUY3sAgo6p0zXOf6K4Zp8oBj
 66QVJI3MQeU5I4wwSDuuU5AWsUGUu4Oy0pCI2+pNiDWG7jCOv6M5RZ1NQNI195PNlsDp
 b/v8FEChoobpla6MlX/9krt8gqpwoMCzKZ8EVziT4qUBYZXBYoaXIg+0nDKRKS/lvI8Q
 M+VQikK07sLvKjiQJpJNbvwdz3DO2CJIrSqFUR8yZpLT4X6QC2CTLD0RBgeGyoocLtjF
 1e+w==
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=ZwtZ0mOyj+i0qaAFT/4uFTt0YWVAMrJV8kc5O+TbtwE=;
 b=bMdUlkrcI4pGMlK9dpLl5w7EHCbeiHogjkzptZNBi4gyVonKqaU39TnxGP1YoVWBXE
 JQjxie4qMBQZsQzOaP0wIWx+6/ZlDTgGEqSR78/WPkhnE/yUTBHNnnEHubOzw7QVexJ1
 K8n6wnTN+f54doaTAJCOYioMAT37SqoMpvN9B9F2FQ+AbSV6Gj5M9Qg7QEiQRVmkuriL
 l588An51OstB5cAEogj4kecAFKfYYojVVaqYJFBd4ZHAGr14+Ezt62HABvbtCk40qOUV
 x0FjnDiA+Mgghy1wvuwAYIy1YahQoz/s/3/+y+EseJ++bwovbEvB3FsrO+yxOmOlnu3Q
 QySw==
X-Gm-Message-State: AJIora9EW4euasgFk2KmfzfkhoZF84GYiDkJaB89Ec8f/xhsHNJAPpom
 XNZNDNRA/Tz+dN6vSrOy3jT0GHBUtDLGSA==
X-Google-Smtp-Source: 
 AGRyM1sXJAw2UE1gkyDfifrQwVNNz0gYlbxlaxn8QDJtTLC46pJgZSSJZlVC3UA+3H7Hh5yqCykdFg==
X-Received: by 2002:a5d:5983:0:b0:21d:a811:3b41 with SMTP id
 n3-20020a5d5983000000b0021da8113b41mr3757215wri.441.1657547899456;
 Mon, 11 Jul 2022 06:58:19 -0700 (PDT)
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 32/45] target/arm: Enable SME for -cpu max
Date: Mon, 11 Jul 2022 14:57:37 +0100
Message-Id: <20220711135750.765803-33-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
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17
 as permitted sender) client-ip=209.51.188.17;
 envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org;
 helo=lists.gnu.org;
Received-SPF: pass client-ip=2a00:1450:4864:20::429;
 envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x429.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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>
Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org
Sender: "Qemu-devel" <qemu-devel-bounces+importer=patchew.org@nongnu.org>
X-ZohoMail-DKIM: pass (identity @linaro.org)
X-ZM-MESSAGEID: 1657550866271100001
Content-Type: text/plain; charset="utf-8"

From: Richard Henderson <richard.henderson@linaro.org>

Note that SME remains effectively disabled for user-only,
because we do not yet set CPACR_EL1.SMEN.  This needs to
wait until the kernel ABI is implemented.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220708151540.18136-33-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 docs/system/arm/emulation.rst |  4 ++++
 target/arm/cpu64.c            | 11 +++++++++++
 2 files changed, 15 insertions(+)

diff --git a/docs/system/arm/emulation.rst b/docs/system/arm/emulation.rst
index 83b44100659..8e494c8bea5 100644
--- a/docs/system/arm/emulation.rst
+++ b/docs/system/arm/emulation.rst
@@ -65,6 +65,10 @@ the following architecture extensions:
 - FEAT_SHA512 (Advanced SIMD SHA512 instructions)
 - FEAT_SM3 (Advanced SIMD SM3 instructions)
 - FEAT_SM4 (Advanced SIMD SM4 instructions)
+- FEAT_SME (Scalable Matrix Extension)
+- FEAT_SME_FA64 (Full A64 instruction set in Streaming SVE mode)
+- FEAT_SME_F64F64 (Double-precision floating-point outer product instructi=
ons)
+- FEAT_SME_I16I64 (16-bit to 64-bit integer widening outer product instruc=
tions)
 - FEAT_SPECRES (Speculation restriction instructions)
 - FEAT_SSBS (Speculative Store Bypass Safe)
 - FEAT_TLBIOS (TLB invalidate instructions in Outer Shareable domain)
diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c
index b4fd4b7ec87..78e27f778ac 100644
--- a/target/arm/cpu64.c
+++ b/target/arm/cpu64.c
@@ -1024,6 +1024,7 @@ static void aarch64_max_initfn(Object *obj)
      */
     t =3D FIELD_DP64(t, ID_AA64PFR1, MTE, 3);       /* FEAT_MTE3 */
     t =3D FIELD_DP64(t, ID_AA64PFR1, RAS_FRAC, 0);  /* FEAT_RASv1p1 + FEAT=
_DoubleFault */
+    t =3D FIELD_DP64(t, ID_AA64PFR1, SME, 1);       /* FEAT_SME */
     t =3D FIELD_DP64(t, ID_AA64PFR1, CSV2_FRAC, 0); /* FEAT_CSV2_2 */
     cpu->isar.id_aa64pfr1 =3D t;
=20
@@ -1074,6 +1075,16 @@ static void aarch64_max_initfn(Object *obj)
     t =3D FIELD_DP64(t, ID_AA64DFR0, PMUVER, 5);    /* FEAT_PMUv3p4 */
     cpu->isar.id_aa64dfr0 =3D t;
=20
+    t =3D cpu->isar.id_aa64smfr0;
+    t =3D FIELD_DP64(t, ID_AA64SMFR0, F32F32, 1);   /* FEAT_SME */
+    t =3D FIELD_DP64(t, ID_AA64SMFR0, B16F32, 1);   /* FEAT_SME */
+    t =3D FIELD_DP64(t, ID_AA64SMFR0, F16F32, 1);   /* FEAT_SME */
+    t =3D FIELD_DP64(t, ID_AA64SMFR0, I8I32, 0xf);  /* FEAT_SME */
+    t =3D FIELD_DP64(t, ID_AA64SMFR0, F64F64, 1);   /* FEAT_SME_F64F64 */
+    t =3D FIELD_DP64(t, ID_AA64SMFR0, I16I64, 0xf); /* FEAT_SME_I16I64 */
+    t =3D FIELD_DP64(t, ID_AA64SMFR0, FA64, 1);     /* FEAT_SME_FA64 */
+    cpu->isar.id_aa64smfr0 =3D t;
+
     /* Replicate the same data to the 32-bit id registers.  */
     aa32_max_features(cpu);
=20
--=20
2.25.1
From nobody Thu May  8 21:38:42 2025
Delivered-To: importer@patchew.org
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass(p=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1657549101; cv=none;
	d=zohomail.com; s=zohoarc;
	b=MpIWgXr9TYe4u8qiQHOc6wqmVdqupowM+1JUldcCC3n6YJgJ8Qm6sIH57v+IFNM8K74JRfT6P9q+TpcuQiZ1wRfMReGkLo4x+84VduI/jpyg8hu9W5lB3jDZ/dHhgM/upjilzNorGh+ki92hraM+LpRE/uFfZNO1669UWqbHrbA=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1657549101;
 h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
	bh=korErL6tl7BONUfbCJvMnIcz8S+EeAk7Q1N3xczdPYQ=;
	b=Vj2SMi1vxROJQsvyTywVi2MZ18AnpFuFXhmDni1yrO0Ejk+JzrX56U+4PwoZzE15uOlVvAYhe4qeaOHUxmjl4wT7NCX8uZjxM5tFQwoUMMHO5pUKetSfbahe/lSosubkF6/H2W78Cawy2wUCtN93AufG4TV2j5MOaqL4SJuZh8Y=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass header.from=<peter.maydell@linaro.org> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1657549101390269.5279149712368;
 Mon, 11 Jul 2022 07:18:21 -0700 (PDT)
Received: from localhost ([::1]:50122 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces+importer=patchew.org@nongnu.org>)
	id 1oAuEu-00088w-Av
	for importer@patchew.org; Mon, 11 Jul 2022 10:18:20 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:43092)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvj-0006hK-LV
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:31 -0400
Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]:55902)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvd-0002nJ-6O
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:31 -0400
Received: by mail-wm1-x32e.google.com with SMTP id l42so3021510wms.5
 for <qemu-devel@nongnu.org>; Mon, 11 Jul 2022 06:58:20 -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.19
 for <qemu-devel@nongnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 11 Jul 2022 06:58:19 -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=korErL6tl7BONUfbCJvMnIcz8S+EeAk7Q1N3xczdPYQ=;
 b=aNRZw6Cv3AT25izA7eoSLfHdSL8q/3m51gaXovFYWRCtJC3ywnNbqQPHbED+OWP20T
 MZFKO4Pg4pDZfZT7wz+/VnkDXfD6pCbMBeM5fM+xlxjIAuregI57lWUqyzyu1Y5tfE/D
 b9iTDtQETUW99DYvPkzWx+NXbnFatFkh8jjHOpkiKVJuc9Q+G0w1ftBkgFZk9kBpJEs3
 SArHKUbRZ9ClsARGJUAA0U6ImxK4kxPK0kznl/KPCLGiHNAWrJO21neYouoINKqV3zJ1
 z+9UqbAxNI8RrhEnT3lChQrlylQTu9ipyEVF9wzr7fUmXeE2IPz8cOwIrGpfikJoP/GL
 URjA==
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=korErL6tl7BONUfbCJvMnIcz8S+EeAk7Q1N3xczdPYQ=;
 b=h55P6221mNulEFV+2R8j9ZarExWfvkKHyZyds+5+5RsCBwemEBNwUTDlZXquwS4q20
 5SOjhPFgH1gyGlz2ZDXBc5BqkB0HnE8Bij/9BM85NH6YQ3A3yly6u3aHmEwWoN+bk32Z
 mfjXXmBT5fmgjzeySU8Kvj0dPdLluRrYehey8m/GyIJupsLgxGpR76eaZ+upZGPDIlcO
 CfWYlrTf6w6hNXNJNCbfydJKIt31w3CcUZbNqwfx9zLCYqWxBVJHaO77bud9CuH+QP/z
 I05CrzsaVQcwpYQKpBC7CTFS48tzwX68PaqRqb192wUr72WzLcKOW0Nvpl0i1GBTn6ZY
 oPrg==
X-Gm-Message-State: AJIora/NiP/Hmg7hZ2EmYPBQRX6bDQ8FQmR8QKtb2OCDLL6A5Iq35e/N
 bDNCgpY/0XTmC3xmBuZI5TQG+JKFSrXvSQ==
X-Google-Smtp-Source: 
 AGRyM1uNLp7QGqT8fRvkEElE0cRzvxPnlsxCDGjiEeaCgRvlBs1+wfh7aDFnX53pnV36wUl9gECRvA==
X-Received: by 2002:a05:600c:4eca:b0:3a1:9c39:ac20 with SMTP id
 g10-20020a05600c4eca00b003a19c39ac20mr16217566wmq.61.1657547900178;
 Mon, 11 Jul 2022 06:58:20 -0700 (PDT)
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 33/45] linux-user/aarch64: Clear tpidr2_el0 if CLONE_SETTLS
Date: Mon, 11 Jul 2022 14:57:38 +0100
Message-Id: <20220711135750.765803-34-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
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17
 as permitted sender) client-ip=209.51.188.17;
 envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org;
 helo=lists.gnu.org;
Received-SPF: pass client-ip=2a00:1450:4864:20::32e;
 envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32e.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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>
Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org
Sender: "Qemu-devel" <qemu-devel-bounces+importer=patchew.org@nongnu.org>
X-ZohoMail-DKIM: pass (identity @linaro.org)
X-ZM-MESSAGEID: 1657549103227100001
Content-Type: text/plain; charset="utf-8"

From: Richard Henderson <richard.henderson@linaro.org>

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220708151540.18136-34-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 linux-user/aarch64/target_cpu.h | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/linux-user/aarch64/target_cpu.h b/linux-user/aarch64/target_cp=
u.h
index 97a477bd3e9..f90359faf20 100644
--- a/linux-user/aarch64/target_cpu.h
+++ b/linux-user/aarch64/target_cpu.h
@@ -34,10 +34,13 @@ static inline void cpu_clone_regs_parent(CPUARMState *e=
nv, unsigned flags)
=20
 static inline void cpu_set_tls(CPUARMState *env, target_ulong newtls)
 {
-    /* Note that AArch64 Linux keeps the TLS pointer in TPIDR; this is
+    /*
+     * Note that AArch64 Linux keeps the TLS pointer in TPIDR; this is
      * different from AArch32 Linux, which uses TPIDRRO.
      */
     env->cp15.tpidr_el[0] =3D newtls;
+    /* TPIDR2_EL0 is cleared with CLONE_SETTLS. */
+    env->cp15.tpidr2_el0 =3D 0;
 }
=20
 static inline abi_ulong get_sp_from_cpustate(CPUARMState *state)
--=20
2.25.1
From nobody Thu May  8 21:38:42 2025
Delivered-To: importer@patchew.org
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass(p=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1657549431; cv=none;
	d=zohomail.com; s=zohoarc;
	b=aeOxnrvIFGwqHd4sUt4aipwf39/qrl1X5VdDB0HzkVGe098Dmdo08YT35YFiUHf6WGJldv/5PB/0mKwpNVSUZY8QHc6aMQyHen7oNGHkV54z9MbstOfHF/iFB105aU7iqXJMxawOnnp23Vz07MZ1itQyry5HHp3U8i/rOj+cXx0=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1657549431;
 h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
	bh=9bCQOBJQUNrEYM6NaGyKlOsHHz/7cHH58vaKjgHSLV8=;
	b=Vy/i/AV7gWhAmMu5gs6qXqSEQOoVOOZhiDLcAWAfUPjxNOnR5s+TyPSfYc1ykZUydx03AkCo5cTByebB5sViV4PBg3jij6fddT/LSiKao1ahfNTowD5snEDWxC9dr147+JuGakqCHdIgyrS2PTKxGOqfelxkv8JcketM9aVNzm4=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass header.from=<peter.maydell@linaro.org> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1657549431015636.6828072225218;
 Mon, 11 Jul 2022 07:23:51 -0700 (PDT)
Received: from localhost ([::1]:58322 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces+importer=patchew.org@nongnu.org>)
	id 1oAuKD-0005jr-Uv
	for importer@patchew.org; Mon, 11 Jul 2022 10:23:49 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:43122)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvk-0006iA-R7
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:33 -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 <peter.maydell@linaro.org>)
 id 1oAtvd-0002pv-69
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:32 -0400
Received: by mail-wr1-x435.google.com with SMTP id v16so7100738wrd.13
 for <qemu-devel@nongnu.org>; Mon, 11 Jul 2022 06:58:21 -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.20
 for <qemu-devel@nongnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 11 Jul 2022 06:58:20 -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=9bCQOBJQUNrEYM6NaGyKlOsHHz/7cHH58vaKjgHSLV8=;
 b=F8FJT9RaQ7WvNLn0W/5wE34FSH144WQ5YQ/znspJVUix52rVL9KGXDCgugnLgqX+nd
 PPOV7quuyNX9vSPsDSCQBsmNeV5PX7Ml+Z04QF3ha5yJu34dbVjop2WHvtefV6juTavX
 4kN84UfZInQtbsDdvqPdpUof6BbjBCtP4Emk+ZEZYGbLdFHodO7eLbAKxkrb5FV4ncyi
 F7vP9Ynm0BEdM4KLHZMHEm6gCWozr5j+ml960sBdzspU7ysX63yRhrkuqdpuEXx+Gljy
 we6IlTI/J2JuQu+VsXqMDEv5mGYFnoZqaM37GxDx3x2DOmDJytm1jba47CgfnXy1HtSY
 pDSw==
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=9bCQOBJQUNrEYM6NaGyKlOsHHz/7cHH58vaKjgHSLV8=;
 b=xitxA1llF+egPlytyyWS53QCdD3JCtEpUX8DITtGjpNoaG7DxRYs/Nkm/hhbcWPlLp
 72EZXltePSA6Fb7/HF9FUVVogJz1Z6W4/7ufcOQjAhN9eAzr5UIP26sdR25jwV0qAAJ7
 rWMc5ChfW7h8Hj0nFlnRQfZFkyDRXrmBGKCUNPfa7rLAHfbAw+WZo/h7YDPCzk84i/Ji
 xnZVYFhtZ+O9pIu6yUQLMhAqcS5TpQaI/5K+ePBK2r9I4G3aSfnsBj5Vg1kIH4bHQH1R
 uATsDVuEtgZdYYAX9I6FqmLuAs8hLnG3oteGDEwrFa7pzpu8Oh1HW1wCfFREHModbUwV
 yuhw==
X-Gm-Message-State: AJIora/eoQACyoxiXwWEph43Kog/njhMXhgkv75rhiYl9ayouaSKaDk1
 ZgptnhtfsM2KM+S9sD10JkF1zhD5FlaWYQ==
X-Google-Smtp-Source: 
 AGRyM1utdngGgCVCEq0lIHJBGz/1ueoPaAnuwVMi8GdT1IGB/p14oMHwph9wo9nn5Nr3wV1hfpvmpA==
X-Received: by 2002:adf:f3c7:0:b0:21d:9349:7a5 with SMTP id
 g7-20020adff3c7000000b0021d934907a5mr14682599wrp.23.1657547900857;
 Mon, 11 Jul 2022 06:58:20 -0700 (PDT)
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 34/45] linux-user/aarch64: Reset PSTATE.SM on syscalls
Date: Mon, 11 Jul 2022 14:57:39 +0100
Message-Id: <20220711135750.765803-35-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
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17
 as permitted sender) client-ip=209.51.188.17;
 envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org;
 helo=lists.gnu.org;
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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>
Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org
Sender: "Qemu-devel" <qemu-devel-bounces+importer=patchew.org@nongnu.org>
X-ZohoMail-DKIM: pass (identity @linaro.org)
X-ZM-MESSAGEID: 1657549431301100001
Content-Type: text/plain; charset="utf-8"

From: Richard Henderson <richard.henderson@linaro.org>

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220708151540.18136-35-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 linux-user/aarch64/cpu_loop.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/linux-user/aarch64/cpu_loop.c b/linux-user/aarch64/cpu_loop.c
index f7ef36cd9fa..9875d609a91 100644
--- a/linux-user/aarch64/cpu_loop.c
+++ b/linux-user/aarch64/cpu_loop.c
@@ -89,6 +89,15 @@ void cpu_loop(CPUARMState *env)
=20
         switch (trapnr) {
         case EXCP_SWI:
+            /*
+             * On syscall, PSTATE.ZA is preserved, along with the ZA matri=
x.
+             * PSTATE.SM is cleared, per SMSTOP, which does ResetSVEState.
+             */
+            if (FIELD_EX64(env->svcr, SVCR, SM)) {
+                env->svcr =3D FIELD_DP64(env->svcr, SVCR, SM, 0);
+                arm_rebuild_hflags(env);
+                arm_reset_sve_state(env);
+            }
             ret =3D do_syscall(env,
                              env->xregs[8],
                              env->xregs[0],
--=20
2.25.1
From nobody Thu May  8 21:38:42 2025
Delivered-To: importer@patchew.org
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass(p=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1657551096; cv=none;
	d=zohomail.com; s=zohoarc;
	b=l+/78rBpaniO2LkIF4dUXt5KzGLO4VSpAscgoha6KaHPsV1q8269uoQAP4Wo7ymrtIjdiIY+fCnlC/V19m3yJFHtHGfZiVZn/sNImnVZ+tLuaTWTfogZ/Xt8xwmZbXH9ITqL1mrnu9+Ydrd0wQhat91J4ktcX8ogJuyXwLNzjoQ=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1657551096;
 h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
	bh=y9vQj24+H/subuYvXTmDhTviP3udk/OQzLlUg2NVuHs=;
	b=FsmR1Tvc9xpV7vufGFVhoTv/fDkPaFOhD/UoNwXYVGhBUm5/r9evvZYVhTZvJWeSTMv032y3nJpPBJrY3X93A8WKcfUkQw9aZOwORT1Lq0SDsvxqAcCpn08vbSaIn29yzA3BnoEla9ykO4qGUU/S9rcbQFukU/eLqR+wDAVa0Jg=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass header.from=<peter.maydell@linaro.org> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1657551096798525.4164173714378;
 Mon, 11 Jul 2022 07:51:36 -0700 (PDT)
Received: from localhost ([::1]:50316 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces+importer=patchew.org@nongnu.org>)
	id 1oAul5-0007zR-LK
	for importer@patchew.org; Mon, 11 Jul 2022 10:51:35 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:43262)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvp-0006nu-50
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:37 -0400
Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]:41915)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtve-0002uE-SV
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:36 -0400
Received: by mail-wm1-x336.google.com with SMTP id
 y22-20020a7bcd96000000b003a2e2725e89so2774666wmj.0
 for <qemu-devel@nongnu.org>; Mon, 11 Jul 2022 06:58:22 -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.20
 for <qemu-devel@nongnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 11 Jul 2022 06:58:21 -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=y9vQj24+H/subuYvXTmDhTviP3udk/OQzLlUg2NVuHs=;
 b=BJDMN9ZfTw6KR0OPbAAVvWMoTF9ljj+EQTUeSm1/RvbmUKYwk7dR66sEWbhSb3ikrF
 1kXPazJMk5Baa6lfl+uPy0IiBNja36tLTdnSUoNkq9s+ziZ7I7LGqMmyAVk3yY3k6bXP
 5ULBF/RR0pkNda99LVMCUzMY2lTeXFKd8ktOptK9bpbogI2fcVDk/Y+5wpSXXaBEJAME
 NERskgAKY+GY33Tsx5OPsINNNP6uLYh6qTt8awkS2RFezO0KrrBrsdsKRQIt3XWLFLJc
 q6egwmw8RperZEO5biP+LuSrzhWZHxJnm+yG7VFRDb0PZj97+CyfRC/ZnbczWuTnqyIj
 mCHw==
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=y9vQj24+H/subuYvXTmDhTviP3udk/OQzLlUg2NVuHs=;
 b=JOepFcpHYvdu8tFnDQoogvcGm4ItSH9nR1TkO8fp5i+xlSjkUab4Ht2SuePPFvZcX0
 gZ9jgCfLnZarrHlLW0q6dM0jZi2LWWvr07bqRGuHRfD3tNzcXF6UxzeTZRjXsD34An6D
 riMWX/bATrAVkpOBYwfjwFngiMow+wRKtz7xQlljIyE2GqIkPhzfTdZFPKc3ubVXqfXE
 oJiWBGNDNDA7XtLeGTNgk1HErqqXHAhwc7oQvA333HDCZsnOhe8oVmE4uiUOlrQcOw+q
 b8np7N/Q0uBn1mJOXawyoDmPq2mKdaDK9+XD8xFR0vAF2zFNC2njaSVtAy25ylSFckE6
 EdeQ==
X-Gm-Message-State: AJIora+dUFDQ+AY0VsrtkjywLN5FT5VrlqUDwXqMDJqHo8slxHYOG3kx
 +brOwzukAbVJaO0MEXOcAdb5bo1nLmFG+g==
X-Google-Smtp-Source: 
 AGRyM1v6DwA4932m64yHso+KQhFCr9lshhpkGnVzsZkLwQ2viNThZk014EY5IrYsBjO5ipSvA/azyQ==
X-Received: by 2002:a7b:ce04:0:b0:3a1:92e0:d889 with SMTP id
 m4-20020a7bce04000000b003a192e0d889mr15652351wmc.131.1657547901545;
 Mon, 11 Jul 2022 06:58:21 -0700 (PDT)
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 35/45] linux-user/aarch64: Add SM bit to SVE signal context
Date: Mon, 11 Jul 2022 14:57:40 +0100
Message-Id: <20220711135750.765803-36-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
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17
 as permitted sender) client-ip=209.51.188.17;
 envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org;
 helo=lists.gnu.org;
Received-SPF: pass client-ip=2a00:1450:4864:20::336;
 envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x336.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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>
Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org
Sender: "Qemu-devel" <qemu-devel-bounces+importer=patchew.org@nongnu.org>
X-ZohoMail-DKIM: pass (identity @linaro.org)
X-ZM-MESSAGEID: 1657551098367100002
Content-Type: text/plain; charset="utf-8"

From: Richard Henderson <richard.henderson@linaro.org>

Make sure to zero the currently reserved fields.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220708151540.18136-36-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 linux-user/aarch64/signal.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/linux-user/aarch64/signal.c b/linux-user/aarch64/signal.c
index 7da0e36c6d4..3cef2f44cf5 100644
--- a/linux-user/aarch64/signal.c
+++ b/linux-user/aarch64/signal.c
@@ -78,7 +78,8 @@ struct target_extra_context {
 struct target_sve_context {
     struct target_aarch64_ctx head;
     uint16_t vl;
-    uint16_t reserved[3];
+    uint16_t flags;
+    uint16_t reserved[2];
     /* The actual SVE data immediately follows.  It is laid out
      * according to TARGET_SVE_SIG_{Z,P}REG_OFFSET, based off of
      * the original struct pointer.
@@ -101,6 +102,8 @@ struct target_sve_context {
 #define TARGET_SVE_SIG_CONTEXT_SIZE(VQ) \
     (TARGET_SVE_SIG_PREG_OFFSET(VQ, 17))
=20
+#define TARGET_SVE_SIG_FLAG_SM  1
+
 struct target_rt_sigframe {
     struct target_siginfo info;
     struct target_ucontext uc;
@@ -177,9 +180,13 @@ static void target_setup_sve_record(struct target_sve_=
context *sve,
 {
     int i, j;
=20
+    memset(sve, 0, sizeof(*sve));
     __put_user(TARGET_SVE_MAGIC, &sve->head.magic);
     __put_user(size, &sve->head.size);
     __put_user(vq * TARGET_SVE_VQ_BYTES, &sve->vl);
+    if (FIELD_EX64(env->svcr, SVCR, SM)) {
+        __put_user(TARGET_SVE_SIG_FLAG_SM, &sve->flags);
+    }
=20
     /* Note that SVE regs are stored as a byte stream, with each byte elem=
ent
      * at a subsequent address.  This corresponds to a little-endian store
--=20
2.25.1
From nobody Thu May  8 21:38:42 2025
Delivered-To: importer@patchew.org
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass(p=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1657551366; cv=none;
	d=zohomail.com; s=zohoarc;
	b=jTXVpL22Cqd8H3v+EmxUOVpih9pRE4avNeQXpJvlQsQne6Yy4TVOLOsIX1OzYueAxy+VY63oAvcIgMShpcNCBuzmvMTeCd9EIrj71PhLvMLSJAYe+Ib8txF2Ebdympyauepgo/+oIL+zNQ0sKvVbCZwamJZ+jk1Y4bXL4ggwhZ4=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1657551366;
 h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
	bh=v0XksmWulWyoIYEkFkRz7rlUUrdgrjXm0Tlxlvbybc0=;
	b=HozCe8X6/Tz5tixa7RHE70dqXhkzMczzwGkjeq4TpZTJDMsBHdajqbWklHgyPSjxb1vlZO5DWlG24la5r1VUmMbHqtM8bO04PhJIwIZWPYx432bSgF+jZRl5/WF56UR9Nh+Rkamf9r1VFvI2QxJ+e+rHbqw0mEEb3s1yuXEgfaw=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass header.from=<peter.maydell@linaro.org> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1657551366118756.7637422622255;
 Mon, 11 Jul 2022 07:56:06 -0700 (PDT)
Received: from localhost ([::1]:34988 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces+importer=patchew.org@nongnu.org>)
	id 1oAupQ-0008JP-OG
	for importer@patchew.org; Mon, 11 Jul 2022 10:56:04 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:43180)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvm-0006j3-G2
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:35 -0400
Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]:46667)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtve-0002qA-5A
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:34 -0400
Received: by mail-wr1-x42e.google.com with SMTP id v16so7100831wrd.13
 for <qemu-devel@nongnu.org>; Mon, 11 Jul 2022 06:58:22 -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.21
 for <qemu-devel@nongnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 11 Jul 2022 06:58:21 -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=v0XksmWulWyoIYEkFkRz7rlUUrdgrjXm0Tlxlvbybc0=;
 b=X6PyNrCY9wUsRlxJekVAJhNVAE89o9oikBE1X4XgdGxyapkElTVdVuP/RDJf9r6Y2W
 Cng4pVnTbOfEu4BtTGLhr6Lywl3zLifv1bEdFnPbfLyGfhgjkhfmqmWYTA6fwo29+2Py
 Qe8CDwxZqxgItaKmaffIqWbd2Llftl+Xdh1Cmn+/zTOYOnz/u7OchbogdzE4fqQXCDo7
 troV4Ufb3UWGdbHEG3Hzv5Na+lJLjC1qBX9xB+gAxmFyPqHW6PVvq3p+1VWPJxYhYqEn
 5ny5WQwyJPjceUDbkbYrm4nRGdBFHGPfM7SNl3715C3f1sIcDtYejmTl0VsZsZdN5qTM
 cgeQ==
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=v0XksmWulWyoIYEkFkRz7rlUUrdgrjXm0Tlxlvbybc0=;
 b=Ps/9ZFyptfO5GFs0dYnruss92yGOP9GjuLqt3h72+Fb3lXpP47O50yvlP/5a0gwpLV
 17VZYPi6pJD75J3oZTwFmeHsdUdK+HjQGeFiVG5n1BmCqqaBsxXgqw+/FIqhlP81ggmb
 2vkLwNVwHuaiR8R+Jjr6md7EgSQ9k+ocbSwKA8vDSwxn6qPU+gtlJ/dEdpKOZu557U0d
 aVon6DYzfD6pjCCxBCj+eVGgisxghSmJcTRQLIuNMBjhbBWjIHJiVq85TIjnBfi/7Xnu
 t9IOz5lsWJCSgvqtPiXE3Pq+WMBWUhUBwav9P29UUpBfh2IKsQhIOMSwcwKw5QlCqviV
 UzjQ==
X-Gm-Message-State: AJIora+F1LDJ/qfiaGhSn8i9JeWKOzrN3NVY/IBmNp5/kte45888Ir7L
 /s+KsimA7GyBLPevhAYZ+WkcsNqo7GVFVA==
X-Google-Smtp-Source: 
 AGRyM1siAis/aYrST1yLrGqmUL8kq+x5hWxZKHZj8HBd1e3ioRsL5VLogjlhHKm+EqCrXK0ob88Q2w==
X-Received: by 2002:a05:6000:15c3:b0:21d:9f8b:2c3e with SMTP id
 y3-20020a05600015c300b0021d9f8b2c3emr8368779wry.72.1657547902271;
 Mon, 11 Jul 2022 06:58:22 -0700 (PDT)
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 36/45] linux-user/aarch64: Tidy target_restore_sigframe error
 return
Date: Mon, 11 Jul 2022 14:57:41 +0100
Message-Id: <20220711135750.765803-37-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
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17
 as permitted sender) client-ip=209.51.188.17;
 envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org;
 helo=lists.gnu.org;
Received-SPF: pass client-ip=2a00:1450:4864:20::42e;
 envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42e.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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>
Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org
Sender: "Qemu-devel" <qemu-devel-bounces+importer=patchew.org@nongnu.org>
X-ZohoMail-DKIM: pass (identity @linaro.org)
X-ZM-MESSAGEID: 1657551368392100001
Content-Type: text/plain; charset="utf-8"

From: Richard Henderson <richard.henderson@linaro.org>

Fold the return value setting into the goto, so each
point of failure need not do both.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220708151540.18136-37-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 linux-user/aarch64/signal.c | 26 +++++++++++---------------
 1 file changed, 11 insertions(+), 15 deletions(-)

diff --git a/linux-user/aarch64/signal.c b/linux-user/aarch64/signal.c
index 3cef2f44cf5..8b352abb97c 100644
--- a/linux-user/aarch64/signal.c
+++ b/linux-user/aarch64/signal.c
@@ -287,7 +287,6 @@ static int target_restore_sigframe(CPUARMState *env,
     struct target_sve_context *sve =3D NULL;
     uint64_t extra_datap =3D 0;
     bool used_extra =3D false;
-    bool err =3D false;
     int vq =3D 0, sve_size =3D 0;
=20
     target_restore_general_frame(env, sf);
@@ -301,8 +300,7 @@ static int target_restore_sigframe(CPUARMState *env,
         switch (magic) {
         case 0:
             if (size !=3D 0) {
-                err =3D true;
-                goto exit;
+                goto err;
             }
             if (used_extra) {
                 ctx =3D NULL;
@@ -314,8 +312,7 @@ static int target_restore_sigframe(CPUARMState *env,
=20
         case TARGET_FPSIMD_MAGIC:
             if (fpsimd || size !=3D sizeof(struct target_fpsimd_context)) {
-                err =3D true;
-                goto exit;
+                goto err;
             }
             fpsimd =3D (struct target_fpsimd_context *)ctx;
             break;
@@ -329,13 +326,11 @@ static int target_restore_sigframe(CPUARMState *env,
                     break;
                 }
             }
-            err =3D true;
-            goto exit;
+            goto err;
=20
         case TARGET_EXTRA_MAGIC:
             if (extra || size !=3D sizeof(struct target_extra_context)) {
-                err =3D true;
-                goto exit;
+                goto err;
             }
             __get_user(extra_datap,
                        &((struct target_extra_context *)ctx)->datap);
@@ -348,8 +343,7 @@ static int target_restore_sigframe(CPUARMState *env,
             /* Unknown record -- we certainly didn't generate it.
              * Did we in fact get out of sync?
              */
-            err =3D true;
-            goto exit;
+            goto err;
         }
         ctx =3D (void *)ctx + size;
     }
@@ -358,17 +352,19 @@ static int target_restore_sigframe(CPUARMState *env,
     if (fpsimd) {
         target_restore_fpsimd_record(env, fpsimd);
     } else {
-        err =3D true;
+        goto err;
     }
=20
     /* SVE data, if present, overwrites FPSIMD data.  */
     if (sve) {
         target_restore_sve_record(env, sve, vq);
     }
-
- exit:
     unlock_user(extra, extra_datap, 0);
-    return err;
+    return 0;
+
+ err:
+    unlock_user(extra, extra_datap, 0);
+    return 1;
 }
=20
 static abi_ulong get_sigframe(struct target_sigaction *ka,
--=20
2.25.1
From nobody Thu May  8 21:38:42 2025
Delivered-To: importer@patchew.org
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass(p=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1657550330; cv=none;
	d=zohomail.com; s=zohoarc;
	b=nBwy+cxvAEHeftdkhF6T/msPQFtk3zMv1ljx8HHrhYegNUKgG45YIh/a4GSlxGkq2Xew/DN0bu/fHN7c//5XJjcKuvVIcS49He7oiCz7Ueg/gQUfaGNSdn0EiSL1Jp7eG2fqN42Gd4pHwHvs2+YByPuFdO2WNOaylXWXMIxXVtM=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1657550330;
 h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
	bh=m/AOR0tE++/JatDV791mjXVdOhyKmyy8clrV8yxXoMI=;
	b=PKvc4PO1FyiXyPGwTkh/pMqa5R0ZaSLaCb6n6wK/BWJBeTf3YROtKAb64X7xbfEkElE7V9nV95VWeQpeeGVmZyWLynt/y/YlCiVhF6vCWMseZSRI8QLOboxT9hAd9EtA0Gman/bQtq0OoMDkVAf/R8RbZL7dhC6V/U3b6S7RD9k=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass header.from=<peter.maydell@linaro.org> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1657550330724438.4098972961;
 Mon, 11 Jul 2022 07:38:50 -0700 (PDT)
Received: from localhost ([::1]:52108 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces+importer=patchew.org@nongnu.org>)
	id 1oAuYj-0006Sq-I1
	for importer@patchew.org; Mon, 11 Jul 2022 10:38:49 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:43100)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvj-0006hL-Pp
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:31 -0400
Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]:42549)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvd-0002nQ-5k
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:31 -0400
Received: by mail-wr1-x434.google.com with SMTP id bu1so5948297wrb.9
 for <qemu-devel@nongnu.org>; Mon, 11 Jul 2022 06:58:23 -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.22
 for <qemu-devel@nongnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 11 Jul 2022 06:58:22 -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=m/AOR0tE++/JatDV791mjXVdOhyKmyy8clrV8yxXoMI=;
 b=Aybkf3luW4WNSsT6/FZwKEyDSC8u7GPbuN1BxsiyFz39s39Uy4jEjJwlddwujMDSzf
 sD8ajcvDDhSPYP9jSktlecCKN2fXr0ZWsg+ikJCmAZQAT57oUGN53D3OxI/4a/Q4aiCk
 s/C0F/EZoDE4i6J08ysxBM9J8Yq0KKA8AJXr61MEcVFJ1QBVFfejhWGs0ZuG8MJw2aSj
 LKV+f6LF/OZ6HIl1qbHpvrYJpJGPNVlwG9a9IFlhN81fVclkYU/y/gnJ7S6nWVjV6jDV
 2AKfI2wMUSs+Z8zKBQ1R8HvqH78vGc4bHtvKvVlCuYPvMod9AbTeKfrzTwWSGwXI5uIC
 ZMwg==
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=m/AOR0tE++/JatDV791mjXVdOhyKmyy8clrV8yxXoMI=;
 b=VeWv8V78wUnvVZplTx21n06Jbu2XaYkgH7btVJAUpav/jXscYgEThQMRTluePaM9m7
 p1R687k7sbKoH8UPaTN9VQckUvs2aPfnXY5L8+idZ7wY7N2LZi+4xout0morBa1vVRIN
 gknO5va4nSk8+M8DLxaB1hen8RT5kaxv/FRn9456bojKs9ce7ThHl4ASXJpue+fiWa/z
 MB6shVVE5G6KLBnPXEL0NYKVEHRoST2uyyf1RjBr0B6f1tK3qriJaWeLKvMpKkez2kou
 lN2oc41AmaM19e2oloYiXBQxuA4fmz37022tz0wx81quPRmY6HUspfffl/K306SycA+M
 6UPQ==
X-Gm-Message-State: AJIora8baP7hZ/9J81DXByjnLRn+Bj4MDdTr4lu5x/gdBln9drJJQfWd
 SAj5RoHYzaN/ERSVbtG2Bu8dgCRKgnHt4g==
X-Google-Smtp-Source: 
 AGRyM1vtAFlIo7D9YXEHVOzjqr/CMu/7RCXhlLMNORBYL2ZGNqp+tlw9W5bK3Ve6hGFifkDf1m7nGg==
X-Received: by 2002:a5d:5151:0:b0:21d:730b:c64a with SMTP id
 u17-20020a5d5151000000b0021d730bc64amr17337911wrt.392.1657547903092;
 Mon, 11 Jul 2022 06:58:23 -0700 (PDT)
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 37/45] linux-user/aarch64: Do not allow duplicate or short sve
 records
Date: Mon, 11 Jul 2022 14:57:42 +0100
Message-Id: <20220711135750.765803-38-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
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17
 as permitted sender) client-ip=209.51.188.17;
 envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org;
 helo=lists.gnu.org;
Received-SPF: pass client-ip=2a00:1450:4864:20::434;
 envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x434.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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>
Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org
Sender: "Qemu-devel" <qemu-devel-bounces+importer=patchew.org@nongnu.org>
X-ZohoMail-DKIM: pass (identity @linaro.org)
X-ZM-MESSAGEID: 1657550332387100001
Content-Type: text/plain; charset="utf-8"

From: Richard Henderson <richard.henderson@linaro.org>

In parse_user_sigframe, the kernel rejects duplicate sve records,
or records that are smaller than the header.  We were silently
allowing these cases to pass, dropping the record.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220708151540.18136-38-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 linux-user/aarch64/signal.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/linux-user/aarch64/signal.c b/linux-user/aarch64/signal.c
index 8b352abb97c..8fbe98d72f2 100644
--- a/linux-user/aarch64/signal.c
+++ b/linux-user/aarch64/signal.c
@@ -318,10 +318,13 @@ static int target_restore_sigframe(CPUARMState *env,
             break;
=20
         case TARGET_SVE_MAGIC:
+            if (sve || size < sizeof(struct target_sve_context)) {
+                goto err;
+            }
             if (cpu_isar_feature(aa64_sve, env_archcpu(env))) {
                 vq =3D sve_vq(env);
                 sve_size =3D QEMU_ALIGN_UP(TARGET_SVE_SIG_CONTEXT_SIZE(vq)=
, 16);
-                if (!sve && size =3D=3D sve_size) {
+                if (size =3D=3D sve_size) {
                     sve =3D (struct target_sve_context *)ctx;
                     break;
                 }
--=20
2.25.1
From nobody Thu May  8 21:38:42 2025
Delivered-To: importer@patchew.org
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass(p=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1657551531; cv=none;
	d=zohomail.com; s=zohoarc;
	b=ICT4Tz3dC4qSer/4Q2JPcXLTimBk1eW7GC0FFSTtnVrHmavT7wZzQtrCzuW/Xq0KTnOXhLE1ptPpR//BaY1cYVQqkhDn9bOv1QyLqDnQpVxaqLrKLFKJgk78mtptTMS93Psw86Lx8oE9S9GWaw/CRPY+BDoT4YogvOCE5KFx+Qc=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1657551531;
 h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
	bh=RcIdbbXzpewsExSM+4LX7uPRbT+xi+nVqfYtgmho4n4=;
	b=Z4IKZALemUZFJSx5IHziEVBDeg6BnQsSh2evRWqdfRVUgqYnKo95b6dYFruZBQDKnhxCflZ0itadPpMVS+WtqDPEMA8K2nnuB0PIaTToVaPBQi4tHjc0M4VKt9jZlTBMACWfW5QUghawH/AA5JvZkMDRfKod6uf0nI8m8fUOyMY=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass header.from=<peter.maydell@linaro.org> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1657551531036169.69008819138458;
 Mon, 11 Jul 2022 07:58:51 -0700 (PDT)
Received: from localhost ([::1]:44414 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces+importer=patchew.org@nongnu.org>)
	id 1oAus5-0006Ey-SG
	for importer@patchew.org; Mon, 11 Jul 2022 10:58:49 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:43266)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvp-0006nw-7j
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:37 -0400
Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]:46673)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtve-0002ud-Sf
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:36 -0400
Received: by mail-wr1-x431.google.com with SMTP id v16so7100932wrd.13
 for <qemu-devel@nongnu.org>; Mon, 11 Jul 2022 06:58:24 -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.23
 for <qemu-devel@nongnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 11 Jul 2022 06:58:23 -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=RcIdbbXzpewsExSM+4LX7uPRbT+xi+nVqfYtgmho4n4=;
 b=QEind2Jf9dCdgO4FuxMA77M1WMoHKJ21n7EvqoZNhvq5DGNRw5CJZRWz0yTMh8y3c9
 kETjkJBfM6KFBD7GBkEyTNS25l//lGry3ga3+lFmZPk5B4HH9iLX8Am/0pXkywsJ2pZ7
 HQFtx0YfrTArFxcXg3l4/8Ahk2monl2mAuc5/RS/e17C3QDsOrNgNTP49W8kBcoL7WV+
 LsbSuxg4zrm5dEK2E3vS5jyLC69lNLGIr47PBEhwWidOLknxaa/XY4Xx+qDmyz+V8HSW
 8NPza4Rz5XhPBIzviUHCtJHhkmTx4898GEIRMgzKZclY+5yMkiOqDP1t6drdt6WzzczE
 MKHg==
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=RcIdbbXzpewsExSM+4LX7uPRbT+xi+nVqfYtgmho4n4=;
 b=O3hPq974EGhISWg4kJFJoSsnqYa6Dfl6k7DF6Ao2kUJ++QfWxi4cswt833n0ZRp5Gk
 UNdywLJ7y+/T7X0z55iB26fXyV+ybfzTYNOn0HuxPIdwV1xt3HHZWua/po/Gmxu19KDc
 WrgdGWDIvIUJpcQmvnrpsk3N9dInSMYbS2h55QUtZKS++85vfX/sjrmFBhIzQY2ukIFC
 OTS4Fol2JgwFyjSMiiA/p6mozhsc9lUVz/mk/d9iHv6Yj8i4OI6IzHDWsmcKA6k69eS7
 n8R4+gEInGHKucxc7o8dHkZak65Y9pmniqXZ6G/yOCqtn+HXFjPyTAKgdnbJznqB6yhy
 LCmA==
X-Gm-Message-State: AJIora82x6Hd5SBtF1fo/0uWZ8njpoaIrc//HAiTvJ+XEVErmrx4/h+N
 0ng5OQZfAPV9R/s2OE6kmyga1quJal50Qg==
X-Google-Smtp-Source: 
 AGRyM1vm+lSjlPIMtHwqTGzRYVy/PKLbxC2mqHyk5w64IFNL/QdN6Cnm5KF51MEksnshkT+q4WnaNw==
X-Received: by 2002:adf:fbc6:0:b0:21d:3fc3:99e with SMTP id
 d6-20020adffbc6000000b0021d3fc3099emr17159923wrs.550.1657547903776;
 Mon, 11 Jul 2022 06:58:23 -0700 (PDT)
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 38/45] linux-user/aarch64: Verify extra record lock succeeded
Date: Mon, 11 Jul 2022 14:57:43 +0100
Message-Id: <20220711135750.765803-39-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
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17
 as permitted sender) client-ip=209.51.188.17;
 envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org;
 helo=lists.gnu.org;
Received-SPF: pass client-ip=2a00:1450:4864:20::431;
 envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x431.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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>
Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org
Sender: "Qemu-devel" <qemu-devel-bounces+importer=patchew.org@nongnu.org>
X-ZohoMail-DKIM: pass (identity @linaro.org)
X-ZM-MESSAGEID: 1657551531543100001
Content-Type: text/plain; charset="utf-8"

From: Richard Henderson <richard.henderson@linaro.org>

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220708151540.18136-39-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 linux-user/aarch64/signal.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/linux-user/aarch64/signal.c b/linux-user/aarch64/signal.c
index 8fbe98d72f2..9ff79da4be0 100644
--- a/linux-user/aarch64/signal.c
+++ b/linux-user/aarch64/signal.c
@@ -340,6 +340,9 @@ static int target_restore_sigframe(CPUARMState *env,
             __get_user(extra_size,
                        &((struct target_extra_context *)ctx)->size);
             extra =3D lock_user(VERIFY_READ, extra_datap, extra_size, 0);
+            if (!extra) {
+                return 1;
+            }
             break;
=20
         default:
--=20
2.25.1
From nobody Thu May  8 21:38:42 2025
Delivered-To: importer@patchew.org
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass(p=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1657549643; cv=none;
	d=zohomail.com; s=zohoarc;
	b=ULa1B0T6JIOOo7g/Du7CxsfOwONoyFitdta7rEJAHWXNKw5ezH37yG/3PPtY8gIkICfok6fSXqJdYFN3emD2+tdDOthcWrWfnTlamNcpQwCeDjuU8uit4JXFV2u0pEEs2RrDr0/HzdbAKHnl7kfiXtRFKcOGZIK8C1ZstcGj3ug=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1657549643;
 h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
	bh=zRQNKZGKQhKr7J1kk0X1ky1/gLAO7OPNVwA91vM50lQ=;
	b=aobPSPSjFmmapV9UYrizTd4+D8o90oAEJFb8FYxWyyeat5gcIzyMYWdHuaon0M9WEn5tBr6VW2j7lsVzKqhnvQWG0eueH2tKcfYgmH7ZjriD+i3C92/gJnmUuN94rzlZ65nt8nkT82iN0M//gsu+qxRFBg0agTqCVcji9uAT8X4=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass header.from=<peter.maydell@linaro.org> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1657549643145955.481639304195;
 Mon, 11 Jul 2022 07:27:23 -0700 (PDT)
Received: from localhost ([::1]:38152 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces+importer=patchew.org@nongnu.org>)
	id 1oAuNa-0003fF-SX
	for importer@patchew.org; Mon, 11 Jul 2022 10:27:18 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:43222)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvo-0006mS-1S
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:36 -0400
Received: from mail-wr1-x431.google.com ([2a00:1450:4864:20::431]:45576)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtve-0002uh-RC
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:35 -0400
Received: by mail-wr1-x431.google.com with SMTP id a5so7118064wrx.12
 for <qemu-devel@nongnu.org>; Mon, 11 Jul 2022 06:58:25 -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.23
 for <qemu-devel@nongnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 11 Jul 2022 06:58:24 -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=zRQNKZGKQhKr7J1kk0X1ky1/gLAO7OPNVwA91vM50lQ=;
 b=dodTiylk8c2Zgq+uMwhnhz1/KCy2tN0oR029p0OWSytK2pg9i1BNquAWp1ip9fksHm
 8mMbQG+PFspwYnjmIl4GhhnXyoXZXOokEAyp8Gg+zwVVK93ZLRxWgYXWQ9uiHrc2eDuH
 u2fem9KxjkQWDivUrmbT94HcOv5QZEpFieVgzCeEpC+fy0dieWIknOtG3ubPIg7+Eku6
 oGOttQIMHwBD7Of6NAVIzhoYW9MekD3rzkRf7AQtp4Q+M6zcuBnaRh2g4UYrV8HLQ2ez
 oL724rbWi2ENs+x3cNP++pYfLsve8Xiypm6Zp42JJnhW3snVLYAmdyGV1Pljh1GodJnl
 UEhA==
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=zRQNKZGKQhKr7J1kk0X1ky1/gLAO7OPNVwA91vM50lQ=;
 b=c56jvAu3l9n8I1tYtrCNvJK0LxT/2yN2MrA/+FuOsStTBYWlMX3L9XxJTPpLiAHbei
 BnJlo6Hqe7AKa+P0IONNxg9LL2igKOXpAjUPPASYUOhbXG1uKQMuWnDYHWRhCQbRb8+H
 fEUsFynibPAHtdQAoW2813PHM0UXQ4nNRc5Iqlq3tSfWGLJSzX/0AQNdua+3ontXkDnZ
 NOdgWEl3T6YeOB8sTxc41x3VZe/D5ooqIgXD8TIr+odytmKbqZNFtpdigNfebnwdgPGM
 LeYl7s5gBxTVp5hsw1b138bkv0u6B/nx1f9OrVVT77iG58uq9w4bvbroKG7EBNRlEFWm
 MYhg==
X-Gm-Message-State: AJIora9ki+grUj9JUPa+7Ou8AF9equsrbTs8PGG6U5ATQLfmNi/0k72J
 rdCgKmCdxqkBuV+ET4/5+dPNoJNcowQKlg==
X-Google-Smtp-Source: 
 AGRyM1vnFIAHkgliCHBD6cSmbqsFkAFb8Cl9O3ouPmtKe//bgoxpvi1q2uI2/ZltQpviGQrg4BNJJQ==
X-Received: by 2002:a05:6000:2aa:b0:21d:ac4b:95af with SMTP id
 l10-20020a05600002aa00b0021dac4b95afmr2138572wry.479.1657547904559;
 Mon, 11 Jul 2022 06:58:24 -0700 (PDT)
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 39/45] linux-user/aarch64: Move sve record checks into restore
Date: Mon, 11 Jul 2022 14:57:44 +0100
Message-Id: <20220711135750.765803-40-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
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17
 as permitted sender) client-ip=209.51.188.17;
 envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org;
 helo=lists.gnu.org;
Received-SPF: pass client-ip=2a00:1450:4864:20::431;
 envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x431.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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>
Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org
Sender: "Qemu-devel" <qemu-devel-bounces+importer=patchew.org@nongnu.org>
X-ZohoMail-DKIM: pass (identity @linaro.org)
X-ZM-MESSAGEID: 1657549644629100001
Content-Type: text/plain; charset="utf-8"

From: Richard Henderson <richard.henderson@linaro.org>

Move the checks out of the parsing loop and into the
restore function.  This more closely mirrors the code
structure in the kernel, and is slightly clearer.

Reject rather than silently skip incorrect VL and SVE record sizes,
bringing our checks in to line with those the kernel does.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220708151540.18136-40-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 linux-user/aarch64/signal.c | 51 +++++++++++++++++++++++++------------
 1 file changed, 35 insertions(+), 16 deletions(-)

diff --git a/linux-user/aarch64/signal.c b/linux-user/aarch64/signal.c
index 9ff79da4be0..22d0b8b4ece 100644
--- a/linux-user/aarch64/signal.c
+++ b/linux-user/aarch64/signal.c
@@ -250,12 +250,36 @@ static void target_restore_fpsimd_record(CPUARMState =
*env,
     }
 }
=20
-static void target_restore_sve_record(CPUARMState *env,
-                                      struct target_sve_context *sve, int =
vq)
+static bool target_restore_sve_record(CPUARMState *env,
+                                      struct target_sve_context *sve,
+                                      int size)
 {
-    int i, j;
+    int i, j, vl, vq;
=20
-    /* Note that SVE regs are stored as a byte stream, with each byte elem=
ent
+    if (!cpu_isar_feature(aa64_sve, env_archcpu(env))) {
+        return false;
+    }
+
+    __get_user(vl, &sve->vl);
+    vq =3D sve_vq(env);
+
+    /* Reject mismatched VL. */
+    if (vl !=3D vq * TARGET_SVE_VQ_BYTES) {
+        return false;
+    }
+
+    /* Accept empty record -- used to clear PSTATE.SM. */
+    if (size <=3D sizeof(*sve)) {
+        return true;
+    }
+
+    /* Reject non-empty but incomplete record. */
+    if (size < TARGET_SVE_SIG_CONTEXT_SIZE(vq)) {
+        return false;
+    }
+
+    /*
+     * Note that SVE regs are stored as a byte stream, with each byte elem=
ent
      * at a subsequent address.  This corresponds to a little-endian load
      * of our 64-bit hunks.
      */
@@ -277,6 +301,7 @@ static void target_restore_sve_record(CPUARMState *env,
             }
         }
     }
+    return true;
 }
=20
 static int target_restore_sigframe(CPUARMState *env,
@@ -287,7 +312,7 @@ static int target_restore_sigframe(CPUARMState *env,
     struct target_sve_context *sve =3D NULL;
     uint64_t extra_datap =3D 0;
     bool used_extra =3D false;
-    int vq =3D 0, sve_size =3D 0;
+    int sve_size =3D 0;
=20
     target_restore_general_frame(env, sf);
=20
@@ -321,15 +346,9 @@ static int target_restore_sigframe(CPUARMState *env,
             if (sve || size < sizeof(struct target_sve_context)) {
                 goto err;
             }
-            if (cpu_isar_feature(aa64_sve, env_archcpu(env))) {
-                vq =3D sve_vq(env);
-                sve_size =3D QEMU_ALIGN_UP(TARGET_SVE_SIG_CONTEXT_SIZE(vq)=
, 16);
-                if (size =3D=3D sve_size) {
-                    sve =3D (struct target_sve_context *)ctx;
-                    break;
-                }
-            }
-            goto err;
+            sve =3D (struct target_sve_context *)ctx;
+            sve_size =3D size;
+            break;
=20
         case TARGET_EXTRA_MAGIC:
             if (extra || size !=3D sizeof(struct target_extra_context)) {
@@ -362,8 +381,8 @@ static int target_restore_sigframe(CPUARMState *env,
     }
=20
     /* SVE data, if present, overwrites FPSIMD data.  */
-    if (sve) {
-        target_restore_sve_record(env, sve, vq);
+    if (sve && !target_restore_sve_record(env, sve, sve_size)) {
+        goto err;
     }
     unlock_user(extra, extra_datap, 0);
     return 0;
--=20
2.25.1
From nobody Thu May  8 21:38:42 2025
Delivered-To: importer@patchew.org
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass(p=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1657551740; cv=none;
	d=zohomail.com; s=zohoarc;
	b=MY0wm2R4xFVTlxHcve+7t7YjFza7IcRCNmfHUAHBjkZZXn3VPVzliTCGuYVbIbH1PJSIgPjoY5VWdPtZaLwdid1elZNT/Vv2zHaaN9csu96ept51DEXO+uZ4HZscAyt3vPwbHvuMBP49T6UTY9DglpIMGbQrfffwxDjoq5ykgf4=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1657551740;
 h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
	bh=pCPJDwjnczLHYV5M/KTJGoCxy94q+B5Z63OSCHqyluc=;
	b=OQMtA+CMT+AqqJRIEdoortvxHD4Djob22TsSbtRc6FPrMU9tO9ZXhjp4Y+xfKjQx6ZeYrdSPbiL+aFJ0Hk+Ee4mb/OD5Ywy2ZbcM8ZCwMa7GP1PRaibUX/znYXcZAfbW5833jiw3Px6H3BKNKeFWX6N9WcIfCYfuWUnP3VZr7+8=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass header.from=<peter.maydell@linaro.org> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1657551739907422.61660081662694;
 Mon, 11 Jul 2022 08:02:19 -0700 (PDT)
Received: from localhost ([::1]:52438 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces+importer=patchew.org@nongnu.org>)
	id 1oAuvS-0003GC-Kn
	for importer@patchew.org; Mon, 11 Jul 2022 11:02:18 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:43322)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvs-0006vl-0V
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:40 -0400
Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]:34392)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvg-0002vP-2M
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:39 -0400
Received: by mail-wm1-x332.google.com with SMTP id
 l22-20020a05600c4f1600b003a2e10c8cdeso1715209wmq.1
 for <qemu-devel@nongnu.org>; Mon, 11 Jul 2022 06:58:26 -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.24
 for <qemu-devel@nongnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 11 Jul 2022 06:58:25 -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=pCPJDwjnczLHYV5M/KTJGoCxy94q+B5Z63OSCHqyluc=;
 b=oG0DMK5vz3naWPKI2RVRz7/n8e3UXVXO/t663HaNAFhG+zpRBpKUI/OGkEEiTrZxQ7
 GGysOjQ5YkD05t0B59Zp3UxTf9rFvao90tJhKfLGemkhs7AzfpA2DjtzhJyvk5v01U3B
 Ck2tKxlrD9b3Ye8U8HLjeZ2TrdL4ZMWp+jI+PB+xRQ+lUepSK165asXF9OjJ/vR8pC5T
 Rwtmk8pytUKGtWniqembBrIkazHDX9jqIt2iRkMI2GPCfGg6DyPNH4T2AlaUI3TPQOlr
 WUThhLF1pKjYFAWkOw1nMrE7X52uEC0anIgJGXf+dIQ+1285fYNdZA2gFHf2vyddcFGU
 iXkg==
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=pCPJDwjnczLHYV5M/KTJGoCxy94q+B5Z63OSCHqyluc=;
 b=q7JjZkfo5aKLBEw0SLxRwR7FAKMHX6mKqgfAYjgDOv+gc04mji3vXDy29N53uoSxVi
 25uJ0yqOkQdIFo99BfcoVBBvY/hWPAeYSKa8kyDdBXzrE2XC8sJZHsWU0veMbAPro5rl
 saQiuOcnUmlBeeAQ7KLldBBmf+OQtdVpL1vDHuZLxCWPthboJJfeM5PR8B0lMdE5IN6O
 RpTT/T9NV1GLlPcyjlm5DQa9BbqT/p3AxI8JD8VrWQxqcLWldzbO+xk6/mxMQwo6lVzQ
 Cpjmh/wXcG0SrQzbucM//QeoNkLZZmsaKtEFQU4Xtk0g1ESqyolv9WFgESFOgTI7BPLE
 XhlQ==
X-Gm-Message-State: AJIora8E1zhnX3QW3bvDGqwPQPl5YX5N7L56ysvT+vZ8S8RRLNycycHo
 6HY0ddweiuLAuMcgPKVW9J8Blxn6Llperg==
X-Google-Smtp-Source: 
 AGRyM1sULstjDUc6T+mgVFype+1FcuSTCs4/6lbz9eulTbTeM/Fr2TYYQ1f3m9KQScPvKpHrfOUXGw==
X-Received: by 2002:a05:600c:3491:b0:3a0:4d4a:2e2d with SMTP id
 a17-20020a05600c349100b003a04d4a2e2dmr16581497wmq.4.1657547905500;
 Mon, 11 Jul 2022 06:58:25 -0700 (PDT)
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 40/45] linux-user/aarch64: Implement SME signal handling
Date: Mon, 11 Jul 2022 14:57:45 +0100
Message-Id: <20220711135750.765803-41-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
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17
 as permitted sender) client-ip=209.51.188.17;
 envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org;
 helo=lists.gnu.org;
Received-SPF: pass client-ip=2a00:1450:4864:20::332;
 envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x332.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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>
Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org
Sender: "Qemu-devel" <qemu-devel-bounces+importer=patchew.org@nongnu.org>
X-ZohoMail-DKIM: pass (identity @linaro.org)
X-ZM-MESSAGEID: 1657551741381100001
Content-Type: text/plain; charset="utf-8"

From: Richard Henderson <richard.henderson@linaro.org>

Set the SM bit in the SVE record on signal delivery, create the ZA record.
Restore SM and ZA state according to the records present on return.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220708151540.18136-41-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 linux-user/aarch64/signal.c | 167 +++++++++++++++++++++++++++++++++---
 1 file changed, 154 insertions(+), 13 deletions(-)

diff --git a/linux-user/aarch64/signal.c b/linux-user/aarch64/signal.c
index 22d0b8b4ece..6a2c6e06d28 100644
--- a/linux-user/aarch64/signal.c
+++ b/linux-user/aarch64/signal.c
@@ -104,6 +104,22 @@ struct target_sve_context {
=20
 #define TARGET_SVE_SIG_FLAG_SM  1
=20
+#define TARGET_ZA_MAGIC        0x54366345
+
+struct target_za_context {
+    struct target_aarch64_ctx head;
+    uint16_t vl;
+    uint16_t reserved[3];
+    /* The actual ZA data immediately follows. */
+};
+
+#define TARGET_ZA_SIG_REGS_OFFSET \
+    QEMU_ALIGN_UP(sizeof(struct target_za_context), TARGET_SVE_VQ_BYTES)
+#define TARGET_ZA_SIG_ZAV_OFFSET(VQ, N) \
+    (TARGET_ZA_SIG_REGS_OFFSET + (VQ) * TARGET_SVE_VQ_BYTES * (N))
+#define TARGET_ZA_SIG_CONTEXT_SIZE(VQ) \
+    TARGET_ZA_SIG_ZAV_OFFSET(VQ, VQ * TARGET_SVE_VQ_BYTES)
+
 struct target_rt_sigframe {
     struct target_siginfo info;
     struct target_ucontext uc;
@@ -176,9 +192,9 @@ static void target_setup_end_record(struct target_aarch=
64_ctx *end)
 }
=20
 static void target_setup_sve_record(struct target_sve_context *sve,
-                                    CPUARMState *env, int vq, int size)
+                                    CPUARMState *env, int size)
 {
-    int i, j;
+    int i, j, vq =3D sve_vq(env);
=20
     memset(sve, 0, sizeof(*sve));
     __put_user(TARGET_SVE_MAGIC, &sve->head.magic);
@@ -207,6 +223,35 @@ static void target_setup_sve_record(struct target_sve_=
context *sve,
     }
 }
=20
+static void target_setup_za_record(struct target_za_context *za,
+                                   CPUARMState *env, int size)
+{
+    int vq =3D sme_vq(env);
+    int vl =3D vq * TARGET_SVE_VQ_BYTES;
+    int i, j;
+
+    memset(za, 0, sizeof(*za));
+    __put_user(TARGET_ZA_MAGIC, &za->head.magic);
+    __put_user(size, &za->head.size);
+    __put_user(vl, &za->vl);
+
+    if (size =3D=3D TARGET_ZA_SIG_CONTEXT_SIZE(0)) {
+        return;
+    }
+    assert(size =3D=3D TARGET_ZA_SIG_CONTEXT_SIZE(vq));
+
+    /*
+     * Note that ZA vectors are stored as a byte stream,
+     * with each byte element at a subsequent address.
+     */
+    for (i =3D 0; i < vl; ++i) {
+        uint64_t *z =3D (void *)za + TARGET_ZA_SIG_ZAV_OFFSET(vq, i);
+        for (j =3D 0; j < vq * 2; ++j) {
+            __put_user_e(env->zarray[i].d[j], z + j, le);
+        }
+    }
+}
+
 static void target_restore_general_frame(CPUARMState *env,
                                          struct target_rt_sigframe *sf)
 {
@@ -252,16 +297,28 @@ static void target_restore_fpsimd_record(CPUARMState =
*env,
=20
 static bool target_restore_sve_record(CPUARMState *env,
                                       struct target_sve_context *sve,
-                                      int size)
+                                      int size, int *svcr)
 {
-    int i, j, vl, vq;
+    int i, j, vl, vq, flags;
+    bool sm;
=20
-    if (!cpu_isar_feature(aa64_sve, env_archcpu(env))) {
+    __get_user(vl, &sve->vl);
+    __get_user(flags, &sve->flags);
+
+    sm =3D flags & TARGET_SVE_SIG_FLAG_SM;
+
+    /* The cpu must support Streaming or Non-streaming SVE. */
+    if (sm
+        ? !cpu_isar_feature(aa64_sme, env_archcpu(env))
+        : !cpu_isar_feature(aa64_sve, env_archcpu(env))) {
         return false;
     }
=20
-    __get_user(vl, &sve->vl);
-    vq =3D sve_vq(env);
+    /*
+     * Note that we cannot use sve_vq() because that depends on the
+     * current setting of PSTATE.SM, not the state to be restored.
+     */
+    vq =3D sve_vqm1_for_el_sm(env, 0, sm) + 1;
=20
     /* Reject mismatched VL. */
     if (vl !=3D vq * TARGET_SVE_VQ_BYTES) {
@@ -278,6 +335,8 @@ static bool target_restore_sve_record(CPUARMState *env,
         return false;
     }
=20
+    *svcr =3D FIELD_DP64(*svcr, SVCR, SM, sm);
+
     /*
      * Note that SVE regs are stored as a byte stream, with each byte elem=
ent
      * at a subsequent address.  This corresponds to a little-endian load
@@ -304,15 +363,57 @@ static bool target_restore_sve_record(CPUARMState *en=
v,
     return true;
 }
=20
+static bool target_restore_za_record(CPUARMState *env,
+                                     struct target_za_context *za,
+                                     int size, int *svcr)
+{
+    int i, j, vl, vq;
+
+    if (!cpu_isar_feature(aa64_sme, env_archcpu(env))) {
+        return false;
+    }
+
+    __get_user(vl, &za->vl);
+    vq =3D sme_vq(env);
+
+    /* Reject mismatched VL. */
+    if (vl !=3D vq * TARGET_SVE_VQ_BYTES) {
+        return false;
+    }
+
+    /* Accept empty record -- used to clear PSTATE.ZA. */
+    if (size <=3D TARGET_ZA_SIG_CONTEXT_SIZE(0)) {
+        return true;
+    }
+
+    /* Reject non-empty but incomplete record. */
+    if (size < TARGET_ZA_SIG_CONTEXT_SIZE(vq)) {
+        return false;
+    }
+
+    *svcr =3D FIELD_DP64(*svcr, SVCR, ZA, 1);
+
+    for (i =3D 0; i < vl; ++i) {
+        uint64_t *z =3D (void *)za + TARGET_ZA_SIG_ZAV_OFFSET(vq, i);
+        for (j =3D 0; j < vq * 2; ++j) {
+            __get_user_e(env->zarray[i].d[j], z + j, le);
+        }
+    }
+    return true;
+}
+
 static int target_restore_sigframe(CPUARMState *env,
                                    struct target_rt_sigframe *sf)
 {
     struct target_aarch64_ctx *ctx, *extra =3D NULL;
     struct target_fpsimd_context *fpsimd =3D NULL;
     struct target_sve_context *sve =3D NULL;
+    struct target_za_context *za =3D NULL;
     uint64_t extra_datap =3D 0;
     bool used_extra =3D false;
     int sve_size =3D 0;
+    int za_size =3D 0;
+    int svcr =3D 0;
=20
     target_restore_general_frame(env, sf);
=20
@@ -350,6 +451,14 @@ static int target_restore_sigframe(CPUARMState *env,
             sve_size =3D size;
             break;
=20
+        case TARGET_ZA_MAGIC:
+            if (za || size < sizeof(struct target_za_context)) {
+                goto err;
+            }
+            za =3D (struct target_za_context *)ctx;
+            za_size =3D size;
+            break;
+
         case TARGET_EXTRA_MAGIC:
             if (extra || size !=3D sizeof(struct target_extra_context)) {
                 goto err;
@@ -381,9 +490,16 @@ static int target_restore_sigframe(CPUARMState *env,
     }
=20
     /* SVE data, if present, overwrites FPSIMD data.  */
-    if (sve && !target_restore_sve_record(env, sve, sve_size)) {
+    if (sve && !target_restore_sve_record(env, sve, sve_size, &svcr)) {
         goto err;
     }
+    if (za && !target_restore_za_record(env, za, za_size, &svcr)) {
+        goto err;
+    }
+    if (env->svcr !=3D svcr) {
+        env->svcr =3D svcr;
+        arm_rebuild_hflags(env);
+    }
     unlock_user(extra, extra_datap, 0);
     return 0;
=20
@@ -451,7 +567,8 @@ static void target_setup_frame(int usig, struct target_=
sigaction *ka,
         .total_size =3D offsetof(struct target_rt_sigframe,
                                uc.tuc_mcontext.__reserved),
     };
-    int fpsimd_ofs, fr_ofs, sve_ofs =3D 0, vq =3D 0, sve_size =3D 0;
+    int fpsimd_ofs, fr_ofs, sve_ofs =3D 0, za_ofs =3D 0;
+    int sve_size =3D 0, za_size =3D 0;
     struct target_rt_sigframe *frame;
     struct target_rt_frame_record *fr;
     abi_ulong frame_addr, return_addr;
@@ -461,11 +578,20 @@ static void target_setup_frame(int usig, struct targe=
t_sigaction *ka,
                                       &layout);
=20
     /* SVE state needs saving only if it exists.  */
-    if (cpu_isar_feature(aa64_sve, env_archcpu(env))) {
-        vq =3D sve_vq(env);
-        sve_size =3D QEMU_ALIGN_UP(TARGET_SVE_SIG_CONTEXT_SIZE(vq), 16);
+    if (cpu_isar_feature(aa64_sve, env_archcpu(env)) ||
+        cpu_isar_feature(aa64_sme, env_archcpu(env))) {
+        sve_size =3D QEMU_ALIGN_UP(TARGET_SVE_SIG_CONTEXT_SIZE(sve_vq(env)=
), 16);
         sve_ofs =3D alloc_sigframe_space(sve_size, &layout);
     }
+    if (cpu_isar_feature(aa64_sme, env_archcpu(env))) {
+        /* ZA state needs saving only if it is enabled.  */
+        if (FIELD_EX64(env->svcr, SVCR, ZA)) {
+            za_size =3D TARGET_ZA_SIG_CONTEXT_SIZE(sme_vq(env));
+        } else {
+            za_size =3D TARGET_ZA_SIG_CONTEXT_SIZE(0);
+        }
+        za_ofs =3D alloc_sigframe_space(za_size, &layout);
+    }
=20
     if (layout.extra_ofs) {
         /* Reserve space for the extra end marker.  The standard end marker
@@ -512,7 +638,10 @@ static void target_setup_frame(int usig, struct target=
_sigaction *ka,
         target_setup_end_record((void *)frame + layout.extra_end_ofs);
     }
     if (sve_ofs) {
-        target_setup_sve_record((void *)frame + sve_ofs, env, vq, sve_size=
);
+        target_setup_sve_record((void *)frame + sve_ofs, env, sve_size);
+    }
+    if (za_ofs) {
+        target_setup_za_record((void *)frame + za_ofs, env, za_size);
     }
=20
     /* Set up the stack frame for unwinding.  */
@@ -536,6 +665,18 @@ static void target_setup_frame(int usig, struct target=
_sigaction *ka,
         env->btype =3D 2;
     }
=20
+    /*
+     * Invoke the signal handler with both SM and ZA disabled.
+     * When clearing SM, ResetSVEState, per SMSTOP.
+     */
+    if (FIELD_EX64(env->svcr, SVCR, SM)) {
+        arm_reset_sve_state(env);
+    }
+    if (env->svcr) {
+        env->svcr =3D 0;
+        arm_rebuild_hflags(env);
+    }
+
     if (info) {
         tswap_siginfo(&frame->info, info);
         env->xregs[1] =3D frame_addr + offsetof(struct target_rt_sigframe,=
 info);
--=20
2.25.1
From nobody Thu May  8 21:38:42 2025
Delivered-To: importer@patchew.org
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass(p=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1657551949; cv=none;
	d=zohomail.com; s=zohoarc;
	b=nR5X9HP5b1TTiwxuZ6A29UZWcJm1gJ8dewdaV9T1k3A4xdeTFEymic54cjcFPKQxX9cHxQoF6B3VrCAZHod0nZJmaGWCaq/TkstfRswduXTCU7BA9Ltyjjx3DQ31DwNDA1OJIyM01/PlkxUT2ynyXXd7z/nsp3YmWn742UgKlbE=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1657551949;
 h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
	bh=3gpC6QDBrlRqoUDnAZkgkjjrqEX50o6S3J99cjzYYnI=;
	b=H6nx/sM51lWDRW2t1qU6RgWKwVS1fGj872ifN7arjjXhGNO9l0UwNz9pj5hZk5W3RYHrnrYUrOMbfJds7qmIZEJIYwaeS9QrxEOhIw3zXCSU1HaK7WXgEKQuT3Fi6MNa0fmzs/CRm6v8taCBZltnN1rgDZfPYSSsChXvo9OUNkc=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass header.from=<peter.maydell@linaro.org> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1657551949300658.0736134717653;
 Mon, 11 Jul 2022 08:05:49 -0700 (PDT)
Received: from localhost ([::1]:58654 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces+importer=patchew.org@nongnu.org>)
	id 1oAuyp-0007ba-8P
	for importer@patchew.org; Mon, 11 Jul 2022 11:05:47 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:43334)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvs-0006x4-92
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:40 -0400
Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]:41906)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvg-0002vo-3V
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:39 -0400
Received: by mail-wm1-x32c.google.com with SMTP id
 y22-20020a7bcd96000000b003a2e2725e89so2774812wmj.0
 for <qemu-devel@nongnu.org>; Mon, 11 Jul 2022 06:58:27 -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.25
 for <qemu-devel@nongnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 11 Jul 2022 06:58:25 -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=3gpC6QDBrlRqoUDnAZkgkjjrqEX50o6S3J99cjzYYnI=;
 b=WsOSTcmbQGcW5CgXPNGpklEtAAf+IcnKQvWGsI/PkcpiHsct/hSLwlKRQLArKhdsi9
 BzxnxTBuE48gmYL4BsajatA9uSuUPrRQXGvYCdjZMB9B4alDrg8uei9nUOxObKIuJuSf
 s1FOI+stDg5Odl+Vfuc8N8b6u0O4XyvoeQLnfIDRGAZ8wD3H9Wk0q0J4aFK3v1OyzhDi
 mVAmjVghljtTl+hWWN6fSkMz3JugwljoevM1ZupXR0g+7Q34M7KgrPErhAC1tViAAi/k
 3+IId3ZqHGW6fKR1Uz60qyvIxR7FNfeko1NP97/73CLTh0hIE20jqH2exU5h7J9UeVeB
 8LuA==
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=3gpC6QDBrlRqoUDnAZkgkjjrqEX50o6S3J99cjzYYnI=;
 b=HYSz3087q5QDun2yPpbUYZQjmZQMi+I5VFYqYHjbbCpsnQT/67/QZN8X+ZbPaKUils
 3U+WhC2192bz8cdMaI4/QTxOWOkuI6glZfclHNSS+uj+4dTEiyG4tbo9ilFrgsemEB3w
 byR3oynUSGjbLS3HyXnv9jgG+pU4V0/aHAWk6ZCqVbnefeFHvRzGOwnPaqgEverx0cRI
 wEGEE7hsX67ew5aP5aj7UzlyBxTJwTYInvNTUEGUBdw8gMI5OiHtsyH7ReYTpoTpYBXz
 RKheagHhHQRif3I7DUH99g4JG3Z17c6vNGr895jt7J2HSyGwHi1Fyg3U70rYfk7q5ZuU
 drUg==
X-Gm-Message-State: AJIora+eFupBEvN7y/4p0O47GW0rQHX53t0ncgbWWe3+k77zWyza/2wK
 wXfru+gQuJBDUxg8x8HblEeMMfXHQh0kng==
X-Google-Smtp-Source: 
 AGRyM1vGvKSq1ai+d89INlmkyAhgpOinAxY/2fy0o2jEr4Cqu4OZ1r/H2WUloX1pYnQNGGDS8WNpmg==
X-Received: by 2002:a05:600c:3b8d:b0:3a2:ea2b:d0f9 with SMTP id
 n13-20020a05600c3b8d00b003a2ea2bd0f9mr1574091wms.120.1657547906235;
 Mon, 11 Jul 2022 06:58:26 -0700 (PDT)
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 41/45] linux-user: Rename sve prctls
Date: Mon, 11 Jul 2022 14:57:46 +0100
Message-Id: <20220711135750.765803-42-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
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17
 as permitted sender) client-ip=209.51.188.17;
 envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org;
 helo=lists.gnu.org;
Received-SPF: pass client-ip=2a00:1450:4864:20::32c;
 envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x32c.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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>
Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org
Sender: "Qemu-devel" <qemu-devel-bounces+importer=patchew.org@nongnu.org>
X-ZohoMail-DKIM: pass (identity @linaro.org)
X-ZM-MESSAGEID: 1657551951479100001
Content-Type: text/plain; charset="utf-8"

From: Richard Henderson <richard.henderson@linaro.org>

Add "sve" to the sve prctl functions, to distinguish
them from the coming "sme" prctls with similar names.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220708151540.18136-42-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 linux-user/aarch64/target_prctl.h |  8 ++++----
 linux-user/syscall.c              | 12 ++++++------
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/linux-user/aarch64/target_prctl.h b/linux-user/aarch64/target_=
prctl.h
index 1d440ffbea4..40481e66635 100644
--- a/linux-user/aarch64/target_prctl.h
+++ b/linux-user/aarch64/target_prctl.h
@@ -6,7 +6,7 @@
 #ifndef AARCH64_TARGET_PRCTL_H
 #define AARCH64_TARGET_PRCTL_H
=20
-static abi_long do_prctl_get_vl(CPUArchState *env)
+static abi_long do_prctl_sve_get_vl(CPUArchState *env)
 {
     ARMCPU *cpu =3D env_archcpu(env);
     if (cpu_isar_feature(aa64_sve, cpu)) {
@@ -14,9 +14,9 @@ static abi_long do_prctl_get_vl(CPUArchState *env)
     }
     return -TARGET_EINVAL;
 }
-#define do_prctl_get_vl do_prctl_get_vl
+#define do_prctl_sve_get_vl do_prctl_sve_get_vl
=20
-static abi_long do_prctl_set_vl(CPUArchState *env, abi_long arg2)
+static abi_long do_prctl_sve_set_vl(CPUArchState *env, abi_long arg2)
 {
     /*
      * We cannot support either PR_SVE_SET_VL_ONEXEC or PR_SVE_VL_INHERIT.
@@ -47,7 +47,7 @@ static abi_long do_prctl_set_vl(CPUArchState *env, abi_lo=
ng arg2)
     }
     return -TARGET_EINVAL;
 }
-#define do_prctl_set_vl do_prctl_set_vl
+#define do_prctl_sve_set_vl do_prctl_sve_set_vl
=20
 static abi_long do_prctl_reset_keys(CPUArchState *env, abi_long arg2)
 {
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 669add74c11..cbde82c9076 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -6362,11 +6362,11 @@ static abi_long do_prctl_inval1(CPUArchState *env, =
abi_long arg2)
 #ifndef do_prctl_set_fp_mode
 #define do_prctl_set_fp_mode do_prctl_inval1
 #endif
-#ifndef do_prctl_get_vl
-#define do_prctl_get_vl do_prctl_inval0
+#ifndef do_prctl_sve_get_vl
+#define do_prctl_sve_get_vl do_prctl_inval0
 #endif
-#ifndef do_prctl_set_vl
-#define do_prctl_set_vl do_prctl_inval1
+#ifndef do_prctl_sve_set_vl
+#define do_prctl_sve_set_vl do_prctl_inval1
 #endif
 #ifndef do_prctl_reset_keys
 #define do_prctl_reset_keys do_prctl_inval1
@@ -6431,9 +6431,9 @@ static abi_long do_prctl(CPUArchState *env, abi_long =
option, abi_long arg2,
     case PR_SET_FP_MODE:
         return do_prctl_set_fp_mode(env, arg2);
     case PR_SVE_GET_VL:
-        return do_prctl_get_vl(env);
+        return do_prctl_sve_get_vl(env);
     case PR_SVE_SET_VL:
-        return do_prctl_set_vl(env, arg2);
+        return do_prctl_sve_set_vl(env, arg2);
     case PR_PAC_RESET_KEYS:
         if (arg3 || arg4 || arg5) {
             return -TARGET_EINVAL;
--=20
2.25.1
From nobody Thu May  8 21:38:42 2025
Delivered-To: importer@patchew.org
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass(p=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1657552097; cv=none;
	d=zohomail.com; s=zohoarc;
	b=im5Gw4qIVs2JacH2WBoCDdzOqoTfH5MV85UUesVsuhbvT5WKDoVvsN9TxCckDeTVEYQilHIjJm5wgx4o3vmaE77VjVdlMY7ofrwsV5fVz5e+vcDMnYcLJOsTSy96rdv2jHHQvJlFn029VRl/1FRg2fNK1g5WiZ2CdJjz95SV8lw=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1657552097;
 h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
	bh=v+KpABCiERhEMgs7leq7TSMjJyDNMo+se3mODEwafVE=;
	b=Kvg7qsQ8PSZIk0mnRPimfF7icQteRZ+VwTQA7zaIenHnbmsFIzS/LY8Ve1pyCEsGQLynR2FxbIqG/ILDnZIeBHoEmOXqK+Uu2uFOJn9fX4WRrx+bvsx1sbgA5MFRPnp0f33W6EeNk6ASoAuJY923HIZH/tNsn/e+S3XVZCw0uy0=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass header.from=<peter.maydell@linaro.org> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1657552097495286.50729735408163;
 Mon, 11 Jul 2022 08:08:17 -0700 (PDT)
Received: from localhost ([::1]:36692 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces+importer=patchew.org@nongnu.org>)
	id 1oAv1D-0003Zf-TH
	for importer@patchew.org; Mon, 11 Jul 2022 11:08:15 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:43386)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvt-00071U-TJ
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:41 -0400
Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]:37550)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvh-0002qz-Td
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:41 -0400
Received: by mail-wr1-x432.google.com with SMTP id r10so972991wrv.4
 for <qemu-devel@nongnu.org>; Mon, 11 Jul 2022 06:58:28 -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.26
 for <qemu-devel@nongnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 11 Jul 2022 06:58:27 -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=v+KpABCiERhEMgs7leq7TSMjJyDNMo+se3mODEwafVE=;
 b=vLBYM+P0gHjlS8+mJgvn4d9dDAouNdzgQfc1sutxElNyW/hVbDmbxclVU4UjWEMRMA
 bpKPFrgE5HnOPw28N/BRv8xYQRmihvRFWnwbOt9SEo4SnUd54FpurJrmrM7fpYH49J8O
 Dix8GqeTBV6gn7t+T0XxocW7/Z0uymrTuUH1zF6IBPEFFYW4mE1d7GJ7a7K5MYOC6BCb
 CGAyjjh0r692A8ZkuVy7bULtouRlH7Q1fGIhtRh9yXUiT5zYWb/xU5u3TMf9CeRlsbvJ
 JnhJQpnDiUNarHR8PAkWyIYRnweH02xhthEaebXe3V4J7+xwsdKnJYh9Kf625tzfRdLa
 eAYw==
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=v+KpABCiERhEMgs7leq7TSMjJyDNMo+se3mODEwafVE=;
 b=szmH1WBh1x4pknv+lSHizEdSc+E6Yh+tHn45EUE9DumcsNIRwoNTIKGjjbzY+Y1Dt7
 tuZSBb4UdnbP3q9SOR4lI5nG0H5qDs8n9HdAmmhqHyHLwKO9b3u0pwCd0sWx8Zr31p7h
 RgWGvcjR+9FUiwo4irRWQ5yTTnFCvOycqsb4hDIi6/2+I821YrXbpvpsC2J6PB+dIria
 4nSli6TsRna2/x5o/2aakvybeRyYTtFPED6zrL7hE2YWHSjQ17ut6Ik97sr18H289MCu
 HLexm+FMvCLBo0XtsWkLN6+4oPH2PwShtSqH058DdUo4vY+50su57Fqcddeb48yXf/zB
 vP5Q==
X-Gm-Message-State: AJIora9FpsCS9cl+vl2QS/XEZ4pKoShOZPexU11Yu/IokmVVYGIuas88
 jNQCs9w72+aTKp2FNOV9bpN72hFndmnP3A==
X-Google-Smtp-Source: 
 AGRyM1tN4A2cb+l5vkZUyeWj7MRp13zQiJ0LipfsmHhypcFpFRRA5QXvKBWRmDT+bQMAEb87cazVBQ==
X-Received: by 2002:adf:dc0d:0:b0:21d:ea5:710f with SMTP id
 t13-20020adfdc0d000000b0021d0ea5710fmr17032110wri.48.1657547908036;
 Mon, 11 Jul 2022 06:58:28 -0700 (PDT)
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 42/45] linux-user/aarch64: Implement PR_SME_GET_VL,
 PR_SME_SET_VL
Date: Mon, 11 Jul 2022 14:57:47 +0100
Message-Id: <20220711135750.765803-43-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
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17
 as permitted sender) client-ip=209.51.188.17;
 envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org;
 helo=lists.gnu.org;
Received-SPF: pass client-ip=2a00:1450:4864:20::432;
 envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x432.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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>
Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org
Sender: "Qemu-devel" <qemu-devel-bounces+importer=patchew.org@nongnu.org>
X-ZohoMail-DKIM: pass (identity @linaro.org)
X-ZM-MESSAGEID: 1657552098984100001
Content-Type: text/plain; charset="utf-8"

From: Richard Henderson <richard.henderson@linaro.org>

These prctl set the Streaming SVE vector length, which may
be completely different from the Normal SVE vector length.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220708151540.18136-43-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 linux-user/aarch64/target_prctl.h | 54 +++++++++++++++++++++++++++++++
 linux-user/syscall.c              | 16 +++++++++
 2 files changed, 70 insertions(+)

diff --git a/linux-user/aarch64/target_prctl.h b/linux-user/aarch64/target_=
prctl.h
index 40481e66635..907c3141466 100644
--- a/linux-user/aarch64/target_prctl.h
+++ b/linux-user/aarch64/target_prctl.h
@@ -10,6 +10,7 @@ static abi_long do_prctl_sve_get_vl(CPUArchState *env)
 {
     ARMCPU *cpu =3D env_archcpu(env);
     if (cpu_isar_feature(aa64_sve, cpu)) {
+        /* PSTATE.SM is always unset on syscall entry. */
         return sve_vq(env) * 16;
     }
     return -TARGET_EINVAL;
@@ -27,6 +28,7 @@ static abi_long do_prctl_sve_set_vl(CPUArchState *env, ab=
i_long arg2)
         && arg2 >=3D 0 && arg2 <=3D 512 * 16 && !(arg2 & 15)) {
         uint32_t vq, old_vq;
=20
+        /* PSTATE.SM is always unset on syscall entry. */
         old_vq =3D sve_vq(env);
=20
         /*
@@ -49,6 +51,58 @@ static abi_long do_prctl_sve_set_vl(CPUArchState *env, a=
bi_long arg2)
 }
 #define do_prctl_sve_set_vl do_prctl_sve_set_vl
=20
+static abi_long do_prctl_sme_get_vl(CPUArchState *env)
+{
+    ARMCPU *cpu =3D env_archcpu(env);
+    if (cpu_isar_feature(aa64_sme, cpu)) {
+        return sme_vq(env) * 16;
+    }
+    return -TARGET_EINVAL;
+}
+#define do_prctl_sme_get_vl do_prctl_sme_get_vl
+
+static abi_long do_prctl_sme_set_vl(CPUArchState *env, abi_long arg2)
+{
+    /*
+     * We cannot support either PR_SME_SET_VL_ONEXEC or PR_SME_VL_INHERIT.
+     * Note the kernel definition of sve_vl_valid allows for VQ=3D512,
+     * i.e. VL=3D8192, even though the architectural maximum is VQ=3D16.
+     */
+    if (cpu_isar_feature(aa64_sme, env_archcpu(env))
+        && arg2 >=3D 0 && arg2 <=3D 512 * 16 && !(arg2 & 15)) {
+        int vq, old_vq;
+
+        old_vq =3D sme_vq(env);
+
+        /*
+         * Bound the value of vq, so that we know that it fits into
+         * the 4-bit field in SMCR_EL1.  Because PSTATE.SM is cleared
+         * on syscall entry, we are not modifying the current SVE
+         * vector length.
+         */
+        vq =3D MAX(arg2 / 16, 1);
+        vq =3D MIN(vq, 16);
+        env->vfp.smcr_el[1] =3D
+            FIELD_DP64(env->vfp.smcr_el[1], SMCR, LEN, vq - 1);
+
+        /* Delay rebuilding hflags until we know if ZA must change. */
+        vq =3D sve_vqm1_for_el_sm(env, 0, true) + 1;
+
+        if (vq !=3D old_vq) {
+            /*
+             * PSTATE.ZA state is cleared on any change to SVL.
+             * We need not call arm_rebuild_hflags because PSTATE.SM was
+             * cleared on syscall entry, so this hasn't changed VL.
+             */
+            env->svcr =3D FIELD_DP64(env->svcr, SVCR, ZA, 0);
+            arm_rebuild_hflags(env);
+        }
+        return vq * 16;
+    }
+    return -TARGET_EINVAL;
+}
+#define do_prctl_sme_set_vl do_prctl_sme_set_vl
+
 static abi_long do_prctl_reset_keys(CPUArchState *env, abi_long arg2)
 {
     ARMCPU *cpu =3D env_archcpu(env);
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index cbde82c9076..991b85e6b4d 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -6343,6 +6343,12 @@ abi_long do_arch_prctl(CPUX86State *env, int code, a=
bi_ulong addr)
 #ifndef PR_SET_SYSCALL_USER_DISPATCH
 # define PR_SET_SYSCALL_USER_DISPATCH 59
 #endif
+#ifndef PR_SME_SET_VL
+# define PR_SME_SET_VL  63
+# define PR_SME_GET_VL  64
+# define PR_SME_VL_LEN_MASK  0xffff
+# define PR_SME_VL_INHERIT   (1 << 17)
+#endif
=20
 #include "target_prctl.h"
=20
@@ -6383,6 +6389,12 @@ static abi_long do_prctl_inval1(CPUArchState *env, a=
bi_long arg2)
 #ifndef do_prctl_set_unalign
 #define do_prctl_set_unalign do_prctl_inval1
 #endif
+#ifndef do_prctl_sme_get_vl
+#define do_prctl_sme_get_vl do_prctl_inval0
+#endif
+#ifndef do_prctl_sme_set_vl
+#define do_prctl_sme_set_vl do_prctl_inval1
+#endif
=20
 static abi_long do_prctl(CPUArchState *env, abi_long option, abi_long arg2,
                          abi_long arg3, abi_long arg4, abi_long arg5)
@@ -6434,6 +6446,10 @@ static abi_long do_prctl(CPUArchState *env, abi_long=
 option, abi_long arg2,
         return do_prctl_sve_get_vl(env);
     case PR_SVE_SET_VL:
         return do_prctl_sve_set_vl(env, arg2);
+    case PR_SME_GET_VL:
+        return do_prctl_sme_get_vl(env);
+    case PR_SME_SET_VL:
+        return do_prctl_sme_set_vl(env, arg2);
     case PR_PAC_RESET_KEYS:
         if (arg3 || arg4 || arg5) {
             return -TARGET_EINVAL;
--=20
2.25.1
From nobody Thu May  8 21:38:42 2025
Delivered-To: importer@patchew.org
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass(p=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1657550448; cv=none;
	d=zohomail.com; s=zohoarc;
	b=KePDtF4rlnomsF08o89cnGFi5inZQLU6cgWDgfD1o964Fv67F5s7jWgOZRWaPTc8vqUGFfZBRFeXsxzX4ukNetD0NtwoiZpC1grTLespO9W0wgSHxhGQ3PR364vzLTS+y0IKdP1H5mFNkkNamwp68SUJ0rh2l20K7HsOOO3etG0=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1657550448;
 h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
	bh=H39kaTMy9J7xwr8e9kYgt0j0csqMDxRmuwJQoBhCvKw=;
	b=h4nDQXgSJSdKE6QIKG4Yt1LJOrlE54xir4em10Ap8zJj0PbEIZz9gZ2dixxS4cGwSt8a/Hg8Ks1c51Nupj/C3QuqY3yo2n1m2Ir3+V7/yqrRN16IKhLEr75tw8rbx5a1ac0ljeFg20RZ09nEqy12YhSG/B0CPrISaQZgqa9AYaE=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass header.from=<peter.maydell@linaro.org> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1657550448396198.0468887359691;
 Mon, 11 Jul 2022 07:40:48 -0700 (PDT)
Received: from localhost ([::1]:55404 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces+importer=patchew.org@nongnu.org>)
	id 1oAuab-0000L4-Mb
	for importer@patchew.org; Mon, 11 Jul 2022 10:40:45 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:43394)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvu-00072H-4U
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:42 -0400
Received: from mail-wr1-x432.google.com ([2a00:1450:4864:20::432]:33723)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvh-0002ng-UD
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:41 -0400
Received: by mail-wr1-x432.google.com with SMTP id h17so7183289wrx.0
 for <qemu-devel@nongnu.org>; Mon, 11 Jul 2022 06:58:29 -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.28
 for <qemu-devel@nongnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 11 Jul 2022 06:58:28 -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=H39kaTMy9J7xwr8e9kYgt0j0csqMDxRmuwJQoBhCvKw=;
 b=d+Ji1fHzNjRMybbKZMKDlRaldwg6kI9RSlLnXAhq6yZqZVq0i7Ii+nyEhfm0Ruz9KN
 WhJs+clqJ41qYa1Et7NX8D/UOIa13x4SOtRubnDWf3wQQKY1jM+kExwFlcfF2hWgJGCB
 FXuVgsmJ/BOGwJ6q450MxJhps3jGY3XaIlaETDxVw33uIJ/0s/g6RXKiGzUh2u7/8I4m
 C41F8zz2JHDxZYlFXLPLIiqPyjvCHq65EtP8eYhpVNjmluh0OAJZsy1uEPy00qu1MDPi
 3V7U3kW/EGLoZ6qFhmxzQuVDdvC1bQAlcydQZ3SVnuycBKIPpkUimFxsloPy824RC0CJ
 CmiA==
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=H39kaTMy9J7xwr8e9kYgt0j0csqMDxRmuwJQoBhCvKw=;
 b=0KCSUSbkie0wmIY0Fgt7HSzBKPPYLJghO+ZeMOXlRQ0ESm0XOm2LKqJfiZx7VNAPuT
 XOP7vDxJO+EQ+t09DA2IwE2JEo3eqNyDXbzPtC0F2BZFLjHR1NFkL0gHx8maJiHL/UHl
 dEWTwt7XoiB5fmIVzprM5WT0mEqy2kLRqNhDD2mVnIvjnUVtYtTTVOvPaqCUL5X2yTuU
 3lUtwHKS1g94gfb+z8EIMs5X7mVB0jKXNbRyOgquEatmEmBSoweXnL9RhQY4y2Q/Obdh
 0zu4ekozT9K8aYbP2QYzmFIoByGh4+olOy1+BvGDKHcuJQ7QCymXxx3u2nQ3jUGlFjvE
 p6hg==
X-Gm-Message-State: AJIora+zPVa8pZtEXg/pdkMyCaWn45YZXzprGDmS7ADY4oZht7igSW5o
 CsYx3ygoIypEPE66D8QOdto2HnGje3inKA==
X-Google-Smtp-Source: 
 AGRyM1um3VwFhsppHo27aEoeIp8NcPT1U4SvGNuHIqE9mdYi3Ppf4QHxHnwNzXmxYk3acRZuQMDjfg==
X-Received: by 2002:a5d:6149:0:b0:21d:6ba7:6095 with SMTP id
 y9-20020a5d6149000000b0021d6ba76095mr16722577wrt.680.1657547908737;
 Mon, 11 Jul 2022 06:58:28 -0700 (PDT)
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 43/45] target/arm: Only set ZEN in reset if SVE present
Date: Mon, 11 Jul 2022 14:57:48 +0100
Message-Id: <20220711135750.765803-44-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
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17
 as permitted sender) client-ip=209.51.188.17;
 envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org;
 helo=lists.gnu.org;
Received-SPF: pass client-ip=2a00:1450:4864:20::432;
 envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x432.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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>
Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org
Sender: "Qemu-devel" <qemu-devel-bounces+importer=patchew.org@nongnu.org>
X-ZohoMail-DKIM: pass (identity @linaro.org)
X-ZM-MESSAGEID: 1657550449225100001
Content-Type: text/plain; charset="utf-8"

From: Richard Henderson <richard.henderson@linaro.org>

There's no reason to set CPACR_EL1.ZEN if SVE disabled.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220708151540.18136-44-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 target/arm/cpu.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/target/arm/cpu.c b/target/arm/cpu.c
index 9c58be8b146..9b544438432 100644
--- a/target/arm/cpu.c
+++ b/target/arm/cpu.c
@@ -204,11 +204,10 @@ static void arm_cpu_reset(DeviceState *dev)
         /* and to the FP/Neon instructions */
         env->cp15.cpacr_el1 =3D FIELD_DP64(env->cp15.cpacr_el1,
                                          CPACR_EL1, FPEN, 3);
-        /* and to the SVE instructions */
-        env->cp15.cpacr_el1 =3D FIELD_DP64(env->cp15.cpacr_el1,
-                                         CPACR_EL1, ZEN, 3);
-        /* with reasonable vector length */
+        /* and to the SVE instructions, with default vector length */
         if (cpu_isar_feature(aa64_sve, cpu)) {
+            env->cp15.cpacr_el1 =3D FIELD_DP64(env->cp15.cpacr_el1,
+                                             CPACR_EL1, ZEN, 3);
             env->vfp.zcr_el[1] =3D cpu->sve_default_vq - 1;
         }
         /*
--=20
2.25.1
From nobody Thu May  8 21:38:42 2025
Delivered-To: importer@patchew.org
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass(p=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1657551235; cv=none;
	d=zohomail.com; s=zohoarc;
	b=cOu/BpSGWIZylqeeDnQnNEfc54xuJtWeqr7oJC0FmAwEcvwaUAZe3InXgeCnyulTt+3wiiNHwSh+EHP/5AxKnCr/26T5MgpHhh5dVSBUKLtBLN4kXl7ZxgW5yX7m6OEpOVzuffY8C8WsJqjWGuQELqjRcwC5yR0BOxJAK24ejkc=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1657551235;
 h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
	bh=1sgBY9euZYqyeJsGgf1ImXhvmAEBL7DAD0J4RuefL6Q=;
	b=Dobi+2ZFCKJLQAyt/bhQjDqE1W4GzkKX9XJQVIghHi8Ya2EZ42kElx59iMAzQfuyf+f85HYbXp/XkwMrhFy7nNBCV+AKitTaJPOu9rJzsubccShR2FKr5nNkyT6Me+LR0mXyLpr2a0IrLjRE1VRfPjVDCS/4iLd5Kewqt0dkM0Y=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass header.from=<peter.maydell@linaro.org> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1657551235265346.31630916882;
 Mon, 11 Jul 2022 07:53:55 -0700 (PDT)
Received: from localhost ([::1]:57878 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces+importer=patchew.org@nongnu.org>)
	id 1oAunJ-0004kH-2S
	for importer@patchew.org; Mon, 11 Jul 2022 10:53:53 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:43404)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvu-00073A-Fb
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:42 -0400
Received: from mail-wr1-x430.google.com ([2a00:1450:4864:20::430]:36550)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvi-0002pO-7w
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:42 -0400
Received: by mail-wr1-x430.google.com with SMTP id o4so7144055wrh.3
 for <qemu-devel@nongnu.org>; Mon, 11 Jul 2022 06:58:29 -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.28
 for <qemu-devel@nongnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 11 Jul 2022 06:58:29 -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=1sgBY9euZYqyeJsGgf1ImXhvmAEBL7DAD0J4RuefL6Q=;
 b=yerFkebCJy1LDgj6reeEwol7btxEPfDzn/7dneGKekBXwIokkrRBBPFvvcltv1GLD2
 wMNExQ1C26TiAl4Jttb+vpvqBPUUsHmKQ5jyabmf3vO3hojHw+gpdJ/t1Tb4bbzuYOX+
 m/EsJFiHWsRb4CaJ0M3CqY/cBjxIUa6IFKVny4vWXeKxN/Z140K/QQ7nRZ0w9qw9v50u
 z0Hthn/hi9ToPu5u74wNbBwAgaSENZaV/iNCxIUgtDAi/Xs/gWy8IkpwSxwMFL72wBZ+
 /nvXdqkpmvsloJgYeksulMXg7f5DaaYymEOfBF8ytbopA3NsIrMcVoKacAQCMygO1p6S
 P8vA==
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=1sgBY9euZYqyeJsGgf1ImXhvmAEBL7DAD0J4RuefL6Q=;
 b=dp7iYDPVhxBUq2QiMbKla3BTXwUrtrAuZsxPnBeEu7A6WWnWorl0xx5KBro06IWWmD
 P/Q9EvoSi/sQrdv274N39Fa3oNFUQblrJCiEORSXhQ0LsxfRaW2ya9uEjuRZh9LawLIW
 ZDj5yTQCu1KQ+6pSRJPE3ApHXra+qKLfpzUVYXCjWoL34xazeVYieh5XckygX3RQn/IM
 hssT53O0Er2IY3LVfaUCyvloATSA6VbpB2uMrwkcAm0oEhXYRIpZnlqq8yZ5/qiLfCbe
 t4TwCQKGbSZ1T2iKBQ7a4NFwTjELJJz8grojwqdCEphbzaoR9L3WEYXa/1V2Dr1nSe+f
 1NjQ==
X-Gm-Message-State: AJIora9Ua6V7yxm0XlvsFR2ddUUNwjpzwQZjY1tUdjVrs8omLDU7aFpW
 LcFYMKV8CKUqEpkner8Cxbt8ODskk+TsbA==
X-Google-Smtp-Source: 
 AGRyM1vyLnCV9FD9Wy9u2+YqkZFAAlyzoq1bTKGSDfu0Rjh4oKxmVDzAut1AaSfBW3rwNKcVaKV5Hg==
X-Received: by 2002:a5d:4aca:0:b0:21d:6793:1c11 with SMTP id
 y10-20020a5d4aca000000b0021d67931c11mr16517688wrs.202.1657547909393;
 Mon, 11 Jul 2022 06:58:29 -0700 (PDT)
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 44/45] target/arm: Enable SME for user-only
Date: Mon, 11 Jul 2022 14:57:49 +0100
Message-Id: <20220711135750.765803-45-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
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17
 as permitted sender) client-ip=209.51.188.17;
 envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org;
 helo=lists.gnu.org;
Received-SPF: pass client-ip=2a00:1450:4864:20::430;
 envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x430.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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>
Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org
Sender: "Qemu-devel" <qemu-devel-bounces+importer=patchew.org@nongnu.org>
X-ZohoMail-DKIM: pass (identity @linaro.org)
X-ZM-MESSAGEID: 1657551237395100001
Content-Type: text/plain; charset="utf-8"

From: Richard Henderson <richard.henderson@linaro.org>

Enable SME, TPIDR2_EL0, and FA64 if supported by the cpu.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220708151540.18136-45-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 target/arm/cpu.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/target/arm/cpu.c b/target/arm/cpu.c
index 9b544438432..5de7e097e9b 100644
--- a/target/arm/cpu.c
+++ b/target/arm/cpu.c
@@ -210,6 +210,17 @@ static void arm_cpu_reset(DeviceState *dev)
                                              CPACR_EL1, ZEN, 3);
             env->vfp.zcr_el[1] =3D cpu->sve_default_vq - 1;
         }
+        /* and for SME instructions, with default vector length, and TPIDR=
2 */
+        if (cpu_isar_feature(aa64_sme, cpu)) {
+            env->cp15.sctlr_el[1] |=3D SCTLR_EnTP2;
+            env->cp15.cpacr_el1 =3D FIELD_DP64(env->cp15.cpacr_el1,
+                                             CPACR_EL1, SMEN, 3);
+            env->vfp.smcr_el[1] =3D cpu->sme_default_vq - 1;
+            if (cpu_isar_feature(aa64_sme_fa64, cpu)) {
+                env->vfp.smcr_el[1] =3D FIELD_DP64(env->vfp.smcr_el[1],
+                                                 SMCR, FA64, 1);
+            }
+        }
         /*
          * Enable 48-bit address space (TODO: take reserved_va into accoun=
t).
          * Enable TBI0 but not TBI1.
--=20
2.25.1
From nobody Thu May  8 21:38:42 2025
Delivered-To: importer@patchew.org
Authentication-Results: mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass(p=none dis=none)  header.from=linaro.org
ARC-Seal: i=1; a=rsa-sha256; t=1657550678; cv=none;
	d=zohomail.com; s=zohoarc;
	b=A8+dMjvLvmxDffAO3A2jGrBLY7uuly31bejcJG1oJjopv4JgNxH1X3OGPYI/UGnXgfdb5Cf8SscDPBjN+AvbJaX9KvpnKkqoYHgBFcDPS6jfC4W7AKheXV5KhSVC+PWDQwnEiiqRX+lDlzDFgaUg9o3c0X1jhLnbd/vHAVYYGfE=
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com;
 s=zohoarc;
	t=1657550678;
 h=Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To;
	bh=ncZmjL4fnXZIwITU/tClyOmhkWxRy5n9Ldo967W1rl4=;
	b=GvYWvtyQ4vzre1fKK/BN1lW4dUY90ig5R4CdpLjJai7XynjWqBvg14P1csmfBveJXAa/XLCU+PsTQmafzmHrKkNAzRrqym+gJriBEVHqxEu00Cz5dnoimNub2Rr19Q0LIXGRqTnMph4FBCXBtj4E6m5oA9rDY7yibJzMTO3nVy4=
ARC-Authentication-Results: i=1; mx.zohomail.com;
	dkim=pass;
	spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as
 permitted sender)
  smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org;
	dmarc=pass header.from=<peter.maydell@linaro.org> (p=none dis=none)
Return-Path: <qemu-devel-bounces+importer=patchew.org@nongnu.org>
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by
 mx.zohomail.com
	with SMTPS id 1657550678229745.4755459877952;
 Mon, 11 Jul 2022 07:44:38 -0700 (PDT)
Received: from localhost ([::1]:35836 helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <qemu-devel-bounces+importer=patchew.org@nongnu.org>)
	id 1oAueG-0006MF-F2
	for importer@patchew.org; Mon, 11 Jul 2022 10:44:32 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:43432)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvv-000764-Gf
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:43 -0400
Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]:42550)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <peter.maydell@linaro.org>)
 id 1oAtvj-0002wv-Le
 for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:43 -0400
Received: by mail-wr1-x42f.google.com with SMTP id bu1so5948812wrb.9
 for <qemu-devel@nongnu.org>; Mon, 11 Jul 2022 06:58:31 -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.29
 for <qemu-devel@nongnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 11 Jul 2022 06:58:29 -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=ncZmjL4fnXZIwITU/tClyOmhkWxRy5n9Ldo967W1rl4=;
 b=kxZGxx7WL8vKQ/Mh4kVYZ4DqZQTZEhCcrogQtF83vElKx/F3WgCUazfnuQdsl4uw9v
 SNVO+/dh93hsIRam3wTu6t2Hl73+JSvgjkvQWcnqnFgixtoLDhp4QwL6uhli2UvrSfqo
 n9jEl6T8GPF1nkyJd3g6lwkeN4Pqd4Sy8eCKLyBnb+SmjmQpqEMGazJrxbRbvM38YJ3p
 HcOufYuLBSSRlqgm6UtY33tIBEjzBqzvkoG873NCUn/v5ciLOOF64lGZ3FRzmsDVAaQY
 Yqk7ALAPnZ7e7VXVPFQJPz7DNLaxzGQuQkscORQNXFEpDnM0/NplSnV23brMXA/vwpfl
 eO4w==
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=ncZmjL4fnXZIwITU/tClyOmhkWxRy5n9Ldo967W1rl4=;
 b=8HBj0HsipuVNvBOnTyVfzyjZizvtlpNw7CYYcQwTuFHNxvUXNBLyDbUDJteoFUWrfx
 tT9GWKG1JsqmH8PbDGzGsPwFjrPoEuhAQFYYkZCASFt0Tc2feqe1OOoxEWUy1xohZv56
 hnUcpUXPCrFTr7MsGtUO1eh90FqZ9C3Oy6jbPq6HNnwKaemJe+8bV8tKpYew9gHB4nZt
 AnOk2Bnp2Jt0/etxVT2wO1HMCyBafnBbdmMT+MZoQs9eeAUkASzDvQMD8hTgcekYvK2N
 /PiuoPSOiHQ9+vwEXAC92L5+/cmZq8OyhPlO241hI9wNVjJjsgy/G58XypB6WsthzPSu
 oIbQ==
X-Gm-Message-State: AJIora/GnaJ/qkkbUPrt41phjUjc2/Q/RpkZ7WJ8Vphwv/cH6gVFHMvi
 fGLn4keUhoKPVJlgXjIixE2l0RnaptTyrA==
X-Google-Smtp-Source: 
 AGRyM1t067bQhFVSMNxJ5lNnmjCbY5hGJU3uDoitCYXflVkCCpdSUitDhtJkUv6XhqtXylaToALXNw==
X-Received: by 2002:a05:6000:1ac8:b0:21b:9236:6207 with SMTP id
 i8-20020a0560001ac800b0021b92366207mr16685503wry.123.1657547910069;
 Mon, 11 Jul 2022 06:58:30 -0700 (PDT)
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Subject: [PULL 45/45] linux-user/aarch64: Add SME related hwcap entries
Date: Mon, 11 Jul 2022 14:57:50 +0100
Message-Id: <20220711135750.765803-46-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
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17
 as permitted sender) client-ip=209.51.188.17;
 envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org;
 helo=lists.gnu.org;
Received-SPF: pass client-ip=2a00:1450:4864:20::42f;
 envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x42f.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: <qemu-devel.nongnu.org>
List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>
List-Archive: <https://lists.nongnu.org/archive/html/qemu-devel>
List-Post: <mailto:qemu-devel@nongnu.org>
List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help>
List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>,
 <mailto:qemu-devel-request@nongnu.org?subject=subscribe>
Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org
Sender: "Qemu-devel" <qemu-devel-bounces+importer=patchew.org@nongnu.org>
X-ZohoMail-DKIM: pass (identity @linaro.org)
X-ZM-MESSAGEID: 1657550679196100001
Content-Type: text/plain; charset="utf-8"

From: Richard Henderson <richard.henderson@linaro.org>

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20220708151540.18136-46-richard.henderson@linaro.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
 linux-user/elfload.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/linux-user/elfload.c b/linux-user/elfload.c
index 1de77c7959f..ce902dbd56b 100644
--- a/linux-user/elfload.c
+++ b/linux-user/elfload.c
@@ -605,6 +605,18 @@ enum {
     ARM_HWCAP2_A64_RNG          =3D 1 << 16,
     ARM_HWCAP2_A64_BTI          =3D 1 << 17,
     ARM_HWCAP2_A64_MTE          =3D 1 << 18,
+    ARM_HWCAP2_A64_ECV          =3D 1 << 19,
+    ARM_HWCAP2_A64_AFP          =3D 1 << 20,
+    ARM_HWCAP2_A64_RPRES        =3D 1 << 21,
+    ARM_HWCAP2_A64_MTE3         =3D 1 << 22,
+    ARM_HWCAP2_A64_SME          =3D 1 << 23,
+    ARM_HWCAP2_A64_SME_I16I64   =3D 1 << 24,
+    ARM_HWCAP2_A64_SME_F64F64   =3D 1 << 25,
+    ARM_HWCAP2_A64_SME_I8I32    =3D 1 << 26,
+    ARM_HWCAP2_A64_SME_F16F32   =3D 1 << 27,
+    ARM_HWCAP2_A64_SME_B16F32   =3D 1 << 28,
+    ARM_HWCAP2_A64_SME_F32F32   =3D 1 << 29,
+    ARM_HWCAP2_A64_SME_FA64     =3D 1 << 30,
 };
=20
 #define ELF_HWCAP   get_elf_hwcap()
@@ -674,6 +686,14 @@ static uint32_t get_elf_hwcap2(void)
     GET_FEATURE_ID(aa64_rndr, ARM_HWCAP2_A64_RNG);
     GET_FEATURE_ID(aa64_bti, ARM_HWCAP2_A64_BTI);
     GET_FEATURE_ID(aa64_mte, ARM_HWCAP2_A64_MTE);
+    GET_FEATURE_ID(aa64_sme, (ARM_HWCAP2_A64_SME |
+                              ARM_HWCAP2_A64_SME_F32F32 |
+                              ARM_HWCAP2_A64_SME_B16F32 |
+                              ARM_HWCAP2_A64_SME_F16F32 |
+                              ARM_HWCAP2_A64_SME_I8I32));
+    GET_FEATURE_ID(aa64_sme_f64f64, ARM_HWCAP2_A64_SME_F64F64);
+    GET_FEATURE_ID(aa64_sme_i16i64, ARM_HWCAP2_A64_SME_I16I64);
+    GET_FEATURE_ID(aa64_sme_fa64, ARM_HWCAP2_A64_SME_FA64);
=20
     return hwcaps;
 }
--=20
2.25.1