From patchwork Mon Jul 11 13:57:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 589353 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:bb16:0:0:0:0 with SMTP id jd22csp3277641mab; Mon, 11 Jul 2022 07:06:31 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tVlf2E4PJEJe9QoswkaJ4pFQxVudlvQnh1FFQzCtLIVLLxNplgIUCb67o0lp1JhpQoiEK7 X-Received: by 2002:a05:620a:cfa:b0:6b5:684d:38c5 with SMTP id c26-20020a05620a0cfa00b006b5684d38c5mr10084663qkj.1.1657548391214; Mon, 11 Jul 2022 07:06:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657548391; cv=none; d=google.com; s=arc-20160816; b=CkEiRrHhWuhXtOGh6lqDtSWoZkHKDdTtDMG5TC0BxbbmeDco2zsw11OE8/JxzdXxoV v575tEq60QzJD86YC6ugjgpzHgve7q1zayNJREm5dTw9P+ApOlJ53Cwy1JPCs+6uScSD Bd6EQ42T4KQVTG94JvhFmlg3C+Izj+q36Zg8kAq2kAUDZeyBlIudcRlJK1YKueU+s6ZZ 1G3xa2GFo1kx+laiOboJrBE6oyblS0UNMy1Ini+Frhl04SPHXnsOqMGIlLhWUhJ+sjHx esaDnP3x4s59N1tye12asHKpxv482TN52kwjmckgfxluW1vMqOqbfpc7ySj3XlqWzQtH 3UtA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=arOhUrEykX6T/wdn4c/Rfw9Py5CnhEHkSl6mPSXt/2Q=; b=bzc3Wv7h1npoLjn/BPONoe9AUjp0LFlS1VRK7Na5B8O0HuFrx9lv084ZreuT2NYNRu aLjIS800kaqrpSM5Ruhhp5fugwlCzzcCxVM3bvewVPk+QwHVcxwHHzATLnm2Zo4NIH5y H8xl15Lyy1+UMoxkXXGdWaor95fLnK7hlKdmGltHOlAJNuYoW6vXGTaaX6qDuJvdTLVB cS3Y9uKjpDsRPMfmbyNtDjSdgd1NdxLq6Lrg/ZpzQZW8I7qWPzu52xTfysA8lcczdO8x TPkd1Crwz3yc71Yj7CbItFEFq+g1nVZmyE3GmCBzaDTBNV0nvKzUQh79OFEpEdtf9oey Kopg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PtyIRllw; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id e18-20020ac84e52000000b0031eba97a167si411090qtw.775.2022.07.11.07.06.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Jul 2022 07:06:31 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PtyIRllw; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:53202 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oAu3S-0007M9-Kx for patch@linaro.org; Mon, 11 Jul 2022 10:06:30 -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 ) 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 ) 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 ; 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=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-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) 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 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jul 2022 06:57:53 -0700 (PDT) From: Peter Maydell 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 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Dump SVCR, plus use the correct access check for Streaming Mode. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20220708151540.18136-2-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- 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 = arm_current_el(env); const char *ns_status; + bool sve; qemu_fprintf(f, " PC=%016" PRIx64 " ", env->pc); for (i = 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'); + if (cpu_isar_feature(aa64_sme, cpu)) { + qemu_fprintf(f, " SVCR=%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=%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=%08x FPSR=%08x\n", vfp_get_fpcr(env), vfp_get_fpsr(env)); - if (cpu_isar_feature(aa64_sve, cpu) && sve_exception_el(env, el) == 0) { + if (cpu_isar_feature(aa64_sme, cpu) && FIELD_EX64(env->svcr, SVCR, SM)) { + sve = sme_exception_el(env, el) == 0; + } else if (cpu_isar_feature(aa64_sve, cpu)) { + sve = sve_exception_el(env, el) == 0; + } else { + sve = false; + } + + if (sve) { int j, zcr_len = sve_vqm1_for_el(env, el); for (i = 0; i <= FFR_PRED_NUM; i++) { From patchwork Mon Jul 11 13:57:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 589351 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:bb16:0:0:0:0 with SMTP id jd22csp3275920mab; Mon, 11 Jul 2022 07:04:58 -0700 (PDT) X-Google-Smtp-Source: AGRyM1s+jPVzQVNFq7oYXHu83Y0WZLjVvrD12MXXRLmFFd3Fzwzn0qkWDg9o3tC6CGfT/ZJTCbCC X-Received: by 2002:a0c:a9d2:0:b0:472:f1c5:f309 with SMTP id c18-20020a0ca9d2000000b00472f1c5f309mr13692196qvb.35.1657548298420; Mon, 11 Jul 2022 07:04:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657548298; cv=none; d=google.com; s=arc-20160816; b=wqO5XGVWa4eXnlP3bjuXstkrB6FHTrhlIAXGubV5xCpp4SK7qlJf5M3gk/KpVp2ZwR oc/kOresWJB+fKQ82uNcRb9w7vERnWNxheVdfIzeMJ5xCFA5bL7adjxLRNoGGv4vefUk ogvmeLyOnwuzuY9W1JoFGRDqDGHxrCb9+23Pq4qGWFjXzxmkr3mMZz4avUqFwVv7mtLc McCrS56hoKHSxb7RqvgVaELoUuEHiTtwsI4CYrOTIfLBePkEmJfcExTGJ3EiDut7wawH 8+AbAIuDN8HnLedcljIXorA9F7d+LYlqsFPJjCxQh/WNSyF84j473+EZCMNT9HOJXCQT djbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=cq6njPeWKBmD/7wPffofXcxJCvDo9VaNMF80FcBqOjU=; b=qr2idJSpv/sRnO7mr2oJASSqtOt/UYTh8n+HRBMKig/E8rHwBUPSSmYLX/G6p/Fdtw 6fedYO14S+qY211iIJq/A3EN86iIKocMBOZ/3Tj/yu5K3pKPjQe0+/iqSFMJATtgt1fX i0JH8XpRDyaFK3mmt6aEKVXV70FLuMOKvSW2Gl5oCrYjGxKcNX/wijtJUzUshvkPzCj6 gH+pAKL8fad1vhbosJw2BDA7w/9L56HsV3LVyFZ0IcycrfHy39hdmZziUW3yWHlJ9//L VpzLt6myr4X2/GenWMZ9qwL9RqsqG6ThVuVmhtZ5x1pG/jJhLcnSDaMTRuou1LWlXRYK tE1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="secG/W/d"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id v15-20020a05620a0f0f00b006b5795b6a39si3630027qkl.151.2022.07.11.07.04.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Jul 2022 07:04:58 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="secG/W/d"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:48972 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oAu1x-0004Va-U5 for patch@linaro.org; Mon, 11 Jul 2022 10:04:57 -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 ) 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 ) 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 ; 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=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-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) 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 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jul 2022 06:57:54 -0700 (PDT) From: Peter Maydell 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 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson This includes the build rules for the decoder, and the new file for translation, but excludes any instructions. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20220708151540.18136-3-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- 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) } bool disas_sve(DisasContext *, uint32_t); +bool disas_sme(DisasContext *, uint32_t); 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 . + +# +# 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(DisasContextBase *dcbase, CPUState *cpu) } 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 . + */ + +#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 = [ decodetree.process('sve.decode', extra_args: '--decode=disas_sve'), + decodetree.process('sme.decode', extra_args: '--decode=disas_sme'), decodetree.process('neon-shared.decode', extra_args: '--decode=disas_neon_shared'), decodetree.process('neon-dp.decode', extra_args: '--decode=disas_neon_dp'), decodetree.process('neon-ls.decode', extra_args: '--decode=disas_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', )) arm_softmmu_ss = ss.source_set() From patchwork Mon Jul 11 13:57:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 589348 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:bb16:0:0:0:0 with SMTP id jd22csp3270241mab; Mon, 11 Jul 2022 06:59:57 -0700 (PDT) X-Google-Smtp-Source: AGRyM1stfOYmxhreGY3DbNxeo1w/dHKieDn0VMOj17KVYcGsZNM1VH3c6cpEB8yHOx3w3hAu8zOD X-Received: by 2002:a05:6214:262b:b0:473:7eaf:27ed with SMTP id gv11-20020a056214262b00b004737eaf27edmr754097qvb.131.1657547997098; Mon, 11 Jul 2022 06:59:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657547997; cv=none; d=google.com; s=arc-20160816; b=eFZMasXdnDGGlzDdZpgCkkaMx+Tjgdq0pViN3sHOJ/Uyn3XYm86GFDHaMksSUC8pJR BMKPUFD+m9DwDgfhHOdr2nBI39epg70ArZSzs2EQiYM9ObALpjUxiu7VrDcs/FXiAQP7 KD7SZNHmF0CJoo7VHesj8sCM/+fY+Y4gI0qCWBJIzq7Neu9pH+fKBBIOtvS2snGH7Tjr 80pmmWVyOSgYLw1lFFYCgRswcuy9YVvmUmYZXOfbto3YW35Y8txtUKKR5t3OfsfBkpbA xkDnwQrvx93LuUmjQd/8/MqMEtb0UyrUS67DL7a1dAUfl0ug/aPlEjbDlnKZtFv8kJIV 33rw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=xo5x3f5DFykiglro7trGefQrOb/O5QrFa/9gBehc4w0=; b=Ql5gnOiQgZUIejCPScQgOZOagyd4oRssy5tV6pgpCR3WYjcsuhVhN3ZThfn7h6J1Xc Y504eGODr2OLoSx6hVLqmScIAXH1IG/z8AzkR32eYWIxiKp65TN0RuPhFnUcHbSI9//U 9wWXt9tc5BjdOHmaoQeG/IbKqZ43LqfescPE6Y4GjL1prtXxyL0OCSR7mcHBSyk482FD kwW9wVY2wMYEHgWCwNK6BWOBbe0GnxRSlAxpMCAK9bOcEOp9dzyfGx3jaOHVwSqY7sdG njQg2CoIB/jbML7kujcdtPKMBnabdsw1sbzncU+t9qm/OghtFLFMhrocoqe8Y6FUNMbT dh+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FLT3QWpt; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id fw12-20020a05622a4a8c00b0031ea2d8c9c9si4158881qtb.444.2022.07.11.06.59.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Jul 2022 06:59:57 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FLT3QWpt; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:40132 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oAtx6-0006YA-Ic for patch@linaro.org; Mon, 11 Jul 2022 09:59:56 -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 ) 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 ) 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 ; 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=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-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) 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 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jul 2022 06:57:55 -0700 (PDT) From: Peter Maydell 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 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson 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 Signed-off-by: Richard Henderson Message-id: 20220708151540.18136-4-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- 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) /* * 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) /* * 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 . + +# +# 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 operations +} + +{ + [ + 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-element operations +} + +FAIL 0-00 110- ---- ---- ---- ---- ---- ---- # Advanced SIMD structure load/store +FAIL 1100 1110 ---- ---- ---- ---- ---- ---- # Advanced SIMD cryptography 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-relative 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 result) +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/crypto instructions +FAIL 1000 010- -00- ---- 10-- ---- ---- ---- # SVE2 32-bit gather NT load (vector+scalar) +FAIL 1000 010- -00- ---- 111- ---- ---- ---- # SVE 32-bit gather prefetch (vector+imm) +FAIL 1000 0100 0-1- ---- 0--- ---- ---- ---- # SVE 32-bit gather prefetch (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 32 bytes (scalar+scalar) +FAIL 1010 010- -010 ---- 001- ---- ---- ---- # SVE load & replicate 32 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 (scalar+32-bit vector) +FAIL 1110 010- ---- ---- 101- ---- ---- ---- # SVE scatter store (misc) 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; } +/* 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 <= 1 && !el_is_in_host(env, el)) { + if (!FIELD_EX64(env->vfp.smcr_el[1], SMCR, FA64)) { + return false; + } + } + if (el <= 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(CPUARMState *env, int fp_el, DP_TBFLAG_ANY(flags, PSTATE__IL, 1); } + /* + * The SME exception we are testing for is raised via + * AArch64.CheckFPAdvSIMDEnabled(), as called from + * AArch32.CheckAdvSIMDOrFPEnabled(). + */ + if (el == 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); } @@ -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, int 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; } +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) } } +/* + * 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 = true; + return true; +} + /** * is_guarded_page: * @env: The cpu environment @@ -14657,6 +14687,7 @@ static void aarch64_tr_init_disas_context(DisasContextBase *dcbase, dc->mte_active[1] = EX_TBFLAG_A64(tb_flags, MTE0_ACTIVE); dc->pstate_sm = EX_TBFLAG_A64(tb_flags, PSTATE_SM); dc->pstate_za = EX_TBFLAG_A64(tb_flags, PSTATE_ZA); + dc->sme_trap_nonstreaming = EX_TBFLAG_A64(tb_flags, SME_TRAP_NONSTREAMING); dc->vec_len = 0; dc->vec_stride = 0; dc->cp_regs = arm_cpu->cp_regs; @@ -14805,6 +14836,11 @@ static void aarch64_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) } } + s->is_nonstreaming = 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 ignore_vfp_enabled) return false; } + /* + * 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 == 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(DisasContextBase *dcbase, CPUState *cs) dc->vec_len = EX_TBFLAG_A32(tb_flags, VECLEN); dc->vec_stride = EX_TBFLAG_A32(tb_flags, VECSTRIDE); } + dc->sme_trap_nonstreaming = + EX_TBFLAG_A32(tb_flags, SME_TRAP_NONSTREAMING); } dc->cp_regs = cpu->cp_regs; dc->features = 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 = [ decodetree.process('sve.decode', extra_args: '--decode=disas_sve'), decodetree.process('sme.decode', extra_args: '--decode=disas_sme'), + decodetree.process('sme-fa64.decode', extra_args: '--static-decode=disas_sme_fa64'), decodetree.process('neon-shared.decode', extra_args: '--decode=disas_neon_shared'), decodetree.process('neon-dp.decode', extra_args: '--decode=disas_neon_dp'), decodetree.process('neon-ls.decode', extra_args: '--decode=disas_neon_ls'), From patchwork Mon Jul 11 13:57:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 589350 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:bb16:0:0:0:0 with SMTP id jd22csp3275845mab; Mon, 11 Jul 2022 07:04:55 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vZKe+nfZ454uIPA0p4wNpQ6YsVpP4+9fFZ5M35ffFSnMi8pNZIYUngcRzJ8MqNpWuqUzeP X-Received: by 2002:a05:6214:e69:b0:473:691d:e4cc with SMTP id jz9-20020a0562140e6900b00473691de4ccmr4795062qvb.58.1657548295105; Mon, 11 Jul 2022 07:04:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657548295; cv=none; d=google.com; s=arc-20160816; b=zQO/b1eV8YpQePDGdKC50L5FRGbUYeA2F/0s/DStgD7v411Foy0pCA65MIKZDHV7+N jaPYK17pDf9Hn3V4N+zJ56m3fRyOBSVyHok7lAE5o2u8r0zUbPf699CEBO2zcAtI62T8 f1b92yVg3Z1tAW/nM6CDFODinkzp/+55TGa4abAwkSbykGJysKT7XlTaqebKgdLXTyS+ Ip4h8iEv1gx3/V+fXEhZEfYY1u8B9rFBGtjii6wWorGfiNFZeKfBGQaquTKvLNbyvFAt szu+eLu7zJg3fM708857D3V5Re0DrCvOuqkd8vwlvp2J+wERELdGBNQZnmKR6V2bUR4a L4Fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=fI18+z5edTaeRfrH4Mp6ek59dUDomNqM3YPKq/pXVYg=; b=B/rxQMqIqKQB5rm9sfppY6NyPstTSTimBX/idx/CWCd9+l13+l4tUP/IXNINc7BxaZ 4N6CYpX4AFROh0sKc//GpPUjTx8GJ0bnBcXHlhDC1jkbm+bHpH9hIDRcph8TL+DtjGTJ oLaUD1ZT4dQx3dVk3O4ymQOTMAxTqb2j4GGLf7VdOQddMRIiQ1tEFqOqodeR3rOyRiXd yENPclJGkxXfTVoAcN14Zr1xI77wHx8qPsExDePLpU+lR0pEilqUYl/BkFL/QZTzRMxf PIgnAz8AE/N33x1Z4U3cEq9eE6JPnefHC8jmTDggkcB9Hwv8mIRGJ58Z3SW4CVyOkNqz othQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=N7nKfoda; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id s9-20020a05620a0bc900b006af33deed49si4909369qki.38.2022.07.11.07.04.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Jul 2022 07:04:55 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=N7nKfoda; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:48686 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oAu1u-0004Ip-Je for patch@linaro.org; Mon, 11 Jul 2022 10:04:54 -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 ) 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 ) 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 ; 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=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-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) 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 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jul 2022 06:57:55 -0700 (PDT) From: Peter Maydell 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 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson 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 Signed-off-by: Richard Henderson Message-id: 20220708151540.18136-5-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- 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__); } +#define TRANS_FEAT_NONSTREAMING(NAME, FEAT, FUNC, ...) \ + static bool trans_##NAME(DisasContext *s, arg_##NAME *a) \ + { \ + s->is_nonstreaming = 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-- ---- ---- # FJCVTZS # --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 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, gen_helper_gvec_3 *fn) return gen_gvec_ool_zzz(s, fn, a->rd, a->rn, a->rm, a->imm); } -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_p32) +TRANS_FEAT_NONSTREAMING(ADR_p64, aa64_sve, do_adr, a, gen_helper_sve_adr_p64) +TRANS_FEAT_NONSTREAMING(ADR_s32, aa64_sve, do_adr, a, gen_helper_sve_adr_s32) +TRANS_FEAT_NONSTREAMING(ADR_u32, aa64_sve, do_adr, a, gen_helper_sve_adr_u32) /* *** SVE Integer Misc - Unpredicated Group From patchwork Mon Jul 11 13:57:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 589346 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:bb16:0:0:0:0 with SMTP id jd22csp3270164mab; Mon, 11 Jul 2022 06:59:51 -0700 (PDT) X-Google-Smtp-Source: AGRyM1u/DK1A3l0wd5waqhThsjdNI4x2zAZr46pQ5ZBgqxRPhFhuc9J3TfVldjz0x3uyGSFkvknJ X-Received: by 2002:a05:622a:114:b0:31d:2388:4df4 with SMTP id u20-20020a05622a011400b0031d23884df4mr13786927qtw.488.1657547991589; Mon, 11 Jul 2022 06:59:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657547991; cv=none; d=google.com; s=arc-20160816; b=FaIIM1tnh80ec4mmLIJgHxjLPArEjaiRdHfxanX2hQoSAkRnyi3N5e8HnUO6mIIT9I ik+cU+G+tXlo1Adx7gYLnE47b8w0S7LF5GFL3TE9kzW9wFLo5j9QnmGgISWqd7yxnwyr u/Ek7MXRtNSr9NJS86t7dabIOHMTLzs/H0tFdd24f++Aul0eWng/9Js2EK/fLtYsD06G BmWS2/KAcBrq0l9tu/piCieT4yXER7pBwSQIYPVm0pWuS6oZvsonnsCBj5E3lTPME06f 74XaMcFerNx3Xype8WRkH7f9QKW/bpgZX0SFH+8YVb3gmPf+LVroVp7WQo1cpca6/xJD l4Ag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=7NGRjcW6POBMRqlOP/cTnnyIXKw34HJdhD9MVrSH9hs=; b=AabA9CymWa9BpnWZQZ3ad1QpBm19+gg+7VvrRgSSeRliR037bcjT+/HE6Q75T6E5py ILpBLnIRrMXYFSvI8+UqeORLEHcO+c8qXnAS3Zu1KT82JY/AALuWUuGgNwa0kRJY3JpT vZEwnBAfjYLtQutRaZ/hZRiapVeM8/jA+CRGnrs3re+asQ17YG5b5lD3Zuu+JHfdpk14 8BT5cyFsHyiiQbIEJcVkaB+8RymuQeLGE1thTedxtoc3RBHam6px+Ye4ImBBLATTlg2o QA9fFdUPrkHQmUh6brXOuRS57Lgqt22i94/xklkzgHKO1pVFmbvNQjp7OZ7YvZ8HEMR6 YcFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YGfk2a3o; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id gs8-20020a056214226800b00472faebbe5dsi4317512qvb.263.2022.07.11.06.59.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Jul 2022 06:59:51 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YGfk2a3o; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:39896 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oAtx1-0006Ok-3D for patch@linaro.org; Mon, 11 Jul 2022 09:59:51 -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 ) 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 ) 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 ; 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=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-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) 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 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jul 2022 06:57:56 -0700 (PDT) From: Peter Maydell 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 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Mark these as a non-streaming instructions, which should trap if full a64 support is not enabled in streaming mode. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20220708151540.18136-6-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- 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-- ---- ---- # FJCVTZS 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 result) 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) /* Note pat == 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) /* Note pat == 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_RDFFR_p *a) .rd = a->rd, .pg = a->pg, .s = a->s, .rn = FFR_PRED_NUM, .rm = FFR_PRED_NUM, }; + + s->is_nonstreaming = true; return trans_AND_pppp(s, &alt_a); } -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) static bool do_pfirst_pnext(DisasContext *s, arg_rr_esz *a, void (*gen_fn)(TCGv_i32, TCGv_ptr, From patchwork Mon Jul 11 13:57:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 589356 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:bb16:0:0:0:0 with SMTP id jd22csp3280068mab; Mon, 11 Jul 2022 07:08:46 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tGOnt1rMlITV98LqVijcm45DL9Nc7OZvkfVJFycvYfKDA/WBhqVc2gOIq4NPiroyWk7M42 X-Received: by 2002:a37:9f49:0:b0:6b5:6fcf:778 with SMTP id i70-20020a379f49000000b006b56fcf0778mr8128621qke.322.1657548526028; Mon, 11 Jul 2022 07:08:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657548526; cv=none; d=google.com; s=arc-20160816; b=RnYdcvgh9U1va2eg9FdidZDwyVE0uE0Ig92V/9uMN+1IUFhvVAW3p03VbV/SJ0lj4O ZVH25iwoVlxMyj2qGU2amxxCzOvK55FtrRIPKm926CnsiMzhpTqKbCBVjfZQcl5TpjGM Yp6B2stYvoSTwcXNxcCk8MGGVGLTbVNMDyIoAIPfk2Y1GYpgAlophrhJ1++YRzxHDuSj Quu6TibQEroKh7I9p9eY9gvDnUBrOsva0JOpnbJlgFuCk96CzTmUJzly80V9Hx+GbL19 qd0tW+c6oxP04lK970XD0TfHsXIT6fwPOcJiOttcE7MRowIrAYaxgX95rJtLs/YLu+F/ buqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=I1g46N7GyifDhLvrgy885389BGvUDqIbWCLHK1RD3mA=; b=gSiwqVqRi+bNURCc1f4DdQDwODNCPXSs8wAqUCwUeUySsbCgYz+/sdthL9O+TkPEaH y9DiuEqRNEqQ0URibtyDbXI+Dui+0fcXM6JPMJnH9DS6H2Vgm+tBbcstgCtxugK+BKKm +pVzKsAyEcU0kErn1DinqUZMJRzkzbWv2v6H436+Y2fzheO3Y9lzW0y7Ko/pY9BFUQKV 3Og2ad/W8O17vbPDGoMx0DQPpn89mFhBHknKx7xMNHNtFdh4QEE18ryuJj8Y2lDcLUcM MDXQAyreZAhb2v6MkZ79olHYGRdqmldkLmKGhAkR4HPBZBsXUs5I9a7V9eEUZ7cvn53r 56gQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=N23zhAuy; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id cn15-20020a05622a248f00b0031ebaaf876fsi297309qtb.711.2022.07.11.07.08.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Jul 2022 07:08:46 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=N23zhAuy; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:59632 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oAu5d-0003Lx-HN for patch@linaro.org; Mon, 11 Jul 2022 10:08:45 -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 ) 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 ) 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 ; 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=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-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) 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 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jul 2022 06:57:57 -0700 (PDT) From: Peter Maydell 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 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Mark these as a non-streaming instructions, which should trap if full a64 support is not enabled in streaming mode. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20220708151540.18136-7-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- 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-- ---- ---- # FJCVTZS # --11 1100 --1- ---- ---- ---- ---- --10 # Load/store FP register (register offset) # --11 1101 ---- ---- ---- ---- ---- ---- # Load/store FP register (scaled imm) -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 result) 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] = { 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) static gen_helper_gvec_3 * const ftssel_fns[4] = { 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) /* *** SVE Predicate Logical Operations Group @@ -2536,7 +2537,8 @@ TRANS_FEAT(TRN2_q, aa64_sve_f64mm, gen_gvec_ool_arg_zzz, static gen_helper_gvec_3 * const compact_fns[4] = { 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) /* 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] = { 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) static gen_helper_gvec_3 * const bdep_fns[4] = { 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) static gen_helper_gvec_3 * const bgrp_fns[4] = { 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) static gen_helper_gvec_3 * const cadd_fns[4] = { gen_helper_sve2_cadd_b, gen_helper_sve2_cadd_h, From patchwork Mon Jul 11 13:57:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 589357 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:bb16:0:0:0:0 with SMTP id jd22csp3280833mab; Mon, 11 Jul 2022 07:09:33 -0700 (PDT) X-Google-Smtp-Source: AGRyM1udjf4a8hOE7/32pd/WhIN0tuZ9ppXp4wHb+ywd5u0c6R3VwYkgE5SRKcU5UBy1XI71OM6a X-Received: by 2002:a05:620a:270e:b0:6b4:8425:d03c with SMTP id b14-20020a05620a270e00b006b48425d03cmr11602945qkp.732.1657548573119; Mon, 11 Jul 2022 07:09:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657548573; cv=none; d=google.com; s=arc-20160816; b=xsvYAi7OIdVo+kxoXRxy3jUBGBd4vuEHRrd1FduzefQh9AiBbydzwOuDhcsI+2au4f W98nNikcmxUXzrzWp7cLHjcmQBfsfsMdNZWWcXwTPO+fTWkM9JkkLe2ZpnRBVZeaQ1XJ 8VnQZE491YVIhNQAwEPt7xUFhw1Ny28B6bNAmRUdaPPexJexARHYWbEDpY8dom3mzpot AjWQW5aKHPTqhSioD249ly+5yjRX38N8gMadpu4uBcAdg51ra6hCROE+VSy/62itW+lD MopA0XTzypgvSJm09X4IIlJ6UOz7OUoBI3W0e0GIMw/DxTZNLFbNtUQpyBzFrXP21SlP TAqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=b/+WDKk3Mk2Y2JF1uylZFAgYZTRJ5lUsqHT3ajN06B8=; b=Kzg++R1upn9W/TRVxXLP9uTvocmARJl8q4GQxyWPh8NXd7d2Kil7WFZlw7li9Q9x7Z RQWtbuU5Z3asnw9/MeXVZMlKbLWLVtQL+UzUdxKChGy61YTH4TJMI6n4lqoveV8VuvvX AeRelzPjuCp2bamGWJDnfRSP76/HzrNoCWvyAoTabLgaB3ix/UPyh5IDTaC6klQ7FNLV JYTYBao0i+Uy8WitlvakNNTc6ZtvhKD3Ar6XjkjHQuYn4ETaL7mnIHZvRwZc/iOxNCgj h+x9TB9VKSCiDjffaGtMyIlByb2oGbVEIJZAs7LiESSVlWJLW0SnwA+3a3/LO8G3AXgi nE/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fonUMEhq; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id eq11-20020ad4596b000000b0047299fce31bsi3753483qvb.495.2022.07.11.07.09.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Jul 2022 07:09:33 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fonUMEhq; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:33440 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oAu6O-0004jN-LU for patch@linaro.org; Mon, 11 Jul 2022 10:09:32 -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 ) 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 ) 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 ; 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=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-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) 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 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jul 2022 06:57:57 -0700 (PDT) From: Peter Maydell 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 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Mark these as a non-streaming instructions, which should trap if full a64 support is not enabled in streaming mode. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20220708151540.18136-8-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- 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-- ---- ---- # FJCVTZS # --11 1100 --1- ---- ---- ---- ---- --10 # Load/store FP register (register offset) # --11 1101 ---- ---- ---- ---- ---- ---- # Load/store FP register (scaled imm) -FAIL 0100 0101 000- ---- 0110 1--- ---- ---- # PMULLB, PMULLT (128b result) -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 == 0 - ? !dc_isar_feature(aa64_sve2_pmull128, s) - : !dc_isar_feature(aa64_sve, s)) { + + if (a->esz == 0) { + if (!dc_isar_feature(aa64_sve2_pmull128, s)) { + return false; + } + s->is_nonstreaming = 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) */ -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) static gen_helper_gvec_4 * const sqdmlal_zzzw_fns[] = { NULL, gen_helper_sve2_sqdmlal_zzzw_h, @@ -7301,8 +7307,8 @@ TRANS_FEAT(BFDOT_zzzz, aa64_sve_bf16, gen_gvec_ool_arg_zzzz, TRANS_FEAT(BFDOT_zzxz, aa64_sve_bf16, gen_gvec_ool_arg_zzxz, gen_helper_gvec_bfdot_idx, a) -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) static bool do_BFMLAL_zzzw(DisasContext *s, arg_rrrr_esz *a, bool sel) { From patchwork Mon Jul 11 13:57:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 589360 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:bb16:0:0:0:0 with SMTP id jd22csp3286106mab; Mon, 11 Jul 2022 07:14:31 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vpL4t4c61T0OoiHoSzRi7Jz43wQTNKfvrZPLDbpEmH7zpYFAPJdlbp0tV/p4NU3SnI1uD9 X-Received: by 2002:ac8:5bc8:0:b0:31e:b643:e96c with SMTP id b8-20020ac85bc8000000b0031eb643e96cmr3087053qtb.671.1657548871343; Mon, 11 Jul 2022 07:14:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657548871; cv=none; d=google.com; s=arc-20160816; b=H/7crtqC8nZpvkvCB/cf2cCLUl9dbD7aSXEjtYt82Zeqbs7fGRVJ+F+eSj2OtJ6/Uk qDP+l+/2YVd3wxGk9OGUcuoSV2eXUtZT06o8vRd0TmVpkQubSTGPIYAMJ8OIHvFR22cG vkJGwwIbc3iM/hHUl9hX+y7cpL7Ltm0BzZlKsEfnTLTISlNEQzKbFXYXxVF4tijTWkSj ZOqE9bjGwOqOT68qnWVFYVDdJ6LSMcSi9P6hwvBz+2c4l8A75E4nCcOQmZQWdYEEhHNx GtE+RVD2vOTTtCpTSTNHeBAYU97BElZdOnoeKec2oOtYAZqQr81TDPCikiLaV7fXSsjt i/bg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=GiZFVh2F4B2LmzFGkdkJQAwP+jfXxKtCxSQAc8iRXro=; b=VVkEtSmjvSdZ+tiIfaOOhITJf0XrgOfvmqARF6OhYlytiUFk9YQu+NngTJf1Z911YP 0aaSZI4T0ilVUR95vqO0K1TGJgapQLfF2jdeSrvbfiqY0vun1aaI2yZzkG1RubVKWTGS Mk12Ii7FCYN4SfnQ4Sc+2fP/1xCLEwNee7nSTqMVmT7O3Uz5vWgqfxpXjWKKxSKGlcP+ 6+BfsAzu9aQVUSmoE040xiJ/P6c1MGon7KlN9H1XLnz03IQpXBnikOH93WBTseCxpCxD yizUlmwCOAkN1QD0SyODqJHPoyUtT784yZR3TSxr7WZX7/KJ57GctDPXbwbYlG/k8dt1 iZUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=j30pUtSP; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id c6-20020a056214224600b00472ff4ff136si5067489qvc.409.2022.07.11.07.14.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Jul 2022 07:14:31 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=j30pUtSP; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:41908 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oAuBC-0002Fu-PN for patch@linaro.org; Mon, 11 Jul 2022 10:14:30 -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 ) 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 ) 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 ; 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=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-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) 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 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jul 2022 06:57:58 -0700 (PDT) From: Peter Maydell 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 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Mark these as a non-streaming instructions, which should trap if full a64 support is not enabled in streaming mode. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20220708151540.18136-9-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- 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-- ---- ---- # FJCVTZS # --11 1100 --1- ---- ---- ---- ---- --10 # Load/store FP register (register offset) # --11 1101 ---- ---- ---- ---- ---- ---- # Load/store FP register (scaled imm) -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/crypto 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] = { 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 == 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 == MO_16 ? FPST_FPCR_F16 : FPST_FPCR) /* *** SVE Floating Point Accumulating Reduction Group @@ -3886,6 +3886,7 @@ static bool trans_FADDA(DisasContext *s, arg_rprr_esz *a) if (a->esz == 0 || !dc_isar_feature(aa64_sve, s)) { return false; } + s->is_nonstreaming = true; if (!sve_access_check(s)) { return true; } @@ -3923,12 +3924,18 @@ static bool trans_FADDA(DisasContext *s, arg_rprr_esz *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) #undef DO_FP3 +static gen_helper_gvec_3_ptr * const ftsmul_fns[4] = { + 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 */ From patchwork Mon Jul 11 13:57:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 589354 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:bb16:0:0:0:0 with SMTP id jd22csp3278816mab; Mon, 11 Jul 2022 07:07:39 -0700 (PDT) X-Google-Smtp-Source: AGRyM1utfGLBocPdhTYdx/gnrZxenbxw4tgXqUM+DzwJ5sczz2MVP7U4iT0Os4LTwLghqSf/aH7A X-Received: by 2002:a37:9c96:0:b0:6b5:6a43:a32f with SMTP id f144-20020a379c96000000b006b56a43a32fmr9922673qke.774.1657548458873; Mon, 11 Jul 2022 07:07:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657548458; cv=none; d=google.com; s=arc-20160816; b=oHwg8T3ZKRizb/theMES0oLIE6QdFBoNG5FEknZ1ho9gOafNjjExD4U6vKGab55t2V nocqQYYr6G5N+kwCDa0SogBY+5Qf/lhnESgi+vIzmEtuaEMIBCRQttkcrzrO2YSRoV4+ IJj1RVxcMjnMnh1PGxyp8wSOQBryDgNaUCxycOQiQ554fmk3kXnlseRi5XAS36x1Zi+J D0NLH1VQ1O2vZeemMvn585QS8cCPFjXWEByfizmb8zaDLaISLFzAfj/boR8wzdm836kd irN/oQZJ4srdB2EVRt8us3p7ov1TsBbeo2oPycQ9dBew83gzuqUI3YjE51ww1CBcRxBe iScA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=Ou0toLpgNQdjfsKkvJnes6zuCeqVFu/r7dnmnsOjFiA=; b=0HCNAfQm1uKYrwIBpqylBvv9KYA/O8up9lNeRyoAuPpadq3Cfq5MlWOtUxqb0FEFuy 81EDw1kP478Ro/IykPPWJI7kIg+D1dSJUjFwSvv4h7y7RH4i84M4JiNOhqpp+NyfTFKd tI7qf772Lv6qsWmwNEkVodw6YGimzVDpnT5Oc/4moxLXTs2Ious/5VoykXI8+tqztucB Z36JVH8VAXUc3kxL8Bl+L0KTlrIycLHsIDr9jmZ5hcQvSSfiOnUP+g0JlbWiSmBmHZGZ nMwMQA2jdFdKPXmaO9AI++fIV/ON6ZbBaesDYhXMMSX2ZfV4i/XmBstecTVb+/pvibLd KqdA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pR0AFYny; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id q13-20020ac8410d000000b0031d3b3d37d7si4579101qtl.776.2022.07.11.07.07.38 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Jul 2022 07:07:38 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pR0AFYny; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:57330 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oAu4Y-0001oU-9M for patch@linaro.org; Mon, 11 Jul 2022 10:07:38 -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 ) 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 ) 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 ; 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=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-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) 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 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jul 2022 06:57:59 -0700 (PDT) From: Peter Maydell 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 Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=peter.maydell@linaro.org; helo=mail-wm1-x334.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Mark these as a non-streaming instructions, which should trap if full a64 support is not enabled in streaming mode. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20220708151540.18136-10-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- 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-- ---- ---- # FJCVTZS # --11 1100 --1- ---- ---- ---- ---- --10 # Load/store FP register (register offset) # --11 1101 ---- ---- ---- ---- ---- ---- # Load/store FP register (scaled imm) -FAIL 0100 0101 --0- ---- 1001 10-- ---- ---- # SMMLA, UMMLA, USMMLA FAIL 0100 0101 --1- ---- 1--- ---- ---- ---- # SVE2 string/histo/crypto instructions FAIL 1000 010- -00- ---- 10-- ---- ---- ---- # SVE2 32-bit gather NT load (vector+scalar) FAIL 1000 010- -00- ---- 111- ---- ---- ---- # SVE 32-bit gather prefetch (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) -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) TRANS_FEAT(BFDOT_zzzz, aa64_sve_bf16, gen_gvec_ool_arg_zzzz, gen_helper_gvec_bfdot, a, 0) From patchwork Mon Jul 11 13:57:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 589352 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:bb16:0:0:0:0 with SMTP id jd22csp3275944mab; Mon, 11 Jul 2022 07:04:59 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uouIg4fPwN/JbY840W1pTQkIGrMb1BE8MwAlM7g4RwzMr5zDWPYNqtXuA3XuPKzqBxGgUu X-Received: by 2002:a05:6214:da5:b0:472:f95e:3efa with SMTP id h5-20020a0562140da500b00472f95e3efamr13302829qvh.91.1657548299289; Mon, 11 Jul 2022 07:04:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657548299; cv=none; d=google.com; s=arc-20160816; b=lpLLBQMLkdJzFwrFQawgpuvgNCdE8g9CWqUa9KusMdHiSv6Pyc4ADjg9A0biy/H16T PAHpfIj7BdgNOA7bz2SUKwYQ5fUw+8W327JZ5tS2wH9cvwjFfQQUCuJjQ/FfE5dx+Auh J86wjLINorwZa5usvj1i7cnVPyjKD/o7apHoLV1Co9kkdJ4GIxf7vfFHtK/EbGILY41e bY5uTR+tACChGWifHAR4Vlgtsh90AQlVulyO7hd3w7lypcXwYp3qw2hHVCIxQHFV2T6D 0iFz6vemYlghuijI00B4B7tmFawy0+sJXyIqcm/DQuXKyhBALhQozrLfX/xSKJ89dUIj 3VLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=G70vVW74+p3/r9FWSpVODhv2PfvwQ8MRxKmUWAG1PNU=; b=hO1q+Tyd148aWDJbZ6qqoB4vaZo9mg51QaCAdiAIqN+tX/RWOnSgEoK/zqXLSX9B5e qZhAUvztas+VOmDMECWCLvlBRpzVVDyk7vwP1Fwk9rg5Vy8yEj9zgOe/oY91qM6PJ+vF nbJUTTB/o2XF4GTHMATEEEGL9Z4npd62/4mZotL7Nh4kpG7Nf0pN0Ytp8tXZdgT49h0p cxKYa462g1dUA32fOsNI8kb5yQ7njbIokLS9pYlk9/UAF9BFjmT3HsJDfz8N3zWzzQNb D21Z9KWPffx3U9WOMeemVOZpvb5IL/evOewpIS91IKdNKJcHRiKhH/83sb5HycqyMkau CjtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kAI2Rjy2; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id cn10-20020a05622a248a00b003188bd8a8c8si4091938qtb.629.2022.07.11.07.04.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Jul 2022 07:04:59 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kAI2Rjy2; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:48924 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oAu1y-0004Td-MU for patch@linaro.org; Mon, 11 Jul 2022 10:04:58 -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 ) 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 ) 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 ; 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=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-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) 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 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jul 2022 06:58:00 -0700 (PDT) From: Peter Maydell 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 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Mark these as non-streaming instructions, which should trap if full a64 support is not enabled in streaming mode. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20220708151540.18136-11-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- 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-- ---- ---- # FJCVTZS # --11 1100 --1- ---- ---- ---- ---- --10 # Load/store FP register (register offset) # --11 1101 ---- ---- ---- ---- ---- ---- # Load/store FP register (scaled imm) -FAIL 0100 0101 --1- ---- 1--- ---- ---- ---- # SVE2 string/histo/crypto instructions FAIL 1000 010- -00- ---- 10-- ---- ---- ---- # SVE2 32-bit gather NT load (vector+scalar) FAIL 1000 010- -00- ---- 111- ---- ---- ---- # SVE 32-bit gather prefetch (vector+imm) FAIL 1000 0100 0-1- ---- 0--- ---- ---- ---- # SVE 32-bit gather prefetch (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] = { 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->esz]) static gen_helper_gvec_flags_4 * const nmatch_fns[4] = { gen_helper_sve2_nmatch_ppzz_b, gen_helper_sve2_nmatch_ppzz_h, NULL, NULL }; -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]) static gen_helper_gvec_4 * const histcnt_fns[4] = { 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) -TRANS_FEAT(HISTSEG, aa64_sve2, gen_gvec_ool_arg_zzz, - a->esz == 0 ? gen_helper_sve2_histseg : NULL, a, 0) +TRANS_FEAT_NONSTREAMING(HISTSEG, aa64_sve2, gen_gvec_ool_arg_zzz, + a->esz == 0 ? gen_helper_sve2_histseg : NULL, a, 0) 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 == 2 ? gen_helper_gvec_usdot_b : NULL, a, 0) -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) -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) -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) -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) TRANS_FEAT(FCVTNT_sh, aa64_sve2, gen_gvec_fpst_arg_zpz, gen_helper_sve2_fcvtnt_sh, a, 0, FPST_FPCR) From patchwork Mon Jul 11 13:57:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 589368 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:bb16:0:0:0:0 with SMTP id jd22csp3295143mab; Mon, 11 Jul 2022 07:24:15 -0700 (PDT) X-Google-Smtp-Source: AGRyM1u8NIrY1O0eiQ5eus+a8RHHrPnw4Gm2FFCrmI4hWC7245/Q3XDIcy7QILcwPuT2FoLtgWrC X-Received: by 2002:a05:6214:762:b0:473:7fa0:61eb with SMTP id f2-20020a056214076200b004737fa061ebmr580168qvz.100.1657549455673; Mon, 11 Jul 2022 07:24:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657549455; cv=none; d=google.com; s=arc-20160816; b=QmQi5QMI16Sjm5TTlxBW7bCUTY4f9WchL4hHy8iqIuQ2KyZhrhLJ3s6/7uHjYCwxdf V4bMrrXfEPTh0DqwFQXwdK7OxmVCkc/A9KH1bDGGbe2XcgY8aeWzAL3rMpKlt7h7g+H9 VRb3UGS3eugUKAsTJUZ05msMdPgyD/tpTnnGbEPh6EMa3dGYUDJw74mkZskz2rR8hYph 9Lv0SfAX+jGp75bk6y/IQZzTphii4lOJcLgn1EwNGMyMpTpw2IYXFJYN8801cWLPsYx7 61+VUCbDDwfZ7tJmHunWQ5o4IDSv2sQkoE1XFaRr7vLaePFgcQcVn09DmVytfKT3QRPV jATA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=uTMMqjDRKpIHGPC7OkIB/YQ8tJedyxE3xlM4z9DBACI=; b=FS+EFN3SzgULjcV/Ilgji9/df8dTpruM1MqLtY9L1g5+8cJcbfrf1SR/wlgxT67cR/ kJWbU/yg8/9q9oYgfitl8m0YAAqrSuHWwqQTCtPUnnzR13sayjswiz4ilQQ5RPywX1mh W7n9NpW8St4B3jWjksdvJauEsMyKUK611Bz48ddgdaUNyLhpibtYPS36vP/ZxToiRE0w cQHzcbVzik0i4AKf6L7MyCndMjX0yRycEJT+MABRy4P3WFX04V3LlDeX6H/4oj03vetO T5JcALGX/NeakPE5Tt3bOpM/b+d++zBHt7y5oWWMdwDA7XHowJ90C71obUOZUQR3PqTm og1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Aks/FESq"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id b10-20020ac85bca000000b003050059df54si4867172qtb.771.2022.07.11.07.24.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Jul 2022 07:24:15 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Aks/FESq"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:57906 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oAuKd-0005Pm-48 for patch@linaro.org; Mon, 11 Jul 2022 10:24:15 -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 ) 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 ) 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 ; 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=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-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) 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 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jul 2022 06:58:01 -0700 (PDT) From: Peter Maydell 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 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Mark these as a non-streaming instructions, which should trap if full a64 support is not enabled in streaming mode. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20220708151540.18136-12-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- 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-- ---- ---- # FJCVTZS # --11 1100 --1- ---- ---- ---- ---- --10 # Load/store FP register (register offset) # --11 1101 ---- ---- ---- ---- ---- ---- # Load/store FP register (scaled imm) -FAIL 1000 010- -00- ---- 10-- ---- ---- ---- # SVE2 32-bit gather NT load (vector+scalar) FAIL 1000 010- -00- ---- 111- ---- ---- ---- # SVE 32-bit gather prefetch (vector+imm) FAIL 1000 0100 0-1- ---- 0--- ---- ---- ---- # SVE 32-bit gather prefetch (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 32 bytes (scalar+scalar) FAIL 1010 010- -010 ---- 001- ---- ---- ---- # SVE load & replicate 32 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 (scalar+32-bit vector) -FAIL 1110 010- ---- ---- 101- ---- ---- ---- # SVE scatter store (misc) 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_zprz *a) if (!dc_isar_feature(aa64_sve, s)) { return false; } + s->is_nonstreaming = true; if (!sve_access_check(s)) { return true; } @@ -5700,6 +5701,7 @@ static bool trans_LD1_zpiz(DisasContext *s, arg_LD1_zpiz *a) if (!dc_isar_feature(aa64_sve, s)) { return false; } + s->is_nonstreaming = 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 = true; if (!sve_access_check(s)) { return true; } @@ -5857,6 +5860,7 @@ static bool trans_ST1_zprz(DisasContext *s, arg_ST1_zprz *a) if (!dc_isar_feature(aa64_sve, s)) { return false; } + s->is_nonstreaming = true; if (!sve_access_check(s)) { return true; } @@ -5887,6 +5891,7 @@ static bool trans_ST1_zpiz(DisasContext *s, arg_ST1_zpiz *a) if (!dc_isar_feature(aa64_sve, s)) { return false; } + s->is_nonstreaming = 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 = true; if (!sve_access_check(s)) { return true; } From patchwork Mon Jul 11 13:57:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 589375 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:bb16:0:0:0:0 with SMTP id jd22csp3305907mab; Mon, 11 Jul 2022 07:37:24 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sWAU7eHJ3W1guP/2S/6cblAHpXUnJqcEeiCYKNDfTUZoc430xnmm3Abny1I7JtT33L66Ec X-Received: by 2002:a05:620a:2b49:b0:6b5:87c7:ecd3 with SMTP id dp9-20020a05620a2b4900b006b587c7ecd3mr3510150qkb.100.1657550244612; Mon, 11 Jul 2022 07:37:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657550244; cv=none; d=google.com; s=arc-20160816; b=tlxj0kt2oirh0lAuK5SOFyICSnJKFxXK8eySpv7uCi1RYdspAKJkQBRCoHG8cPXmek hvUCRkrP4TA6rIxppWxbY1BiajuSul2rsJRM20YNj+KPmceUvcn82VGAp+zEuosojb9U /tVSS8cr4GN8EV3PzzrNVeSdaQ8oxh2cscaXe0z4l9z45FLmPgYBBt7qmoZ/VZx5qYZa 5riFDmV2S8ctBaJWc5JL9mbzmkK/v7VmKcDKcAzWnrE1PcNhEZUESM63+RhQY4QfDCNP fLXyrW7f7gOW8xQRvBIb6/z6jSsf+9owPt/VUWeEFVAWHr7lqJzu/fwIGacxtFGxCoqE QWeA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=9H4vayvC6P8HyxpZR8DvsdsTXJo88+HbItchv84O0iE=; b=l1JYmBomnM+VId7KMbLz9Rfm1CXx4n2YGElqfzjjwaR5lkkdv3Hv6BkE9coC8sRmpa Mtx1FdZ0ObPPbQ5uShHajuW/Nsh2IJxIfokK6DuKfd8ClVmd4te3SiO/VXYjtaaRQ6RF R2pIAbWe2711z0e2aOd7iAdSQrQ9vjeB7VTEN3oFeVpskw9ZifRbmycI7SXCAJZqBxlR ooF26u5pJ5AFzBaLtF/WwuKrKnVbxqu8e1Vh2vQxlPRg0/du3NjF2MsQjORDnJFKAurc e6NC7QpGFAs1RNexZXAcXMerbpwvLxivzgLsCksWZXSdvwy9k4AHgE4ugEbjdXWRET3U IYUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QmhX5Ai7; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id de10-20020a05620a370a00b006af25ed312esi381316qkb.483.2022.07.11.07.37.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Jul 2022 07:37:24 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QmhX5Ai7; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:46496 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oAuXM-0002EU-4G for patch@linaro.org; Mon, 11 Jul 2022 10:37:24 -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 ) 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 ) 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 ; 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=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-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) 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 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jul 2022 06:58:01 -0700 (PDT) From: Peter Maydell 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 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson 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 Signed-off-by: Richard Henderson Message-id: 20220708151540.18136-13-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- 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-- ---- ---- # FJCVTZS # --11 1100 --1- ---- ---- ---- ---- --10 # Load/store FP register (register offset) # --11 1101 ---- ---- ---- ---- ---- ---- # Load/store FP register (scaled imm) -FAIL 1000 010- -00- ---- 111- ---- ---- ---- # SVE 32-bit gather prefetch (vector+imm) -FAIL 1000 0100 0-1- ---- 0--- ---- ---- ---- # SVE 32-bit gather prefetch (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 32 bytes (scalar+scalar) FAIL 1010 010- -010 ---- 001- ---- ---- ---- # SVE load & replicate 32 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=0 # SVE 32-bit gather prefetch (scalar plus 32-bit scaled offsets) -PRF 1000010 00 -1 ----- 0-- --- ----- 0 ---- +PRF_ns 1000010 00 -1 ----- 0-- --- ----- 0 ---- # SVE 32-bit gather prefetch (vector plus immediate) -PRF 1000010 -- 00 ----- 111 --- ----- 0 ---- +PRF_ns 1000010 -- 00 ----- 111 --- ----- 0 ---- # 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=3 # SVE 64-bit gather prefetch (scalar plus 64-bit scaled offsets) -PRF 1100010 00 11 ----- 1-- --- ----- 0 ---- +PRF_ns 1100010 00 11 ----- 1-- --- ----- 0 ---- # 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 ---- # SVE 64-bit gather prefetch (vector plus immediate) -PRF 1100010 -- 00 ----- 111 --- ----- 0 ---- +PRF_ns 1100010 -- 00 ----- 111 --- ----- 0 ---- ### SVE Memory Store Group 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; } +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 = true; + (void)sve_access_check(s); + return true; +} + /* * Move Prefix * From patchwork Mon Jul 11 13:57:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 589381 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:bb16:0:0:0:0 with SMTP id jd22csp3311960mab; Mon, 11 Jul 2022 07:45:30 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vyf9SUfHeFfczXLyWWarPUOaEi7QsnWVNeWXhdqOeCvoOEDQ1sybkBMBPIsPyqgwj7ENfM X-Received: by 2002:ac8:7e8b:0:b0:31b:c86b:ec0a with SMTP id w11-20020ac87e8b000000b0031bc86bec0amr14051083qtj.503.1657550729908; Mon, 11 Jul 2022 07:45:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657550729; cv=none; d=google.com; s=arc-20160816; b=P/K2tYBgw/yIcpGaZUR/3g5B2kev+cMAYt6wOBOo3Cb2cC9HRB7cz085xEDLGQNzsd BgP716xF03616ZU+8+FWh1n7xDuuSLN5XnWnq0C24HYwCjec7VDifGmLCUio4C+iOJL8 /bqWU93q1piKekpnswhFROA7Ozyf3xmlafm9BaQQCS+R4nm1r95MXdgBNT1yrxwnHonM JpjhsSfcjjGFzey0/VGDlq1HdzCKH8/JBIPWoA69nXIJrtiwc17O4t2+BuQwWLZWK1rh kCiHpF5ulRd5MAvoeOm2URrT1Q74UCD6sRu+OhTRCLifNRsc8wza895Ed7psEpZUdVKI k5Iw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=3Y3RKAb9EKRHz85QQ1SBe15QE606OXLqE7AmpOCzWmo=; b=B7z3XvbiG7JVq/t1IpsINDQWrM5d9ek+hEDQgAwikltBHCArpD8lskW4Qe3mhLmjBI PciGZarp6plFetisexcDWkYUefVWhbVZV3qH+VvVa44fizC7hA6jSlmfizRIG+R5/LmK c8Dw6UR43vrvVayGnrh5oA9JSaOX8t9k4xKTfzGNq4HcCtf170nPE1mi9y/DkhRp9SNK s5CUA/IbmQPh0MNHwOOaCSokKoafJrZR/QB3NvCIKCARnbt6NJhrgrntgcjuStSDsDFV nbXOqcBxklK+pJGNt5oiC9yaZE5a/TvRxdnpW/8H4nFtGQTQCatjWzCa6SmAEeyjVSsU DIuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ojPJK69p; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id x19-20020a05620a099300b006b5920c4a23si635362qkx.743.2022.07.11.07.45.29 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Jul 2022 07:45:29 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ojPJK69p; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:35498 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oAufB-00068G-DX for patch@linaro.org; Mon, 11 Jul 2022 10:45:29 -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 ) 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 ) 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 ; 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=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-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) 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 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jul 2022 06:58:02 -0700 (PDT) From: Peter Maydell 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 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Mark these as a non-streaming instructions, which should trap if full a64 support is not enabled in streaming mode. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20220708151540.18136-14-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- 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-- ---- ---- # FJCVTZS # --11 1100 --1- ---- ---- ---- ---- --10 # Load/store FP register (register offset) # --11 1101 ---- ---- ---- ---- ---- ---- # Load/store FP register (scaled imm) -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 32 bytes (scalar+scalar) FAIL 1010 010- -010 ---- 001- ---- ---- ---- # SVE load & replicate 32 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_rprr_load *a) if (!dc_isar_feature(aa64_sve, s)) { return false; } + s->is_nonstreaming = true; if (sve_access_check(s)) { TCGv_i64 addr = 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_rpri_load *a) if (!dc_isar_feature(aa64_sve, s)) { return false; } + s->is_nonstreaming = true; if (sve_access_check(s)) { int vsz = vec_full_reg_size(s); int elements = vsz >> dtype_esz[a->dtype]; From patchwork Mon Jul 11 13:57:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 589378 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:bb16:0:0:0:0 with SMTP id jd22csp3309351mab; Mon, 11 Jul 2022 07:41:57 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sBf26wrOpVUwL8tRlGWkTlWhzYQLi0lC8P857/gUs0F66ZHjwEtJmCralJzpxD5SA0A2zs X-Received: by 2002:a05:620a:4397:b0:6b5:5b8c:d48e with SMTP id a23-20020a05620a439700b006b55b8cd48emr11706169qkp.734.1657550516883; Mon, 11 Jul 2022 07:41:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657550516; cv=none; d=google.com; s=arc-20160816; b=ug9uBy/GwLsQEEXW4HpvpeZ1DuPedvHZXeF/ngwCnxjMElGZpTriBuBBktRD0YaONm v//R+YZtf1r+Fr+TfIlzQ7WW68sfD928JWAPe04uMAcz7U7nAEcZL4NgezPWr52Ky3Fm OK3sYWiA8XAm8Nx8PYhBTaMDg749Kc3PGEIS9EvH531QfdD5MxvDfFFMuTMokRsmnlie 1LwwnA/WNt6lPZagcA1E0qZJzzJ4CSP31CU2PMd3Z88Y7NxtRcGszuhOcWvQhA9nFVTj Hx2VwW9pLOZ0rGgR8/XfsciSPo9C8K2O2kLkVJe6Dm4lEd69KT/5ZzmTojfuRU2PFqlP lI/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=/RhdQJhnWDHCgh0k4clVqzvRti9Nt0LbFx159lSbzvk=; b=rnz9oW9fRFmx8wFRSunC6Fwt/cYF9Tdf7+PwxQOrHI44aFtmVhyWP2nJhgQMO5tAIZ cVNJ+WD02OMG6yI0KTRzA95uZOmpmbFCOgq+SaUgDlz4uv39QqTdY2EwPvuJwYEcJ5Zc qkZNb0n8OEIzGr3rwUwEgi1Lreg2OEyGBMwQhD311sarZBgzrnyTlfGbFMawiCJ+AFwX WfZgWfjnRdCKnuBZqFsxM3q7ll4pmN5sM9AMxyJcoo5XV7gJaANBSbISm7l1zAabq8RV RYHdBTjmNZqfRJzoOt4yuk9y7KEBfLy/mEpPrLGZNFSG1DE7iX9/EZK6PBmxAseVPIcL NPwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VJjAg4wx; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id f9-20020a0562141d2900b00473247812ddsi4488347qvd.19.2022.07.11.07.41.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Jul 2022 07:41:56 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=VJjAg4wx; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:54888 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oAubk-0008O1-2z for patch@linaro.org; Mon, 11 Jul 2022 10:41:56 -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 ) 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 ) 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 ; 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=/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-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) 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 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jul 2022 06:58:03 -0700 (PDT) From: Peter Maydell 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 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Mark these as a non-streaming instructions, which should trap if full a64 support is not enabled in streaming mode. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20220708151540.18136-15-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- 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-- ---- ---- # FJCVTZS # --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 32 bytes (scalar+scalar) -FAIL 1010 010- -010 ---- 001- ---- ---- ---- # SVE load & replicate 32 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_rprr_load *a) if (a->rm == 31) { return false; } + s->is_nonstreaming = true; if (sve_access_check(s)) { TCGv_i64 addr = 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_rpri_load *a) if (!dc_isar_feature(aa64_sve_f64mm, s)) { return false; } + s->is_nonstreaming = true; if (sve_access_check(s)) { TCGv_i64 addr = new_tmp_a64(s); tcg_gen_addi_i64(addr, cpu_reg_sp(s, a->rn), a->imm * 32); From patchwork Mon Jul 11 13:57:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 589364 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:bb16:0:0:0:0 with SMTP id jd22csp3290972mab; Mon, 11 Jul 2022 07:19:15 -0700 (PDT) X-Google-Smtp-Source: AGRyM1s5asgvDnaL8GKqUw31wx2oCUkDDGUxnCMWbgRsszdFAjR/EYGtLupqaLnCbppOytgEYHS8 X-Received: by 2002:a05:6214:226d:b0:473:339e:3264 with SMTP id gs13-20020a056214226d00b00473339e3264mr13373244qvb.41.1657549154887; Mon, 11 Jul 2022 07:19:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657549154; cv=none; d=google.com; s=arc-20160816; b=usp+rRiiRZL7UrO26zXezrDYwBcK8tgqxOTi0WZdoFczSMzV6adZCa6GhsKofkgkVW vREBAc7CDDkp5eV6RvslIPrKsffLklfHwFsRph+KDoOMb1YkgZm72aRJkERkGtWT5FF2 t35gJjxys/NDinPCM8M3uB+gNV/vSvqudWVEDWOLSj1NwR+5XfjbkmuaDGQLA3p1hN6N eYVaKFtns9KlpyBt/32ByCFz5eFHH8ZygujgrPzZPcnV9RNq+HyJ+Ly/bQjQ2pECwYiV vD1WaJG9g4vmbfC3rBAKwPA4tI50jw2L5ZIyn0H+1vYtvR2me5EOwlHZJOjDINpGcEtp vvRw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=eWXMTGlXUgB42hymanetwXDWMolb+Ga7HqnDSm4JcUg=; b=gX/Rq7sHJm1y+SnxtMtu3zB6XVjXIaoRK9kvlhx5DPFD4O7MqTmEEf0JcVbY8Qxwx+ sno652WpchtHijbuAwWFBWgw7E5gGMlq9q7xz9e6cbmvhAn6ZZSV6DQ9XoHm/KzoYtlD 1+rTmBdaN1pV1SHcFuNNXaCAXdHuwNl4LFDVkHyKv3JydhLYh80SOMpFsR1b17+H+bxh 2tM1vhOdV/spd9tY/lguW9JB/HoWHfu36FufTcOc/h/tj+7XVC8GaJ06rmXf7f3tNRaw G0nDcCJajPj/eHRCntbJbxsYcOY8sLIHrKoS0c+O+K+7VJG0R1ugdw139vcx4eBY35d+ oQ6g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="jiVOr/BL"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id a185-20020a3798c2000000b006b577e42e0csi3111299qke.681.2022.07.11.07.19.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Jul 2022 07:19:14 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="jiVOr/BL"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:49808 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oAuFl-0007ui-UZ for patch@linaro.org; Mon, 11 Jul 2022 10:19:13 -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 ) 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 ) 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 ; 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-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) 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 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jul 2022 06:58:04 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 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 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson These functions will be used to verify that the cpu is in the correct state for a given instruction. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20220708151540.18136-16-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- 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; } +/* 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 = 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 From patchwork Mon Jul 11 13:57:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 589358 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:bb16:0:0:0:0 with SMTP id jd22csp3283877mab; Mon, 11 Jul 2022 07:12:36 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tPlmQ5jOupjczNFqNGy8NMMGW3++qVzSV0dRf8DAL0rUk7+po3i97u8Pd6mXY6GxglFa8c X-Received: by 2002:a05:6214:19ec:b0:473:4e67:d4d4 with SMTP id q12-20020a05621419ec00b004734e67d4d4mr9317734qvc.61.1657548756780; Mon, 11 Jul 2022 07:12:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657548756; cv=none; d=google.com; s=arc-20160816; b=GlQkwqw6eb/bt/OXji23IEyMH0fRahAJQPRFDzDsMtVy4zVteevR675QFhR1TQk7Un qPTxl9MTaCoQyR8ZVpWMKfkxhxdfZzHQWgBHHT4o11YnA90767lietMB7kAlmAZi5fpF y4OqjPitnsfJ7eXleOB6raPQm3B52cucfEgxuE+gQIKRmDC3voRS+9g/bwGv6r2sQsNu 7REYQvWI7lmb+VIxIVUIGNXmTlPunhgiG7wZVN9yZVU06qoh532IqX1adFEaT4vuECjD H2DgVlW2EDHMU13dvfayf1i9qfD6B8H/qqTwKuorb4/WtuA3/9fJMniKxAFQD+FHmne9 KvXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=iUJ2sm4ykqwIgMCGtXLZ1jWMeR/9y75k/xuAaZSsGgw=; b=CLAlJtk+z5QyboSfN+46eiMw/xuz0FTVEG5NJoEhwTgqCHLaNNVoSuvjsd5Ffd0iR2 c586X8garJWaUHckx2VG7RXkvGmLsQbREFWf4KNTAYpjgMuC44QHqq+tnCj49bwSJEbH ObK5vZKJQdfoUAKBZT4vmOCfQQdRYSoUnZxZbPFgYw+MdvW1G4W7ca0VUWA1TCA5GEtr V2cjjlIvfc/zc8GKrA6Bc66jNsHYbZH0lg2Fs4D0xCxLR4KtCEhIg+CQXyCA2nNtjtnP dqIbu6+sH9BsTb50R7N8Ws5sKq21jD1mbjUfrnaj5F3pox63iQULOLS5oD1Ro3z9rnLA +VBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=s2V0A2vi; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id bs7-20020a05620a470700b006b263cd9f07si3904803qkb.735.2022.07.11.07.12.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Jul 2022 07:12:36 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=s2V0A2vi; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:37618 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oAu9M-0007Y3-9w for patch@linaro.org; Mon, 11 Jul 2022 10:12:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:42614) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oAtvS-0006Wf-Oy for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:15 -0400 Received: from mail-wr1-x435.google.com ([2a00:1450:4864:20::435]:46673) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oAtvQ-0002pv-3X for qemu-devel@nongnu.org; Mon, 11 Jul 2022 09:58:13 -0400 Received: by mail-wr1-x435.google.com with SMTP id v16so7099742wrd.13 for ; Mon, 11 Jul 2022 06:58:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=iUJ2sm4ykqwIgMCGtXLZ1jWMeR/9y75k/xuAaZSsGgw=; b=s2V0A2vicMkb/gmZaVb31xl+Of7w/mXz4hTaw3m2QUlvR8MRvAXd6jsr6AbgJGLMg4 rZAuY3NyW29tbBslgza0fSsGt+PxZEkjbBkKiWS+STBS5qBoMgWbWiQfK/ZKlnlTWrNT XOFOI6bhr6TwYdF9gPuFSAAm3jLHBXDplnCwbT8e4Yn0Q8ihvjB+nuaelG33vO6BeDO/ ObcmBt1XbAva9vgO9vzvjIFvnql/a7Qoc+qYbWs6LY2WmrIlXkHvHYA0BQNmpWWosM6Q XW1mXOG/0zHlBWzja1ZJ/v4QFvhrQGmDTFWfXwnKXXVVkUqG6FD17XggywWNGmpqVs2i uaow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=iUJ2sm4ykqwIgMCGtXLZ1jWMeR/9y75k/xuAaZSsGgw=; b=frk9dNgyhKQY3mKil/qKlZ/36OdvXyJ58pVTZg8wR50uO/ZAIjGHOSWw2EHH7TS8vp UyZCk/SrvXNprueNER969Peq1IlkQWKFXwghLZNHUZUkVCvc4SZdumcq4SgGNRubaEhi ZYVqHpQGRDSw/Nocx2A6cZ5dV2BEy5o1PZQclcRZXOUrLM25xPmXYCD/lcJ3orXjYC9G Ul7GKNuxJz+Ubn4cLsMj3lYSzEo4oIiO/M2FKn2Mu1TflLyGIIiYS2rFqsiQdyYheMXd LtMMclTzDjRgvFkXKM3o8Cegw/ll8aia/Gr41aiG+FFptKu6wwMRwfVLWajFLuF/Fnxj tGsA== X-Gm-Message-State: AJIora+lLlrKVRX4OVDVMfOJNXbCUt7ByeDPKvRJ3XUwpbd9Ry2/+gkt q+AN8X9EwDIHDkMWoxROxkhltAz6LplM5g== X-Received: by 2002:a05:6000:15c3:b0:21d:9f8b:2c3e with SMTP id y3-20020a05600015c300b0021d9f8b2c3emr8367710wry.72.1657547885103; Mon, 11 Jul 2022 06:58:05 -0700 (PDT) Received: from orth.archaic.org.uk (orth.archaic.org.uk. [2001:8b0:1d0::2]) by smtp.gmail.com with ESMTPSA id q123-20020a1c4381000000b00397402ae674sm7595596wma.11.2022.07.11.06.58.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jul 2022 06:58:04 -0700 (PDT) From: Peter Maydell To: qemu-devel@nongnu.org Subject: [PULL 16/45] target/arm: Handle SME in sve_access_check Date: Mon, 11 Jul 2022 14:57:21 +0100 Message-Id: <20220711135750.765803-17-peter.maydell@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220711135750.765803-1-peter.maydell@linaro.org> References: <20220711135750.765803-1-peter.maydell@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::435; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x435.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson The pseudocode for CheckSVEEnabled gains a check for Streaming SVE mode, and for SME present but SVE absent. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20220708151540.18136-17-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- target/arm/translate-a64.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index b16d81bf197..b7b64f73584 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -1183,21 +1183,31 @@ static bool fp_access_check(DisasContext *s) return true; } -/* Check that SVE access is enabled. If it is, return true. +/* + * Check that SVE access is enabled. If it is, return true. * If not, emit code to generate an appropriate exception and return false. + * This function corresponds to CheckSVEEnabled(). */ bool sve_access_check(DisasContext *s) { - if (s->sve_excp_el) { - assert(!s->sve_access_checked); - s->sve_access_checked = true; - + if (s->pstate_sm || !dc_isar_feature(aa64_sve, s)) { + assert(dc_isar_feature(aa64_sme, s)); + if (!sme_sm_enabled_check(s)) { + goto fail_exit; + } + } else if (s->sve_excp_el) { gen_exception_insn_el(s, s->pc_curr, EXCP_UDEF, syn_sve_access_trap(), s->sve_excp_el); - return false; + goto fail_exit; } s->sve_access_checked = true; return fp_access_check(s); + + fail_exit: + /* Assert that we only raise one exception per instruction. */ + assert(!s->sve_access_checked); + s->sve_access_checked = true; + return false; } /* From patchwork Mon Jul 11 13:57:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 589361 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:bb16:0:0:0:0 with SMTP id jd22csp3286604mab; Mon, 11 Jul 2022 07:14:52 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tV3pPrVus9eRddTn70ac1Qov4g+/qGpM7jnS3thGHi356fDqmDzlTQRpQl88JTsfSXOLFJ X-Received: by 2002:ac8:5ac9:0:b0:31a:63e6:eee3 with SMTP id d9-20020ac85ac9000000b0031a63e6eee3mr13539511qtd.120.1657548892895; Mon, 11 Jul 2022 07:14:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657548892; cv=none; d=google.com; s=arc-20160816; b=ifwIMDTrU/6w113otKmrsjQ4quAqiBEAB5Bgzkzt+B23nFtBOlmtQkwEY+k5I7PO/t q48xv3y1CCMGEDtfUfBHRmHlqxK6I5hFru1JGU2PuLtBHiH9kMPaZkMRbrIyQM+wQVpF 00e8Wjv3afrtmToLt6CABrPfTx/bW72Ntqju7fT2u8SiOosSvq+duIv4ylRRsRXSIH6K y4/Q4q3uY+T6vs6Orck5nDbEEMczLGSQ3DOSeZls6F0eQcQF8ViUZvqbwfl5/jkNNQMQ iIGkWXLPllggyXz84UM4myhjOjJfzRuwrQCDs5QmcGaGi9+rFvOeOp5+RUL2J5ATtPtv TTwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=0SnW41amKkOvYQy7JWpeer4ukEO9PLX9nZ7OoMrxHX8=; b=QhOylrTe5qLeEsIHLAwPVddsvFzBfCyo6oScYEUrJ+L4fH5UZc51iI6y8guJLJNAtm ljgs7Sw+hF84ePUABUUmoSlGHLHur5yQ8kzuQ4LWL/jK2h1AYiacS6SkYJ1emujRvjZ6 C786WlyJ9JN5LiYAsNw7aZAoIBuAvVEvn9fKx+2BlKCfAeFynsKe/imgMpeozzsv6Z2I 1rVH0D6KBttOsoBJ9s5L6pRUpgHw5+diemAWw4nnFhE8ckhitD39DrHXDyTAlF0R4Lkg BFa2i/JUTAxpMd5az8EYYCOFz+iDF57l9KxDsQApBP2CZfkjVUwlLgIPGr3AtPRBq0s5 1QiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YdSN+EVt; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id f15-20020a05622a1a0f00b0031bf5ebaaf3si5308766qtb.47.2022.07.11.07.14.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Jul 2022 07:14:52 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YdSN+EVt; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:42714 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oAuBY-0002qa-CN for patch@linaro.org; Mon, 11 Jul 2022 10:14:52 -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 ) 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 ) 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 ; 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=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-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) 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 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jul 2022 06:58:05 -0700 (PDT) From: Peter Maydell 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 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson 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 Signed-off-by: Richard Henderson Message-id: 20220708151540.18136-18-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- 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; } +/* 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; } +/* 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 rd:5 # SVE index generation (register start, register increment) INDEX_rr 00000100 .. 1 ..... 010011 ..... ..... @rd_rn_rm -### SVE Stack Allocation Group +### SVE / Streaming SVE Stack Allocation Group # 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 # SVE stack frame size RDVL 00000100 101 11111 01010 imm:s6 rd:5 +RDSVL 00000100 101 11111 01011 imm:s6 rd:5 ### SVE Bitwise Shift - Unpredicated Group 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; } +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 = cpu_reg_sp(s, a->rd); + TCGv_i64 rn = 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; } +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 = cpu_reg_sp(s, a->rd); + TCGv_i64 rn = 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; } +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 = cpu_reg(s, a->rd); + tcg_gen_movi_i64(reg, a->imm * streaming_vec_reg_size(s)); + } + return true; +} + /* *** SVE Compute Vector Address Group */ From patchwork Mon Jul 11 13:57:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 589347 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:bb16:0:0:0:0 with SMTP id jd22csp3270234mab; Mon, 11 Jul 2022 06:59:56 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tR2EttVo/tTWnF7ExU37Enq2lIBGdpB1nSSxAyTSAHI2z/ZDRWOXvWKHVfc1oVBmizphIX X-Received: by 2002:a05:6214:f6c:b0:470:3e03:a24a with SMTP id iy12-20020a0562140f6c00b004703e03a24amr13758558qvb.25.1657547996828; Mon, 11 Jul 2022 06:59:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657547996; cv=none; d=google.com; s=arc-20160816; b=JHgIKKYmJjcbEHMgHv8aape9o6jqnmfmKWoF//pkKVWVjzPZnhwgEN6I9KyJg/q7Cj UMggnRQlHjVGcLpeKzhe5SU5Xrh0Hn/0f4zPn0ZeowyK8/09cn6BL6RjiGfXPa1b9dy4 bJgkpsSTrFP2cYQ9N4SeE+RRXOcoOuR1mf4b4VYJhbYKllFsdFfaInKUtjn3YeQ00ZS+ 8T/xvXA9zeaUvonzta8WLivFpMFzt/Gtv5p4VyEgqwa2TWrwZl5d28xEgSFFFfkBSORk uXyDupI+x/76ilxzGOJCDXQ4uYviColwihKOYixv0P3+jnB0o0hYdSrOZR6dpkJya0Lo a0fg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=xU+wxBR/nb5VhvZR6dMFf9W7EuBiUbFbtZKkKknvG9M=; b=X9X+jY2e9IeKphHnU9GdnylP+WbFQEpSVtiY0fdLvd3+WWrGKCT6WoHz2TmpewkO5G 8he00mWpitpfYh604m3DrlcCl8lG3JSGUS2JBFjoaUmLJADYACJiTx/QKCdNQFmXpTk2 9ZPU3/D+NmbX+X7nz+eayrVApJ70LfHlclw/XvqzZI1mmaVOIpMN9lGg50E0RTcymiWG eC4r4k4/H+71xirnBFGVPJa8kz8NZK0SmYN3v9vOdPQGGl48kBQzf8ycRe4l44vEmyPC bqoWvKfawHp58AYn/vdMclpGnOqrtDgMObxATFLKn57WVSfYqMS1sY58s7ZRPRfYcDQm fopw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=I3+YpVZm; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id gh3-20020a05621429c300b004736f73052fsi1747780qvb.468.2022.07.11.06.59.56 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Jul 2022 06:59:56 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=I3+YpVZm; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:40236 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oAtx6-0006c5-DC for patch@linaro.org; Mon, 11 Jul 2022 09:59:56 -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 ) 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 ) 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 ; 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=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-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) 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 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jul 2022 06:58:06 -0700 (PDT) From: Peter Maydell 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 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20220708151540.18136-19-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- 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 @@ 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 == 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 = 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 @@ */ #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; +} From patchwork Mon Jul 11 13:57:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 589363 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:bb16:0:0:0:0 with SMTP id jd22csp3289695mab; Mon, 11 Jul 2022 07:17:46 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sq9OlBTCGhbS8J1/wAYRRBT6hhw1H4Fb/KDzl+wnHu3NmctlHu7yQyxKrsDp6CpZIply66 X-Received: by 2002:a05:622a:1742:b0:31d:299d:cbae with SMTP id l2-20020a05622a174200b0031d299dcbaemr14199272qtk.476.1657549066425; Mon, 11 Jul 2022 07:17:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657549066; cv=none; d=google.com; s=arc-20160816; b=RtRWplqA3uMC8zsccw7244culli9UzYAMHUu8pGnoCOFM8xpMKzsDQKEltVIMu5TUl T2v01R7tBqL3LHNdPt7mI1q/H/Rv+W3YlLpGf4q0Wa0tqQ3a0c4+umMDFSG0DfPi2E6C avlluOCJK/nPnQ2wxbB8K3b2Fsdti8ABJ6fmvfqLqnTI0NnJPwKzQbnTCqlBzNaJYAgI PbaD/9VRcU0VGrSWZCXHP8HfZwKFaFR3hJ4aK903iAkQu/L/CahP0oz/bU7a+oh2dQeA v4TIpGj/gdTmNBXZIG+MDWv+XkC8UNsGp8ljyh+fvGvuC1vVfnb0CaR0g6+nIedJl+d+ n40g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=P+PObeibL5C3+Uz8LfbpgBOBFwzFbCbwTK56pDFrdzU=; b=JBf03Vsu+0cX6dcUj0WoCpahymB2iL1eXEfmigfJw0SYTWQ+9OIX/6k5P2Kgdr021Y hDwnk8YHVntyIgDhayOVIJquIuZuvDZUb/FIp0PkdSskHD9e2u4g915dL8VehED9uQJU MBcUEi2y+ChEgasleRDvrjbr/McEc1S/c6ic9F9UOAG3fUrCe227aI1zApjeqzC4ahjF odl8a7QihfAeeKpewGG7dKrvp5HgcjNv5sGK74h9RrDM52dPrrFtWNmzmafyhRAixknn crrrYfM0gdmWaKe/pEdf6C2jNaJWx/shT/g7XDavcWR9DtD47+K6sZNaWoftT5c3Yplq I9fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Pka/28UA"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id o189-20020a375ac6000000b006af435b6aa3si3641901qkb.677.2022.07.11.07.17.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Jul 2022 07:17:46 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Pka/28UA"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:46228 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oAuEL-0005Iu-Ty for patch@linaro.org; Mon, 11 Jul 2022 10:17:45 -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 ) 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 ) 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 ; 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=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-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) 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 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jul 2022 06:58:07 -0700 (PDT) From: Peter Maydell 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 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson We 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 Signed-off-by: Richard Henderson Message-id: 20220708151540.18136-20-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- 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) 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, i32) +DEF_HELPER_FLAGS_4(sme_mova_zc_b, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(sme_mova_cz_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(sme_mova_zc_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(sme_mova_cz_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(sme_mova_zc_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +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, i32) +DEF_HELPER_FLAGS_4(sme_mova_cz_q, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(sme_mova_zc_q, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) 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) 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)); } +/* Return a newly allocated pointer to the predicate register. */ +static inline TCGv_ptr pred_full_reg_ptr(DisasContext *s, int regno) +{ + TCGv_ptr ret = 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); 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; } +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 ZERO 11000000 00 001 00000000000 imm:8 + +### SME Move into/from Array + +%mova_rs 13:2 !function=plus_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=0 rs=%mova_rs +MOVA 11000000 11 00000 1 v:1 .. pg:3 zr:5 0 za_imm:4 \ + &mova to_vec=0 rs=%mova_rs esz=4 + +MOVA 11000000 esz:2 00001 0 v:1 .. pg:3 0 za_imm:4 zr:5 \ + &mova to_vec=1 rs=%mova_rs +MOVA 11000000 11 00001 1 v:1 .. pg:3 0 za_imm:4 zr:5 \ + &mova to_vec=1 rs=%mova_rs esz=4 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 @@ #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" /* ResetSVEState */ void arm_reset_sve_state(CPUARMState *env) @@ -84,3 +86,150 @@ void helper_sme_zero(CPUARMState *env, uint32_t imm, uint32_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 = simd_oprsz(desc); \ + for (i = 0; i < oprsz; ) { \ + uint16_t pg = *(uint16_t *)(vg + H1_2(i >> 3)); \ + do { \ + if (pg & 1) { \ + *(TYPE *)(za + tile_vslice_offset(i)) = *(TYPE *)(vn + H(i)); \ + } \ + i += sizeof(TYPE); \ + pg >>= 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 = simd_oprsz(desc) / 8; + uint8_t *pg = vg; + uint64_t *n = vn; + uint64_t *a = za; + + for (i = 0; i < oprsz; i++) { + if (pg[H1(i)] & 1) { + a[tile_vslice_index(i)] = n[i]; + } + } +} + +void HELPER(sme_mova_cz_q)(void *za, void *vn, void *vg, uint32_t desc) +{ + int i, oprsz = simd_oprsz(desc) / 16; + uint16_t *pg = vg; + Int128 *n = vn; + Int128 *a = za; + + /* + * Int128 is used here simply to copy 16 bytes, and to simplify + * the address arithmetic. + */ + for (i = 0; i < oprsz; i++) { + if (pg[H2(i)] & 1) { + a[tile_vslice_index(i)] = 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 = simd_oprsz(desc); \ + for (i = 0; i < oprsz; ) { \ + uint16_t pg = *(uint16_t *)(vg + H1_2(i >> 3)); \ + do { \ + if (pg & 1) { \ + *(TYPE *)(vd + H(i)) = *(TYPE *)(za + tile_vslice_offset(i)); \ + } \ + i += sizeof(TYPE); \ + pg >>= 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 = simd_oprsz(desc) / 8; + uint8_t *pg = vg; + uint64_t *d = vd; + uint64_t *a = za; + + for (i = 0; i < oprsz; i++) { + if (pg[H1(i)] & 1) { + d[i] = a[tile_vslice_index(i)]; + } + } +} + +void HELPER(sme_mova_zc_q)(void *vd, void *za, void *vg, uint32_t desc) +{ + int i, oprsz = simd_oprsz(desc) / 16; + uint16_t *pg = vg; + Int128 *d = vd; + Int128 *a = za; + + /* + * Int128 is used here simply to copy 16 bytes, and to simplify + * the address arithmetic. + */ + for (i = 0; i < oprsz; i++, za += sizeof(ARMVectorReg)) { + if (pg[H2(i)] & 1) { + d[i] = 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, } } +void HELPER(sve_sel_zpzz_q)(void *vd, void *vn, void *vm, + void *vg, uint32_t desc) +{ + intptr_t i, opr_sz = simd_oprsz(desc) / 16; + Int128 *d = vd, *n = vn, *m = vm; + uint16_t *pg = vg; + + for (i = 0; i < opr_sz; i += 1) { + d[i] = (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" +/* + * 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 = tile_index >> (4 - esz); + int index = esz == 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 = 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 = ctz32(streaming_vec_reg_size(s)) - esz; + + if (vertical) { + /* + * Compute the byte offset of the index within the tile: + * (index % (svl / size)) * size + * = (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 = 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)) + * = (index % (svl >> esz)) << (esz + log2(sizeof(row))) + */ + pos = 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 = tile * sizeof(ARMVectorReg); + + /* Include the byte offset of zarray to make this relative to env. */ + offset += offsetof(CPUARMState, zarray); + tcg_gen_addi_i32(tmp, tmp, offset); + + /* Add the byte offset to env to produce the final pointer. */ + addr = 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] = { + 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] = { + 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] = { + 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 = get_tile_rowcol(s, a->esz, a->rs, a->za_imm, a->v); + t_zr = vec_full_reg_ptr(s, a->zr); + t_pg = pred_full_reg_ptr(s, a->pg); + + svl = streaming_vec_reg_size(s); + t_desc = 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; +} From patchwork Mon Jul 11 13:57:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 589373 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:bb16:0:0:0:0 with SMTP id jd22csp3299669mab; Mon, 11 Jul 2022 07:30:02 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uIIMzCI2mkcvH7pnhBIQUEeeoNsGXKz5C7olPzGBjXQK7cZ4OjL4OCHn85mSrIwRJWm4T8 X-Received: by 2002:a05:6214:21ec:b0:470:3f54:e846 with SMTP id p12-20020a05621421ec00b004703f54e846mr13534791qvj.58.1657549802541; Mon, 11 Jul 2022 07:30:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657549802; cv=none; d=google.com; s=arc-20160816; b=Ibc/xhUisPu5/yEqAVj2PNoQ/9rCamw893rBBVTkPgRF8O7+oV8prQaRbcFfa1iuq2 S5uDZalMICl08zAkSS/EtZm1Q553V+1nfH0z0jF2tGCe6N4cEGrOXZkLJmmSxDIuDrFh T0/Rqe/6hNBBpuBvpNK8KzeuuMySjeXFs0xl8AMZIwdbfVtJBepghiVKWumHACywGZD1 hPujKZd4lBElku1wA1/1R798noma6VEg/E36Zx75Mo/xUF/Zv74X7YiRrJLvp+4qYn7G 6d7XJX0yGw1/Ltfg5cWE6VDkFlfKJyzi3NoZUiI3u2U4tsTvAXhdR1WHm5TiGWxTxvN5 /6JQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=ZyUf8Y8AINyya8GaLwmXsquW759D0Iw6TfD8Uk3jfYw=; b=a6xg5nmjF68GzhnuEZvnDJRFhw+vIj/rPeFiyHb9utVyyFLCmkvXxFrk5inObtfk1L ojwWCZw7MaqqcvkbtqGUxqea2m5I4kzudQGwMPdYYMKk1suMQNSyN0xhcLapTB16g7DG wSRjbXTy6dOpvqINDdEPElSyt3IYzRuU1F50pqpsAUEDa33Rh5Dycx4HufOIElqRyKYq A2y1v2ZTXlQp1JzTImp8QZNDSPb0CB8rK8EsntUrHrBnULjgnH2wJeB92xPVKtKTMXfn jfU1HCZpbAUqyqUEg5aouYTCDVjcdY4AJnB/UxUf323qRFoNZagrToHL2SiPQSAkMaOB 8hFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AGMLIViV; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id fd10-20020a05622a4d0a00b0031eab70c078si4071885qtb.436.2022.07.11.07.30.02 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Jul 2022 07:30:02 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AGMLIViV; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:39016 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oAuQD-0004Kg-Us for patch@linaro.org; Mon, 11 Jul 2022 10:30:01 -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 ) 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 ) 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 ; 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=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-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) 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 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jul 2022 06:58:08 -0700 (PDT) From: Peter Maydell 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 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson We 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 Signed-off-by: Richard Henderson Message-id: 20220708151540.18136-21-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- 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, i32) DEF_HELPER_FLAGS_4(sme_mova_cz_q, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(sme_mova_zc_q, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) + +DEF_HELPER_FLAGS_5(sme_ld1b_h, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_5(sme_ld1b_v, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) +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, i32) +DEF_HELPER_FLAGS_5(sme_st1b_v, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) +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=1 rs=%mova_rs MOVA 11000000 11 00001 1 v:1 .. pg:3 0 za_imm:4 zr:5 \ &mova to_vec=1 rs=%mova_rs esz=4 + +### 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=%mova_rs +LDST1 1110000 111 st:1 rm:5 v:1 .. pg:3 rn:5 0 za_imm:4 \ + &ldst esz=4 rs=%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 @@ #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" /* 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) } #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 = 0; i < len; ++i) { + *(uint8_t *)(vptr + tile_vslice_offset(i + off)) = 0; + } +} + +static void clear_vertical_h(void *vptr, size_t off, size_t len) +{ + for (size_t i = 0; i < len; i += 2) { + *(uint16_t *)(vptr + tile_vslice_offset(i + off)) = 0; + } +} + +static void clear_vertical_s(void *vptr, size_t off, size_t len) +{ + for (size_t i = 0; i < len; i += 4) { + *(uint32_t *)(vptr + tile_vslice_offset(i + off)) = 0; + } +} + +static void clear_vertical_d(void *vptr, size_t off, size_t len) +{ + for (size_t i = 0; i < len; i += 8) { + *(uint64_t *)(vptr + tile_vslice_offset(i + off)) = 0; + } +} + +static void clear_vertical_q(void *vptr, size_t off, size_t len) +{ + for (size_t i = 0; i < len; i += 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 = vsrc; + uint8_t *dst = vdst; + size_t i; + + for (i = 0; i < len; ++i) { + dst[tile_vslice_index(i)] = src[i]; + } +} + +static void copy_vertical_h(void *vdst, const void *vsrc, size_t len) +{ + const uint16_t *src = vsrc; + uint16_t *dst = vdst; + size_t i; + + for (i = 0; i < len / 2; ++i) { + dst[tile_vslice_index(i)] = src[i]; + } +} + +static void copy_vertical_s(void *vdst, const void *vsrc, size_t len) +{ + const uint32_t *src = vsrc; + uint32_t *dst = vdst; + size_t i; + + for (i = 0; i < len / 4; ++i) { + dst[tile_vslice_index(i)] = src[i]; + } +} + +static void copy_vertical_d(void *vdst, const void *vsrc, size_t len) +{ + const uint64_t *src = vsrc; + uint64_t *dst = vdst; + size_t i; + + for (i = 0; i < len / 8; ++i) { + dst[tile_vslice_index(i)] = src[i]; + } +} + +static void copy_vertical_q(void *vdst, const void *vsrc, size_t len) +{ + for (size_t i = 0; i < len; i += 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 = HOST(host); \ + *(TYPE *)(za + tile_vslice_offset(off)) = val; \ +} \ +static inline void sme_##NAME##_v_tlb(CPUARMState *env, void *za, \ + intptr_t off, target_ulong addr, uintptr_t ra) \ +{ \ + TYPE val = TLB(env, useronly_clean_ptr(addr), ra); \ + *(TYPE *)(za + tile_vslice_offset(off)) = val; \ +} + +#define DO_ST(NAME, TYPE, HOST, TLB) \ +static inline void sme_##NAME##_v_host(void *za, intptr_t off, void *host) \ +{ \ + TYPE val = *(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 = *(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 = HOST(host), val1 = HOST(host + 8); \ + uint64_t *ptr = za + off; \ + ptr[0] = BE ? val1 : val0, ptr[1] = 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 = TLB(env, useronly_clean_ptr(addr), ra); \ + uint64_t val1 = TLB(env, useronly_clean_ptr(addr + 8), ra); \ + uint64_t *ptr = za + off; \ + ptr[0] = BE ? val1 : val0, ptr[1] = 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 = 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 = 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 = simd_oprsz(desc); + const intptr_t esize = 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 => !mte_active. + */ + if (mtedesc) { + sve_cont_ldst_mte_check(&info, env, vg, addr, esize, esize, + mtedesc, ra); + } + + flags = info.page[0].flags | info.page[1].flags; + if (unlikely(flags != 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 = { }; + + reg_off = info.reg_off_first[0]; + reg_last = info.reg_off_last[1]; + if (reg_last < 0) { + reg_last = info.reg_off_split; + if (reg_last < 0) { + reg_last = info.reg_off_last[0]; + } + } + + do { + uint64_t pg = vg[reg_off >> 6]; + do { + if ((pg >> (reg_off & 63)) & 1) { + tlb_fn(env, &scratch, reg_off, addr + reg_off, ra); + } + reg_off += esize; + } while (reg_off & 63); + } while (reg_off <= reg_last); + + cpy_fn(za, &scratch, reg_max); + return; +#endif + } + + /* The entire operation is in RAM, on valid pages. */ + + reg_off = info.reg_off_first[0]; + reg_last = info.reg_off_last[0]; + host = info.page[0].host; + + if (!vertical) { + memset(za, 0, reg_max); + } else if (reg_off) { + clr_fn(za, 0, reg_off); + } + + while (reg_off <= reg_last) { + uint64_t pg = 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 += esize; + } while (reg_off <= 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 = info.reg_off_split; + if (unlikely(reg_off >= 0)) { + tlb_fn(env, za, reg_off, addr + reg_off, ra); + } + + reg_off = info.reg_off_first[1]; + if (unlikely(reg_off >= 0)) { + reg_last = info.reg_off_last[1]; + host = info.page[1].host; + + do { + uint64_t pg = 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 += esize; + } while (reg_off & 63); + } while (reg_off <= 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 = desc >> (SIMD_DATA_SHIFT + SVE_MTEDESC_SHIFT); + int bit55 = extract64(addr, 55, 1); + + /* Remove mtedesc from the normal sve descriptor. */ + desc = 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 = 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 = simd_oprsz(desc); + const intptr_t esize = 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 => !mte_active. + */ + if (mtedesc) { + sve_cont_ldst_mte_check(&info, env, vg, addr, esize, esize, + mtedesc, ra); + } + + flags = info.page[0].flags | info.page[1].flags; + if (unlikely(flags != 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 = info.reg_off_first[0]; + reg_last = info.reg_off_last[1]; + if (reg_last < 0) { + reg_last = info.reg_off_split; + if (reg_last < 0) { + reg_last = info.reg_off_last[0]; + } + } + + do { + uint64_t pg = vg[reg_off >> 6]; + do { + if ((pg >> (reg_off & 63)) & 1) { + tlb_fn(env, za, reg_off, addr + reg_off, ra); + } + reg_off += esize; + } while (reg_off & 63); + } while (reg_off <= reg_last); + return; +#endif + } + + reg_off = info.reg_off_first[0]; + reg_last = info.reg_off_last[0]; + host = info.page[0].host; + + while (reg_off <= reg_last) { + uint64_t pg = vg[reg_off >> 6]; + do { + if ((pg >> (reg_off & 63)) & 1) { + host_fn(za, reg_off, host + reg_off); + } + reg_off += 1 << esz; + } while (reg_off <= 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 = info.reg_off_split; + if (unlikely(reg_off >= 0)) { + tlb_fn(env, za, reg_off, addr + reg_off, ra); + } + + reg_off = info.reg_off_first[1]; + if (unlikely(reg_off >= 0)) { + reg_last = info.reg_off_last[1]; + host = info.page[1].host; + + do { + uint64_t pg = vg[reg_off >> 6]; + do { + if ((pg >> (reg_off & 63)) & 1) { + host_fn(za, reg_off, host + reg_off); + } + reg_off += 1 << esz; + } while (reg_off & 63); + } while (reg_off <= reg_last); + } +} + +static inline QEMU_ALWAYS_INLINE +void sme_st1_mte(CPUARMState *env, void *za, uint64_t *vg, target_ulong addr, + 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 = desc >> (SIMD_DATA_SHIFT + SVE_MTEDESC_SHIFT); + int bit55 = extract64(addr, 55, 1); + + /* Remove mtedesc from the normal sve descriptor. */ + desc = 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 = 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) 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] = { + 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 = 0; + bool be = s->be_data == MO_BE; + bool mte = s->mte_active[0]; + + if (!dc_isar_feature(aa64_sme, s)) { + return false; + } + if (!sme_smza_enabled_check(s)) { + return true; + } + + t_za = get_tile_rowcol(s, a->esz, a->rs, a->za_imm, a->v); + t_pg = pred_full_reg_ptr(s, a->pg); + addr = 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 = FIELD_DP32(desc, MTEDESC, MIDX, get_mem_index(s)); + desc = FIELD_DP32(desc, MTEDESC, TBI, s->tbid); + desc = FIELD_DP32(desc, MTEDESC, TCMA, s->tcma); + desc = FIELD_DP32(desc, MTEDESC, WRITE, a->st); + desc = FIELD_DP32(desc, MTEDESC, SIZEM1, (1 << a->esz) - 1); + desc <<= SVE_MTEDESC_SHIFT; + } else { + addr = clean_data_tbi(s, addr); + } + svl = streaming_vec_reg_size(s); + desc = 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; +} From patchwork Mon Jul 11 13:57:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 589355 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:bb16:0:0:0:0 with SMTP id jd22csp3279007mab; Mon, 11 Jul 2022 07:07:50 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vcCImeT3lclEdmDDc/rUPg00wxaZBRPzHu6wWxFE1C1nwZDLa9/fhTeUDdCLrTyVpV4oCg X-Received: by 2002:a05:620a:240b:b0:6b5:77ea:3394 with SMTP id d11-20020a05620a240b00b006b577ea3394mr6324187qkn.706.1657548470053; Mon, 11 Jul 2022 07:07:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657548470; cv=none; d=google.com; s=arc-20160816; b=Mz5s1hOeA7/z2MkCbtj2l3fX6G4IXfQhFAjdNg9AuNMFnD9BEXvRT0OV4hF2q7nxdf wdH0+9OJqLKfK88oPgMVzO/z2oeaDZFrYbyHAikBSK2vB/r/d48a9L5e0Qz5Fw0hwVEl W4fua6ykF0AjOjB/unRttML8IIji+VuUvtaQnUVtYlK0gjqdXlyndw/qo57PnLLpjFxa W5agPHo4/61HOsGkhJNmB8GlV2OzSHdDs2B+jHgQK+nemGv9Axhn4OzhlKfaxRZPbO7W OGcImlJn3Ufos8R4NftOaPamAg53UhpuyfOn99Qh5xV5XGIbykyIZ2ZdQrFfFOergxV8 gchQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=R6i7MnDmgZ9TGTFifqojFktd9bEi6hBbq+TpHvZPZLY=; b=GR6HWWUSj9afdjw3oWiZC+57FH+1gLLce6HISbISzEYijXzrwxygxS7kakfJoz188x i/rUKfkntyy+MWtNwMI/ocGWqlaXe78bsIufP0+7yErjZayyD+gywtA8fz4wYvVS1OnC bo6mettiKp/dLQJQkImv/BVHcSZCJfM007MzEWQK8WIc5Gjwt/YqIPQvK4xGYA0jozvA U9FSnwS+qeP0wA662Jez/zyphrLPMdIip2LMb4A3BptjS9ONZay918PGaHlXrEIBk4Ty Ffc9mVfeIttKbndnFvRjbIQbCqNFlOY6JalVysI+uZtukO35xeIxTfT+TYtwhtVKsUlp hfiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=euk51xoM; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id bx13-20020a05622a090d00b0031eb33e9206si2388022qtb.387.2022.07.11.07.07.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Jul 2022 07:07:50 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=euk51xoM; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:57566 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oAu4j-0001yh-DE for patch@linaro.org; Mon, 11 Jul 2022 10:07:49 -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 ) 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 ) 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 ; 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=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-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) 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 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jul 2022 06:58:09 -0700 (PDT) From: Peter Maydell 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 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson 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 Signed-off-by: Richard Henderson Message-id: 20220708151540.18136-22-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- 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, uint32_t rn_ofs, uint32_t rm_ofs, int64_t shift, uint32_t opr_sz, uint32_t max_sz); +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. */ -static void do_ldr(DisasContext *s, uint32_t vofs, int len, int rn, int imm) +void gen_sve_ldr(DisasContext *s, TCGv_ptr base, int vofs, + int len, int rn, int imm) { int len_align = QEMU_ALIGN_DOWN(len, 8); int len_remain = len % 8; @@ -4332,7 +4333,7 @@ static void do_ldr(DisasContext *s, uint32_t vofs, int len, int rn, int imm) t0 = tcg_temp_new_i64(); for (i = 0; i < len_align; i += 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, int len, int rn, int imm) clean_addr = new_tmp_a64_local(s); tcg_gen_mov_i64(clean_addr, t0); + if (base != cpu_env) { + TCGv_ptr b = tcg_temp_local_new_ptr(); + tcg_gen_mov_ptr(b, base); + base = b; + } + gen_set_label(loop); t0 = tcg_temp_new_i64(); @@ -4352,7 +4359,7 @@ static void do_ldr(DisasContext *s, uint32_t vofs, int len, int rn, int imm) tcg_gen_addi_i64(clean_addr, clean_addr, 8); tp = 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, int len, int rn, int imm) tcg_gen_brcondi_ptr(TCG_COND_LTU, i, len_align, loop); tcg_temp_free_ptr(i); + + if (base != cpu_env) { + tcg_temp_free_ptr(base); + assert(len_remain == 0); + } } /* @@ -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); } } /* Similarly for stores. */ -static void do_str(DisasContext *s, uint32_t vofs, int len, int rn, int imm) +void gen_sve_str(DisasContext *s, TCGv_ptr base, int vofs, + int len, int rn, int imm) { int len_align = QEMU_ALIGN_DOWN(len, 8); int len_remain = len % 8; @@ -4420,7 +4433,7 @@ static void do_str(DisasContext *s, uint32_t vofs, int len, int rn, int imm) t0 = tcg_temp_new_i64(); for (i = 0; i < len_align; i += 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 = new_tmp_a64_local(s); tcg_gen_mov_i64(clean_addr, t0); + if (base != cpu_env) { + TCGv_ptr b = tcg_temp_local_new_ptr(); + tcg_gen_mov_ptr(b, base); + base = b; + } + gen_set_label(loop); t0 = tcg_temp_new_i64(); tp = 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) tcg_gen_brcondi_ptr(TCG_COND_LTU, i, len_align, loop); tcg_temp_free_ptr(i); + + if (base != cpu_env) { + tcg_temp_free_ptr(base); + assert(len_remain == 0); + } } /* Predicate register stores can be any multiple of 2. */ if (len_remain) { t0 = tcg_temp_new_i64(); - tcg_gen_ld_i64(t0, cpu_env, vofs + len_align); + tcg_gen_ld_i64(t0, base, vofs + len_align); 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 = vec_full_reg_size(s); int off = 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 = pred_full_reg_size(s); int off = 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 = vec_full_reg_size(s); int off = 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 = pred_full_reg_size(s); int off = 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; } From patchwork Mon Jul 11 13:57:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 589385 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:bb16:0:0:0:0 with SMTP id jd22csp3317046mab; Mon, 11 Jul 2022 07:52:44 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uauzRAayk5OMkesOz1dstEtFdjR2WWgqCGME9cLqham5rFkQbOfukm8AoYJQIQvLMBNRKM X-Received: by 2002:a05:6214:d08:b0:472:fc88:ec with SMTP id 8-20020a0562140d0800b00472fc8800ecmr13517300qvh.129.1657551164369; Mon, 11 Jul 2022 07:52:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657551164; cv=none; d=google.com; s=arc-20160816; b=LWtrbofMmWElQquE5w9hvFxyV9dBuuI396fK7tZWUhUWSbNSperYVEGuQh2Sak8ojx yqQ4HT+WgAbIPdsTtFnY1K352OFUxp6UXynMmnQVh3HuTa2CWLHKaED1K9XFjRP5q+Z5 sd/xSZcR+83oPXKIvZzqvML/YyqmVfQSriowJ4JDYiA7PQHwLuEwOOgfCzENk0cn9ZRE r1R0QFu8/uXj6ja3WbMowLfQVI5I+sm7qE+h6EyvY4mZNjhKVn4r++/S70mQSqoXJJta yM6Mx9ATxzSm4Fxl8E72YO3ZKXFM2bmvHr8ZGdyn+cp8iVv+teNNQmvUocT4/5NASwkS tCGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=RmOk6nsqmajD+IRJZhKUc2IWWgl+LIcAbHluvdhJCZg=; b=QT2fgnQvnc9ArKVMEPpaOIPgoE5xVCowNqh7KAU5euZhX7KhALnc1BDCJytyRNs/7u icFEV94YJwcgb0wryE/jratCP1p0XDMQ3X6JCYp7e/cLAD+cgRr6NLYdWX35xB9kDMsY MNRpeU+9FNYO+D+gEtNooBhge6Km+1lSD9hySHBvnrBgrez7ADn4B0/O61pG0C+LRW1u aqdKyIO/ATLXssoPTTMFseVjbNNHHO/glsbNGcUJR2GwDH/ahPUqnRSjC0VNgqKJGyKO HGf8lyO9adgFtnSO/ADsUYuSuSXysjoT68W7AbSFTn3eumPUGP7C9fwQ9Sa0EE2mAKoD D6tw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WFmiku2R; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id kl24-20020a056214519800b0047326fff0f6si3852647qvb.269.2022.07.11.07.52.44 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Jul 2022 07:52:44 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WFmiku2R; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:52930 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oAumA-0001Qk-R8 for patch@linaro.org; Mon, 11 Jul 2022 10:52:43 -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 ) 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 ) 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 ; 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=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-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) 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 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jul 2022 06:58:10 -0700 (PDT) From: Peter Maydell 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 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson We 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 Signed-off-by: Richard Henderson Message-id: 20220708151540.18136-23-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- 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=%mova_rs LDST1 1110000 111 st:1 rm:5 v:1 .. pg:3 rn:5 0 za_imm:4 \ &ldst esz=4 rs=%mova_rs + +&ldstr rv rn imm +@ldstr ....... ... . ...... .. ... rn:5 . imm:4 \ + &ldstr rv=%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 = streaming_vec_reg_size(s); + int imm = a->imm; + TCGv_ptr base; + + if (!sme_za_enabled_check(s)) { + return true; + } + + /* ZA[n] equates to ZA0H.B[n]. */ + base = 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) From patchwork Mon Jul 11 13:57:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 589372 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:bb16:0:0:0:0 with SMTP id jd22csp3298901mab; Mon, 11 Jul 2022 07:29:10 -0700 (PDT) X-Google-Smtp-Source: AGRyM1t1a7Nw2fsYkwReoQkcbYVvWmD+Sl1QQB+Dq5D/6H2dyc6q8wSqxx+ejsjBg5D7RrK2hny8 X-Received: by 2002:a05:620a:214b:b0:6b5:8292:d8a8 with SMTP id m11-20020a05620a214b00b006b58292d8a8mr4086952qkm.776.1657549750260; Mon, 11 Jul 2022 07:29:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657549750; cv=none; d=google.com; s=arc-20160816; b=s4vioRp/HdZT3pbLqJz24Ff3yt/gpyDX/HrppbrybLO6AnPJ+GPJCVV4Zk+cyb3ets 6SdK1Vesg4oHs+QDAFuph8LWk7boVFX92eVph3AFAfaj90FsKTVPonDBebAQ0e/X8syZ oNlQ9KjbqvyFIQwssXdOHl9FR6/+vJHgyRCxj4Y1hcWwbh0RPL2vCkqaFw1v/mDwa4nt 4CMBEZV3CNpIrp5vhvQMEDyyVb6K++LFi9rMzLGkksCpMncPVSVKYy6nnhWB/oHGE/Bw i0erl3n2Z4XgykCeVilbOt64dMBudptmBgHAwR9jHsuQSiLFslL1dqNhVQDo8Kmd6C2O uxWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=Jrs2Elt6zkurq1tlTCd5KnpdSWVFVT+ucLNxgSmBuew=; b=wxO+dTb6QGAMlL5FKZIymqBMxiik4LcJOJieKWKv6Yo23xy8Jjf3toxb6qtdNY7R7a hCvDBC4xwd2qYqyxVVLQSJEDeW52/g0BbRFhIGo6pfwdv7byea3QIxDlP8z5SDpHPSfI W/HnP4/iKSNJpjxXxlPk1xllVYrYCnxUT35BARdAK4O9K1fJ3XCcQE3R4IBhJbzhE9nn m5EjnI+vQeQOTC/2HCRGYn7r2FisvUW2xB7O9iTYMMCxumuMlTvl8ZG7fbUynmENpeNK gqg1iWj3G5kJ19rCumrv4JsutkkWF9uCcLoNkJNe4dQst66ybcB/LtNTqk7Kbe1T56G3 Mr8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GT8KSd6f; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id bs7-20020ac86f07000000b00315fc7161desi4114805qtb.98.2022.07.11.07.29.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Jul 2022 07:29:10 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GT8KSd6f; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:37914 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oAuPN-0003VD-Om for patch@linaro.org; Mon, 11 Jul 2022 10:29:09 -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 ) 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 ) 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 ; 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=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-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) 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 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jul 2022 06:58:11 -0700 (PDT) From: Peter Maydell 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 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20220708151540.18136-24-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- 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, void, 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 \ 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) #undef DO_ST + +void HELPER(sme_addha_s)(void *vzda, void *vzn, void *vpn, + void *vpm, uint32_t desc) +{ + intptr_t row, col, oprsz = simd_oprsz(desc) / 4; + uint64_t *pn = vpn, *pm = vpm; + uint32_t *zda = vzda, *zn = vzn; + + for (row = 0; row < oprsz; ) { + uint64_t pa = pn[row >> 4]; + do { + if (pa & 1) { + for (col = 0; col < oprsz; ) { + uint64_t pb = pm[col >> 4]; + do { + if (pb & 1) { + zda[tile_vslice_index(row) + H4(col)] += zn[H4(col)]; + } + pb >>= 4; + } while (++col & 15); + } + } + pa >>= 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 = simd_oprsz(desc) / 8; + uint8_t *pn = vpn, *pm = vpm; + uint64_t *zda = vzda, *zn = vzn; + + for (row = 0; row < oprsz; ++row) { + if (pn[H1(row)] & 1) { + for (col = 0; col < oprsz; ++col) { + if (pm[H1(col)] & 1) { + zda[tile_vslice_index(row) + col] += zn[col]; + } + } + } + } +} + +void HELPER(sme_addva_s)(void *vzda, void *vzn, void *vpn, + void *vpm, uint32_t desc) +{ + intptr_t row, col, oprsz = simd_oprsz(desc) / 4; + uint64_t *pn = vpn, *pm = vpm; + uint32_t *zda = vzda, *zn = vzn; + + for (row = 0; row < oprsz; ) { + uint64_t pa = pn[row >> 4]; + do { + if (pa & 1) { + uint32_t zn_row = zn[H4(row)]; + for (col = 0; col < oprsz; ) { + uint64_t pb = pm[col >> 4]; + do { + if (pb & 1) { + zda[tile_vslice_index(row) + H4(col)] += zn_row; + } + pb >>= 4; + } while (++col & 15); + } + } + pa >>= 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 = simd_oprsz(desc) / 8; + uint8_t *pn = vpn, *pm = vpm; + uint64_t *zda = vzda, *zn = vzn; + + for (row = 0; row < oprsz; ++row) { + if (pn[H1(row)] & 1) { + uint64_t zn_row = zn[row]; + for (col = 0; col < oprsz; ++col) { + if (pm[H1(col)] & 1) { + zda[tile_vslice_index(row) + col] += 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, GenLdStR *fn) 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 = streaming_vec_reg_size(s); + uint32_t desc = 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 = get_tile_rowcol(s, esz, 31, a->zad, false); + zn = vec_full_reg_ptr(s, a->zn); + pn = pred_full_reg_ptr(s, a->pn); + pm = 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_addha_d) +TRANS_FEAT(ADDVA_d, aa64_sme_i16i64, do_adda, a, MO_64, gen_helper_sme_addva_d) From patchwork Mon Jul 11 13:57:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 589383 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:bb16:0:0:0:0 with SMTP id jd22csp3314648mab; Mon, 11 Jul 2022 07:49:20 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tFg6j1Bry4973mc1+5tL3+gPZ+6hOByH/iYYS7PVMScrkKGz8T3fF8u46RQ3H2yAO4JiU1 X-Received: by 2002:ad4:5f8a:0:b0:473:2108:7fe0 with SMTP id jp10-20020ad45f8a000000b0047321087fe0mr13728787qvb.115.1657550959975; Mon, 11 Jul 2022 07:49:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657550959; cv=none; d=google.com; s=arc-20160816; b=CHEOPwiRSrNR3SdSSBxECuAlx5ANUDqerbB+l+Y34LgBHSCUNQcdAyjxhsS5OKoK5T FUaH+mWU6k59Fqqzp4hLTwiBOGa/ySjnuBGNYg1Z6Ux4mzexcuygmFjQB2PpbIJI6H1G 44r3aBXifg/4FILYCsTeVoI0qPzs1zuK6j2NDBNwQWfAREuPqrh35FAAX9FLqc9fa/gg LyLmeAh56YLI5+wHuHY4Lax+oDQh2HOSP0sUYUQlOprE/wqMxJsWVfMV7K7vbH/OLhLa gzbonWE5Zr+aMQpp5dcW94K08xIW2cG2CyBboLeeITcxHdoXynEuT9GVCrKWCWn7djF7 vtpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=cR0PvnQKG0XfbYb9xus9rRJ6s/0aSnCTWRG0QGmXr4w=; b=UlgJ/vqd6K26oOwuco0XrAsbD9u4RG1qBwHfyqrOmyiz6jmXSgSgSQQmDcaJSTOjl8 itUaZ7UalexnCCGODWiU7PxjhOX2zyI08xumujy5Xz88PdPsXke/VjLA0b+yl8fhU6g9 sVF5l7gkYtFUVUlDLEKfKKe/siIJAx1zsvThXotIKEONnIl5t5UkZnZ2Kl9g3S5RQpE9 m4qIA/+51Yw4JXbKwEb8Raq6yr89zXRCktRcvqqNB1xzevJZqDLC4iEIU9FckCEhsGnv AAFQs/x3ojc+aUw57pysi+XRO4ezf+8+TkNqv468CbkpxWvuoT5SC1IQapXlW+4ct9w5 WXIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iqQk8F2x; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id v38-20020a05622a18a600b0031eaed115dasi4405798qtc.652.2022.07.11.07.49.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Jul 2022 07:49:19 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iqQk8F2x; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:44238 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oAuit-0003ki-Cu for patch@linaro.org; Mon, 11 Jul 2022 10:49:19 -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 ) 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 ) 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 ; 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=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-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) 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 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jul 2022 06:58:12 -0700 (PDT) From: Peter Maydell 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 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Signed-off-by: Richard Henderson Message-id: 20220708151540.18136-25-richard.henderson@linaro.org Signed-off-by: Peter Maydell Reviewed-by: Peter Maydell --- 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" @@ -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 = simd_maxsz(desc); + uint32_t neg = simd_data(desc) << 31; + uint16_t *pn = vpn, *pm = 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 = *(float_status *)vst; + set_default_nan_mode(true, &fpst); + + for (row = 0; row < oprsz; ) { + uint16_t pa = pn[H2(row >> 4)]; + do { + if (pa & 1) { + void *vza_row = vza + tile_vslice_offset(row); + uint32_t n = *(uint32_t *)(vzn + H1_4(row)) ^ neg; + + for (col = 0; col < oprsz; ) { + uint16_t pb = pm[H2(col >> 4)]; + do { + if (pb & 1) { + uint32_t *a = vza_row + H1_4(col); + uint32_t *m = vzm + H1_4(col); + *a = float32_muladd(n, *m, *a, 0, vst); + } + col += 4; + pb >>= 4; + } while (col & 15); + } + } + row += 4; + pa >>= 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 = simd_oprsz(desc) / 8; + uint64_t neg = (uint64_t)simd_data(desc) << 63; + uint64_t *za = vza, *zn = vzn, *zm = vzm; + uint8_t *pn = vpn, *pm = vpm; + float_status fpst = *(float_status *)vst; + + set_default_nan_mode(true, &fpst); + + for (row = 0; row < oprsz; ++row) { + if (pn[H1(row)] & 1) { + uint64_t *za_row = &za[tile_vslice_index(row)]; + uint64_t n = zn[row] ^ neg; + + for (col = 0; col < oprsz; ++col) { + if (pm[H1(col)] & 1) { + uint64_t *a = &za_row[col]; + *a = 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_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_addha_d) TRANS_FEAT(ADDVA_d, aa64_sme_i16i64, do_adda, a, MO_64, gen_helper_sme_addva_d) + +static bool do_outprod_fpst(DisasContext *s, arg_op *a, MemOp esz, + gen_helper_gvec_5_ptr *fn) +{ + int svl = streaming_vec_reg_size(s); + uint32_t desc = 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 = get_tile_rowcol(s, esz, 31, a->zad, false); + zn = vec_full_reg_ptr(s, a->zn); + zm = vec_full_reg_ptr(s, a->zm); + pn = pred_full_reg_ptr(s, a->pn); + pm = pred_full_reg_ptr(s, a->pm); + fpst = 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_fmopa_s) +TRANS_FEAT(FMOPA_d, aa64_sme_f64f64, do_outprod_fpst, a, MO_64, gen_helper_sme_fmopa_d) From patchwork Mon Jul 11 13:57:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 589359 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:bb16:0:0:0:0 with SMTP id jd22csp3283908mab; Mon, 11 Jul 2022 07:12:38 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vb2x6j03mEP6Gs0Q5lxQgKywxdVIAXxHnN7I1Bs4HJPJnrmKcwudlglRrOiq5sb8cpstUR X-Received: by 2002:a05:620a:2491:b0:6b5:9537:2cdc with SMTP id i17-20020a05620a249100b006b595372cdcmr1187079qkn.205.1657548757898; Mon, 11 Jul 2022 07:12:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657548757; cv=none; d=google.com; s=arc-20160816; b=jTFqDEbMmrD5gk2OXx7MnNoFOxtn6ae4bwXDOvi8scJEw8ioATHXWTOfzQPdJMBGlp 09dTRAgvgnRo3ZCAP6yqqawDnrebpsg4bvZHMrYABqAK4eGKYWncD0S0mGoZk8nbEwFt OLz3+IRY3a1uOFFCTdzInzpMG7F0i4Va8xaquGqWNrIr8fpBQd+Q2Boe1KsELsmAwfcu enb5O2thf45pU0+01cDu7AHFUr7MqrmshPILRZsA1qc08wbvY/DWXQC0+oC36QywaebH 5Yvc1zFeTq84jrxBorxwVdEo/RElQaRQP7w1v7UEMjyATUALH3lqI7uAN5S0furVpZKd GSRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=JqTdKTDdhhvQtZZBygtrOEZ/plp0svP5Se/zJYrh/p8=; b=YPLZeBDwURPxH22UAgKIVoO+3zCL4Gvtdl521LnK+ZvebjFz/vHRb49yxz0LHgpVh3 p0GkKOUxlMazm9GioveQr5MyNAsaytvR6HYfiwUGR19h45ab53RhB8+QP5aXC1ir0WuF P00WRZ+6oFrPWlykTRX2FtHlwwn3JblPsa/TPRbc17tj77WnUzV1BS7fAXYqJ6yIgxZp CaPGE7/Sc69n41GsNaUNlAY4rgS9w9vpHkNJt9i9bsNzVo+9PuVCihwlwGPdg/Ic4Sya 4p1udHlEAUOHerA2cBcfHzdbJ0M0Bcm1V6TYQ5DUY62Kmbo91VRV6AXUTgNCxBTzvFzR Qveg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oGzAxBql; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id w135-20020a37628d000000b006af2669b0ffsi3562032qkb.187.2022.07.11.07.12.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Jul 2022 07:12:37 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oGzAxBql; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:37710 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oAu9N-0007bk-Cz for patch@linaro.org; Mon, 11 Jul 2022 10:12:37 -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 ) 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 ) 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 ; 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=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-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) 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 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jul 2022 06:58:12 -0700 (PDT) From: Peter Maydell 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 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Signed-off-by: Richard Henderson Message-id: 20220708151540.18136-26-richard.henderson@linaro.org Signed-off-by: Peter Maydell Reviewed-by: Peter Maydell --- 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 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 *vzm, 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 zero. + */ + pair ^= neg; + if (!(pg & 1)) { + pair &= 0xffff0000u; + } + if (!(pg & 4)) { + pair &= 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 = simd_maxsz(desc); + uint32_t neg = simd_data(desc) * 0x80008000u; + uint16_t *pn = vpn, *pm = vpm; + + for (row = 0; row < oprsz; ) { + uint16_t prow = pn[H2(row >> 4)]; + do { + void *vza_row = vza + tile_vslice_offset(row); + uint32_t n = *(uint32_t *)(vzn + H1_4(row)); + + n = f16mop_adj_pair(n, prow, neg); + + for (col = 0; col < oprsz; ) { + uint16_t pcol = pm[H2(col >> 4)]; + do { + if (prow & pcol & 0b0101) { + uint32_t *a = vza_row + H1_4(col); + uint32_t m = *(uint32_t *)(vzm + H1_4(col)); + + m = f16mop_adj_pair(m, pcol, 0); + *a = bfdotadd(*a, n, m); + + col += 4; + pcol >>= 4; + } + } while (col & 15); + } + row += 4; + prow >>= 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_helper_sme_addva_s) TRANS_FEAT(ADDHA_d, aa64_sme_i16i64, do_adda, a, MO_64, gen_helper_sme_addha_d) TRANS_FEAT(ADDVA_d, aa64_sme_i16i64, do_adda, a, MO_64, gen_helper_sme_addva_d) +static bool do_outprod(DisasContext *s, arg_op *a, MemOp esz, + gen_helper_gvec_5 *fn) +{ + int svl = streaming_vec_reg_size(s); + uint32_t desc = 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 = get_tile_rowcol(s, esz, 31, a->zad, false); + zn = vec_full_reg_ptr(s, a->zn); + zm = vec_full_reg_ptr(s, a->zm); + pn = pred_full_reg_ptr(s, a->pn); + pm = 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, TRANS_FEAT(FMOPA_s, aa64_sme, do_outprod_fpst, a, MO_32, gen_helper_sme_fmopa_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) From patchwork Mon Jul 11 13:57:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 589369 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:bb16:0:0:0:0 with SMTP id jd22csp3295568mab; Mon, 11 Jul 2022 07:24:48 -0700 (PDT) X-Google-Smtp-Source: AGRyM1usnezHAWw0MbgO0wzwIEz//F9dqnvOh619TjXvLlXLRLJq0YMnngeitu205TFePeiSVSYN X-Received: by 2002:a05:6214:4113:b0:473:74dd:de77 with SMTP id kc19-20020a056214411300b0047374ddde77mr2813707qvb.84.1657549488495; Mon, 11 Jul 2022 07:24:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657549488; cv=none; d=google.com; s=arc-20160816; b=IXxr4okB+EuXkR08eWLKfLDb4LShAib79MugsE3/Ixf4KbOaqQ7K10qLWW44ZZOMex rV5eHRx8VZ3XRm/1Q4XAAv+Tw0VDKVBBQWkBnwsORJfappeuZGljzbIcMEWu9IEII5jy ccmkmu0ZIJsnHNsBDYA2tC8pXMgxg/PIUEU4TQXOJg4sjWne/iRGjexyF1/2WIJMroOj Q8mzy3N6HZXXaTBGqC/tOaegIANVv6fXNTrrC4xnEIjBMGM8kqPyUrD1KVMivlpGDWP2 FfW1NvOUNnSiLvlUeUvrU3A9AgZZxOHuaF3cbZvwxS4CbMQR9+ouQYbA3Gnz1l0jUbSB NEGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=rdPq6uSChyhiVf54BW91Z5hNyR78/N5QUsEASqtPQEU=; b=fxWzOnK3vf7iE7EW7c6sNZKa4Pd8HhzMzbYE/sEJ54YK2fG66n1vUwftJaiaHglxn2 BH2FdYwp+BdxHlQALXF1379+ImfgO/YjDF0j2xxV9P5WHftRej/BW+ya7/1Fz15cS+HI 77vN4WtY3tryH/7k5Zf0oqf1m81nJdfqyU7sWGMUzEUh6o+3jWMCTFchC2qZM/gFi7K2 CwTDZUs1zuKd41oMa9sNnvOztxk9sirJ/KFzEyoGPvWYZ9E380af99qRPrqD7Hz8dxpl +XJnKNC4A614DceiGwL9CyWmQYFrfCsQK4it49drfxp/FvOCsPhJq2iEiQfik8ErN4RO 2X6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YzbXPtF1; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id f6-20020a05620a280600b006abad0fbcf1si5200976qkp.538.2022.07.11.07.24.48 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Jul 2022 07:24:48 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YzbXPtF1; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:59096 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oAuL9-0006KQ-Up for patch@linaro.org; Mon, 11 Jul 2022 10:24:48 -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 ) 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 ) 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 ; 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=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-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) 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 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jul 2022 06:58:13 -0700 (PDT) From: Peter Maydell 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 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Signed-off-by: Richard Henderson Message-id: 20220708151540.18136-27-richard.henderson@linaro.org Signed-off-by: Peter Maydell Reviewed-by: Peter Maydell --- 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) +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 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; } +static float32 f16_dotadd(float32 sum, uint32_t e1, uint32_t e2, + float_status *s_std, float_status *s_odd) +{ + float64 e1r = float16_to_float64(e1 & 0xffff, true, s_std); + float64 e1c = float16_to_float64(e1 >> 16, true, s_std); + float64 e2r = float16_to_float64(e2 & 0xffff, true, s_std); + float64 e2c = 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 = float64_mul(e1r, e2r, s_odd); + t64 = float64r32_muladd(e1c, e2c, t64, 0, s_std); + + /* This conversion is exact, because we've already rounded. */ + t32 = 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 = simd_maxsz(desc); + uint32_t neg = simd_data(desc) * 0x80008000u; + uint16_t *pn = vpn, *pm = 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 = *(float_status *)vst; + set_default_nan_mode(true, &fpst_std); + fpst_odd = fpst_std; + set_float_rounding_mode(float_round_to_odd, &fpst_odd); + + for (row = 0; row < oprsz; ) { + uint16_t prow = pn[H2(row >> 4)]; + do { + void *vza_row = vza + tile_vslice_offset(row); + uint32_t n = *(uint32_t *)(vzn + H1_4(row)); + + n = f16mop_adj_pair(n, prow, neg); + + for (col = 0; col < oprsz; ) { + uint16_t pcol = pm[H2(col >> 4)]; + do { + if (prow & pcol & 0b0101) { + uint32_t *a = vza_row + H1_4(col); + uint32_t m = *(uint32_t *)(vzm + H1_4(col)); + + m = f16mop_adj_pair(m, pcol, 0); + *a = f16_dotadd(*a, n, m, &fpst_std, &fpst_odd); + + col += 4; + pcol >>= 4; + } + } while (col & 15); + } + row += 4; + prow >>= 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; } +TRANS_FEAT(FMOPA_h, aa64_sme, do_outprod_fpst, a, MO_32, gen_helper_sme_fmopa_h) TRANS_FEAT(FMOPA_s, aa64_sme, do_outprod_fpst, a, MO_32, gen_helper_sme_fmopa_s) TRANS_FEAT(FMOPA_d, aa64_sme_f64f64, do_outprod_fpst, a, MO_64, gen_helper_sme_fmopa_d) From patchwork Mon Jul 11 13:57:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 589367 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:bb16:0:0:0:0 with SMTP id jd22csp3294248mab; Mon, 11 Jul 2022 07:23:05 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sfT63m05mAe0Y3+rqR2AMEMU6uocH5LnDWPwS6kguyVj3bJoNQxQqRQPQrRHau9p7G2g2S X-Received: by 2002:a05:6214:5086:b0:473:2363:808f with SMTP id kk6-20020a056214508600b004732363808fmr13533566qvb.104.1657549385179; Mon, 11 Jul 2022 07:23:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657549385; cv=none; d=google.com; s=arc-20160816; b=xd4xBGYxUnqRW+0iLUsci2SuNuj+S7J3iYPWlLJPHC10U8H+h0yB+CyaMY1Ra/u0TM xu9mZOmOheA8ctsWlRBodw2v6ww2RxnRdgPOrfqIwkXr9ru1oFgBXIqxJ/6HlgrBMn1A 24EPuSrDkc7yXKLbaXHcB08yNzA4TvuDwGnhMO5HaAWu4iUzWPfqOIO77CfosnrB0rGT DXmNQMiia4/euD8QHax0FAVdn1v8KZQsKpWBU+FFadw5fllZ1S2UHvxSpLi5ZH7otZnl 3ghKAgQ8kav4t6T416Yq6PZOMkDYMjte8J8//ANp4GOOlom/kNyOyiGnc3zbRDVvrTUl ztOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=wLF084Ezdzf2ZLeUWRpU2I0inK+HajABcj7tU1hY7is=; b=FihIWxFFok9nb1dS8A+jz1LpNK1rCHus8+GUo0Gfe7X6Wi2pPe+gmsMbmhasyMz1nI w2M1W/8SogBRruebKrvarfUTkOLszFixcPSfp+lDX75bwnJMhh60CZ1LxHAsKVDh4y1A T0opem27mQ7yYkdn9jShNHNWqrvsPB+HeYbjLcEPxsW5CW/qGo0kRNVkuQ+RmQzBrUQ7 56TifIPPZ/x7xe70ZcuEJ+zf42BeTdN7A8tGIUpEvsB4p5fxoCWvRLjbHeZ6i5EIMFeS Dl7LVv4fuAmy73vz1bjTYb7V2FiDRBfV7vMLM8ImWKLwK3jMSnJ30+MMI5/3d8U3x92m 5+DA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=g1lx7ooM; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id cj24-20020a05622a259800b0031eb22fa61bsi2736967qtb.485.2022.07.11.07.23.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Jul 2022 07:23:05 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=g1lx7ooM; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:54556 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oAuJU-0002yg-KZ for patch@linaro.org; Mon, 11 Jul 2022 10:23:04 -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 ) 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 ) 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 ; 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=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-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) 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 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jul 2022 06:58:14 -0700 (PDT) From: Peter Maydell 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 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson This is SMOPA, SUMOPA, USMOPA_s, UMOPA, for both Int8 and Int16. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20220708151540.18136-28-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- 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 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 = simd_oprsz(desc) / 8; + bool neg = simd_data(desc); + + for (row = 0; row < oprsz; ++row) { + uint8_t pa = pn[H1(row)]; + uint64_t *za_row = &za[tile_vslice_index(row)]; + uint64_t n = zn[row]; + + for (col = 0; col < oprsz; ++col) { + uint8_t pb = pm[H1(col)]; + uint64_t *a = &za_row[col]; + + *a = 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 neg) \ +{ \ + uint32_t sum0 = 0, sum1 = 0; \ + /* Apply P to N as a mask, making the inactive elements 0. */ \ + n &= expand_pred_b(p); \ + sum0 += (NTYPE)(n >> 0) * (MTYPE)(m >> 0); \ + sum0 += (NTYPE)(n >> 8) * (MTYPE)(m >> 8); \ + sum0 += (NTYPE)(n >> 16) * (MTYPE)(m >> 16); \ + sum0 += (NTYPE)(n >> 24) * (MTYPE)(m >> 24); \ + sum1 += (NTYPE)(n >> 32) * (MTYPE)(m >> 32); \ + sum1 += (NTYPE)(n >> 40) * (MTYPE)(m >> 40); \ + sum1 += (NTYPE)(n >> 48) * (MTYPE)(m >> 48); \ + sum1 += (NTYPE)(n >> 56) * (MTYPE)(m >> 56); \ + if (neg) { \ + sum0 = (uint32_t)a - sum0, sum1 = (uint32_t)(a >> 32) - sum1; \ + } else { \ + sum0 = (uint32_t)a + sum0, sum1 = (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 neg) \ +{ \ + uint64_t sum = 0; \ + /* Apply P to N as a mask, making the inactive elements 0. */ \ + n &= expand_pred_h(p); \ + sum += (NTYPE)(n >> 0) * (MTYPE)(m >> 0); \ + sum += (NTYPE)(n >> 16) * (MTYPE)(m >> 16); \ + sum += (NTYPE)(n >> 32) * (MTYPE)(m >> 32); \ + sum += (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 /* 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) From patchwork Mon Jul 11 13:57:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 589365 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:bb16:0:0:0:0 with SMTP id jd22csp3292190mab; Mon, 11 Jul 2022 07:20:39 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vv3jYipM64pk0bHJJN3HmhQwB7iYlXGsfSXb0pyOrq7XB3FSaPUBH0Zf4knNLRDL0NOi6Q X-Received: by 2002:ac8:7e8f:0:b0:31e:a1fe:8155 with SMTP id w15-20020ac87e8f000000b0031ea1fe8155mr13929688qtj.220.1657549239420; Mon, 11 Jul 2022 07:20:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657549239; cv=none; d=google.com; s=arc-20160816; b=DWI2GPkvvq1/ENWqLFzzh5kWzByObyCcNWHpSQahBedJCnqIqGl7E90WmumrhrX9K/ Q97fwBcon1d7H/lmm069kajlAY1c0YX6s1RKNntimhpV0rU8lSP42WCbBBrgTYnKQfQB HklzeoK1sytCXQIEF49pBVuFwqahvIOsESo5gnkjK7Q8nPjO8zdqA4mLthCDP26GG3gL wXbiPd/scBNjPgWbff3e+Q8A8A+5PXk8xbmJHxa77n4H+7QU+tHPiDI19rXcyo4NjsB/ y2wxibLlNpN/r6+L1GSZjgZsf5l6sCRpaofeMxpHG3dJBkT80Px3koYVP1TEka/zeOdR t/fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=xJStjhVhh8lM0KlESTH9cBr5cEkP8jOBDsIB6MUlD9s=; b=RFpL1FaT9WQ+/PDNKUFvAEHzPi5t65oXVoqXt8zOEoF2tVdLhdqznGES4hhMFcgRQS iydHDTWesnltVqoO46rS7BJbFVoIDHBz44ZKyHmtnlCWmDRtVYUzfZuQJKwC/z8cLdBe q1EL161FHUJ9+o04WQl4m9SoMnOo/Nhdy7MClqr3T7GL16HLP1rs29hpBDfZBmyWOLbG SnVJ/E55LoR73ZXFa6FWXeHyi90UylNWiMtHFdekkbmo+KhGhnl71dGUghbCp9yHxny9 5hp65L2TKExGICPymKSstrfrIu3jV1EoMn6+9we4pA5JyMc3Ch5ByU+UwBqUPjKmx2nS tBXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HHVnnJSl; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id a185-20020a3798c2000000b006b577e42e0csi3112822qke.681.2022.07.11.07.20.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Jul 2022 07:20:39 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HHVnnJSl; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:50990 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oAuH8-0000Il-Pn for patch@linaro.org; Mon, 11 Jul 2022 10:20:38 -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 ) 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 ) 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 ; 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=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-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) 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 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jul 2022 06:58:15 -0700 (PDT) From: Peter Maydell 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 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson 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 Signed-off-by: Richard Henderson Message-id: 20220708151540.18136-29-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- 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=2 ### SVE2 floating-point bfloat16 dot-product (indexed) BFDOT_zzxz 01100100 01 1 ..... 010000 ..... ..... @rrxr_2 esz=2 + +### SVE broadcast predicate element + +&psel esz pd pn pm rv imm +%psel_rv 16:2 !function=plus_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=%psel_rv + +PSEL 00100101 .. 1 ..1 .. 01 .... 0 .... 0 .... \ + @psel esz=0 imm=%psel_imm_b +PSEL 00100101 .. 1 .10 .. 01 .... 0 .... 0 .... \ + @psel esz=1 imm=%psel_imm_h +PSEL 00100101 .. 1 100 .. 01 .... 0 .... 0 .... \ + @psel esz=2 imm=%psel_imm_s +PSEL 00100101 .1 1 000 .. 01 .... 0 .... 0 .... \ + @psel esz=3 imm=%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) 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 = vec_full_reg_size(s); + int pl = pred_gvec_reg_size(s); + int elements = 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 = tcg_temp_new_i64(); + dbit = tcg_temp_new_i64(); + didx = tcg_temp_new_i64(); + ptr = 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; +} From patchwork Mon Jul 11 13:57:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 589371 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:bb16:0:0:0:0 with SMTP id jd22csp3296548mab; Mon, 11 Jul 2022 07:25:59 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vbs/yKEAIJGOCzHo03vYFusu7H7NK5e8PzU05Ev5X8vv648tYfsD5JtLJxBMiH90MF0bJa X-Received: by 2002:a37:bf86:0:b0:6b5:7427:3d08 with SMTP id p128-20020a37bf86000000b006b574273d08mr6949280qkf.597.1657549559740; Mon, 11 Jul 2022 07:25:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657549559; cv=none; d=google.com; s=arc-20160816; b=lNJJ89V0GCvv/7QCAdEriiIFrapQLiezV94jcqzrXDqjUsczA3Sz//NboNYxAsH4+r VZqjDS3nkFpPY6TrjlnekBoJtj5yFDlk7NKiv5ZIu+F6DGmMToHxc9MnRTSsF8ajwMr+ Fi4suwzQRFTMLffGSnN8RrZBL8pjOjO8zOPJ2OwMLcu8851nVzGsCsldCuCVc+I+rC/T ytonBl9iHkxOfaG0j/yoNMelZ9x4l8zznUzRTTK9cwmnvatp9q5Wp5gudTE+cX14oBws Z+ehYXYP0t1nc5JVGVSMLJmSQHi3xhyaBcX3mRriM0wlipd30MtNmMSyc/Fld85//spv PF6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=q781D2NAiISZsnf5qYib8iLZW0xTOuik/EP0N0QqMfE=; b=wG2MG2hAll9HZQwRWhwfyQnIh4ZQcf/7b/wA8zTR6bNUT94uHEM0PMTP2ZOxzqlVPh JISABUhd31qUV/F6DY6t4aMJuq8megc2qT1omkG3PneSb786wkXGChn4BOLJPqvYx9Gm wlc5P9bJEeVQ/Vw+xX3q/9VbiglYVqo42y2wT4ZIwGyfwW5bPYaIfF2cYZdCkAgSzazI Pf+IwtyVLpeXKAcubm0jTqs+3+cfZXsnktxwlG+4gO+d4lImklzE6300N6RnUBPJc+3c JJUtdoCZrJYm//Xaxkn5I3uzMEKt4QJSTzas5Ip7JAQL9rrxr9NEt7XPmnbJBX1K29m3 Ajrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KsFPEzam; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id n8-20020a05620a294800b006af2a698b86si5244790qkp.711.2022.07.11.07.25.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Jul 2022 07:25:59 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KsFPEzam; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:34280 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oAuMJ-0000jl-8h for patch@linaro.org; Mon, 11 Jul 2022 10:25:59 -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 ) 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 ) 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 ; 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=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-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) 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 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jul 2022 06:58:16 -0700 (PDT) From: Peter Maydell 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 Received-SPF: pass client-ip=2a00:1450:4864:20::435; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x435.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson 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 Signed-off-by: Richard Henderson Message-id: 20220708151540.18136-30-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- 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, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(sve_revw_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +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 # 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) DO_ZPZ_D(sve_revw_d, uint64_t, wswap64) +void HELPER(sme_revd_q)(void *vd, void *vn, void *vg, uint32_t desc) +{ + intptr_t i, opr_sz = simd_oprsz(desc) / 8; + uint64_t *d = vd, *n = vn; + uint8_t *pg = vg; + + for (i = 0; i < opr_sz; i += 2) { + if (pg[H1(i)] & 1) { + uint64_t n0 = n[i + 0]; + uint64_t n1 = n[i + 1]; + d[i + 0] = n1; + d[i + 1] = 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 == 3 ? gen_helper_sve_revw_d : NULL, a, 0) +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) From patchwork Mon Jul 11 13:57:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 589379 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:bb16:0:0:0:0 with SMTP id jd22csp3309987mab; Mon, 11 Jul 2022 07:42:50 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uvYlTzW+jW7Frg4rmbXkh3/9QgMxTHzfxpuELtdTe4FcoO0HKEfsK/dCCeCf+I9mIGCCPt X-Received: by 2002:a05:622a:612:b0:31e:a8cd:c449 with SMTP id z18-20020a05622a061200b0031ea8cdc449mr11685484qta.321.1657550570477; Mon, 11 Jul 2022 07:42:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657550570; cv=none; d=google.com; s=arc-20160816; b=ah6fl+M4knSiVeOyBO3fgJ8EVybW77CG2TqFv3opQAwGsnVJa7h+nFSOmyiDchukmT eK5B8PBoBkEiar+ob9BD4MXM5VsTTj/QYiT4DfvFqgQretfLbWC2v3qX77PT4ekfAbVh j2cnPy/XFyQ7CkTDXC916SZiFkeY5gR9hZZO8bHkFsImHTcPzY9w3iFOTewh11IbOsFy ZZigPCeYeQ42lWRWmy1JOzZ9XQxxfMTidmNzs046HRpk2bt4X699cc0Yz6jtcdIyQ914 wTwqbhDza60dDLv5Izik7hDz7KfmNSryntijM3GcbM7ALERAcmuQ2JqZsPJHh859QLU3 uFPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=NefM+zE4IIZS4r9ntXfwlEBdnRvPOEaUwHvQJzfMAXc=; b=UL+agjT6qB9YZFPhjUwnTXeNYsCWus0crcpyC7waAKCYxOA/oEP2GXEeBdxvAae9Cu L9Fur2K2A9rfPUPqjp7o1oPweleksrslYkfcQAc0t2tNgyjFdpbkvG3LcNFYr8VuxxlR JhKszPHOOesS4ik4Cipyj/VJ7BIyTta51AZfntNygJf9lIfw2cvyoDq87r9iGRrAWOI6 LwcrjpKDyx8JK9m5Eb6Mip0qFLQMfFJaALdLwhLD9O/p0fwKdhsUoaIGYt/Bw2Feq/R5 LHomE/B6i/ov9mz9NEMHxS13A6aCPP2lFfpohNJjCkrCQqn/tSe+L8qU6aOvymyvh9DU lUQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="HaTW4r/n"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id jf7-20020a0562142a4700b004703f981a0bsi4324889qvb.28.2022.07.11.07.42.50 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Jul 2022 07:42:50 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="HaTW4r/n"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:56720 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oAucb-0001Dm-Vj for patch@linaro.org; Mon, 11 Jul 2022 10:42:50 -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 ) 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 ) 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 ; 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=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-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) 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 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jul 2022 06:58:17 -0700 (PDT) From: Peter Maydell 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 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson 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 Signed-off-by: Richard Henderson Message-id: 20220708151540.18136-31-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- 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) +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=2 imm=%psel_imm_s PSEL 00100101 .1 1 000 .. 01 .... 0 .... 0 .... \ @psel esz=3 imm=%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[] = { + INDEX_op_smin_vec, INDEX_op_smax_vec, 0 + }; + static const GVecGen4 ops[4] = { + { .fniv = gen_sclamp_vec, + .fno = gen_helper_gvec_sclamp_b, + .opt_opc = vecop, + .vece = MO_8 }, + { .fniv = gen_sclamp_vec, + .fno = gen_helper_gvec_sclamp_h, + .opt_opc = vecop, + .vece = MO_16 }, + { .fni4 = gen_sclamp_i32, + .fniv = gen_sclamp_vec, + .fno = gen_helper_gvec_sclamp_s, + .opt_opc = vecop, + .vece = MO_32 }, + { .fni8 = gen_sclamp_i64, + .fniv = gen_sclamp_vec, + .fno = gen_helper_gvec_sclamp_d, + .opt_opc = vecop, + .vece = MO_64, + .prefer_i64 = TCG_TARGET_REG_BITS == 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[] = { + INDEX_op_umin_vec, INDEX_op_umax_vec, 0 + }; + static const GVecGen4 ops[4] = { + { .fniv = gen_uclamp_vec, + .fno = gen_helper_gvec_uclamp_b, + .opt_opc = vecop, + .vece = MO_8 }, + { .fniv = gen_uclamp_vec, + .fno = gen_helper_gvec_uclamp_h, + .opt_opc = vecop, + .vece = MO_16 }, + { .fni4 = gen_uclamp_i32, + .fniv = gen_uclamp_vec, + .fno = gen_helper_gvec_uclamp_s, + .opt_opc = vecop, + .vece = MO_32 }, + { .fni8 = gen_uclamp_i64, + .fniv = gen_uclamp_vec, + .fno = gen_helper_gvec_uclamp_d, + .opt_opc = vecop, + .vece = MO_64, + .prefer_i64 = TCG_TARGET_REG_BITS == 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, void *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 = simd_oprsz(desc); \ + for (i = 0; i < opr_sz; i += sizeof(TYPE)) { \ + TYPE aa = *(TYPE *)(a + i); \ + TYPE nn = *(TYPE *)(n + i); \ + TYPE mm = *(TYPE *)(m + i); \ + TYPE dd = MIN(MAX(aa, nn), mm); \ + *(TYPE *)(d + i) = 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) From patchwork Mon Jul 11 13:57:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 589374 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:bb16:0:0:0:0 with SMTP id jd22csp3303562mab; Mon, 11 Jul 2022 07:34:28 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uo9lqSjuT40zbwzwZygUCQ6Qb3TiWTbjjxKWbZ5V7dEDToRRZRsAt/OYX1Tmf9elEF8Ayl X-Received: by 2002:ac8:5801:0:b0:31d:4c67:6f3 with SMTP id g1-20020ac85801000000b0031d4c6706f3mr14028206qtg.46.1657550068384; Mon, 11 Jul 2022 07:34:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657550068; cv=none; d=google.com; s=arc-20160816; b=jPEpnj9Gp0WCJyu+3qTP5c8kGzVQbV8mzt3zSZ2q29bQNqIG/JN9kmnkA/OyU2+6T3 0V5VRY/6JasgUH244ML7IyJ4Z85krKpooetq0ZyTH8vPxd3BtaiPBqAF2VYDV+oif1sz 67KgyuT1lAkgrhKm8KTP5C1wiBssu9Ci6cOpMgBOszDbv5cyaweefRSlVM+02EvQ4lNo zc3MgXbMegHpXN0Z6n8WuxNQ9ClQ7qWpEwyIee+VZf+ZybAz8Md3/xrJmS5q0dPvvhht X2r1PShOs85kXY6xt47sKEB9YlLGXo1DTwTMFPh/0NeiT6hCltXygKhLfm80eacLjm80 rD0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=HEJdzVygGY0s6uguuLvn1wUd1JpqYr/BZXBoM1CiCf4=; b=efYc3JLMoGBdjYvtw589d/4Fo+BNuoxBpLPe9x+YDfCRqVtleJmv26oKaiWqcReOVr OF1B+H28CkpNTzSVNTKkkQJFl08lE0KWrnaws7/CzgBHYI4+/8OquFd9OiT8IXWmNyZN B1cqiW5mtILxr3NMTqEY8yWSSilTN33lLjF8sTOmm83xqUOQyDwj3H3rHNvjtNh/fOMO VADxRMadaAXL3j/cgFJnGvXHc6L+WQPUsuv9uD/UrazlDP/IdbqKKSTy71u93bh3ZESz 1NS2zbSpfUTySEsMduRzZSgd/OGb5rbh1zdyCjUeS5OOy5k3VsikM8WHCvcLDv33mQ/E 0B7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=d1KW+XGJ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id l26-20020a37f51a000000b006a711bb7498si3560353qkk.277.2022.07.11.07.34.28 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Jul 2022 07:34:28 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=d1KW+XGJ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:42502 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oAuUU-0007HJ-Pp for patch@linaro.org; Mon, 11 Jul 2022 10:34:26 -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 ) 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 ) 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 ; 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=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-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) 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 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jul 2022 06:58:18 -0700 (PDT) From: Peter Maydell 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 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson We can handle both exception entry and exception return by hooking into aarch64_sve_change_el. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20220708151540.18136-32-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- 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 old_el, return; } + old_a64 = old_el ? arm_el_is_aa64(env, old_el) : el0_a64; + new_a64 = 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 != 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 old_el, * we already have the correct register contents when encountering the * vq0->vq0 transition between EL0->EL1. */ - old_a64 = old_el ? arm_el_is_aa64(env, old_el) : el0_a64; old_len = (old_a64 && !sve_exception_el(env, old_el) ? sve_vqm1_for_el(env, old_el) : 0); - new_a64 = new_el ? arm_el_is_aa64(env, new_el) : el0_a64; new_len = (new_a64 && !sve_exception_el(env, new_el) ? sve_vqm1_for_el(env, new_el) : 0); From patchwork Mon Jul 11 13:57:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 589382 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:bb16:0:0:0:0 with SMTP id jd22csp3312846mab; Mon, 11 Jul 2022 07:46:47 -0700 (PDT) X-Google-Smtp-Source: AGRyM1t36szwV8I/ebbsDuAvcinqo1VNcHcRqeb+RXjIX2kJhBAvrWHVYVZI8wzTUxS/EQwJyeic X-Received: by 2002:ac8:588b:0:b0:31e:b6a8:ed64 with SMTP id t11-20020ac8588b000000b0031eb6a8ed64mr2631122qta.636.1657550806996; Mon, 11 Jul 2022 07:46:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657550806; cv=none; d=google.com; s=arc-20160816; b=tYt8W4gGeRNVIl7Pa5izjd+imwG+TFxOQZYNmB1e8mFb/xqGOq5wR0BT1VXua3Bn41 kXsCKdTG8LQo5eZyLGru95Qk2sQPd8iUEltNc7wrbPiq+QDSEvwouZYYfy4m3zkPoxIp oemDSXPWCeXPq4YRCySc6RFK+TeuUPB1Y34NsnvZuli3ziWjDWX/F9Oy25we0C8ecxry RTVtNofq9cOYh4xkrqZ9T5y3NehTVwD1J6YcdNcqXKG68Tw8U5IDRSbapn9E0uAPIL0D 7q/5R+NIGFuHEqKnvbdgC+k/BPQJiYTQx45GGReMzZuHM6SXYdhBok8h/FFPslVm2Xiw tCvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=ZwtZ0mOyj+i0qaAFT/4uFTt0YWVAMrJV8kc5O+TbtwE=; b=i3gYumVF4GYZJEUTviEqxQAKkkSqHp+dYFHgQlt94eXrQznqwAcA7ak9vh8x82mmHl XgkfWFfO6vRr1/m01mwg8GV1I/yoMZir18gzK0eocoe5YVpjfQfDVmOGcg2cDjk9PPLd zLkW/e0omu+0HDVnPRP+4r0MVXSa2OAH5JIXV7YHhrGL0pQ7oxD7oaXhslKytft6Tt++ NLkAY5aOBKemZnBkiJtFMHJ4kvyE1EkWSrEnQXnIFZpBvl8Cwg/4xGMJ4Uwt61hqjD5e caPf2BPnLaf8uDTg6uA4Dc656S9vj5I1eJ4PwXlpAsX+J0o4R2J8xURiphabui9MjCJI DHyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QGTTcMZm; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 7-20020a05621420c700b004564d25bac7si5218891qve.167.2022.07.11.07.46.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Jul 2022 07:46:46 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QGTTcMZm; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:37624 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oAugQ-0007Y5-H8 for patch@linaro.org; Mon, 11 Jul 2022 10:46:46 -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 ) 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 ) 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 ; 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=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-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) 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 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jul 2022 06:58:19 -0700 (PDT) From: Peter Maydell 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 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson 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 Signed-off-by: Richard Henderson Message-id: 20220708151540.18136-33-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- 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 instructions) +- FEAT_SME_I16I64 (16-bit to 64-bit integer widening outer product instructions) - 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 = FIELD_DP64(t, ID_AA64PFR1, MTE, 3); /* FEAT_MTE3 */ t = FIELD_DP64(t, ID_AA64PFR1, RAS_FRAC, 0); /* FEAT_RASv1p1 + FEAT_DoubleFault */ + t = FIELD_DP64(t, ID_AA64PFR1, SME, 1); /* FEAT_SME */ t = FIELD_DP64(t, ID_AA64PFR1, CSV2_FRAC, 0); /* FEAT_CSV2_2 */ cpu->isar.id_aa64pfr1 = t; @@ -1074,6 +1075,16 @@ static void aarch64_max_initfn(Object *obj) t = FIELD_DP64(t, ID_AA64DFR0, PMUVER, 5); /* FEAT_PMUv3p4 */ cpu->isar.id_aa64dfr0 = t; + t = cpu->isar.id_aa64smfr0; + t = FIELD_DP64(t, ID_AA64SMFR0, F32F32, 1); /* FEAT_SME */ + t = FIELD_DP64(t, ID_AA64SMFR0, B16F32, 1); /* FEAT_SME */ + t = FIELD_DP64(t, ID_AA64SMFR0, F16F32, 1); /* FEAT_SME */ + t = FIELD_DP64(t, ID_AA64SMFR0, I8I32, 0xf); /* FEAT_SME */ + t = FIELD_DP64(t, ID_AA64SMFR0, F64F64, 1); /* FEAT_SME_F64F64 */ + t = FIELD_DP64(t, ID_AA64SMFR0, I16I64, 0xf); /* FEAT_SME_I16I64 */ + t = FIELD_DP64(t, ID_AA64SMFR0, FA64, 1); /* FEAT_SME_FA64 */ + cpu->isar.id_aa64smfr0 = t; + /* Replicate the same data to the 32-bit id registers. */ aa32_max_features(cpu); From patchwork Mon Jul 11 13:57:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 589362 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:bb16:0:0:0:0 with SMTP id jd22csp3289643mab; Mon, 11 Jul 2022 07:17:43 -0700 (PDT) X-Google-Smtp-Source: AGRyM1swu9+SxDD31qroeJ5TnV+gpPbgo4l5Dq5MyVQxv6HFAcOCs7hLqAELq6A8V+GYQvztSe8Q X-Received: by 2002:a05:622a:1a21:b0:2f1:f29e:40a with SMTP id f33-20020a05622a1a2100b002f1f29e040amr14269576qtb.235.1657549063055; Mon, 11 Jul 2022 07:17:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657549063; cv=none; d=google.com; s=arc-20160816; b=Vf1ySOyVZaui2iPzsXJmHtcCgU70bfPtynnJex1Ph9qEKfaQZO8IKDAJPy9PGcLK48 KVfLQAiJ/JDATKEAwhZoIgSOIttnnjXjouis9aQ0+L2gUk6ofWcp1HMSC8SzyJFdLqfI Yv0kyt+ncBCi5LBOQae57AsFuYywXd2nEJncxwSNgfvN+nGZYtp41HVAUQvBnAOD4B6R t1DUX/dOcgHCLUbU4k2I0ReDaWAKboiBTGA53RMml/baeHnUAXlWjo9O6Df+Y9I+bfB8 u+GiLum4UEUJVhBb9qFU/aTn/NphIU2gZ049tzZxqerQcCOwY8vsfrBUW5wHtRQgXrpb z1Yg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=korErL6tl7BONUfbCJvMnIcz8S+EeAk7Q1N3xczdPYQ=; b=UU6ZNY0MAoMdeWw2pTWcIXiaCminXJC8bLEe1kEgedtUMQNaJY+xd0RnSEeBQdouUr /sxUIqQFfU+oOoCio9nshhqswBaDYx7X5NiCtfgoj+/1l0ciRSbVTo7DbeXltGWOoKlo 4IewJq8H0MGMhYJN47EsH++PcaUNjLzqQK71NBP5omZUDOgX4l1wZT2E3C/UOFeccPHG PM3w5eUKe5W9QZNvo79x+PIQd5FVKolvYAh3xMTDsuGVPW69+RO4cWmiev4nb2sBV475 uOBbaUuwd/3vQ3SV7xl+0wzdTV+ya+oZidI4g5bd/zxdwihc1GE6aHj964RSU0q/tNYT mCTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aNRZw6Cv; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id bb29-20020a05622a1b1d00b0031eb00172bcsi3344356qtb.333.2022.07.11.07.17.43 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Jul 2022 07:17:43 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aNRZw6Cv; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:46250 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oAuEI-0005JV-IW for patch@linaro.org; Mon, 11 Jul 2022 10:17:42 -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 ) 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 ) 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 ; 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=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-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) 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 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jul 2022 06:58:19 -0700 (PDT) From: Peter Maydell 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 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20220708151540.18136-34-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- 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_cpu.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 *env, unsigned flags) 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] = newtls; + /* TPIDR2_EL0 is cleared with CLONE_SETTLS. */ + env->cp15.tpidr2_el0 = 0; } static inline abi_ulong get_sp_from_cpustate(CPUARMState *state) From patchwork Mon Jul 11 13:57:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 589366 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:bb16:0:0:0:0 with SMTP id jd22csp3294241mab; Mon, 11 Jul 2022 07:23:04 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tAhZP4GCDDs/amAktkaaOdcRg2H4wjWeFkFwLx7M2q53W8ISEZJb78NCbTKXpz9UfB+jTs X-Received: by 2002:a05:6214:410a:b0:473:38b7:e09c with SMTP id kc10-20020a056214410a00b0047338b7e09cmr13818862qvb.26.1657549384885; Mon, 11 Jul 2022 07:23:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657549384; cv=none; d=google.com; s=arc-20160816; b=u/zIfDM7W5U1pvcjTuZik408EpX1zqf15FNqtoL/VSDJiyyiBMWOLGuN33GN7HP2K8 k/7DRdUK2/CMS+y2gxlqyZ8qE4XhmCZKdt1Igwsc2P+TkApOOnLlZ1yEInuyCkhdg7/h 7+uV6LqyHS5cwlmsP4yYxR2wYp8aUD2sl3CiXoNyjkzF0prjJW/VWNSPiz9lOAPYarBt U7S0LLw6MZRcTR6u+p0DMPq0cfdQ9BltmqlO6MSZyD4h2GwySHNDUeXUT58cWhjPF8Ly lHLIQsbaVydXRlxnmsxJu59RMIqVmF9IPCqEDcvFSk0MNl37hESROHCjlfOGXDiyK21g aIxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=9bCQOBJQUNrEYM6NaGyKlOsHHz/7cHH58vaKjgHSLV8=; b=WFZ4Q+kgRd6uEMU3d7qCcb13FkPp4QQFfgKXggpgrm/vSasHvvMPabD36mpED05+gz GzopicRsrMXcX/PUuQh0u1s97fRytcJ1mcKA/3Q6BESTBmgZw3cTn/x4nn8rfriwfuoJ p+uitHaBSLcjxbfmCV5764zXT7w8iT/u+REosZGSHaJU5LHV5bjQLzDtwQScQGRuc9WJ cdY6m7bn1OQQ7f+Z3jGgkgq+7Zil/jQ4OvjVb1kY406cFYU7QrI52n5NSiMUbMQGPPVh O/VCiUHgG+A4P0u25yHe1iN4E/lp7Ulm9Kgw6Xg+sNoX+X9loeGi7rif66s2ZEjDIDtH j1Uw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=F8FJT9Ra; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id u10-20020a05620a430a00b006b57a78d648si3196539qko.671.2022.07.11.07.23.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Jul 2022 07:23:04 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=F8FJT9Ra; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:54468 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oAuJU-0002vJ-CV for patch@linaro.org; Mon, 11 Jul 2022 10:23:04 -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 ) 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 ) 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 ; 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=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-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) 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 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jul 2022 06:58:20 -0700 (PDT) From: Peter Maydell 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 Received-SPF: pass client-ip=2a00:1450:4864:20::435; envelope-from=peter.maydell@linaro.org; helo=mail-wr1-x435.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20220708151540.18136-35-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- 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) switch (trapnr) { case EXCP_SWI: + /* + * On syscall, PSTATE.ZA is preserved, along with the ZA matrix. + * PSTATE.SM is cleared, per SMSTOP, which does ResetSVEState. + */ + if (FIELD_EX64(env->svcr, SVCR, SM)) { + env->svcr = FIELD_DP64(env->svcr, SVCR, SM, 0); + arm_rebuild_hflags(env); + arm_reset_sve_state(env); + } ret = do_syscall(env, env->xregs[8], env->xregs[0], From patchwork Mon Jul 11 13:57:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 589384 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:bb16:0:0:0:0 with SMTP id jd22csp3315370mab; Mon, 11 Jul 2022 07:50:31 -0700 (PDT) X-Google-Smtp-Source: AGRyM1u5D3WYU8O3iY1Q+9HwLgc/6TJpz+q/XIwIQm5mYyNq4MYC0VPDW8pwtgLm/TRpHzSWctt/ X-Received: by 2002:a05:622a:1742:b0:31d:299d:cbae with SMTP id l2-20020a05622a174200b0031d299dcbaemr14320293qtk.476.1657551031079; Mon, 11 Jul 2022 07:50:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657551031; cv=none; d=google.com; s=arc-20160816; b=ahGIldBzXbgatmk8QmCVOPM7IWy1GSsP8JiyQxeBYWT01D/W+G55IRAQlx1ALWAOBX wnFODWIePvt7+zlJP/aDSzP7mxTKGKHJ4+Ag7U+YkN2yMp2AVfu28lc1pAF/UQM+LrdQ OF0+ivvsJXGRJRpxBiupkGxEC7rr2q+x+/aEy4hpqf0yix7VyHnxr4m+i4iJunIfliAA Emz44adYDf9L0sqi6raSrxMjscbS84l2wBs1ruTlbGAKHKZ/60wwMMqhHPwE3h1jPpxA E6JY7nl+uqs6tSRUaT2YwChPmNEPje9EBwI7wMH/FuWTEXPFvkeVgeYKNF2FFgu4juzb Mh+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=y9vQj24+H/subuYvXTmDhTviP3udk/OQzLlUg2NVuHs=; b=ak3ksWWWExH9iYsg8a2Esdlq10ds3kmVjdlufwtr4Y8CpztjVr0aeYerePU/80QA6L rx6iSSHEn3b7w/Ai+vd8YoGIVEW0xvl3aYCLEP8n6VIDjUWqG8F19PkqkC1lIZewNMlx M4advbKJqAtN2ibG8vrk+cf2kPI11wmOspyBsf2B6sgZfNILVoITnlM2Qa+gBm0yx5k9 rg1FxYgnR7CSHrHCPna7hCITwVORenV2CiVRdrYcx73DE+cbPSAr8b8e1Xodp69vaUCf zI+tkx2ur4WEspyn8dFPqzU91lbFfJYvRg/oyhNfGx1kYvTo06sMpSRgItJiFPW7w5se ttIg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BJDMN9Zf; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d11-20020a05620a240b00b006b595e92cb1si516940qkn.413.2022.07.11.07.50.31 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Jul 2022 07:50:31 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=BJDMN9Zf; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:46330 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oAuk2-00059X-JB for patch@linaro.org; Mon, 11 Jul 2022 10:50:30 -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 ) 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 ) 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 ; 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=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-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) 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 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jul 2022 06:58:21 -0700 (PDT) From: Peter Maydell 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 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Make sure to zero the currently reserved fields. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20220708151540.18136-36-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- 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)) +#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; + 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); + } /* Note that SVE regs are stored as a byte stream, with each byte element * at a subsequent address. This corresponds to a little-endian store From patchwork Mon Jul 11 13:57:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 589387 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:bb16:0:0:0:0 with SMTP id jd22csp3319072mab; Mon, 11 Jul 2022 07:55:41 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vH1vHDuweYpZnwPKHQi/ejprwXw8YHDXrmWSns8MY2QBI5eWEdYbygm6cusrRLWcxzsJU0 X-Received: by 2002:ac8:5c86:0:b0:31e:ba16:23ae with SMTP id r6-20020ac85c86000000b0031eba1623aemr1160613qta.531.1657551341097; Mon, 11 Jul 2022 07:55:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657551341; cv=none; d=google.com; s=arc-20160816; b=dxG+N8Ojj72LUEdzHB547aav1+n99uIDuX2/ciwBGDGyBPXa/ir4hJpGm8w9XhH43i PwupgiJQ+gmTBfIjVmzaoE41MwKKzoYbogweie2GaPWmkqsWMD3M3Ez5vecmvAqM7KDe r8Xvm2mBQgTMfZAOdGh46WuvdhwjcTXMt2xQIuuLqce5ahqLdBoL6WjlJvJpD0K+OWj/ h6v5AHy34fFkFCleTK63mCODpXjdy5Gga2qvnO5kJ9ON+iYtbegfF4E2k8gmyfh8bkqa yg2Rg99j0mGNYAlIdrmO+WEYeysMEgAegS9phJDCL3VSiCT6oMJsybXEd4MP+YS54Ygk AQYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=v0XksmWulWyoIYEkFkRz7rlUUrdgrjXm0Tlxlvbybc0=; b=IfNqzNem+y+hduT4OEdLOZ0LqDjzpJ8iWj4Ny+MZEzKla/kAbYPxXojimJ3IHVmeKs 6vXWk4kYd4EiyYDH22Z6PXdUZnBVgI6aYrc8u4nEvXAtF2hcW+q207Qz5+nMbeh+x8Rv z2PZyb276JAzRXRlQccoJFc7/VjlMpje+ayIdNENwsrWNczbSjhZTPzhvXN+syn3xd2u 8cnO63A8Ie1AJsboG/bvqe8YBOfQPtFeqh3BK0ojpQgkb4Oy3lCWI4O+HcBTKklc/OFy 2xlfuyaoZ/KXeLn4+1lJkI68bh0FOmXsnsQhDQ09V3pYuZro1lq8smF74L7rrfASzjPS ns4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=X6PyNrCY; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id bw26-20020a05622a099a00b00302e1db52a6si4418663qtb.13.2022.07.11.07.55.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Jul 2022 07:55:41 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=X6PyNrCY; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:59912 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oAup2-00066W-IW for patch@linaro.org; Mon, 11 Jul 2022 10:55:40 -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 ) 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 ) 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 ; 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=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-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) 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 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jul 2022 06:58:21 -0700 (PDT) From: Peter Maydell 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 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Fold the return value setting into the goto, so each point of failure need not do both. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20220708151540.18136-37-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- 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 = NULL; uint64_t extra_datap = 0; bool used_extra = false; - bool err = false; int vq = 0, sve_size = 0; target_restore_general_frame(env, sf); @@ -301,8 +300,7 @@ static int target_restore_sigframe(CPUARMState *env, switch (magic) { case 0: if (size != 0) { - err = true; - goto exit; + goto err; } if (used_extra) { ctx = NULL; @@ -314,8 +312,7 @@ static int target_restore_sigframe(CPUARMState *env, case TARGET_FPSIMD_MAGIC: if (fpsimd || size != sizeof(struct target_fpsimd_context)) { - err = true; - goto exit; + goto err; } fpsimd = (struct target_fpsimd_context *)ctx; break; @@ -329,13 +326,11 @@ static int target_restore_sigframe(CPUARMState *env, break; } } - err = true; - goto exit; + goto err; case TARGET_EXTRA_MAGIC: if (extra || size != sizeof(struct target_extra_context)) { - err = 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 = true; - goto exit; + goto err; } ctx = (void *)ctx + size; } @@ -358,17 +352,19 @@ static int target_restore_sigframe(CPUARMState *env, if (fpsimd) { target_restore_fpsimd_record(env, fpsimd); } else { - err = true; + goto err; } /* 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; } static abi_ulong get_sigframe(struct target_sigaction *ka, From patchwork Mon Jul 11 13:57:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 589376 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:bb16:0:0:0:0 with SMTP id jd22csp3306365mab; Mon, 11 Jul 2022 07:38:05 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vDwMTi6B8tydEekZ5NlH8YN+Nr49ojGF71oFmlxfQlexJT2J6MayrU+c+YUYtOz/dTn0uz X-Received: by 2002:a05:620a:4507:b0:6af:348b:85fe with SMTP id t7-20020a05620a450700b006af348b85femr11813336qkp.629.1657550285103; Mon, 11 Jul 2022 07:38:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657550285; cv=none; d=google.com; s=arc-20160816; b=B4OvikfFxJB5cxvY5FhbNfM0+AYTcsDHHN8Kw6k/VyqqiOXKmIKptqNuTSeMWC/4ev T1Rfndw1RFc7amT/gKw0woYcTFNNjdf0xUANX1BqesgU/l+SPhqPiYjExZyZaasg3mwu fHT/iZD/90C3MKEpPSQtxAgScy2HIo/OoUisBvHNSzK0e9K4br1QI40dxCpSTzgFbszv rjtujk5cI5qN2Ik29rn4Y2XLD5tTXUbJvZ1Rmrj8DPLM9EPz8QqWStsJwD1s0ToZ/zAi 8+3eaeSb9nMV7k9JK7CpWIGMFdjOwyD5TgYrv9Ludad6neBlFh8DN0r5Ph7tlTdgGQyP CeYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=m/AOR0tE++/JatDV791mjXVdOhyKmyy8clrV8yxXoMI=; b=LASAOzLUUnqKIxDYh7wJ17QJOnVOA5wU3Yc5Fw8k9k97map12RMHMmjaw83vaVhStd urwxQqZhZHh7PNAkKYKKtUyLoQiIQ2NP6+9BS/rlRnKcoBLW77Dfm2IcfCNpPe86di+N BjWyXbrE7D/TBwSfWnaV7KpZNrNRUIScapZvmuGl2G4KBwH3xQ5WWGpbkngj8lCvp2dR ajABwc64jeFKTkCYDYr24ql4E4n1HxoeWSrwatELAGiAVS0Ap02eLosad+Ci/kRvZ9Lh B45RGS8pamQtDBE9Ira5Jw7CqgBw9UxlM4UNIghB3zrhF0l+XaAwBcTkXHGyezvhW6ju KDaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Aybkf3lu; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id bk42-20020a05620a1a2a00b006b593bdb677si637453qkb.728.2022.07.11.07.38.05 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Jul 2022 07:38:05 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Aybkf3lu; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:48022 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oAuY0-0003e1-Ja for patch@linaro.org; Mon, 11 Jul 2022 10:38:04 -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 ) 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 ) 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 ; 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=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-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) 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 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jul 2022 06:58:22 -0700 (PDT) From: Peter Maydell 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 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson 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 Signed-off-by: Richard Henderson Message-id: 20220708151540.18136-38-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- 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; case TARGET_SVE_MAGIC: + if (sve || size < sizeof(struct target_sve_context)) { + goto err; + } if (cpu_isar_feature(aa64_sve, env_archcpu(env))) { vq = sve_vq(env); sve_size = QEMU_ALIGN_UP(TARGET_SVE_SIG_CONTEXT_SIZE(vq), 16); - if (!sve && size == sve_size) { + if (size == sve_size) { sve = (struct target_sve_context *)ctx; break; } From patchwork Mon Jul 11 13:57:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 589388 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:bb16:0:0:0:0 with SMTP id jd22csp3320723mab; Mon, 11 Jul 2022 07:58:13 -0700 (PDT) X-Google-Smtp-Source: AGRyM1ta9A3Htl//gKMILlVVvZXYW+mi6xQqOdcl4sM9O7CzePE5ttKQc7Z8ZCelZZBNXmHEbS2G X-Received: by 2002:ac8:5807:0:b0:31e:b997:d832 with SMTP id g7-20020ac85807000000b0031eb997d832mr1515362qtg.16.1657551493217; Mon, 11 Jul 2022 07:58:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657551493; cv=none; d=google.com; s=arc-20160816; b=C9YqFRJDpB16qyZGIK2EX1pod5tA6RHv5Ag9B+2IIZbKfR/LbFmseuY6dOe7iBNiVj +AkLpLJrOgjeSBMygas+aIy6TXTexe/9uhHBw4sM0//UWSHo3CQiwt8+8j9HAN3q35r4 SKyj9cKlSeK9Omk1sNN466fJCR4VoB37uQzqpdT6VAASsDRnb3iOT2245QnQQUKI4yCb oo0mZhey+NN4Cl0HyY5Pmt0LBRhKXf4bp9JZez3+IbUr1HISLaQVCE+jibyAg1UdCK5S t8BxEefBnX0CKZnsw1pcJWneLzpyUTlzQS8OnbtYNk/2lrR67fM31W76v9300GbLnZZ1 gl5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=RcIdbbXzpewsExSM+4LX7uPRbT+xi+nVqfYtgmho4n4=; b=QeJvTbqUZhQTlTEcbgPishB+Cbh0gWNU2saNBJ00CPSi8AHJbRwmQj0tBSkUg3inSx g1oWXGDwKHUXHlTnwX2CoS3/153U9RCy86RiPfrVkLo5xDMwN/oGFltVppITnZGAXg03 v976P7nEFftOeOTrK30VUnjWTPmLGCcNcsmosxe6LwJ/uMnfa1vSB1cYqzuhLAs/Zy6h lWC0L43JVYqeNRkis+9394Hd4lewFVYbN6YcsBpGuX+vMPLlW7TEwrDludOiEWOhWJjI YkiA8vuj81H5VBbjy2FIu311syJ4tuJg6zR15808/0uTvlKjoqgqtUUcD/5p1rgtv2SZ wo9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QEind2Jf; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id h2-20020a05622a170200b0031e7910acd0si4355385qtk.780.2022.07.11.07.58.13 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Jul 2022 07:58:13 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=QEind2Jf; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:40448 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oAurU-0003bt-Ly for patch@linaro.org; Mon, 11 Jul 2022 10:58:12 -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 ) 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 ) 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 ; 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=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-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) 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 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jul 2022 06:58:23 -0700 (PDT) From: Peter Maydell 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 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20220708151540.18136-39-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- 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 = lock_user(VERIFY_READ, extra_datap, extra_size, 0); + if (!extra) { + return 1; + } break; default: From patchwork Mon Jul 11 13:57:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 589370 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:bb16:0:0:0:0 with SMTP id jd22csp3296547mab; Mon, 11 Jul 2022 07:25:59 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vhmvWSjAvKlE4GqZutbOtEDeIDDYebZOjNNm8M1bGKgsk6W3WTQ6vwQ0NkCPsmuSetKnET X-Received: by 2002:a05:622a:551:b0:31d:425c:fb8e with SMTP id m17-20020a05622a055100b0031d425cfb8emr14073695qtx.478.1657549559721; Mon, 11 Jul 2022 07:25:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657549559; cv=none; d=google.com; s=arc-20160816; b=znMvrtty7sEmUfCqpmzxkzXgKDSX7fylvUQWFyzfFJk3JCw/EDyitS4dj/g6soyCXL GEO0KW3zFV2hXhVJZ4NbzsPlHiE7Dlmavj3ho4YvPoE5Toafd6AzqHwrZUD/btJHhfxH dAODzKRr47MOdw+0Rlu8rdrh6J1PlUaXJiDsYhBitvXJ/Fr+OR+uXjmFTDhKpbQM+vl0 6ds5dzEaJjnRADGJJbXx4ltiaS712/mlvbPD1gXszlxFxQl0lYnb3aJHl91ZZ09hvxNy 4revV2dG0t7N/R1zNfRnIPMAWnSffVJSQ7rn88hPVAn1nj/LVDESvYKjlG5U7W5aj1nH buzA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=zRQNKZGKQhKr7J1kk0X1ky1/gLAO7OPNVwA91vM50lQ=; b=ZOm54WS6MB+p+lcBabeS/cOYztPmXr3rm/bdcZOCD7QJo64zmdKkdjvzOQuuk0Uw6L 6MtbjRz8goQPIVYkN7k0oO7EErfmYDF5uOaMEE6VfL+q9QwY462WcXVlKtxuXNP6xpuZ nZuDIUVqc3nE6LiS8857cLwQahg9IpVw7JM3QAv+4+a0INEBbO+hJh/k5Zitxyha1H1j qAAOqKfWdgooiimQNNQxVvsJQNnqbS/LqesMxs7K+XC0WJnN5lvlY5nQoFrew7g4uRfT mbwUYgO51byYFpOl3hB9HzNgnpAKUegw0UYE5I7JS8fVHZZcupM8weN+lMtWRZCwqF66 Ctpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dodTiylk; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id cp4-20020a05622a420400b003196e8eda00si3823398qtb.290.2022.07.11.07.25.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Jul 2022 07:25:59 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dodTiylk; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:34358 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oAuMJ-0000ms-5L for patch@linaro.org; Mon, 11 Jul 2022 10:25:59 -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 ) 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 ) 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 ; 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=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-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) 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 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jul 2022 06:58:24 -0700 (PDT) From: Peter Maydell 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 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson 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 Signed-off-by: Richard Henderson Message-id: 20220708151540.18136-40-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- 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, } } -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; - /* Note that SVE regs are stored as a byte stream, with each byte element + if (!cpu_isar_feature(aa64_sve, env_archcpu(env))) { + return false; + } + + __get_user(vl, &sve->vl); + vq = sve_vq(env); + + /* Reject mismatched VL. */ + if (vl != vq * TARGET_SVE_VQ_BYTES) { + return false; + } + + /* Accept empty record -- used to clear PSTATE.SM. */ + if (size <= 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 element * 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; } static int target_restore_sigframe(CPUARMState *env, @@ -287,7 +312,7 @@ static int target_restore_sigframe(CPUARMState *env, struct target_sve_context *sve = NULL; uint64_t extra_datap = 0; bool used_extra = false; - int vq = 0, sve_size = 0; + int sve_size = 0; target_restore_general_frame(env, sf); @@ -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 = sve_vq(env); - sve_size = QEMU_ALIGN_UP(TARGET_SVE_SIG_CONTEXT_SIZE(vq), 16); - if (size == sve_size) { - sve = (struct target_sve_context *)ctx; - break; - } - } - goto err; + sve = (struct target_sve_context *)ctx; + sve_size = size; + break; case TARGET_EXTRA_MAGIC: if (extra || size != sizeof(struct target_extra_context)) { @@ -362,8 +381,8 @@ static int target_restore_sigframe(CPUARMState *env, } /* 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; From patchwork Mon Jul 11 13:57:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 589389 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:bb16:0:0:0:0 with SMTP id jd22csp3323244mab; Mon, 11 Jul 2022 08:01:14 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sR9AIw3FV2hQc9TTEDYHxVY8Eep9lXXGnK8WotTMqDr0aRlQUYpm6uUBtCx/q2MQWLykWT X-Received: by 2002:a05:620a:6011:b0:6b5:5a81:5241 with SMTP id dw17-20020a05620a601100b006b55a815241mr11818619qkb.623.1657551674135; Mon, 11 Jul 2022 08:01:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657551674; cv=none; d=google.com; s=arc-20160816; b=058gnJsjyMXGrAmKvB7JAen2YRsUQW5+vKM9E1UfnL4Gc/D53S5g+iYnlELMAvZtll wqI9DSXMQvD/aK5E7DtbDa2k+sGP928raYRyHWGud2EQIBfqung3yz3jw2DhQZy0N9QH dmdKyElFp6HpFo0IBIeounMdPCVS9FmTDhhktK212AnugsGSxDlfDf7KnzSghVRve/6q RhQ/uLi/m7D413Dh4pK6BFi9abiiJD3Ducy/Sb/Cb8fLOzhQYveVGLqypOnFytvMyim/ OVIWZFk0DvOxVSgO+syVCuBQyiMRUdoUfGp3zLhxFX5Xe6NCKxm7jTpuYaRXwOO96qk+ IUDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=pCPJDwjnczLHYV5M/KTJGoCxy94q+B5Z63OSCHqyluc=; b=EW/mc8sFi803xE8unZcoRvEDdg8b67oPKL5ihHh135nnSD4VQHTk7C0qcHaLGhcJVQ QOEIRxJe8bAyxKlLKDpjbvgm0J+byv57+tik6wbO0Hg7i21uw/ELVRM4uqa+3JxwzEFw 03rB0yQB7Fq534x/710XZsVzNJOrgSp2Ip2vEcZ02UNHQClPiic3tK9DVzJsTXySEyPI +VjzbCoSDgPmy3pE/V9HMYDEAgoE27nLREg2+We9/9vDy7zF1z7388bwDZwlb2GpSESp YHWuEgyCkAQP2X0w66fEWpw952rNsZ0JEjgUKeGQMcVDxObeSLPRRIE662/w4b+PYTSd G8qw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oG0DMK5v; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id g11-20020ac8124b000000b00304e119d071si3693531qtj.520.2022.07.11.08.01.13 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Jul 2022 08:01:14 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=oG0DMK5v; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:48848 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oAuuO-0000hw-3F for patch@linaro.org; Mon, 11 Jul 2022 11:01:12 -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 ) 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 ) 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 ; Mon, 11 Jul 2022 06:58:26 -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-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) 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 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jul 2022 06:58:25 -0700 (PDT) From: Peter Maydell 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 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson 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 Signed-off-by: Richard Henderson Message-id: 20220708151540.18136-41-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- 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 { #define TARGET_SVE_SIG_FLAG_SM 1 +#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_aarch64_ctx *end) } 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 = sve_vq(env); 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, } } +static void target_setup_za_record(struct target_za_context *za, + CPUARMState *env, int size) +{ + int vq = sme_vq(env); + int vl = 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 == TARGET_ZA_SIG_CONTEXT_SIZE(0)) { + return; + } + assert(size == 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 = 0; i < vl; ++i) { + uint64_t *z = (void *)za + TARGET_ZA_SIG_ZAV_OFFSET(vq, i); + for (j = 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, 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; - if (!cpu_isar_feature(aa64_sve, env_archcpu(env))) { + __get_user(vl, &sve->vl); + __get_user(flags, &sve->flags); + + sm = 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; } - __get_user(vl, &sve->vl); - vq = 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 = sve_vqm1_for_el_sm(env, 0, sm) + 1; /* Reject mismatched VL. */ if (vl != vq * TARGET_SVE_VQ_BYTES) { @@ -278,6 +335,8 @@ static bool target_restore_sve_record(CPUARMState *env, return false; } + *svcr = FIELD_DP64(*svcr, SVCR, SM, sm); + /* * Note that SVE regs are stored as a byte stream, with each byte element * at a subsequent address. This corresponds to a little-endian load @@ -304,15 +363,57 @@ static bool target_restore_sve_record(CPUARMState *env, return true; } +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 = sme_vq(env); + + /* Reject mismatched VL. */ + if (vl != vq * TARGET_SVE_VQ_BYTES) { + return false; + } + + /* Accept empty record -- used to clear PSTATE.ZA. */ + if (size <= 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 = FIELD_DP64(*svcr, SVCR, ZA, 1); + + for (i = 0; i < vl; ++i) { + uint64_t *z = (void *)za + TARGET_ZA_SIG_ZAV_OFFSET(vq, i); + for (j = 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 = NULL; struct target_fpsimd_context *fpsimd = NULL; struct target_sve_context *sve = NULL; + struct target_za_context *za = NULL; uint64_t extra_datap = 0; bool used_extra = false; int sve_size = 0; + int za_size = 0; + int svcr = 0; target_restore_general_frame(env, sf); @@ -350,6 +451,14 @@ static int target_restore_sigframe(CPUARMState *env, sve_size = size; break; + case TARGET_ZA_MAGIC: + if (za || size < sizeof(struct target_za_context)) { + goto err; + } + za = (struct target_za_context *)ctx; + za_size = size; + break; + case TARGET_EXTRA_MAGIC: if (extra || size != sizeof(struct target_extra_context)) { goto err; @@ -381,9 +490,16 @@ static int target_restore_sigframe(CPUARMState *env, } /* 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 != svcr) { + env->svcr = svcr; + arm_rebuild_hflags(env); + } unlock_user(extra, extra_datap, 0); return 0; @@ -451,7 +567,8 @@ static void target_setup_frame(int usig, struct target_sigaction *ka, .total_size = offsetof(struct target_rt_sigframe, uc.tuc_mcontext.__reserved), }; - int fpsimd_ofs, fr_ofs, sve_ofs = 0, vq = 0, sve_size = 0; + int fpsimd_ofs, fr_ofs, sve_ofs = 0, za_ofs = 0; + int sve_size = 0, za_size = 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 target_sigaction *ka, &layout); /* SVE state needs saving only if it exists. */ - if (cpu_isar_feature(aa64_sve, env_archcpu(env))) { - vq = sve_vq(env); - sve_size = 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 = QEMU_ALIGN_UP(TARGET_SVE_SIG_CONTEXT_SIZE(sve_vq(env)), 16); sve_ofs = 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 = TARGET_ZA_SIG_CONTEXT_SIZE(sme_vq(env)); + } else { + za_size = TARGET_ZA_SIG_CONTEXT_SIZE(0); + } + za_ofs = alloc_sigframe_space(za_size, &layout); + } 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); } /* Set up the stack frame for unwinding. */ @@ -536,6 +665,18 @@ static void target_setup_frame(int usig, struct target_sigaction *ka, env->btype = 2; } + /* + * 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 = 0; + arm_rebuild_hflags(env); + } + if (info) { tswap_siginfo(&frame->info, info); env->xregs[1] = frame_addr + offsetof(struct target_rt_sigframe, info); From patchwork Mon Jul 11 13:57:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 589390 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:bb16:0:0:0:0 with SMTP id jd22csp3327553mab; Mon, 11 Jul 2022 08:05:05 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sQYeDxHFdu82oyp6yf9yAuakjiHQ4U54YSEAQZ6BVulXvs+eCvQUpzoETimvAm717pvrDd X-Received: by 2002:a05:620a:1430:b0:6b5:9527:817d with SMTP id k16-20020a05620a143000b006b59527817dmr1468426qkj.659.1657551904923; Mon, 11 Jul 2022 08:05:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657551904; cv=none; d=google.com; s=arc-20160816; b=d4G6KutsJtjW32B4CgOci8oGhxIGttxcyxs1q2y/kWNEySNI85iZHU1NjnwlIKyED8 fk4YlKZ2qgkz6fKc561Flrtcu67y83/c47mVIqx0qRNECLXmMS8IDe0qxuF2yXFkaj1r ohuORGskG4WC8mg82kKJRvGQXWWNuoIU82UEjPHBZ9gHYBeoZ0/1cGYe7GkBu4yXlkAa r+XlrFF18hKiXSVOZ3USs/CR6RCamWAU9yctpr/x/NNuLB2sVeVWRmiesgafGi+f0sxX BCuuob6m4nUdeegknhs7FSONIUJVoTOuaBjxApNJ3XZNwZX4Xs/S27bnuEn9bPXa24d+ QH/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=3gpC6QDBrlRqoUDnAZkgkjjrqEX50o6S3J99cjzYYnI=; b=V3GjX7cwsMuYb2FmSeSe9xm7oCzCxA/WbHeP6t6wsgZCi2hVqeB/wsaKKORnIIM0im A7ThHOrNiFNRyA/z7fdhPof2/0Zsk7yBFXK81MH7kDKfWLJBVB1sQWwOMAWORbWNlU+H dWiciIkfu/7qzedN4NEkRQN57CdqmJATMDx9H2HfmVOF+lR69uNTSMpufQuNSUjrnNsq T95tj18Q+EykpR53k+lzJNrHe2DDh2qkpLju2o5Nc7YzJ6mk7kYnxxB/Uzh5YlO9ix2h 0bWPP524EXccpvkGAefnFWIDokkkNrvaVY5ScqILYm1A1fw5PcVUf8Swy7CEThqaHOGt AnGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WsOSTcmb; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id j14-20020a05620a288e00b006b579775d2bsi3747764qkp.126.2022.07.11.08.05.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Jul 2022 08:05:04 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WsOSTcmb; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:55770 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oAuy6-0005a5-6r for patch@linaro.org; Mon, 11 Jul 2022 11:05:02 -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 ) 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 ) 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 ; 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=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-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) 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 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jul 2022 06:58:25 -0700 (PDT) From: Peter Maydell 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 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Add "sve" to the sve prctl functions, to distinguish them from the coming "sme" prctls with similar names. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20220708151540.18136-42-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- 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 -static abi_long do_prctl_get_vl(CPUArchState *env) +static abi_long do_prctl_sve_get_vl(CPUArchState *env) { ARMCPU *cpu = 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 -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_long arg2) } return -TARGET_EINVAL; } -#define do_prctl_set_vl do_prctl_set_vl +#define do_prctl_sve_set_vl do_prctl_sve_set_vl 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; From patchwork Mon Jul 11 13:57:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 589391 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:bb16:0:0:0:0 with SMTP id jd22csp3330115mab; Mon, 11 Jul 2022 08:07:33 -0700 (PDT) X-Google-Smtp-Source: AGRyM1t+VefmXMAPXjJZYhg+LF2aD8xq+uR+gecWomVbb0m1qNb1u6/FImMDi3rJlVer4KSOkWnr X-Received: by 2002:ac8:7f46:0:b0:31e:9dba:acf3 with SMTP id g6-20020ac87f46000000b0031e9dbaacf3mr14295240qtk.556.1657552053784; Mon, 11 Jul 2022 08:07:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657552053; cv=none; d=google.com; s=arc-20160816; b=eaAMfa4fZF6fhtu/3F1T7HFPA1Z7Eg5bHhGWz/pJCuqHNhI0VcXPJM+qAJwzB+Yt/b 1M5wwvMfJAO5LZGdaxzjoDfidyc0+fsJx1LHBq0HTvKk7ETZKKKzKluDHWsf156OBYME yz5GTisRJ3eF5HMNHhBakY8ErEg4KJSCHR4ANGdhwh7bc/pUuiMa3n52yCksXTJzKq0S QApY8Y37/Ro03u9WZ8bBjZow9MR8ssqMPt8psysGdIl/LlPAXmUEuJawiR9fq6/eWrw4 Z6RIo06K1r+UuZd6tMraolXJK995shfYhWAYEXz3xSfcN62trcwUhogQAqJkqOuzsP3n nPuw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=v+KpABCiERhEMgs7leq7TSMjJyDNMo+se3mODEwafVE=; b=t48+4imZ+V+VITbFqOP0sXzu8XoK02GVzeamIVPzMc4SsUbVeZy+pT5WAQGyZ/rShP bsqUdt35NY0d2z/Ui0lTmLMUJVMpk2YisUV6BAo0Ki4hjJ3FgVdnfRHA3TBfW9V7Ik7V c/T1UfazHerJHlDn5ct6k2yisJVOrAoXTbqnQ20BpfHvcw4t5V/bRpm360gOvaOyvDTC XCMYemM2QJql0RAtkmtZ8T0dFC+mwYoY9YNQbMScMNQaaQE4c1ApF3/HGFO0YiP1XUwc KG2lQ4CwKXmhEbUFa0nDctOb1Gq7XNpuUAYJpUo4RPz3pAUpNWrLl7dYF+o1D8THWCgr p4uA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vLBYM+P0; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d9-20020ac85449000000b0031d2a00a61dsi3769499qtq.295.2022.07.11.08.07.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Jul 2022 08:07:33 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=vLBYM+P0; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:33706 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oAv0W-0001WU-Im for patch@linaro.org; Mon, 11 Jul 2022 11:07:32 -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 ) 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 ) 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 ; 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=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-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) 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 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jul 2022 06:58:27 -0700 (PDT) From: Peter Maydell 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 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson These prctl set the Streaming SVE vector length, which may be completely different from the Normal SVE vector length. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20220708151540.18136-43-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- 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 = 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, abi_long arg2) && arg2 >= 0 && arg2 <= 512 * 16 && !(arg2 & 15)) { uint32_t vq, old_vq; + /* PSTATE.SM is always unset on syscall entry. */ old_vq = sve_vq(env); /* @@ -49,6 +51,58 @@ static abi_long do_prctl_sve_set_vl(CPUArchState *env, abi_long arg2) } #define do_prctl_sve_set_vl do_prctl_sve_set_vl +static abi_long do_prctl_sme_get_vl(CPUArchState *env) +{ + ARMCPU *cpu = 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=512, + * i.e. VL=8192, even though the architectural maximum is VQ=16. + */ + if (cpu_isar_feature(aa64_sme, env_archcpu(env)) + && arg2 >= 0 && arg2 <= 512 * 16 && !(arg2 & 15)) { + int vq, old_vq; + + old_vq = 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 = MAX(arg2 / 16, 1); + vq = MIN(vq, 16); + env->vfp.smcr_el[1] = + FIELD_DP64(env->vfp.smcr_el[1], SMCR, LEN, vq - 1); + + /* Delay rebuilding hflags until we know if ZA must change. */ + vq = sve_vqm1_for_el_sm(env, 0, true) + 1; + + if (vq != 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 = 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 = 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, abi_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 #include "target_prctl.h" @@ -6383,6 +6389,12 @@ static abi_long do_prctl_inval1(CPUArchState *env, abi_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 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; From patchwork Mon Jul 11 13:57:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 589377 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:bb16:0:0:0:0 with SMTP id jd22csp3307677mab; Mon, 11 Jul 2022 07:39:37 -0700 (PDT) X-Google-Smtp-Source: AGRyM1srpyDZRJsK954N7txzmwO6YmapwHu4ykXdI2v5lHsXxuGadeJ7mE0IMD/4IoJptWIm/0Up X-Received: by 2002:a05:622a:6185:b0:2f1:ebdd:58c with SMTP id hh5-20020a05622a618500b002f1ebdd058cmr14146136qtb.400.1657550377003; Mon, 11 Jul 2022 07:39:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657550377; cv=none; d=google.com; s=arc-20160816; b=k1MiUGBOk1QcylpZP07FMH7Y2J+do/9tgucz5itNKKV5mgIaF4/OgIKzg9b44TBVF5 RI5MELj5AM9xTxwb2lJ8aF4mduYsDjhnzadpnw201mecEjMSv8GOx2BuKcSCDPuW7ckx D043Y5FlFj23DeLd7JLMJ4RXF/zpiKrBMD8Wiydn/gbwD7SeJH58aQj16sbtUOFN3Cfp ICsfElMicwtPRv8QlcnGZdxXOlbM2Dij7w5AmIKV57CW30rDwyMLuHvZqKNwkhBCxflW BT7i23XxPD7IHuc3Q7PyyiXuJqmyffswvCF2nIWNwM6+HZP3smDpqyHtwK7VDfl9gfUy 5ZqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=H39kaTMy9J7xwr8e9kYgt0j0csqMDxRmuwJQoBhCvKw=; b=IdnY2FDdrwC5pu/ZJxMphs8nT4Mqbiq7hZaiXSbWCZLfNTZ0iI5+Vhf8Bo1mmHE9ZL pYBy6LE5Gvz/jKkR6L2l4AjJ0FWFbZLvpAkFmNw8j78DdOaEb31Tn5RAe1FgvQEAVSbQ BWLBkJLi+3seflF3l8a6aO0YE+Nwra1jMlQgDkuzGTMNQC81NA7gZDQhqsEo0iOlUncF oKa8a5WDMbrcs7MPgANy9s2JtRSBETVG7hJ9Ysuoo51FgpN9LAO5UDB81DOSdAGPuKlP PxANqRebcMbe61dEmcl72QHR/07mZ7wPztxOYIf/hcAi9Dkwz/O7RFKEUNpNATRTIZzX YEiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=d+Ji1fHz; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id bn14-20020a05622a1dce00b003050c5041f3si4136421qtb.438.2022.07.11.07.39.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Jul 2022 07:39:36 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=d+Ji1fHz; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:51314 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oAuZU-0005vc-HV for patch@linaro.org; Mon, 11 Jul 2022 10:39:36 -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 ) 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 ) 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 ; 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=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-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) 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 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jul 2022 06:58:28 -0700 (PDT) From: Peter Maydell 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 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson There's no reason to set CPACR_EL1.ZEN if SVE disabled. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20220708151540.18136-44-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- 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 = FIELD_DP64(env->cp15.cpacr_el1, CPACR_EL1, FPEN, 3); - /* and to the SVE instructions */ - env->cp15.cpacr_el1 = 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 = FIELD_DP64(env->cp15.cpacr_el1, + CPACR_EL1, ZEN, 3); env->vfp.zcr_el[1] = cpu->sve_default_vq - 1; } /* From patchwork Mon Jul 11 13:57:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 589386 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:bb16:0:0:0:0 with SMTP id jd22csp3317515mab; Mon, 11 Jul 2022 07:53:25 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uU9kqGcKHFAHrL8fYBg6Dsh62aYSRbY9dBIKPS8pdiMngng6cHTQkbmkp2h1A32C9q5b+o X-Received: by 2002:a05:620a:d54:b0:6b2:5a9b:ef2e with SMTP id o20-20020a05620a0d5400b006b25a9bef2emr11375334qkl.715.1657551205857; Mon, 11 Jul 2022 07:53:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657551205; cv=none; d=google.com; s=arc-20160816; b=WfPx0dtOs8nnbsY/hBBaCF6RXqm7y/nPbITK57BMRNsmQijBeK3JeEjx+INhTWFQnt GUepxIg35vxv+rTCCFvODMws7X+A+hSCGSvZA9aDq2a8sjOa0maoMR/nEV5cPvMhrpom +JRnp4cUS8ihTN8LKVJW5FzJ315UBMTN25PnHc9uER+bhoe+JqdUH4cEipdi0WPE9nN1 5HYUiau9Y/q7gKMYDL4QRqzOtek23u8lF9NIVl+eEF3z1GegJWGN6fzbdB4HUBMrk9z6 XNMU+TMTAYmbs4Q4Q6LQ+aw+9y1lmH5Qpghrr9MCec0mhk9z4dqdnJkUzP/4w/UzVQX8 eVHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=1sgBY9euZYqyeJsGgf1ImXhvmAEBL7DAD0J4RuefL6Q=; b=RVKc0NKoMv8l0Bj2YAigOHoc8igBFqzObrHPFFi6Zgp4GPr/jE7jH9gGfDp/+vRfM+ 8gSW+kAv3rzanquyf51Nh4bsYCGr7F5GtjQ+jSin9uFZULpKFWReiuThE76dOmAVbAR+ V6ryzq1GDAZfANue0BjS4Xj/jxF+B9A355dtGqWGvYuEGMbJEZdYrd5zr7n7QJb43xR4 bQL0qtUJ66v0HEf6lPtEQXAkRQXkZfO/5rSIjZBDqvBaU3rodFJpT0o+AnfIsdHh+AWf JZMauoZOb+A6E/Nb02mHjzQZrghlvkDHgo/dl0uThefs9xjvY2FRBIbiq4MHJEyG1yhi fUHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yerFkebC; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id r8-20020a05622a034800b0031ea24756f6si3590495qtw.679.2022.07.11.07.53.25 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Jul 2022 07:53:25 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=yerFkebC; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:54868 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oAumr-0002kC-Cz for patch@linaro.org; Mon, 11 Jul 2022 10:53:25 -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 ) 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 ) 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 ; 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-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) 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 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jul 2022 06:58:29 -0700 (PDT) From: Peter Maydell 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 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Enable SME, TPIDR2_EL0, and FA64 if supported by the cpu. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20220708151540.18136-45-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- 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] = cpu->sve_default_vq - 1; } + /* and for SME instructions, with default vector length, and TPIDR2 */ + if (cpu_isar_feature(aa64_sme, cpu)) { + env->cp15.sctlr_el[1] |= SCTLR_EnTP2; + env->cp15.cpacr_el1 = FIELD_DP64(env->cp15.cpacr_el1, + CPACR_EL1, SMEN, 3); + env->vfp.smcr_el[1] = cpu->sme_default_vq - 1; + if (cpu_isar_feature(aa64_sme_fa64, cpu)) { + env->vfp.smcr_el[1] = FIELD_DP64(env->vfp.smcr_el[1], + SMCR, FA64, 1); + } + } /* * Enable 48-bit address space (TODO: take reserved_va into account). * Enable TBI0 but not TBI1. From patchwork Mon Jul 11 13:57:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 589380 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:bb16:0:0:0:0 with SMTP id jd22csp3310678mab; Mon, 11 Jul 2022 07:43:47 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sjgSJJl9N5Q5vbME8WSmGFrrqwDmfie8h1ShYjNgxkwWehQDrv7BFOklcziRpzABoVo2e6 X-Received: by 2002:ac8:58cd:0:b0:31b:f627:733f with SMTP id u13-20020ac858cd000000b0031bf627733fmr14232725qta.627.1657550627567; Mon, 11 Jul 2022 07:43:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657550627; cv=none; d=google.com; s=arc-20160816; b=vN81Z8wahjl9sIyhbwwnQjH1i1IzoveLua+hejJdDVbwYIKFES1khlF6BoJ6hSkKGs HMV0wcdRnjZoJzRJiCMS46nYL3scmwT1vX7XO/di1d4pkuQRY1JS7Yk1eL/ISvBwjAPg SU+m62fctqoV0GEPMEvWvCBYNA4BcGd+QNIr+g22G5CIZE3f8rqQ156O+VQw3BYQ6mV3 8bVLq72KrsLDxNnK0rq97H9+wj2jXXsVoH4n6Xh0PTyTpyR7wqztNdeRBzL/0XkrvUXb C0IIfX6MWFb4WTsrJIVPgFcuIATXIyLeM5B7SpYTqqxkD2cILZGksRfWZT7pLKPevnKn htfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=ncZmjL4fnXZIwITU/tClyOmhkWxRy5n9Ldo967W1rl4=; b=hzuM1kfwzjd+d9EyuZUyx75/cVSTHpyNBSjhScC0vGNx157wRiZB9wKSAgh3r+fEaF jYAM/kPqn62j22AkNDwyXxdPp/8Rhrwc4Vk9mXX15VKZ4VgcbCrSXGH+fid3kZ1kkQb5 CDh6AGt6p/Rd5YN+NduIhe1watIQpVLy0r45/EGj2MF/j1aTDhs4SMJAUzSK7kHD+CAG al/p84sgDWKgMAXucj7/v6uDtSWhPR6eksnAHFtSX9WPLxMzj3u7KJpGldSIKERyUt10 tGLEtGwU0XzN8W69GlA2AIC/kjdWFNCYrNyGYI7l02Rwdn98KM/gtx/mc9OzqiRsgTrL au/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kxZGxx7W; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id b16-20020ac85bd0000000b0031d4044c470si4607921qtb.621.2022.07.11.07.43.47 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 11 Jul 2022 07:43:47 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kxZGxx7W; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1]:60116 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oAudX-0003i0-3V for patch@linaro.org; Mon, 11 Jul 2022 10:43:47 -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 ) 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 ) 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 ; Mon, 11 Jul 2022 06:58:31 -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-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) 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 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jul 2022 06:58:29 -0700 (PDT) From: Peter Maydell 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 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Richard Henderson Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Message-id: 20220708151540.18136-46-richard.henderson@linaro.org Signed-off-by: Peter Maydell --- 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 = 1 << 16, ARM_HWCAP2_A64_BTI = 1 << 17, ARM_HWCAP2_A64_MTE = 1 << 18, + ARM_HWCAP2_A64_ECV = 1 << 19, + ARM_HWCAP2_A64_AFP = 1 << 20, + ARM_HWCAP2_A64_RPRES = 1 << 21, + ARM_HWCAP2_A64_MTE3 = 1 << 22, + ARM_HWCAP2_A64_SME = 1 << 23, + ARM_HWCAP2_A64_SME_I16I64 = 1 << 24, + ARM_HWCAP2_A64_SME_F64F64 = 1 << 25, + ARM_HWCAP2_A64_SME_I8I32 = 1 << 26, + ARM_HWCAP2_A64_SME_F16F32 = 1 << 27, + ARM_HWCAP2_A64_SME_B16F32 = 1 << 28, + ARM_HWCAP2_A64_SME_F32F32 = 1 << 29, + ARM_HWCAP2_A64_SME_FA64 = 1 << 30, }; #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); return hwcaps; }