From nobody Tue Nov 26 13:32:57 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1707274422; cv=none; d=zohomail.com; s=zohoarc; b=b5aek0ezMkrsoT8AgE0zAKIobg8aKGrTBt2fEAMahR94v6fZLABg5h7TyDEWd8mxq/2uNgrq8c9WDmAHTzzepkn194Jwc4XFDYzJxpn0dB0jW+g5HBV/CIn+dcF5jdCWvjeaSjyTr+CdYTPnkiPKKiV+96S/Ua183ffsgB3uNyk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1707274422; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=XeR3jaWaGEublhkyds5zMH3a9rvdTlNi440zus838qM=; b=R26kFukFp3ACpQGGh2z2gZEd3etepK6zw/h+xdmtZ6J4kBzROvGNaBlRBKvp9JsXiljD5Be1c5TKs8PCp91UjvGcycbE6SFT/5iHyLSLG8OTtyvMCcyCYqiLndRjSqTvcQV6qPCbLvHDWOfuU+KoGaYUY3X7opncIHYzG3v/uBc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1707274422484569.1509153232762; Tue, 6 Feb 2024 18:53:42 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rXY2z-0003By-W7; Tue, 06 Feb 2024 21:52:26 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rXY2y-0003BW-HD for qemu-devel@nongnu.org; Tue, 06 Feb 2024 21:52:24 -0500 Received: from mail-pl1-x62d.google.com ([2607:f8b0:4864:20::62d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rXY2x-0000aa-2A for qemu-devel@nongnu.org; Tue, 06 Feb 2024 21:52:24 -0500 Received: by mail-pl1-x62d.google.com with SMTP id d9443c01a7336-1d7881b1843so1870695ad.3 for ; Tue, 06 Feb 2024 18:52:22 -0800 (PST) Received: from stoup.. (60-242-98-186.static.tpgi.com.au. [60.242.98.186]) by smtp.gmail.com with ESMTPSA id kr8-20020a170903080800b001d8ef97de4asm255435plb.38.2024.02.06.18.52.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 18:52:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707274342; x=1707879142; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=XeR3jaWaGEublhkyds5zMH3a9rvdTlNi440zus838qM=; b=jPPRtVt2qlWbOd4dk8tsixl03xv5kvn5NHQcsSVcWLuy4CDw+BoDGX5N2AOSphQeLc ebJIA9APqAoOLUhm+S5LjZQwsRB3VlnGlSLbO2bUqG9D92qtRk90LWg+3b9ie9N3qKoR uEl5IQBSrew7npzOBNC53EijHBVkITqLaQRA22TdBcatZpr+9MI7kFO9KbRvTYc4RGtx tFHF82FgVnn7S5j41vogvK9/u2hODsk6aZ+Vx31hOHJ70We+r5TbdtwNVGrXdDCpnQzj 6x8BlXYj79dqrnm5tL9gXvzx30VitpOxJzX1ZfoXxjb79KfFkx0TZ9i3dagBL7jyYhp6 7eBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707274342; x=1707879142; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=XeR3jaWaGEublhkyds5zMH3a9rvdTlNi440zus838qM=; b=V2+SGZNJHcsTpRFo/0s6xFPpErPVZC6uupN+KHpBjBTnObC9hzN6ET2PRs6kbmWdgQ XQsAEztsnYam5WhwqCk8D8aUom7/38qhAqpuTk+wfDQk1n/uqJbBWbIrHdVLJE3tOCHf 2U7D102lQPlREQHsOFvQwjZxoZA1092h91+J7/7QiHJ7dAEwhtxW2EHOhQIUQqhRspNO cGU5Nk6K+hhUce3MnyqrL1e5BlBJpdVo/+v9OaW0BqWxcNd1KaEoxzGIUvnyXMNL6EmA PcQt+JB8fDLLZepopntbxEare/n72CWcRShuYpBjtQAPg+MfRmldBesLCbcaeDEFmgcz ekTw== X-Gm-Message-State: AOJu0YxdixF026KpPodR5zRkCKyjn+Ims4PharsiloZ3n6Dhe71pixBc V8w5l9B1Ch8HMKRDd27u8WPTzjGKY+bRjvuXqEm+mvaJCBYiqZYvCofTENZp134fzckK5ibXLBb 17hg= X-Google-Smtp-Source: AGHT+IHsdTQac/xAkNwdXpFXHf7g8N4a4Z8LjqetWStt8M2KpmdhbIOZSNj/TC2ducnl4/lfaWsmEQ== X-Received: by 2002:a17:902:f544:b0:1d9:cded:4ef1 with SMTP id h4-20020a170902f54400b001d9cded4ef1mr4766316plf.13.1707274341606; Tue, 06 Feb 2024 18:52:21 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCU5m2j9cgPXpIuWFfZLH0bgymEtyndClnEul0XDonZ3RMXQEcItZrvl/TiYj0n+tgcVJd7B1yCWirZp6UXIFJJmhtvoRkXoQpZJmy3xkZEgBzw6X6OQssd/BoxDvXXS/YY/ From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, gustavo.romero@linaro.org, qemu-stable@nongnu.org Subject: [PATCH v3 1/6] linux-user/aarch64: Choose SYNC as the preferred MTE mode Date: Wed, 7 Feb 2024 12:52:05 +1000 Message-Id: <20240207025210.8837-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240207025210.8837-1-richard.henderson@linaro.org> References: <20240207025210.8837-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::62d; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62d.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1707274424827100003 Content-Type: text/plain; charset="utf-8" The API does not generate an error for setting ASYNC | SYNC; that merely constrains the selection vs the per-cpu default. For qemu linux-user, choose SYNC as the default. Cc: qemu-stable@nongnu.org Reported-by: Gustavo Romero Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell Tested-by: Gustavo Romero --- linux-user/aarch64/target_prctl.h | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/linux-user/aarch64/target_prctl.h b/linux-user/aarch64/target_= prctl.h index 5067e7d731..aa8e203c15 100644 --- a/linux-user/aarch64/target_prctl.h +++ b/linux-user/aarch64/target_prctl.h @@ -173,21 +173,26 @@ static abi_long do_prctl_set_tagged_addr_ctrl(CPUArch= State *env, abi_long arg2) env->tagged_addr_enable =3D arg2 & PR_TAGGED_ADDR_ENABLE; =20 if (cpu_isar_feature(aa64_mte, cpu)) { - switch (arg2 & PR_MTE_TCF_MASK) { - case PR_MTE_TCF_NONE: - case PR_MTE_TCF_SYNC: - case PR_MTE_TCF_ASYNC: - break; - default: - return -EINVAL; - } - /* * Write PR_MTE_TCF to SCTLR_EL1[TCF0]. - * Note that the syscall values are consistent with hw. + * + * The kernel has a per-cpu configuration for the sysadmin, + * /sys/devices/system/cpu/cpu/mte_tcf_preferred, + * which qemu does not implement. + * + * Because there is no performance difference between the modes, a= nd + * because SYNC is most useful for debugging MTE errors, choose SY= NC + * as the preferred mode. With this preference, and the way the A= PI + * uses only two bits, there is no way for the program to select + * ASYMM mode. */ - env->cp15.sctlr_el[1] =3D - deposit64(env->cp15.sctlr_el[1], 38, 2, arg2 >> PR_MTE_TCF_SHI= FT); + unsigned tcf =3D 0; + if (arg2 & PR_MTE_TCF_SYNC) { + tcf =3D 1; + } else if (arg2 & PR_MTE_TCF_ASYNC) { + tcf =3D 2; + } + env->cp15.sctlr_el[1] =3D deposit64(env->cp15.sctlr_el[1], 38, 2, = tcf); =20 /* * Write PR_MTE_TAG to GCR_EL1[Exclude]. --=20 2.34.1 From nobody Tue Nov 26 13:32:57 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1707274435; cv=none; d=zohomail.com; s=zohoarc; b=kJ1KJq7i/rtxrs1UA0D5JZ225Zygxm6wGe5thwmPTvEZutg3hzL3tD+Uu8jq71XR+6WjHFuH0uoZ/T2tRTIsYxH1cza/Ts0AaysYH905rYhpxBL+yoQAptT4+Md2beqyQof2+WNRvaI1v3v/RutfofhHLpkJunSX9YkgcK7lmHE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1707274435; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=8/3IB+SoDAzkmHVKlFR4bQnh/JTWAMai5rQK+rwyNyA=; b=V1U7UkXJVr36uSdSRcTeK2gt86LpOnPmc86WsfpBgUpHBk1uQz03dwZhiaI7NE1TeyO7uiHq980Yhz9Kaj3xjklTStIbDUc5+zZpDLcT1bZkSrxWvTuzq1RPzDv2K42oGHuyRUJbH/AvuxxKiHd16IDKINj7KuRrBWGMtZkBT9g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1707274435827150.9977856775813; Tue, 6 Feb 2024 18:53:55 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rXY33-0003E0-Tl; Tue, 06 Feb 2024 21:52:29 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rXY32-0003DG-75 for qemu-devel@nongnu.org; Tue, 06 Feb 2024 21:52:28 -0500 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rXY30-0000dB-OU for qemu-devel@nongnu.org; Tue, 06 Feb 2024 21:52:27 -0500 Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-1d7431e702dso1939615ad.1 for ; Tue, 06 Feb 2024 18:52:26 -0800 (PST) Received: from stoup.. (60-242-98-186.static.tpgi.com.au. [60.242.98.186]) by smtp.gmail.com with ESMTPSA id kr8-20020a170903080800b001d8ef97de4asm255435plb.38.2024.02.06.18.52.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 18:52:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707274345; x=1707879145; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=8/3IB+SoDAzkmHVKlFR4bQnh/JTWAMai5rQK+rwyNyA=; b=DoKQseycYOVQwr8krjmQ/jUO33B5km8OCt6v40vdaxCfDT46uM3ssBhtel4LeuRK5S GLQmwxNXhqrBvXRUcPWhOSdPwN6OHoTWdbQPQ/aDfErS20vlni2CbK4wkEPqQg0uWFdW 2QCG/O2+1OLb1/FgWOOYqx1IO46FOu6rjQN01D+LP11RQnbvlcRxAEnKISfAkJSnSrhi V3gDmej5hSGoVM7YgDH4SoKzlbUEO133qQOIVRFRMWkrf2pFmvihEKxODYC38aR+B0ai NroTP2ZbBhBaxyJ14swTgFBAvNYpYi9suR23pj5+LZYbJOGqpVyilCvlScwTDNarYkYW lTgw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707274345; x=1707879145; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8/3IB+SoDAzkmHVKlFR4bQnh/JTWAMai5rQK+rwyNyA=; b=mU/aKKvYGb+g5y7s+E+KflQNQ6Dwey8pBoI5RqZUOna48GHwK1XlXezfYqUwpzQw1P ILdb1AlR1dpNmkrkypQxOC8Zv/DMO2KrXgZppv2alc8EH9dTlcTSzEjWKCjVz9wx3Tc/ 1JGmzT6ok3io4xz7SRFwyvy3G/HWCUGeMe1NSy3G9likeVjDHczTACyLhJJU6IbOYC4C 7Uo+sRFAL3YnRXxbi1pJzJW0+694OW6RnQ8tjVIvb1e7vkOVuBf1jGKAd3GopXjg7eQm t3fOFm5fAQ0G9iLQ62KLHtLHyIPLgo6Lvvb5kRR69LkbvwGxFjPz9o1DQl/j+7xPPbNc hY+g== X-Gm-Message-State: AOJu0Yy412HdV9+YKyV33oqVLcEtCz2fY9kJCVaZ/PbrUtjNECFhJ9aa mCsJ1J+eclGMhYi+vZCg9eKJww/gLseEwuJRWh1vh1SKX720neHF++DB7jNBA9zbBgqrtmC2HXz J7w4= X-Google-Smtp-Source: AGHT+IHKgVQkntaiRoJm4UCcgGjBjKoxvqU9peXhBjkUf7LKe8lpr3yH1vttfuO/2ReORC5DIr38Ng== X-Received: by 2002:a17:903:41c9:b0:1d9:e1e3:8639 with SMTP id u9-20020a17090341c900b001d9e1e38639mr3687125ple.62.1707274345389; Tue, 06 Feb 2024 18:52:25 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCUAfiWzBiEt+kkkM9AN4fJ9p671JGoUeySNOU45usbl6NeaLO/FoX2gbZsuaQ8j6WIGE5bI9ADxzEBFkh4fDKXffqTFLcO+SG+kTwEKX4Jb4z5JusfDZQS+JuKObEdtmvy3 From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, gustavo.romero@linaro.org, qemu-stable@nongnu.org Subject: [PATCH v3 2/6] target/arm: Fix nregs computation in do_{ld,st}_zpa Date: Wed, 7 Feb 2024 12:52:06 +1000 Message-Id: <20240207025210.8837-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240207025210.8837-1-richard.henderson@linaro.org> References: <20240207025210.8837-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::632; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x632.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1707274436788100001 Content-Type: text/plain; charset="utf-8" The field is encoded as [0-3], which is convenient for indexing our array of function pointers, but the true value is [1-4]. Adjust before calling do_mem_zpa. Add an assert, and move the comment re passing ZT to the helper back next to the relevant code. Cc: qemu-stable@nongnu.org Fixes: 206adacfb8d ("target/arm: Add mte helpers for sve scalar + int loads= ") Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell Tested-by: Gustavo Romero --- target/arm/tcg/translate-sve.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/target/arm/tcg/translate-sve.c b/target/arm/tcg/translate-sve.c index 296e7d1ce2..7108938251 100644 --- a/target/arm/tcg/translate-sve.c +++ b/target/arm/tcg/translate-sve.c @@ -4445,11 +4445,7 @@ static void do_mem_zpa(DisasContext *s, int zt, int = pg, TCGv_i64 addr, TCGv_ptr t_pg; int desc =3D 0; =20 - /* - * For e.g. LD4, there are not enough arguments to pass all 4 - * registers as pointers, so encode the regno into the data field. - * For consistency, do this even for LD1. - */ + assert(mte_n >=3D 1 && mte_n <=3D 4); if (s->mte_active[0]) { int msz =3D dtype_msz(dtype); =20 @@ -4463,6 +4459,11 @@ static void do_mem_zpa(DisasContext *s, int zt, int = pg, TCGv_i64 addr, addr =3D clean_data_tbi(s, addr); } =20 + /* + * For e.g. LD4, there are not enough arguments to pass all 4 + * registers as pointers, so encode the regno into the data field. + * For consistency, do this even for LD1. + */ desc =3D simd_desc(vsz, vsz, zt | desc); t_pg =3D tcg_temp_new_ptr(); =20 @@ -4600,7 +4601,7 @@ static void do_ld_zpa(DisasContext *s, int zt, int pg, * accessible via the instruction encoding. */ assert(fn !=3D NULL); - do_mem_zpa(s, zt, pg, addr, dtype, nreg, false, fn); + do_mem_zpa(s, zt, pg, addr, dtype, nreg + 1, false, fn); } =20 static bool trans_LD_zprr(DisasContext *s, arg_rprr_load *a) @@ -5168,14 +5169,13 @@ static void do_st_zpa(DisasContext *s, int zt, int = pg, TCGv_i64 addr, if (nreg =3D=3D 0) { /* ST1 */ fn =3D fn_single[s->mte_active[0]][be][msz][esz]; - nreg =3D 1; } else { /* ST2, ST3, ST4 -- msz =3D=3D esz, enforced by encoding */ assert(msz =3D=3D esz); fn =3D fn_multiple[s->mte_active[0]][be][nreg - 1][msz]; } assert(fn !=3D NULL); - do_mem_zpa(s, zt, pg, addr, msz_dtype(s, msz), nreg, true, fn); + do_mem_zpa(s, zt, pg, addr, msz_dtype(s, msz), nreg + 1, true, fn); } =20 static bool trans_ST_zprr(DisasContext *s, arg_rprr_store *a) --=20 2.34.1 From nobody Tue Nov 26 13:32:57 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1707274447; cv=none; d=zohomail.com; s=zohoarc; b=iCoVHktLLBXcrPDFMCqadRnArtH6xw7YHwENY/wrLkLlUzTtV8re57eT9ZPGxrZ3ovXe9HGU6uavamCnOZRA98st8XL1KmZBUmO3rMXvQmNoI1KNAMUp38d3QPLB8W3K9GSTO4D79dMWVEMJHIV5FH41xw2F5dRAyGMPiqGSidw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1707274447; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=TlKFEqZAqQ3pAY5dLOI6DMwcM/4p9lbYDIei9Bg0M3Q=; b=Rsae/398k4F2A2/I8Nl6J9Q9dKi6L9qMckGDjGat6/qhEzJ08+MTk7wQkEPzcuIt6/Li6OZrKQtXikMx1oR4xRGt+TniX23qEhbEFppt9uy1IpeNofatLcLp0YjBzkX0hjyiSiXFnVYt0KgOIotnnQadiuGteE61GNFuZ8bqSog= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1707274447209499.8544612424764; Tue, 6 Feb 2024 18:54:07 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rXY37-0003FO-GN; Tue, 06 Feb 2024 21:52:33 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rXY36-0003Eo-6n for qemu-devel@nongnu.org; Tue, 06 Feb 2024 21:52:32 -0500 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rXY34-0000fr-Po for qemu-devel@nongnu.org; Tue, 06 Feb 2024 21:52:31 -0500 Received: by mail-pl1-x631.google.com with SMTP id d9443c01a7336-1d9b2400910so1415855ad.0 for ; Tue, 06 Feb 2024 18:52:29 -0800 (PST) Received: from stoup.. (60-242-98-186.static.tpgi.com.au. [60.242.98.186]) by smtp.gmail.com with ESMTPSA id kr8-20020a170903080800b001d8ef97de4asm255435plb.38.2024.02.06.18.52.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 18:52:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707274349; x=1707879149; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=TlKFEqZAqQ3pAY5dLOI6DMwcM/4p9lbYDIei9Bg0M3Q=; b=OEIty088a7D36IEO+R5MgPgwJIIQ3+uCYUbjTCxIecylIh92NxRpSqSKSpjmZJN5io kEhpBdm/XetUZaR/WiL9tBLQnp7+FCcuwrVQRt/ZXa7oF0vdd9O1CV85/r3NfABFhYql HNpfnDWmSI6sd7scS5asTGUEcVOi1z089WE/Eyvpl5qdpc7ngR0dLaaGzTrCmvT3I4Wo 7Ev2RBZQwE43SX44rqhqEOL+IpB9aYvNFDPqv3K6Ldc2v7+YHe3P7yPRjC+Mt2jiRKNu QXDSd+t6UNJIGsR8sB2qZ1h0z7RPTlSgBQf+X/zI8IZvTI/TR9Xk7Ejr+4RnBDluER2b yRFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707274349; x=1707879149; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TlKFEqZAqQ3pAY5dLOI6DMwcM/4p9lbYDIei9Bg0M3Q=; b=GU59q+MAt97dTjk8Ijrao6UIIqGewXGzVUWdzzeLAzGCysoJRPywbK7LsKcUU4y7p+ GJ+Wh47LPZq/JHgggBTOPxNhphSezq7n0QHfEjlzR/a6fHPStytFxrSGfDaBsAt1keUC 3+yG+5lrfA7YRPfeKjM2zHFQqXqrBy4rbkOAitUg1CXfWa2ii8gj99nmBv48F2EplUNt jR4wNrNGJ7j1YOfAu3UkpMd47zyKETJr6eHpg31K77YO0JCVGBVURJ7XihOp8F81se85 mxXXKvMb3o+a5X9vV+VQRNDNzhAiBeeY9l/xZ8HXFMNPTH/juOqB6B7M3yZQ5ktqZPo7 fDig== X-Gm-Message-State: AOJu0YwY44OgyLGPy6CEuTZP8fnQsoU5G0phwpIhf4/23zzHtYKB4fzn 15hzgR2WqOPMCoymIw2KkZdWxbqisxzDRL91n1LmBQegti4Yyc1z7ZScnvCOwGkZTYoAbYBypIK Vk0s= X-Google-Smtp-Source: AGHT+IFVOOLPXu/SnNsLtDFlNQ2iuKF6CoW2Y0oSOWJ1AV+LinfmGwyWpxXCGkDX0Y4mGD5nYQ3kWg== X-Received: by 2002:a17:902:e802:b0:1d9:3edf:1e2 with SMTP id u2-20020a170902e80200b001d93edf01e2mr5648247plg.3.1707274349017; Tue, 06 Feb 2024 18:52:29 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCV/9fEBvxZ179Rf5XzajD3RWE0SQCCajNCrcLVa3rq5LTAoZgPOW38YKYCJyhuvDjR7UBZu1RuofMr40qUAJ1NAwK0MDYdCrAFv9Y8/sanyn7tVQt0n01YzpFK4LVKMlVxmw0NbBb/IE//GrUaTxbZNDiVIHPFYrhVhTTY= From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, gustavo.romero@linaro.org, qemu-stable@nongnu.org, Peter Maydell Subject: [PATCH v3 3/6] target/arm: Adjust and validate mtedesc sizem1 Date: Wed, 7 Feb 2024 12:52:07 +1000 Message-Id: <20240207025210.8837-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240207025210.8837-1-richard.henderson@linaro.org> References: <20240207025210.8837-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::631; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x631.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1707274448769100001 Content-Type: text/plain; charset="utf-8" When we added SVE_MTEDESC_SHIFT, we effectively limited the maximum size of MTEDESC. Adjust SIZEM1 to consume the remaining bits (32 - 10 - 5 - 12 =3D=3D 5). Assert that the data to be stored fits within the field (expecting 8 * 4 - 1 =3D=3D 31, exact fit). Cc: qemu-stable@nongnu.org Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Tested-by: Gustavo Romero --- target/arm/internals.h | 2 +- target/arm/tcg/translate-sve.c | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/target/arm/internals.h b/target/arm/internals.h index fc337fe40e..50bff44549 100644 --- a/target/arm/internals.h +++ b/target/arm/internals.h @@ -1278,7 +1278,7 @@ FIELD(MTEDESC, TBI, 4, 2) FIELD(MTEDESC, TCMA, 6, 2) FIELD(MTEDESC, WRITE, 8, 1) FIELD(MTEDESC, ALIGN, 9, 3) -FIELD(MTEDESC, SIZEM1, 12, SIMD_DATA_BITS - 12) /* size - 1 */ +FIELD(MTEDESC, SIZEM1, 12, SIMD_DATA_BITS - SVE_MTEDESC_SHIFT - 12) /* si= ze - 1 */ =20 bool mte_probe(CPUARMState *env, uint32_t desc, uint64_t ptr); uint64_t mte_check(CPUARMState *env, uint32_t desc, uint64_t ptr, uintptr_= t ra); diff --git a/target/arm/tcg/translate-sve.c b/target/arm/tcg/translate-sve.c index 7108938251..a88e523cba 100644 --- a/target/arm/tcg/translate-sve.c +++ b/target/arm/tcg/translate-sve.c @@ -4443,17 +4443,18 @@ static void do_mem_zpa(DisasContext *s, int zt, int= pg, TCGv_i64 addr, { unsigned vsz =3D vec_full_reg_size(s); TCGv_ptr t_pg; + uint32_t sizem1; int desc =3D 0; =20 assert(mte_n >=3D 1 && mte_n <=3D 4); + sizem1 =3D (mte_n << dtype_msz(dtype)) - 1; + assert(sizem1 <=3D R_MTEDESC_SIZEM1_MASK >> R_MTEDESC_SIZEM1_SHIFT); if (s->mte_active[0]) { - int msz =3D dtype_msz(dtype); - desc =3D FIELD_DP32(desc, MTEDESC, MIDX, get_mem_index(s)); desc =3D FIELD_DP32(desc, MTEDESC, TBI, s->tbid); desc =3D FIELD_DP32(desc, MTEDESC, TCMA, s->tcma); desc =3D FIELD_DP32(desc, MTEDESC, WRITE, is_write); - desc =3D FIELD_DP32(desc, MTEDESC, SIZEM1, (mte_n << msz) - 1); + desc =3D FIELD_DP32(desc, MTEDESC, SIZEM1, sizem1); desc <<=3D SVE_MTEDESC_SHIFT; } else { addr =3D clean_data_tbi(s, addr); --=20 2.34.1 From nobody Tue Nov 26 13:32:57 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1707274416; cv=none; d=zohomail.com; s=zohoarc; b=QmpsuE9l+b19n9h6zbCo1jhKxiOD6gwdaCRbmzq7mefhY3O3lqBkauDVeubN7OM6Scp9QM4fPHXyykAwHHuRKGkE+l5k6SFomwxv74MA1S1NoiPtE1ClqVND+hzseZQWU5b4sVLH5/coxZ7vz4HiTDU2LK5PdQ4VdlNu9NRTMI0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1707274416; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=tlUygCHtFk0VaXGDrmWE40VfWYD6mSX0y7BA0niY71c=; b=WuE6E6/00fePwpXJtuZZOXZqwnQ3+D0tk6qwp5nPS6ViZrO6G30W0vZxskLScleYB60nUzLD5vhsGwGmy/t7rOA581d8J8YEb6zwoUvFN87G7BgswRs2Pt67ve2lI7+Zj0YErm1zsW0w/GqsyedWPxNheCOCTh8u+jIFW887fw0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1707274416235853.3072664598827; Tue, 6 Feb 2024 18:53:36 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rXY3C-0003Gy-2n; Tue, 06 Feb 2024 21:52:38 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rXY3A-0003GL-Pl for qemu-devel@nongnu.org; Tue, 06 Feb 2024 21:52:36 -0500 Received: from mail-pg1-x52c.google.com ([2607:f8b0:4864:20::52c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rXY39-0000gi-1x for qemu-devel@nongnu.org; Tue, 06 Feb 2024 21:52:36 -0500 Received: by mail-pg1-x52c.google.com with SMTP id 41be03b00d2f7-5dc13cbce45so88846a12.2 for ; Tue, 06 Feb 2024 18:52:34 -0800 (PST) Received: from stoup.. (60-242-98-186.static.tpgi.com.au. [60.242.98.186]) by smtp.gmail.com with ESMTPSA id kr8-20020a170903080800b001d8ef97de4asm255435plb.38.2024.02.06.18.52.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 18:52:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707274354; x=1707879154; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=tlUygCHtFk0VaXGDrmWE40VfWYD6mSX0y7BA0niY71c=; b=IagH4IMqplzV8gqZxZ0mhSTTUHci8Pyd8447gHyM9VkpSSgCDL3JwzyaKedowLHEB4 MkAYq02dmTj2S8U6WhxhVXZyyTGe13rGqIinS5hq9GdtrztZTxDR8Upk3rMb+0b2M0vV fCjhLbfaM7sx2f0ckvsgYAiZumg0rQJ/Xi7fTpd9xueDswMM2sx93DzaJT5i+r1UJ5uT plHTKEieIp7G/gePhNd9jI5lfh0nTo1UMA7u66umqJhlONEROdqzARbrcmMGkSJiZNVe UkxHum/n+XJsXgtqz6XT927/8EBhfDPR65ZjJ2V4prvkuMyck0ErdxfGSpsHgohvn4MZ 7okw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707274354; x=1707879154; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tlUygCHtFk0VaXGDrmWE40VfWYD6mSX0y7BA0niY71c=; b=IEPDtoWapXDC2n/supTdGXf2EMDjyGiNTT751++8xTg+yJ9LNmnLLBwWUmCABLbxcJ aYi971JI5XAMq+TCjWuKk9w71VtKUyHWmCXVW96yzneW9MIauSzDJSh0BgBDefqQLLX4 oL9UhqViZ323K/Kl+uZraiD5kMyJuAB5C3wh3ujQWM+u/i5xBr93sCK1y9aUkQPMbMx7 8SV7vRYMUdiayrzYfacguCpTPCiqEAcjzS4PqIRsNWZuNwrScH81na2w+fxpuHUlVi8L Xu6l44/ijNF1Bns/Q1f79tYupMlt700cdAlWYh/6piU2P+oF+xORiQCiH1p70U7NlDOj jjJQ== X-Gm-Message-State: AOJu0YyEmECbLYxcvtnlsIA1y1a5P42/NmdX47YsU11fISiDrdZ/X73j rTnpD5MTB/YSX4fTLd/TM81aI7i4COi6H94vuVqhGFEt349MCNS0rVFHAJbdnuAJpbavUNSEA9l dvYU= X-Google-Smtp-Source: AGHT+IHeA9p7rQupASz1q2Wa0a+evIiNetkJ7Ftt/JzrqA3EAvzUNJzw4r2R5o1F6C/DtSlXAJCtVA== X-Received: by 2002:a05:6a21:3948:b0:19c:b40a:d8ab with SMTP id ac8-20020a056a21394800b0019cb40ad8abmr4454865pzc.4.1707274353797; Tue, 06 Feb 2024 18:52:33 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCV68Ib8Izz4Y9ko/GumheyKwEgJMGYR4RGQzLHj7EvEz/hDDNQoNq6WXm8Ji5hXz+PxXUdsAUGgUpF/q2mKVxSw/TH8a+aXX4zqpvSFzi3ur78MJmmxZR2sU9zDx7nmBwiOP5y466GCgPeDOHJH4IcydSl55qPcKMP4Cg0= From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, gustavo.romero@linaro.org, qemu-stable@nongnu.org, Peter Maydell Subject: [PATCH v3 4/6] target/arm: Split out make_svemte_desc Date: Wed, 7 Feb 2024 12:52:08 +1000 Message-Id: <20240207025210.8837-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240207025210.8837-1-richard.henderson@linaro.org> References: <20240207025210.8837-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::52c; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52c.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+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1707274416831100001 Content-Type: text/plain; charset="utf-8" Share code that creates mtedesc and embeds within simd_desc. Cc: qemu-stable@nongnu.org Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Tested-by: Gustavo Romero --- target/arm/tcg/translate-a64.h | 2 ++ target/arm/tcg/translate-sme.c | 15 +++-------- target/arm/tcg/translate-sve.c | 47 ++++++++++++++++++---------------- 3 files changed, 31 insertions(+), 33 deletions(-) diff --git a/target/arm/tcg/translate-a64.h b/target/arm/tcg/translate-a64.h index 96ba39b37e..7b811b8ac5 100644 --- a/target/arm/tcg/translate-a64.h +++ b/target/arm/tcg/translate-a64.h @@ -28,6 +28,8 @@ bool logic_imm_decode_wmask(uint64_t *result, unsigned in= t immn, bool sve_access_check(DisasContext *s); bool sme_enabled_check(DisasContext *s); bool sme_enabled_check_with_svcr(DisasContext *s, unsigned); +uint32_t make_svemte_desc(DisasContext *s, unsigned vsz, uint32_t nregs, + uint32_t msz, bool is_write, uint32_t data); =20 /* This function corresponds to CheckStreamingSVEEnabled. */ static inline bool sme_sm_enabled_check(DisasContext *s) diff --git a/target/arm/tcg/translate-sme.c b/target/arm/tcg/translate-sme.c index 8f0dfc884e..46c7fce8b4 100644 --- a/target/arm/tcg/translate-sme.c +++ b/target/arm/tcg/translate-sme.c @@ -206,7 +206,7 @@ static bool trans_LDST1(DisasContext *s, arg_LDST1 *a) =20 TCGv_ptr t_za, t_pg; TCGv_i64 addr; - int svl, desc =3D 0; + uint32_t desc; bool be =3D s->be_data =3D=3D MO_BE; bool mte =3D s->mte_active[0]; =20 @@ -224,18 +224,11 @@ static bool trans_LDST1(DisasContext *s, arg_LDST1 *a) tcg_gen_shli_i64(addr, cpu_reg(s, a->rm), a->esz); tcg_gen_add_i64(addr, addr, cpu_reg_sp(s, a->rn)); =20 - if (mte) { - desc =3D FIELD_DP32(desc, MTEDESC, MIDX, get_mem_index(s)); - desc =3D FIELD_DP32(desc, MTEDESC, TBI, s->tbid); - desc =3D FIELD_DP32(desc, MTEDESC, TCMA, s->tcma); - desc =3D FIELD_DP32(desc, MTEDESC, WRITE, a->st); - desc =3D FIELD_DP32(desc, MTEDESC, SIZEM1, (1 << a->esz) - 1); - desc <<=3D SVE_MTEDESC_SHIFT; - } else { + if (!mte) { addr =3D clean_data_tbi(s, addr); } - svl =3D streaming_vec_reg_size(s); - desc =3D simd_desc(svl, svl, desc); + + desc =3D make_svemte_desc(s, streaming_vec_reg_size(s), 1, a->esz, a->= st, 0); =20 fns[a->esz][be][a->v][mte][a->st](tcg_env, t_za, t_pg, addr, tcg_constant_i32(desc)); diff --git a/target/arm/tcg/translate-sve.c b/target/arm/tcg/translate-sve.c index a88e523cba..508f7b6bbd 100644 --- a/target/arm/tcg/translate-sve.c +++ b/target/arm/tcg/translate-sve.c @@ -4437,18 +4437,18 @@ static const uint8_t dtype_esz[16] =3D { 3, 2, 1, 3 }; =20 -static void do_mem_zpa(DisasContext *s, int zt, int pg, TCGv_i64 addr, - int dtype, uint32_t mte_n, bool is_write, - gen_helper_gvec_mem *fn) +uint32_t make_svemte_desc(DisasContext *s, unsigned vsz, uint32_t nregs, + uint32_t msz, bool is_write, uint32_t data) { - unsigned vsz =3D vec_full_reg_size(s); - TCGv_ptr t_pg; uint32_t sizem1; - int desc =3D 0; + uint32_t desc =3D 0; =20 - assert(mte_n >=3D 1 && mte_n <=3D 4); - sizem1 =3D (mte_n << dtype_msz(dtype)) - 1; + /* Assert all of the data fits, with or without MTE enabled. */ + assert(nregs >=3D 1 && nregs <=3D 4); + sizem1 =3D (nregs << msz) - 1; assert(sizem1 <=3D R_MTEDESC_SIZEM1_MASK >> R_MTEDESC_SIZEM1_SHIFT); + assert(data < 1u << SVE_MTEDESC_SHIFT); + if (s->mte_active[0]) { desc =3D FIELD_DP32(desc, MTEDESC, MIDX, get_mem_index(s)); desc =3D FIELD_DP32(desc, MTEDESC, TBI, s->tbid); @@ -4456,7 +4456,18 @@ static void do_mem_zpa(DisasContext *s, int zt, int = pg, TCGv_i64 addr, desc =3D FIELD_DP32(desc, MTEDESC, WRITE, is_write); desc =3D FIELD_DP32(desc, MTEDESC, SIZEM1, sizem1); desc <<=3D SVE_MTEDESC_SHIFT; - } else { + } + return simd_desc(vsz, vsz, desc | data); +} + +static void do_mem_zpa(DisasContext *s, int zt, int pg, TCGv_i64 addr, + int dtype, uint32_t nregs, bool is_write, + gen_helper_gvec_mem *fn) +{ + TCGv_ptr t_pg; + uint32_t desc; + + if (!s->mte_active[0]) { addr =3D clean_data_tbi(s, addr); } =20 @@ -4465,7 +4476,8 @@ static void do_mem_zpa(DisasContext *s, int zt, int p= g, TCGv_i64 addr, * registers as pointers, so encode the regno into the data field. * For consistency, do this even for LD1. */ - desc =3D simd_desc(vsz, vsz, zt | desc); + desc =3D make_svemte_desc(s, vec_full_reg_size(s), nregs, + dtype_msz(dtype), is_write, zt); t_pg =3D tcg_temp_new_ptr(); =20 tcg_gen_addi_ptr(t_pg, tcg_env, pred_full_reg_offset(s, pg)); @@ -5224,25 +5236,16 @@ static void do_mem_zpz(DisasContext *s, int zt, int= pg, int zm, int scale, TCGv_i64 scalar, int msz, bool is_write, gen_helper_gvec_mem_scatter *fn) { - unsigned vsz =3D vec_full_reg_size(s); TCGv_ptr t_zm =3D tcg_temp_new_ptr(); TCGv_ptr t_pg =3D tcg_temp_new_ptr(); TCGv_ptr t_zt =3D tcg_temp_new_ptr(); - int desc =3D 0; - - if (s->mte_active[0]) { - desc =3D FIELD_DP32(desc, MTEDESC, MIDX, get_mem_index(s)); - desc =3D FIELD_DP32(desc, MTEDESC, TBI, s->tbid); - desc =3D FIELD_DP32(desc, MTEDESC, TCMA, s->tcma); - desc =3D FIELD_DP32(desc, MTEDESC, WRITE, is_write); - desc =3D FIELD_DP32(desc, MTEDESC, SIZEM1, (1 << msz) - 1); - desc <<=3D SVE_MTEDESC_SHIFT; - } - desc =3D simd_desc(vsz, vsz, desc | scale); + uint32_t desc; =20 tcg_gen_addi_ptr(t_pg, tcg_env, pred_full_reg_offset(s, pg)); tcg_gen_addi_ptr(t_zm, tcg_env, vec_full_reg_offset(s, zm)); tcg_gen_addi_ptr(t_zt, tcg_env, vec_full_reg_offset(s, zt)); + + desc =3D make_svemte_desc(s, vec_full_reg_size(s), 1, msz, is_write, s= cale); fn(tcg_env, t_zt, t_pg, t_zm, scalar, tcg_constant_i32(desc)); } =20 --=20 2.34.1 From nobody Tue Nov 26 13:32:57 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1707274443; cv=none; d=zohomail.com; s=zohoarc; b=KfoyIw0AlTOEeGP+y+exanHBHk/ohIWKmf5gdw/Gt9k5QDdNMqIJACA1ILI/dUJEhINWlVXD7Fwixa5QmSUE1/Z6KfvQGlYNTczGvSp2SLoby/dN2PtAmbGE7TgIQkNo82Bznb2Tuplsv+skXeJooKat8j08yn6GwF4LIi/PSHc= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1707274443; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=KE5lr6JW9Hb5FNHnTu7wAvaaKUMTGQjD484Q9RZmfv8=; b=ccvfKWcp+WUHiQUaxA5Yt7YU9NIJdV7h0Kzpk7zEowgwwK1wtlL8WIMQ/goapcSxL8fi1qbo1+gFxUVPGeCyqjOD2ANbrl6T9+PnZcQCSyMNG/IWDMPG+v+2aED02zWN16rl3s8gi34crdSDpreZsLsAVW4qlLez0uz+ig/PE18= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1707274443871690.837271984709; Tue, 6 Feb 2024 18:54:03 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rXY3H-0003JF-Es; Tue, 06 Feb 2024 21:52:43 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rXY3G-0003IS-EU for qemu-devel@nongnu.org; Tue, 06 Feb 2024 21:52:42 -0500 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rXY3D-0000ha-RK for qemu-devel@nongnu.org; Tue, 06 Feb 2024 21:52:42 -0500 Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-6da9c834646so139428b3a.3 for ; Tue, 06 Feb 2024 18:52:39 -0800 (PST) Received: from stoup.. (60-242-98-186.static.tpgi.com.au. [60.242.98.186]) by smtp.gmail.com with ESMTPSA id kr8-20020a170903080800b001d8ef97de4asm255435plb.38.2024.02.06.18.52.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 18:52:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707274358; x=1707879158; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=KE5lr6JW9Hb5FNHnTu7wAvaaKUMTGQjD484Q9RZmfv8=; b=I8QxszfuWmxyGn0hZWzeGy85VONnNye4JIqdywAaElbsgR2Idyr8gYcLHVxs/R32+W n95TTBG7dw07XDvk0QqASut/HpE9l2+agw8i6RTMES65oxEbF5vTOwFzr9U/78sqSlf9 elVQkqr3ZEcSQFNUcBocNF4FW8jE9zQ4EGiqFtI4gL00hLntFYextaldrukXd/EucxyK wnW8itDVI7IX+SkWaFpS/gwMnf+YSIu2CUK1h7nKa6rag9/8qeQbyNvdeB7w7jk8ET51 IXQye4f58BJ73wu72dJkluqtt9K2Mlry9cRUbCfKULHj3SI3rf0Dq9XTbGhMyn7t6JAt u3EA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707274358; x=1707879158; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KE5lr6JW9Hb5FNHnTu7wAvaaKUMTGQjD484Q9RZmfv8=; b=EG5mqtSpa7GGPIudEiSPaVRWOJ1u4DpO3suSYbm6dN0RTl1e+Dzw4/rmJcTsyS73aA DUIEv5YVfLZHpyZa/JXbjmpktUPzG7EOt14skfRoBLeqNi+JGaH6K3NO+q2P4f0h4JC5 EJ1mzEKnKcXQ3tfZhlO4e91ndlpJ1Tk3mhmbyqxkj0hgwJ4twMShRvximmQ1VqT6bA+Z vABYsgIPijue81hGmACkovVIXdiyqr7dU7ik9nPLzpKkgDcfuJ9l03y2nsgkQHirmRli L1+WB72gpbnm6sFXJ8lBKqKFtBa4RACqJsPYKAtwqGOq360ag33F3jpI3i77oo0X69/F 1N8A== X-Gm-Message-State: AOJu0Yx7u6IVe5KpT3mGYB9BYXz18je0Eh4R581yT8N1mTugP9+igjYs n7XqVyVzhZcq2/tahOir46py8FGJvWykZUKw6cg3sxTQ8ZRLFqGRQJ22rfbl3JI/uwcNgnb7lKm vZX0= X-Google-Smtp-Source: AGHT+IFCXYj8nwBT2ww/xlVOkZhFqNRzZZNbFtQxvUsb86YTTRM51XXapOzecMBEXzjPLjRPqcztgQ== X-Received: by 2002:a05:6a21:6d98:b0:19a:4418:1e86 with SMTP id wl24-20020a056a216d9800b0019a44181e86mr4262411pzb.58.1707274358277; Tue, 06 Feb 2024 18:52:38 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCWxqpYzYGjo+qKTG+7sZrr7d1XLfgwzefc4tUX9Y+WpenNlHz3T25lp7BrCdXss/0h71Zg3lF/phF+vbpB+WR1JQF+QkG8AKeRkfgi3UBZT/DrqOezu+fKuQvQgLiP4IcnG6WIpmZPbGJOnGPYGZWcvikkTmA9xjpFksFI= From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, gustavo.romero@linaro.org, qemu-stable@nongnu.org, Peter Maydell Subject: [PATCH v3 5/6] target/arm: Handle mte in do_ldrq, do_ldro Date: Wed, 7 Feb 2024 12:52:09 +1000 Message-Id: <20240207025210.8837-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240207025210.8837-1-richard.henderson@linaro.org> References: <20240207025210.8837-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::434; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-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=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1707274444754100005 Content-Type: text/plain; charset="utf-8" These functions "use the standard load helpers", but fail to clean_data_tbi or populate mtedesc. Cc: qemu-stable@nongnu.org Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Tested-by: Gustavo Romero --- target/arm/tcg/translate-sve.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/target/arm/tcg/translate-sve.c b/target/arm/tcg/translate-sve.c index 508f7b6bbd..ada05aa530 100644 --- a/target/arm/tcg/translate-sve.c +++ b/target/arm/tcg/translate-sve.c @@ -4861,8 +4861,13 @@ static void do_ldrq(DisasContext *s, int zt, int pg,= TCGv_i64 addr, int dtype) unsigned vsz =3D vec_full_reg_size(s); TCGv_ptr t_pg; int poff; + uint32_t desc; =20 /* Load the first quadword using the normal predicated load helpers. = */ + if (!s->mte_active[0]) { + addr =3D clean_data_tbi(s, addr); + } + poff =3D pred_full_reg_offset(s, pg); if (vsz > 16) { /* @@ -4886,7 +4891,8 @@ static void do_ldrq(DisasContext *s, int zt, int pg, = TCGv_i64 addr, int dtype) =20 gen_helper_gvec_mem *fn =3D ldr_fns[s->mte_active[0]][s->be_data =3D=3D MO_BE][dtype][0]; - fn(tcg_env, t_pg, addr, tcg_constant_i32(simd_desc(16, 16, zt))); + desc =3D make_svemte_desc(s, 16, 1, dtype_msz(dtype), false, zt); + fn(tcg_env, t_pg, addr, tcg_constant_i32(desc)); =20 /* Replicate that first quadword. */ if (vsz > 16) { @@ -4929,6 +4935,7 @@ static void do_ldro(DisasContext *s, int zt, int pg, = TCGv_i64 addr, int dtype) unsigned vsz_r32; TCGv_ptr t_pg; int poff, doff; + uint32_t desc; =20 if (vsz < 32) { /* @@ -4941,6 +4948,9 @@ static void do_ldro(DisasContext *s, int zt, int pg, = TCGv_i64 addr, int dtype) } =20 /* Load the first octaword using the normal predicated load helpers. = */ + if (!s->mte_active[0]) { + addr =3D clean_data_tbi(s, addr); + } =20 poff =3D pred_full_reg_offset(s, pg); if (vsz > 32) { @@ -4965,7 +4975,8 @@ static void do_ldro(DisasContext *s, int zt, int pg, = TCGv_i64 addr, int dtype) =20 gen_helper_gvec_mem *fn =3D ldr_fns[s->mte_active[0]][s->be_data =3D=3D MO_BE][dtype][0]; - fn(tcg_env, t_pg, addr, tcg_constant_i32(simd_desc(32, 32, zt))); + desc =3D make_svemte_desc(s, 32, 1, dtype_msz(dtype), false, zt); + fn(tcg_env, t_pg, addr, tcg_constant_i32(desc)); =20 /* * Replicate that first octaword. --=20 2.34.1 From nobody Tue Nov 26 13:32:57 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1707274441; cv=none; d=zohomail.com; s=zohoarc; b=ISiE3eLQXwjVpyajQ5rQPLWMSTDdaxROTlRQngEadzPeD44hTHWIhMHtFd+NgoqyxYCBJj0shNYkpAMTu3fFf68xC8H2AhNp/g7X9mYo9XlG5ck854AcBu321sq4RwNUk8gUsS1Bdbp+gNLxKRrA/jJT/fIffPnapHLJ4j9p5WE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1707274441; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=EwSkPSHiupn05u+RAeWRJRNLnJ0SRDTtyOincwirVhY=; b=aokDRo8bhPhu2JXr/xxpuL+zpzj2o8yP5Z68uTJqWkNLDwuLsYD0aPibSTN9ASfwIQEySRra/7oLMpgq+0wGNtqlSouVBfEphtC59JMTs/qE2a5Rlqo4fqsxJXuloAkZA9C3J88fx+CQNOH7W5NNiWEYj61BlrovXmQTIhK6pzo= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1707274441424957.3667659353732; Tue, 6 Feb 2024 18:54:01 -0800 (PST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rXY3O-0003LN-BU; Tue, 06 Feb 2024 21:52:50 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rXY3N-0003L1-8R for qemu-devel@nongnu.org; Tue, 06 Feb 2024 21:52:49 -0500 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rXY3H-0000iG-JD for qemu-devel@nongnu.org; Tue, 06 Feb 2024 21:52:49 -0500 Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-1d731314e67so1467025ad.1 for ; Tue, 06 Feb 2024 18:52:43 -0800 (PST) Received: from stoup.. (60-242-98-186.static.tpgi.com.au. [60.242.98.186]) by smtp.gmail.com with ESMTPSA id kr8-20020a170903080800b001d8ef97de4asm255435plb.38.2024.02.06.18.52.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 18:52:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1707274362; x=1707879162; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=EwSkPSHiupn05u+RAeWRJRNLnJ0SRDTtyOincwirVhY=; b=DetoBs8CegDJzKFU3S775vQUiF8ehTIKfeHtS8JBOdpGcRSyzvTsmeAZcH/s4t6yA5 1U8RYkfjJnZov1+RW0DQKQ9OjW4fCaplcIMDxbxR0vBK7fyoyFNO0MBk3WSZt8zhkTvr fB6YowJfe80IMJ7qgh1KSILUdRPce3N3Hd8chB4WyoSP12lKMtrMVy+EPPyosrO6mES+ eagMF0lnuRvPX+UjUkJ2PYnfIxEtXf3xB6hJbbageDTT6HEMN9G/NxOgL8avSMJJsZ+E ytsIv6iiCHKzDImFNQ92yWWA5doy8m0kwSmjJWcJaFxzRNX6U+h/UJeBd4V+MhCRJVd/ eIFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707274362; x=1707879162; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=EwSkPSHiupn05u+RAeWRJRNLnJ0SRDTtyOincwirVhY=; b=GIGtlzHbS6D5J44xc2cIwEQLVOVv/x/q+6DEQGhS7copbG57Q6FMHwHZneUa+CYkpT Oh4p9Zr973ipjfXxNSMaBE8FZKcOMKdxCBDdPJTkMrXB4bYAAunl4TN1oOvn6YdCXZOs 22FkGnHzGarBv38abJg0yTsAoxloi2LmqtXbNsBO6XLUT4T4b3dYd3NIb60VBfAXPh1B xfIgCkJZgqcLF9pSWoiYUkqU3tsu+3MShTmtRNqrEguUqPN+xbdIfRjWPnCs2+kmNaSf 2zf4gkia1z5YHKwUjs6Vp2mm7bl18bX7HZ5Vj/98MnH79gEuWFaOElihLLh3Zbf4S6KL qcQw== X-Gm-Message-State: AOJu0Ywi31dftBZaeepsmAdeR+dwkt08Q66RRVTd9gxiB7PBzrQUCTe9 SeRmCbaOEJg3eQUloOy1RIkzy1H6oW+585err6b3p1OUZYLRP+zexqOcoVqeO0vk7SyZYYkKyeE YTQ4= X-Google-Smtp-Source: AGHT+IHiwJuWhkDHCHm6UDdWmrOa8/za0Hk4Ynw7ntX1eu1DWxai4qNS7A+XH0MUbuvtePoARr9Gfg== X-Received: by 2002:a17:903:442:b0:1d9:624e:126d with SMTP id iw2-20020a170903044200b001d9624e126dmr3298272plb.62.1707274362305; Tue, 06 Feb 2024 18:52:42 -0800 (PST) X-Forwarded-Encrypted: i=1; AJvYcCVdM8CBAqet6sXU+v4XakJHPz2Xo7DnrAF6LFex+GVd1xuy/EAvBj995Jarghp1JVDN8kwpq1tBOyWW2x6v4oSzZ8JhR27Jx5AVbEFGZ/Zs/SFLoTWR44zvfkb+aaEL7fHCZkOIFPE8mQ0SatPHswFQgoj8JiRWQvUWIN4= From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, gustavo.romero@linaro.org, qemu-stable@nongnu.org, Peter Maydell Subject: [PATCH v3 6/6] target/arm: Fix SVE/SME gross MTE suppression checks Date: Wed, 7 Feb 2024 12:52:10 +1000 Message-Id: <20240207025210.8837-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240207025210.8837-1-richard.henderson@linaro.org> References: <20240207025210.8837-1-richard.henderson@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2607:f8b0:4864:20::62b; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1707274442764100001 Content-Type: text/plain; charset="utf-8" The TBI and TCMA bits are located within mtedesc, not desc. Cc: qemu-stable@nongnu.org Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson Tested-by: Gustavo Romero --- target/arm/tcg/sme_helper.c | 8 ++++---- target/arm/tcg/sve_helper.c | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/target/arm/tcg/sme_helper.c b/target/arm/tcg/sme_helper.c index 1ee2690ceb..904bfdac43 100644 --- a/target/arm/tcg/sme_helper.c +++ b/target/arm/tcg/sme_helper.c @@ -573,8 +573,8 @@ void sme_ld1_mte(CPUARMState *env, void *za, uint64_t *= vg, desc =3D extract32(desc, 0, SIMD_DATA_SHIFT + SVE_MTEDESC_SHIFT); =20 /* Perform gross MTE suppression early. */ - if (!tbi_check(desc, bit55) || - tcma_check(desc, bit55, allocation_tag_from_addr(addr))) { + if (!tbi_check(mtedesc, bit55) || + tcma_check(mtedesc, bit55, allocation_tag_from_addr(addr))) { mtedesc =3D 0; } =20 @@ -750,8 +750,8 @@ void sme_st1_mte(CPUARMState *env, void *za, uint64_t *= vg, target_ulong addr, desc =3D extract32(desc, 0, SIMD_DATA_SHIFT + SVE_MTEDESC_SHIFT); =20 /* Perform gross MTE suppression early. */ - if (!tbi_check(desc, bit55) || - tcma_check(desc, bit55, allocation_tag_from_addr(addr))) { + if (!tbi_check(mtedesc, bit55) || + tcma_check(mtedesc, bit55, allocation_tag_from_addr(addr))) { mtedesc =3D 0; } =20 diff --git a/target/arm/tcg/sve_helper.c b/target/arm/tcg/sve_helper.c index bce4295d28..6853f58c19 100644 --- a/target/arm/tcg/sve_helper.c +++ b/target/arm/tcg/sve_helper.c @@ -5800,8 +5800,8 @@ void sve_ldN_r_mte(CPUARMState *env, uint64_t *vg, ta= rget_ulong addr, desc =3D extract32(desc, 0, SIMD_DATA_SHIFT + SVE_MTEDESC_SHIFT); =20 /* Perform gross MTE suppression early. */ - if (!tbi_check(desc, bit55) || - tcma_check(desc, bit55, allocation_tag_from_addr(addr))) { + if (!tbi_check(mtedesc, bit55) || + tcma_check(mtedesc, bit55, allocation_tag_from_addr(addr))) { mtedesc =3D 0; } =20 @@ -6156,8 +6156,8 @@ void sve_ldnfff1_r_mte(CPUARMState *env, void *vg, ta= rget_ulong addr, desc =3D extract32(desc, 0, SIMD_DATA_SHIFT + SVE_MTEDESC_SHIFT); =20 /* Perform gross MTE suppression early. */ - if (!tbi_check(desc, bit55) || - tcma_check(desc, bit55, allocation_tag_from_addr(addr))) { + if (!tbi_check(mtedesc, bit55) || + tcma_check(mtedesc, bit55, allocation_tag_from_addr(addr))) { mtedesc =3D 0; } =20 @@ -6410,8 +6410,8 @@ void sve_stN_r_mte(CPUARMState *env, uint64_t *vg, ta= rget_ulong addr, desc =3D extract32(desc, 0, SIMD_DATA_SHIFT + SVE_MTEDESC_SHIFT); =20 /* Perform gross MTE suppression early. */ - if (!tbi_check(desc, bit55) || - tcma_check(desc, bit55, allocation_tag_from_addr(addr))) { + if (!tbi_check(mtedesc, bit55) || + tcma_check(mtedesc, bit55, allocation_tag_from_addr(addr))) { mtedesc =3D 0; } =20 --=20 2.34.1