From patchwork Wed Feb 7 02:52:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 770628 Delivered-To: patch@linaro.org Received: by 2002:a5d:40c1:0:b0:33b:4db1:f5b3 with SMTP id b1csp112131wrq; Tue, 6 Feb 2024 18:53:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IHUbbNXvQc1ahd2BCKFFExyhWv0sqMeMPlcvK6LrZ+HGjulcLdThZ6fQS89364mXl8ZcQ9f X-Received: by 2002:a05:622a:111:b0:42c:3ea0:a40f with SMTP id u17-20020a05622a011100b0042c3ea0a40fmr911789qtw.66.1707274422382; Tue, 06 Feb 2024 18:53:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1707274422; cv=none; d=google.com; s=arc-20160816; b=pNo7e9GC1So4gn22TiSTpWMEQbC26ZBFrxFjy4adIchbQAAgggeddIrOwaZZ6y4J5A IG2iPj9F+lWAcTOtWc1it0ScHSbzod61B168rmA0rFL4ofny6YEGuUcuiNNoHy3Waj8M 2kftvkUIfi3hsU5ff3iafc6eCxNh329WSRkj0mio1kU6vSZeP3L7VGCJrCzOYeB2HsOZ /YYaQQWbQ+/oxm9gYkBq6evdi/EEl4cXHzLu2rflmmAwa3NX/sOV3Zkmdv4pl4omIpfF fPJ5FNWPkZnRfjaA2AIS3JdDqWGzQ0Nfwe4m6cEoWd34PqmKvwv95FqLvvyfedvxgLT5 rTBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=XeR3jaWaGEublhkyds5zMH3a9rvdTlNi440zus838qM=; fh=y5HGdu15vG0xOLZvV7Iw+B2gdq0cRDCByhs/lnGgKec=; b=efWTZ2miyYUcKN188ld/RUAz7Fih4EMmKho/KZdINt16my3lLCx0FJMoOMxniOdfyg EfU5j61I5Ae7J20vb3JyYnShxIkjAfeahQ7YbMANeaTf7Gs8GcZ+GxfYQATpDP7+jVSX //R9FtZHspbMIF7l+wMnhWGryAJ4XCxeYfUcrm2UrWBOPLPGaycc7ytFgVO0Gs/U3Pab NSSkW1tqYBUVi1heBZXP8L/Yo6o8r+RRNMy54RQAMHen17OqyFRHQTgPkUFOYcXanpXS np3eG7w/k57BVgL6vbXnIdQBVZi/13F+hLduTql/p+YjHH6u0Nf+euAX4g2XLoLI8NaW S3fw==; darn=linaro.org ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jPPRtVt2; 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 X-Forwarded-Encrypted: i=1; AJvYcCWjsjFcxymoQg2s4gSclvhyZPwswT0FCTS/+nnBjkjTo0Ux2ILgg1xLMqnY0+Jl4FcqJ9rHcBmEAORjwYqdj9n6 Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 6-20020ac85746000000b0042c3114f018si305717qtx.318.2024.02.06.18.53.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 06 Feb 2024 18:53:42 -0800 (PST) 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=jPPRtVt2; 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] 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) 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-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/ 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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 --- 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(CPUArchState *env, abi_long arg2) env->tagged_addr_enable = arg2 & PR_TAGGED_ADDR_ENABLE; 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, and + * because SYNC is most useful for debugging MTE errors, choose SYNC + * as the preferred mode. With this preference, and the way the API + * uses only two bits, there is no way for the program to select + * ASYMM mode. */ - env->cp15.sctlr_el[1] = - deposit64(env->cp15.sctlr_el[1], 38, 2, arg2 >> PR_MTE_TCF_SHIFT); + unsigned tcf = 0; + if (arg2 & PR_MTE_TCF_SYNC) { + tcf = 1; + } else if (arg2 & PR_MTE_TCF_ASYNC) { + tcf = 2; + } + env->cp15.sctlr_el[1] = deposit64(env->cp15.sctlr_el[1], 38, 2, tcf); /* * Write PR_MTE_TAG to GCR_EL1[Exclude]. From patchwork Wed Feb 7 02:52:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 770629 Delivered-To: patch@linaro.org Received: by 2002:a5d:40c1:0:b0:33b:4db1:f5b3 with SMTP id b1csp112159wrq; Tue, 6 Feb 2024 18:53:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IEgALpJSZNm4+ouQPMZm8K7TBj8oMb27ibKvfMQtjaP+pJUbasKp3j3OCut/6G403jBtm/I X-Received: by 2002:a05:6122:288b:b0:4c0:3116:e909 with SMTP id fl11-20020a056122288b00b004c03116e909mr1535770vkb.7.1707274435501; Tue, 06 Feb 2024 18:53:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1707274435; cv=none; d=google.com; s=arc-20160816; b=GrrGnvtRFCL8G8r5Al5n1uGJEf9LrjQUBmlWhNaUDiTRjvR91P1EZAMPhCeZDzcJcR PQjlEmpEyqPHWyP5NheBBQrtzJdmeTRGDlQO1RFhIpkefIK3WDnDR32vGkCHIuAurgwt YgbtbW4s5ixelZ4LE7Q2079aVsiG+Dper9dqOffnRDSGzVXfw+xtBXlwMpJW4kUKjwje qP48YVyT1K2s7I9TCtrvWJWwSQEz4UrfAPgqPb8zUN9c/UNHR4ifiEEZJQgCV9rKdyRT 4XfHGo+aYPsZ7covppT+CSydkxQ4UbfAwY39dJxs0Y55PjEAvzpAR0DfCotPBakMtABc +Rew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=8/3IB+SoDAzkmHVKlFR4bQnh/JTWAMai5rQK+rwyNyA=; fh=th2zWicA0MndCsvJ8HNff58c9EJTD0GFS4fUVXiJupA=; b=F3cHfjZYdvu5ySlzGx29V/et3cxC6hZdJ68NY+9tbthe4Gm/jZUEkzy0TXeOz0yyJg V7mxmmECmi/BpakBy5OWjqfRKyOKZf38GXutUmz3t0D4Jzg14a32NreFOMlHkke2daoU adkhBuVpRCfGPKQJTFEsPKrWydFSO6cpzSxDkBBqvDZmXj4ZBtkDhibnmF/aRV/sqmRd dYOMIRU1Bj7UdHVdwjNNpXs2R4OmN/h2XT5XQ5JhlRZ0FZ4Db1x6LJgDYu/ZGVyn1Ypm SoK4FT4KqHEDn6a6vKVzfFvlRC7ym5MKZX4+9s4j9KcOkr1IvbCBV537cH/6u6FZzLbl Dt8Q==; darn=linaro.org ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DoKQseyc; 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 X-Forwarded-Encrypted: i=1; AJvYcCXiH1RKyGqm1G+zeJlNgZh2QMJLFFATL9cz8lJE3vVaxZtuxkLxuivRGjazuVxuaPgEsWQMrUV/HDna0rUSXJzc Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id o8-20020a05622a044800b0042c1eb99b13si288303qtx.641.2024.02.06.18.53.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 06 Feb 2024 18:53:55 -0800 (PST) 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=DoKQseyc; 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] 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) 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-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 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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 --- 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 = 0; - /* - * 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 >= 1 && mte_n <= 4); if (s->mte_active[0]) { int msz = dtype_msz(dtype); @@ -4463,6 +4459,11 @@ static void do_mem_zpa(DisasContext *s, int zt, int pg, TCGv_i64 addr, addr = clean_data_tbi(s, addr); } + /* + * 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 = simd_desc(vsz, vsz, zt | desc); t_pg = tcg_temp_new_ptr(); @@ -4600,7 +4601,7 @@ static void do_ld_zpa(DisasContext *s, int zt, int pg, * accessible via the instruction encoding. */ assert(fn != NULL); - do_mem_zpa(s, zt, pg, addr, dtype, nreg, false, fn); + do_mem_zpa(s, zt, pg, addr, dtype, nreg + 1, false, fn); } 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 == 0) { /* ST1 */ fn = fn_single[s->mte_active[0]][be][msz][esz]; - nreg = 1; } else { /* ST2, ST3, ST4 -- msz == esz, enforced by encoding */ assert(msz == esz); fn = fn_multiple[s->mte_active[0]][be][nreg - 1][msz]; } assert(fn != 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); } static bool trans_ST_zprr(DisasContext *s, arg_rprr_store *a) From patchwork Wed Feb 7 02:52:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 770632 Delivered-To: patch@linaro.org Received: by 2002:a5d:40c1:0:b0:33b:4db1:f5b3 with SMTP id b1csp112221wrq; Tue, 6 Feb 2024 18:54:07 -0800 (PST) X-Google-Smtp-Source: AGHT+IHcACfHtr7W+e+C6iC+wyuQKKAOZptaq18i2PWOymWpSz85aHRClCe2jmPZDR1/SuiALh19 X-Received: by 2002:ac8:4911:0:b0:42b:e6ad:b020 with SMTP id e17-20020ac84911000000b0042be6adb020mr5734172qtq.33.1707274446887; Tue, 06 Feb 2024 18:54:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1707274446; cv=none; d=google.com; s=arc-20160816; b=HdPAfBxeZQNicjoD6epcbOWDi2ZMzSARwYZDHrgyaftg8p76bB1m9LxqYTGiZ15jQV gAQrCcfOCPuB+vfQlrg1MENKI0AFC9M1vHF0BMoAIW4Emacnu/6AHmiW1MyaR7s+QFSd q5hoZXx8TmO3GluXW+k9x0sB8w6uwbeWT7n7cSWYbEmhJzOgspFn60yFpJXBwJ+Wq7OS dUE+9GClXJP0csMi6BhE2ljS0zmIwoBa+7vUgbgs+Le8s/P+KtHGor+iHMBkYe0C+Mty u/lot5MRs/5KU/Yx+cUDgyZvBK/+089IZecpJsrAIuO9d+5XOCUjWHj3Ot23iccNPZBw 9pRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=TlKFEqZAqQ3pAY5dLOI6DMwcM/4p9lbYDIei9Bg0M3Q=; fh=MonbiymnRhszp4GbsuNsHb/plEmkvhf2Ne3X2nQpggo=; b=l0qUW6jEe+qhfN/J02pgiBImlLUxXDX1q0ADT5/0Vx9KPSv4ZCgHE/JokuamHaWz+f iYSVmTDzj96+OH6Td74A2K6fpTs+35nkSRoazAtNintFN/ZTZP3CbWp/ejyMxIvCw1DE 9OJrEFs+xTFQdDs9YApv2JHMwupf9O17aVV/z5fr0NwXEUEwEP9/ZzsIIjAAZQghCFTz U4N2tRPXK/UeAEWOlDTIEopYcBbbfqCMPH3TLRlDVdKjz7siCrNezpNi9cLHb5Ipq/GI 4605pvmuBcCKwWkIhYbkw4GuJ8mSnKRqbgMlh7bNU/eTIIQYJIU7Owd5QZAOOktKi8jU LiGA==; darn=linaro.org ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OEIty088; 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 X-Forwarded-Encrypted: i=1; AJvYcCWu2Az+48PRqrFQrT/fOFLc7gmTyhJalOeY991u8YCCY9JNOoLuchQ358XVvEA4sgc5aldSkEcpl+DKsyBwaCGb Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id v9-20020a05622a144900b0042beca41f7asi298870qtx.397.2024.02.06.18.54.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 06 Feb 2024 18:54:06 -0800 (PST) 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=OEIty088; 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] 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) 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-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= 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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 == 5). Assert that the data to be stored fits within the field (expecting 8 * 4 - 1 == 31, exact fit). Cc: qemu-stable@nongnu.org Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- 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) /* size - 1 */ 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 = vec_full_reg_size(s); TCGv_ptr t_pg; + uint32_t sizem1; int desc = 0; assert(mte_n >= 1 && mte_n <= 4); + sizem1 = (mte_n << dtype_msz(dtype)) - 1; + assert(sizem1 <= R_MTEDESC_SIZEM1_MASK >> R_MTEDESC_SIZEM1_SHIFT); if (s->mte_active[0]) { - int msz = dtype_msz(dtype); - 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, is_write); - desc = FIELD_DP32(desc, MTEDESC, SIZEM1, (mte_n << msz) - 1); + desc = FIELD_DP32(desc, MTEDESC, SIZEM1, sizem1); desc <<= SVE_MTEDESC_SHIFT; } else { addr = clean_data_tbi(s, addr); From patchwork Wed Feb 7 02:52:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 770627 Delivered-To: patch@linaro.org Received: by 2002:a5d:40c1:0:b0:33b:4db1:f5b3 with SMTP id b1csp112109wrq; Tue, 6 Feb 2024 18:53:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IHCRK8yqSALyI74PDdsLLolw8kMkgKn7GTXlE5lOouHz/O88myqIiINhKslC5gBFTtHGYmA X-Received: by 2002:a0c:db0a:0:b0:685:7125:67e6 with SMTP id d10-20020a0cdb0a000000b00685712567e6mr4387482qvk.1.1707274416000; Tue, 06 Feb 2024 18:53:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1707274415; cv=none; d=google.com; s=arc-20160816; b=hBMzw9z4nU7zQ7hzPeoO9QaaX+rnkVZ0UPIfAXUwjaiw9B7hj8uemPhQY86Oexv1AV 6iafn/6ij2vZuD3F3KbjJrqOLtu6RjOOEjagD4HV8FPVOokJExT4w+xE8QJMg4oOXQ/I mKNXX0+9dsK5rvI39x48ft30QmUhnnKxxNo5WR4X5DZ/0MtK9mTrWTXoTHCUOa4ZFrSU VNj+rK35+SC0F3pC2DSeE//GvJmI5uvzi0nzb3o6t9PwA8zvkRV66of6xw/R/apeYq3z 3T0fgMcFopKADrPMBWp732ne0+8PARbsaWvOcnvE/OG5omrRnh/v3bqAa9aCVcn0w8u/ +owQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=tlUygCHtFk0VaXGDrmWE40VfWYD6mSX0y7BA0niY71c=; fh=8UyiwClzOlxm/yOelMYq0SDX76zwD9yRd2omAq+d3UI=; b=mQ0bI55nv6NQS8kpHgBwFieD4rDABK0u+7UpyFICrLDOJCBsvDqrokJ0GwLtZmwFdX SB7qRP1zHqtGd+A1q0CMws1tcuuemUKB7o9ureGQQbgEby0e9babIQVJ5kYYDmsga8iY hHx5BBblOBqIcxBeiKplnOf5d6ARP8mg0D5WCDHcarz3Q8O1mjodssXZ5sWMTOgop88h nHREeKOUGcPmJYOGOnxyI3PuJXqkW55LPNCyHAij28IUVmRzAjQj1Vnw6a9dC41BrNtT 1CiyP5KpKQPcV689CrL95k3jJazmKpDP4KEQQMeryY48AwgIRP6dC3kCS9MbRSx+Fvn/ s4nw==; darn=linaro.org ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IagH4IMq; 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 X-Forwarded-Encrypted: i=1; AJvYcCXkRMk2i9EZXOgtfP+TlPX957lJNETPqRf5ZGVi10sOShbsSnjPXReqjI8ZzWIYPxlRHIVdlv0tKDHuyFiFtj/g Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id i5-20020ad45c65000000b0068cafc7c1bdsi313916qvh.237.2024.02.06.18.53.35 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 06 Feb 2024 18:53:35 -0800 (PST) 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=IagH4IMq; 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] 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) 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-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= 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org Share code that creates mtedesc and embeds within simd_desc. Cc: qemu-stable@nongnu.org Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- 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 int 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); /* 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) TCGv_ptr t_za, t_pg; TCGv_i64 addr; - int svl, desc = 0; + uint32_t desc; bool be = s->be_data == MO_BE; bool mte = s->mte_active[0]; @@ -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)); - 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 { + if (!mte) { addr = clean_data_tbi(s, addr); } - svl = streaming_vec_reg_size(s); - desc = simd_desc(svl, svl, desc); + + desc = make_svemte_desc(s, streaming_vec_reg_size(s), 1, a->esz, a->st, 0); 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] = { 3, 2, 1, 3 }; -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 = vec_full_reg_size(s); - TCGv_ptr t_pg; uint32_t sizem1; - int desc = 0; + uint32_t desc = 0; - assert(mte_n >= 1 && mte_n <= 4); - sizem1 = (mte_n << dtype_msz(dtype)) - 1; + /* Assert all of the data fits, with or without MTE enabled. */ + assert(nregs >= 1 && nregs <= 4); + sizem1 = (nregs << msz) - 1; assert(sizem1 <= R_MTEDESC_SIZEM1_MASK >> R_MTEDESC_SIZEM1_SHIFT); + assert(data < 1u << SVE_MTEDESC_SHIFT); + if (s->mte_active[0]) { desc = FIELD_DP32(desc, MTEDESC, MIDX, get_mem_index(s)); desc = 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 = FIELD_DP32(desc, MTEDESC, WRITE, is_write); desc = FIELD_DP32(desc, MTEDESC, SIZEM1, sizem1); desc <<= 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 = clean_data_tbi(s, addr); } @@ -4465,7 +4476,8 @@ static void do_mem_zpa(DisasContext *s, int zt, int pg, TCGv_i64 addr, * registers as pointers, so encode the regno into the data field. * For consistency, do this even for LD1. */ - desc = simd_desc(vsz, vsz, zt | desc); + desc = make_svemte_desc(s, vec_full_reg_size(s), nregs, + dtype_msz(dtype), is_write, zt); t_pg = tcg_temp_new_ptr(); 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 = vec_full_reg_size(s); TCGv_ptr t_zm = tcg_temp_new_ptr(); TCGv_ptr t_pg = tcg_temp_new_ptr(); TCGv_ptr t_zt = tcg_temp_new_ptr(); - int desc = 0; - - if (s->mte_active[0]) { - 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, is_write); - desc = FIELD_DP32(desc, MTEDESC, SIZEM1, (1 << msz) - 1); - desc <<= SVE_MTEDESC_SHIFT; - } - desc = simd_desc(vsz, vsz, desc | scale); + uint32_t desc; 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 = make_svemte_desc(s, vec_full_reg_size(s), 1, msz, is_write, scale); fn(tcg_env, t_zt, t_pg, t_zm, scalar, tcg_constant_i32(desc)); } From patchwork Wed Feb 7 02:52:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 770631 Delivered-To: patch@linaro.org Received: by 2002:a5d:40c1:0:b0:33b:4db1:f5b3 with SMTP id b1csp112213wrq; Tue, 6 Feb 2024 18:54:03 -0800 (PST) X-Google-Smtp-Source: AGHT+IGCMV62yFKcUTEEgYpnkM6OxGbwFY3jtSLaD38XXJaALIXFaeKKF8aSMkFTOHzwjd7fPSqY X-Received: by 2002:a05:6214:260a:b0:68c:a83c:ca22 with SMTP id gu10-20020a056214260a00b0068ca83cca22mr5448215qvb.50.1707274443567; Tue, 06 Feb 2024 18:54:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1707274443; cv=none; d=google.com; s=arc-20160816; b=dvk740D6VGRtJUiU9KdNvbtkYoNOTz6huzcmPp+FQoGrO0i30H1QyeH4qwZCPmAKM3 Opc5vlBVnmFcyryalILwQXlvRzaeO14p/pttt166NPteTI/r6C8fm0hJ6jlToaXBuNVR JHAWB+qFk1xWvE+GbTqVIBih0nX0knpF3GCqzb6ZTWTHS7ImmzuNR4ZDs/29l4Y78XA1 O7l8wiUM7y6VFLsIJC88zlj22wWgq/QnU9gkK95ppxpRMlfaLWk7f/HNMGvq5JKrdqKc SBOWFow/jInMXAAdWFDGgG3L1/Xab0+nx2k1wPfveRPG67wqdbL99Q4pywZ4AccilPIn crdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=KE5lr6JW9Hb5FNHnTu7wAvaaKUMTGQjD484Q9RZmfv8=; fh=mDGETVeBOLdT8oI7DLSCEVagKlsweUBETYTBPfQthkg=; b=0wdtrNfOp1p2QZG+JmF03/nS+hE9YDFYMbWC3S7xoa9+0c/1R/UzYFODOSlSI5liZu 8S0MOJsEM8s3FN1BjuA4/4KdRXL1ij0bl2OKZR1tbty/h3tyNRYAr+wPm9Y0jfUyDXJX Ny17zTTxmX0If5g6mhXDVSoEA/6lRXEB8YL6opIlAWn5rTaN5F0K82CIMoHupxMp1xSS MEwNLP1aVGMNIv4Y+geMyZYIR8y5wfUDkeIl6ty8RgtcLldGn5YYODl7trzCVJI80OQA HTNR6xtfbbRTyoWFkxYSsxz2K7S+c7qr/Asdmj9SmgwqO/ZINHu5rEux/Xve1xH9PRYf FrWw==; darn=linaro.org ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=I8Qxszfu; 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 X-Forwarded-Encrypted: i=1; AJvYcCUtZPZ5Z2maEF1Nb9ebTYuCSI3iFWcfcO/eWgZ8I+KhjKWeptSdUpDh+Hl48CEAzNnFuw3HkkvdZA143LaUbiBO Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id h18-20020a0cf8d2000000b0068cae2f7605si281244qvo.304.2024.02.06.18.54.03 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 06 Feb 2024 18:54:03 -0800 (PST) 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=I8Qxszfu; 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] 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) 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-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= 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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 --- 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 = vec_full_reg_size(s); TCGv_ptr t_pg; int poff; + uint32_t desc; /* Load the first quadword using the normal predicated load helpers. */ + if (!s->mte_active[0]) { + addr = clean_data_tbi(s, addr); + } + poff = 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) gen_helper_gvec_mem *fn = ldr_fns[s->mte_active[0]][s->be_data == MO_BE][dtype][0]; - fn(tcg_env, t_pg, addr, tcg_constant_i32(simd_desc(16, 16, zt))); + desc = make_svemte_desc(s, 16, 1, dtype_msz(dtype), false, zt); + fn(tcg_env, t_pg, addr, tcg_constant_i32(desc)); /* 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; if (vsz < 32) { /* @@ -4941,6 +4948,9 @@ static void do_ldro(DisasContext *s, int zt, int pg, TCGv_i64 addr, int dtype) } /* Load the first octaword using the normal predicated load helpers. */ + if (!s->mte_active[0]) { + addr = clean_data_tbi(s, addr); + } poff = 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) gen_helper_gvec_mem *fn = ldr_fns[s->mte_active[0]][s->be_data == MO_BE][dtype][0]; - fn(tcg_env, t_pg, addr, tcg_constant_i32(simd_desc(32, 32, zt))); + desc = make_svemte_desc(s, 32, 1, dtype_msz(dtype), false, zt); + fn(tcg_env, t_pg, addr, tcg_constant_i32(desc)); /* * Replicate that first octaword. From patchwork Wed Feb 7 02:52:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 770630 Delivered-To: patch@linaro.org Received: by 2002:a5d:40c1:0:b0:33b:4db1:f5b3 with SMTP id b1csp112198wrq; Tue, 6 Feb 2024 18:54:02 -0800 (PST) X-Google-Smtp-Source: AGHT+IFRLX/pN5Lghin7ZQ1e4WIzqCexGYgohmBg/k/i2vzLlufS80ZTPi1Y8EV8wL9WZ15Kbm7X X-Received: by 2002:ad4:5fcc:0:b0:68c:88fd:d3f2 with SMTP id jq12-20020ad45fcc000000b0068c88fdd3f2mr5156693qvb.50.1707274442054; Tue, 06 Feb 2024 18:54:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1707274442; cv=none; d=google.com; s=arc-20160816; b=u4C5tRmXL91jUYKvTXz7g8LB4dN4a9YygFMvDbX1goUuL5brqFa6ewuh3GC37QKmdD ZeBh7fkDzcPAZlKy3P2YRoXXXF58oX0YaAhOv4aPcHkLBhFRK7oxje4nN+n/GK6vkPaO Mp7Y0WlbEC63zMO088c8VRCEkbtnEJDY8b5JqtCY0mUi+5PZoZIteWEaWQQua+/a6cYX LTWyWb8WLBbsVcJ1x2Wtfz+pgLK2eHk4lJMxRzl690Gw6M/595LYFVpIBkRstyxygS6w ZOOi21UWRZQU4NJYezNQ/e/D3jg9j/ChbRsLJAMh3PGfb6xUHTPpba5unpfA6n64+IsX nvxw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=EwSkPSHiupn05u+RAeWRJRNLnJ0SRDTtyOincwirVhY=; fh=Qw3NYcK1QA0+H+mabNX8LAktZRqhYPxt5cj3QqvXEAE=; b=FK7farRF9Os66yqISO1WYq1H9e5d7vWxf7Ngh+B7fWQeQW9wc5rvA3ubP2sy6oLIeA xFmmXrIesMc7XLOc+X3qlPnmZ0bi7ZoCPSm0AK2UJ3qF0CQwjFJuoittzYAZSFlR2WKa s30Fuws2yjFVJxGrX49uQhjr3WtUroBhGmFGh8BkBIon5IxW4hH6VzJ915T1IiAr2Oj8 CnHL1BksMAW1sIa5/9kpjNNobO34NXVRHB3JYoBrRkCRyv8HY0FyBpRw3pVIRedAXPCr jBBR8QDnqp6cp86lUbrO8IpK3sztFI8TI9K6eFLEtDZVBOM5Orulpff94dmn5p2Pu3ds /HFg==; darn=linaro.org ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DetoBs8C; 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 X-Forwarded-Encrypted: i=1; AJvYcCULHEVsMuv4LA7fWhXwOChmdV6Q7u+k7arUrrL+4C2xXcmx8O4HbeQ4/xLCCSqCofCbmOLW72tPvE8ThcNoHWz/ Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id jx14-20020a0562142b0e00b0068cb61a4873si305125qvb.558.2024.02.06.18.54.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 06 Feb 2024 18:54:02 -0800 (PST) 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=DetoBs8C; 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] 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) 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-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= 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) 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 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+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org 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 --- 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 = 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))) { + if (!tbi_check(mtedesc, bit55) || + tcma_check(mtedesc, bit55, allocation_tag_from_addr(addr))) { mtedesc = 0; } @@ -750,8 +750,8 @@ void sme_st1_mte(CPUARMState *env, void *za, uint64_t *vg, target_ulong addr, 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))) { + if (!tbi_check(mtedesc, bit55) || + tcma_check(mtedesc, bit55, allocation_tag_from_addr(addr))) { mtedesc = 0; } 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, target_ulong addr, 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))) { + if (!tbi_check(mtedesc, bit55) || + tcma_check(mtedesc, bit55, allocation_tag_from_addr(addr))) { mtedesc = 0; } @@ -6156,8 +6156,8 @@ void sve_ldnfff1_r_mte(CPUARMState *env, void *vg, target_ulong addr, 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))) { + if (!tbi_check(mtedesc, bit55) || + tcma_check(mtedesc, bit55, allocation_tag_from_addr(addr))) { mtedesc = 0; } @@ -6410,8 +6410,8 @@ void sve_stN_r_mte(CPUARMState *env, uint64_t *vg, target_ulong addr, 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))) { + if (!tbi_check(mtedesc, bit55) || + tcma_check(mtedesc, bit55, allocation_tag_from_addr(addr))) { mtedesc = 0; }