From patchwork Wed Jul 6 08:23:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 587709 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1ec:0:0:0:0 with SMTP id 12csp2530489map; Wed, 6 Jul 2022 01:28:25 -0700 (PDT) X-Google-Smtp-Source: AGRyM1u3ljc5o2BI54xIqAl0LAwgmxfXDa4WFnUHtY141J/JM4cDFRpgPE4wEzLttu0TxDir+Qct X-Received: by 2002:a25:b183:0:b0:66e:697b:90a5 with SMTP id h3-20020a25b183000000b0066e697b90a5mr10657607ybj.435.1657096105206; Wed, 06 Jul 2022 01:28:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657096105; cv=none; d=google.com; s=arc-20160816; b=ZTVb4HyI9mCX8Ye8GIVh7+xUUnOrL59vihemrT4Mp0miKPE+AoiW2g9k6DMzTS2s2y SjioetpuhLOl/dzTUvY2SVF/2lMVeGxgq/yTYrEQtNxTbrNSLrV9hhxupaW+v8rjwBmQ U+iFqogm3r4VwhGkUa9LEcb2rHHYj1pqtnzHN58aZLh2ZcX+Z/QaEbsDHUJOcvFFjb0d brgnz4ZYLh9gQF4Dn+i7BCsCpk7oE1QtMn596+AYE9HprWaXVVIdyDY6/rFh/3FJceiG Pd5kaihr+g1sWqfuOfbkhxEWamdWwzmRmWPtww+2KgKzVJmwlG9OYMc9vkoq59knZYjN FGFw== 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=ROIaR2/2j+a5heyURGySBxjwOTFvMLYqmlHWrVr1ZCs=; b=qEQCQe3SvF8B1Es0P+H7U+5tPqiRRnBUOZipKLajAXhPBjnWQjLndkUVFz1BlTY3QW uXKVtuhhpMRMA/mkY8GQQ3NbS0sT3oGS9S9H0Vq+K/EaPbUmtbZZfpWNL+VTaREPuQkV J6Bg+QawbvhuTtkPWQNo5UuTD/9T8kC/H4r8Fz+PVswdUDmffIKWt6msQazlf8fV3kor 4DUBgjKVFE0vTrkXjV8TLMVRhiY6eTiZN94Du/uJ8yJ9hdQ4H7nRul8fOmTius0lROeJ qXrp1RvN/2ez6J442Q62TiljCfMoUc7kFQfQOmZkupYMw46i32pGIqYwgcDdZ/hEYVwz ptEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jfOpWNFm; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 70-20020a811549000000b0031c874d82a1si15497548ywv.489.2022.07.06.01.28.25 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Jul 2022 01:28:25 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jfOpWNFm; 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]:50592 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o90OW-0005jI-MW for patch@linaro.org; Wed, 06 Jul 2022 04:28:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48600) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o90Kh-0005ep-7w for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:24:28 -0400 Received: from mail-pg1-x52f.google.com ([2607:f8b0:4864:20::52f]:39522) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o90Kb-0000Iu-5t for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:24:23 -0400 Received: by mail-pg1-x52f.google.com with SMTP id q82so6274179pgq.6 for ; Wed, 06 Jul 2022 01:24:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ROIaR2/2j+a5heyURGySBxjwOTFvMLYqmlHWrVr1ZCs=; b=jfOpWNFmWX07NF4c4nXo0EhwOcvwYb9QFlHmyDhxV+IlM2CkjZwBJ8V8thX8Lsrodm 20Inq8m/yG8003DrVuwa4NZge3eQ5clBNr0wrzCiCBENm28TwpdWFsBJ0v12yzGUhvEK xE7P/nD/PYDD21SNDB+bRkgEtRUXOAkTeCODLRSspsbl2t+v2dbRYyZnxolMzxwV51Vv vBBSaaajWekOoHSNw/avkdlaOtEWIXqAaBCxNZ8VfZJisCqW15HfqvhhrGTEOQCzykUL h6xtJoWW6lqETf4d588JZrzbsQChSopek4RBIQxlbwXPGp4vZWVmtVdtDwoaQwRDEzVs kVtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ROIaR2/2j+a5heyURGySBxjwOTFvMLYqmlHWrVr1ZCs=; b=U2zlUqEEkOoaQje6G7927f++nCx7RTwWV7mXDA35q6n3w4DzNBKOYvpOGmTM9B0zoS ZVeAdOYqfhAluyAgmSiNM+GPZ01CYDOXdYyj5j40kH6GyCrtCjzCXvP8PofCIVnUleOb BInyoje1ARLjSz3wF68j7fBQW52kTiAt3n3WGM1d7DGjtLKpo2BGPbkEl1hxe0F0vcuO opODrxNkxrKHG+Ou2fcdSTPlKO+Bnh1Tt0SBwBk5epGUul9rkc1nHqU5YmRb0BOe2n1V UXECwghdZt95PN8/QhwQBaSEa6mfrpIG/idEqVWILPSiiNngfHemc01+mgZEovBNuqXS 0vPw== X-Gm-Message-State: AJIora/LsT5OGVam3HbkMbVu3KA3j2jCQ+/gbgITpKfIgSdlNziH8yoo T5DABC0jg4CSioINWtcLaRrPnihtvWwG0/qT X-Received: by 2002:aa7:8b47:0:b0:525:4214:c195 with SMTP id i7-20020aa78b47000000b005254214c195mr47017842pfd.55.1657095859055; Wed, 06 Jul 2022 01:24:19 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id t17-20020a170902e85100b00162529828aesm25199256plg.109.2022.07.06.01.24.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jul 2022 01:24:18 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v5 01/45] target/arm: Handle SME in aarch64_cpu_dump_state Date: Wed, 6 Jul 2022 13:53:27 +0530 Message-Id: <20220706082411.1664825-2-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220706082411.1664825-1-richard.henderson@linaro.org> References: <20220706082411.1664825-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52f; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52f.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" Dump SVCR, plus use the correct access check for Streaming Mode. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/cpu.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/target/arm/cpu.c b/target/arm/cpu.c index ae6dca2f01..9c58be8b14 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -878,6 +878,7 @@ static void aarch64_cpu_dump_state(CPUState *cs, FILE *f, int flags) int i; int el = arm_current_el(env); const char *ns_status; + bool sve; qemu_fprintf(f, " PC=%016" PRIx64 " ", env->pc); for (i = 0; i < 32; i++) { @@ -904,6 +905,12 @@ static void aarch64_cpu_dump_state(CPUState *cs, FILE *f, int flags) el, psr & PSTATE_SP ? 'h' : 't'); + if (cpu_isar_feature(aa64_sme, cpu)) { + qemu_fprintf(f, " SVCR=%08" PRIx64 " %c%c", + env->svcr, + (FIELD_EX64(env->svcr, SVCR, ZA) ? 'Z' : '-'), + (FIELD_EX64(env->svcr, SVCR, SM) ? 'S' : '-')); + } if (cpu_isar_feature(aa64_bti, cpu)) { qemu_fprintf(f, " BTYPE=%d", (psr & PSTATE_BTYPE) >> 10); } @@ -918,7 +925,15 @@ static void aarch64_cpu_dump_state(CPUState *cs, FILE *f, int flags) qemu_fprintf(f, " FPCR=%08x FPSR=%08x\n", vfp_get_fpcr(env), vfp_get_fpsr(env)); - if (cpu_isar_feature(aa64_sve, cpu) && sve_exception_el(env, el) == 0) { + if (cpu_isar_feature(aa64_sme, cpu) && FIELD_EX64(env->svcr, SVCR, SM)) { + sve = sme_exception_el(env, el) == 0; + } else if (cpu_isar_feature(aa64_sve, cpu)) { + sve = sve_exception_el(env, el) == 0; + } else { + sve = false; + } + + if (sve) { int j, zcr_len = sve_vqm1_for_el(env, el); for (i = 0; i <= FFR_PRED_NUM; i++) { From patchwork Wed Jul 6 08:23:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 587714 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1ec:0:0:0:0 with SMTP id 12csp2544375map; Wed, 6 Jul 2022 01:51:24 -0700 (PDT) X-Google-Smtp-Source: AGRyM1v+qGXwGMnJ1VTderrr61+KibuOYA1M+02lAsG3lWQ/7YMbcU2RFI345xHXPFkL2RzB37nt X-Received: by 2002:a05:620a:b5d:b0:6af:6675:68c3 with SMTP id x29-20020a05620a0b5d00b006af667568c3mr26153697qkg.171.1657097483880; Wed, 06 Jul 2022 01:51:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657097483; cv=none; d=google.com; s=arc-20160816; b=s+eLlIDtQJ0W1ZwFemwH0IMEokG+EwxUHcyMz91FIlkemdYzcFMpsT3GYJhHkPhtUH PxtjsDLi2m6Ez1uBSZBtQpwD9gzuq6K0GSjuH3+ioyc36JKL+ZqUB8KH4dfT+fbhuiWn HsJcKnTULvV4ZH3nLza6Z8v8rtzWOrPhJXeCd4tzHQeCmrKgsVjxy/A/vqzd7OSSOENj 1yHfKyGW1GD6o1Gx1tpi2yS2khVuLTrG9/9y8dlpzOFVPKDKCORcLnUMKMet/K9ZpYNv 9e1DnMa2C2a+sHsW/PF6f77nHKIPN3Ri0TCXm/Ya67sl3Ffdrf+S/CyU19qB52FSxHDm C7QQ== 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=Zt0iFWR3qz21z3bSyJ1iuT1OyELXtc2hbyVwv56j1M4=; b=ux0InlUZPQcnBp+YqZGzBSaintPFt0MRd2fw9Q9J1WykomNSCMNMmTjyBDBTZHUWug VRJO0sanzQIYKD6c/l+/pVR+W4vbbQzhNAkbjm4nILZfyeqZrxqYvMmWK11kbl9BEg7B wVQldNBkbDZ2JWo/W7prGpdxHSwGWw2FviXdwahdvG4MOWdwKBV36oEvfptIbllePgaj JiGTfABeCeTJqgWADVfkA8/SDKM9Y3P3sv8+75sPqruzAND0q8XpseY3nluH4N8RnPZj XpejLpQU9sSewZMZl3gIALgknuXSkKP4dvM2pHfOetJO40VazXqmGz7qZTsuNC/bSOwF zIig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DwOty5jf; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id l11-20020a05622a050b00b003077bcbcb65si22359643qtx.269.2022.07.06.01.51.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Jul 2022 01:51:23 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DwOty5jf; 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]:48272 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o90kl-0007JW-FW for patch@linaro.org; Wed, 06 Jul 2022 04:51:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48660) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o90Kk-0005hZ-74 for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:24:30 -0400 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]:40537) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o90Kd-0000JD-1T for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:24:29 -0400 Received: by mail-pj1-x102b.google.com with SMTP id g16-20020a17090a7d1000b001ea9f820449so19583676pjl.5 for ; Wed, 06 Jul 2022 01:24:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Zt0iFWR3qz21z3bSyJ1iuT1OyELXtc2hbyVwv56j1M4=; b=DwOty5jfyrAdH+R5lveulEDACgBbxoq3624k7XN1sjbbeN282LcZx6LYdao8wAf/al BnHDoAzdPSjB473oh0/ntgCQrv+O08gyfU00Q+PeMQSF93fvjLN+rujcfz7ILoU2yLHx w2Xjf9I02oKisH/L+ypZwRTBgJ/4VI3FQaw+Abq7zzCPdQUV9I6Gcz2ywkCbTFlI7UU3 ryvZShZ9yFOX2rokVvOtfYO+GEGfEU4nfu8LIs8/sXBkrHFtzrLFc41j+u0YbaaJ2Q89 gfPUy9LwtXyTWgoRRcFMIekbP7W+EzRGeyCU2XFZx+ZFrl0TdJvhEBFppHVSyHuZpiSS mmtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Zt0iFWR3qz21z3bSyJ1iuT1OyELXtc2hbyVwv56j1M4=; b=2EfBOLeKJTxQMItQWpEDptLy6kidBAYvDGVUbtoAJceah1ce69iraBAJTN93xchJGR TJoB5kkxOL3gcY4EUNJS6Waa9AsTRsL8hl/Y938M/t3exPVnwFNNs7qbGqPTIsNs8ebw Fb3N6glWXRy4a/p86aROf5tvV4z3UtG5GlpHbXfRrfaAOiBMB4/6+uxEPEagIT770G26 i0DIe4/wLoS+sHInrPiLglCfN/ioyZEOIh+Etq+zcjH8hiqcUkc1wSTihe5+esP6yzaP z+w+gJj/molkaSxYcP+h6rOCCMtQRO/dG8rwzxRbixjBt1mM3EeCimOp8lcbMUTtEILz BuCQ== X-Gm-Message-State: AJIora8leVuzkZlpIHS4/zjlo0gTyYYDq1v1f+BpjDmtHOoVYQBqLX8S zR8/Uy6omkdoLAcW6DvJcGLOCynw0Ursd768 X-Received: by 2002:a17:902:e889:b0:16a:439f:b3c5 with SMTP id w9-20020a170902e88900b0016a439fb3c5mr46950003plg.131.1657095861586; Wed, 06 Jul 2022 01:24:21 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id t17-20020a170902e85100b00162529828aesm25199256plg.109.2022.07.06.01.24.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jul 2022 01:24:21 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v5 02/45] target/arm: Add infrastructure for disas_sme Date: Wed, 6 Jul 2022 13:53:28 +0530 Message-Id: <20220706082411.1664825-3-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220706082411.1664825-1-richard.henderson@linaro.org> References: <20220706082411.1664825-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102b; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102b.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" This includes the build rules for the decoder, and the new file for translation, but excludes any instructions. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/translate-a64.h | 1 + target/arm/sme.decode | 20 ++++++++++++++++++++ target/arm/translate-a64.c | 7 ++++++- target/arm/translate-sme.c | 35 +++++++++++++++++++++++++++++++++++ target/arm/meson.build | 2 ++ 5 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 target/arm/sme.decode create mode 100644 target/arm/translate-sme.c diff --git a/target/arm/translate-a64.h b/target/arm/translate-a64.h index f0970c6b8c..789b6e8e78 100644 --- a/target/arm/translate-a64.h +++ b/target/arm/translate-a64.h @@ -146,6 +146,7 @@ static inline int pred_gvec_reg_size(DisasContext *s) } bool disas_sve(DisasContext *, uint32_t); +bool disas_sme(DisasContext *, uint32_t); void gen_gvec_rax1(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, uint32_t rm_ofs, uint32_t opr_sz, uint32_t max_sz); diff --git a/target/arm/sme.decode b/target/arm/sme.decode new file mode 100644 index 0000000000..c25c031a71 --- /dev/null +++ b/target/arm/sme.decode @@ -0,0 +1,20 @@ +# AArch64 SME instruction descriptions +# +# Copyright (c) 2022 Linaro, Ltd +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, see . + +# +# This file is processed by scripts/decodetree.py +# diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index c86b97b1d4..a5f8a6c771 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -14806,7 +14806,12 @@ static void aarch64_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) } switch (extract32(insn, 25, 4)) { - case 0x0: case 0x1: case 0x3: /* UNALLOCATED */ + case 0x0: + if (!extract32(insn, 31, 1) || !disas_sme(s, insn)) { + unallocated_encoding(s); + } + break; + case 0x1: case 0x3: /* UNALLOCATED */ unallocated_encoding(s); break; case 0x2: diff --git a/target/arm/translate-sme.c b/target/arm/translate-sme.c new file mode 100644 index 0000000000..786c93fb2d --- /dev/null +++ b/target/arm/translate-sme.c @@ -0,0 +1,35 @@ +/* + * AArch64 SME translation + * + * Copyright (c) 2022 Linaro, Ltd + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +#include "qemu/osdep.h" +#include "cpu.h" +#include "tcg/tcg-op.h" +#include "tcg/tcg-op-gvec.h" +#include "tcg/tcg-gvec-desc.h" +#include "translate.h" +#include "exec/helper-gen.h" +#include "translate-a64.h" +#include "fpu/softfloat.h" + + +/* + * Include the generated decoder. + */ + +#include "decode-sme.c.inc" diff --git a/target/arm/meson.build b/target/arm/meson.build index 43dc600547..6dd7e93643 100644 --- a/target/arm/meson.build +++ b/target/arm/meson.build @@ -1,5 +1,6 @@ gen = [ decodetree.process('sve.decode', extra_args: '--decode=disas_sve'), + decodetree.process('sme.decode', extra_args: '--decode=disas_sme'), decodetree.process('neon-shared.decode', extra_args: '--decode=disas_neon_shared'), decodetree.process('neon-dp.decode', extra_args: '--decode=disas_neon_dp'), decodetree.process('neon-ls.decode', extra_args: '--decode=disas_neon_ls'), @@ -50,6 +51,7 @@ arm_ss.add(when: 'TARGET_AARCH64', if_true: files( 'sme_helper.c', 'translate-a64.c', 'translate-sve.c', + 'translate-sme.c', )) arm_softmmu_ss = ss.source_set() From patchwork Wed Jul 6 08:23:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 587710 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1ec:0:0:0:0 with SMTP id 12csp2534380map; Wed, 6 Jul 2022 01:34:39 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vRBjfGGHxS+v2yvNsEUUnZYpNUE/cmtcI84goLvCDHMkJz3rHhj59xpXYEubzRvQ58JQCR X-Received: by 2002:a05:620a:4914:b0:6af:3011:585f with SMTP id ed20-20020a05620a491400b006af3011585fmr25665916qkb.245.1657096479442; Wed, 06 Jul 2022 01:34:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657096479; cv=none; d=google.com; s=arc-20160816; b=aHo6du9GcwJWIkh3TrknQL+8isUfvaDea6GNet085ijzk52yNzcFjwv6A4BqAU69wS htkkIOAbquULbqW9eT5ywJy0c/Irtr5LpGjAYfdZvdE7P1xWdbfnAvBKlaOnWf4zs7oI HwSgcYmdpQ8wQuAcP1+ZxbPXPPIfwqqj6AIcLQiblKE8Qud2YrpCMHVjLw5rRA5FqEp6 MpM3YvJfqXVuX1w/zH60ILQEoV6srLjGljftWNnCOwREXOA2I+ETjiVm7x9a/NXVvhLO euq+5twfNOvK0apRVbnyKIE3+fbhNiQAy+u0gzPhuGZMvlayJinorCFs6tR/LMMENpoy gklA== 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=etebcuoml6MPCnpZwQtsUCAalp1H8l/qBDSJXvo8Lgk=; b=rqwUsyLiiGA1FXVsZJcfPPclWGJf7BpBs4kwWcqDPi1CmsoSakzVu3ZGlzyzXzjI4S S//pmcIoGEIKFWudduJi8c57GkUW22siXDR0N8CuuuY922mQZLWkDBIGeJCQ7X4BM92b 2P80GwQBfVYYZl22UTMrzGrHdf5xVROO2mReps5Sysct6VK3bN8JkKYF4xeMBIUaebuC obW5LXRGniyt2YObeTEJRzqJiZ/ky4VrUYeWZ29ZPd0rCCYCEnPlJ7EihEIcnKjllNnu 2mMFGUhZ+uQY8oHw8Dv4HuLnprBWMorfIAKxbVf7J7dmj49wqbiiCesHfke7KRbbTkF9 ihjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CgdmAiaN; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id q4-20020ad45ca4000000b00470703e6e74si1004835qvh.512.2022.07.06.01.34.39 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Jul 2022 01:34:39 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=CgdmAiaN; 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]:58492 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o90UX-00038K-NM for patch@linaro.org; Wed, 06 Jul 2022 04:34:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48662) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o90Kk-0005ha-8e for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:24:30 -0400 Received: from mail-pg1-x52b.google.com ([2607:f8b0:4864:20::52b]:41732) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o90Kg-0000JX-QV for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:24:29 -0400 Received: by mail-pg1-x52b.google.com with SMTP id 23so13439979pgc.8 for ; Wed, 06 Jul 2022 01:24:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=etebcuoml6MPCnpZwQtsUCAalp1H8l/qBDSJXvo8Lgk=; b=CgdmAiaNsRqWxhVBwM8l9n3taV84hdLkmQLR0xPr7olyD5QQft3ojyHVQCAp7TbQGp heZwAMf7ujQNfExkqj1iFLwrUGvvdjwBDo48q+QVwiCshQvo9BquAgocln+hqCHAIKh+ xTfc32ZDUSZi2f854cjI72UT7JwRf1ow2eOE7DjzncubaD9YtnvPgb1LjLs6USEq4Kvb IWUsSXw62CZslxRZhMFu0tWImiwUkfO9mTygh/5qSjEuX7KjwlvCoG1xbx8Zef7VPK5C jUDL6XpqqRHon/HIZZYVeZAJK4NfiV5cUu/sPMZ6cF51d/kVCU/QZkGNS0plDCf14OI5 uOHg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=etebcuoml6MPCnpZwQtsUCAalp1H8l/qBDSJXvo8Lgk=; b=ox6DffeibRkwzY9yakjZ9c1A/sOhmTA/+HyDsL1XF0bTHbpuhaMh8Mahx6BBIkBu1s mhhuOyC3A58AVCbGrpuCkprbO9/EpZ/pdMh8yb+dh10ZoveXgJd9a9ZbZF1Ocw4NE5N1 suGbdTdaejf+BPvSL5iZbWwV6KTQnswnRXv5eIW0PP69YaEYnfwBbQZvxY646511NQAH p0JPnBtCQ8aeIIzp/3TqnF9fhjjWOAwt7UQiEup/j2nzdGJlpVxkwxpb4qERNr/i/dbd LLxB3saWgLle7kxFEA7xcnCpd4AqhJd3TGB7xwZ7rPG5DNrEPNZDDfZmVxADJyBgJmZx dodQ== X-Gm-Message-State: AJIora8NHLPIaQ4eQ9aTCsIguDNrdbmFQTRKslNmW3Cw6Wzs3lqi+8bg xkIvVJgPBXPwQuArnL4j9qMV6FOsJR/1My9b X-Received: by 2002:a05:6a00:2d2:b0:528:9311:bb44 with SMTP id b18-20020a056a0002d200b005289311bb44mr8736862pft.48.1657095863734; Wed, 06 Jul 2022 01:24:23 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id t17-20020a170902e85100b00162529828aesm25199256plg.109.2022.07.06.01.24.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jul 2022 01:24:23 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v5 03/45] target/arm: Trap non-streaming usage when Streaming SVE is active Date: Wed, 6 Jul 2022 13:53:29 +0530 Message-Id: <20220706082411.1664825-4-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220706082411.1664825-1-richard.henderson@linaro.org> References: <20220706082411.1664825-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52b; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52b.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" This new behaviour is in the ARM pseudocode function AArch64.CheckFPAdvSIMDEnabled, which applies to AArch32 via AArch32.CheckAdvSIMDOrFPEnabled when the EL to which the trap would be delivered is in AArch64 mode. Given that ARMv9 drops support for AArch32 outside EL0, the trap EL detection ought to be trivially true, but the pseudocode still contains a number of conditions, and QEMU has not yet committed to dropping A32 support for EL[12] when v9 features are present. Since the computation of SME_TRAP_NONSTREAMING is necessarily different for the two modes, we might as well preserve bits within TBFLAG_ANY and allocate separate bits within TBFLAG_A32 and TBFLAG_A64 instead. Note that DDI0616A.a has typos for bits [22:21] of LD1RO in the table of instructions illegal in streaming mode. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/cpu.h | 7 +++ target/arm/translate.h | 4 ++ target/arm/sme-fa64.decode | 90 ++++++++++++++++++++++++++++++++++++++ target/arm/helper.c | 41 +++++++++++++++++ target/arm/translate-a64.c | 40 ++++++++++++++++- target/arm/translate-vfp.c | 12 +++++ target/arm/translate.c | 2 + target/arm/meson.build | 1 + 8 files changed, 195 insertions(+), 2 deletions(-) create mode 100644 target/arm/sme-fa64.decode diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 4a4342f262..9e12669c12 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -3146,6 +3146,11 @@ FIELD(TBFLAG_A32, HSTR_ACTIVE, 9, 1) * the same thing as the current security state of the processor! */ FIELD(TBFLAG_A32, NS, 10, 1) +/* + * Indicates that SME Streaming mode is active, and SMCR_ELx.FA64 is not. + * This requires an SME trap from AArch32 mode when using NEON. + */ +FIELD(TBFLAG_A32, SME_TRAP_NONSTREAMING, 11, 1) /* * Bit usage when in AArch32 state, for M-profile only. @@ -3183,6 +3188,8 @@ FIELD(TBFLAG_A64, SMEEXC_EL, 20, 2) FIELD(TBFLAG_A64, PSTATE_SM, 22, 1) FIELD(TBFLAG_A64, PSTATE_ZA, 23, 1) FIELD(TBFLAG_A64, SVL, 24, 4) +/* Indicates that SME Streaming mode is active, and SMCR_ELx.FA64 is not. */ +FIELD(TBFLAG_A64, SME_TRAP_NONSTREAMING, 28, 1) /* * Helpers for using the above. diff --git a/target/arm/translate.h b/target/arm/translate.h index 22fd882368..cbc907c751 100644 --- a/target/arm/translate.h +++ b/target/arm/translate.h @@ -102,6 +102,10 @@ typedef struct DisasContext { bool pstate_sm; /* True if PSTATE.ZA is set. */ bool pstate_za; + /* True if non-streaming insns should raise an SME Streaming exception. */ + bool sme_trap_nonstreaming; + /* True if the current instruction is non-streaming. */ + bool is_nonstreaming; /* True if MVE insns are definitely not predicated by VPR or LTPSIZE */ bool mve_no_pred; /* diff --git a/target/arm/sme-fa64.decode b/target/arm/sme-fa64.decode new file mode 100644 index 0000000000..3d90837fc7 --- /dev/null +++ b/target/arm/sme-fa64.decode @@ -0,0 +1,90 @@ +# AArch64 SME allowed instruction decoding +# +# Copyright (c) 2022 Linaro, Ltd +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, see . + +# +# This file is processed by scripts/decodetree.py +# + +# These patterns are taken from Appendix E1.1 of DDI0616 A.a, +# Arm Architecture Reference Manual Supplement, +# The Scalable Matrix Extension (SME), for Armv9-A + +{ + [ + OK 0-00 1110 0000 0001 0010 11-- ---- ---- # SMOV W|Xd,Vn.B[0] + OK 0-00 1110 0000 0010 0010 11-- ---- ---- # SMOV W|Xd,Vn.H[0] + OK 0100 1110 0000 0100 0010 11-- ---- ---- # SMOV Xd,Vn.S[0] + OK 0000 1110 0000 0001 0011 11-- ---- ---- # UMOV Wd,Vn.B[0] + OK 0000 1110 0000 0010 0011 11-- ---- ---- # UMOV Wd,Vn.H[0] + OK 0000 1110 0000 0100 0011 11-- ---- ---- # UMOV Wd,Vn.S[0] + OK 0100 1110 0000 1000 0011 11-- ---- ---- # UMOV Xd,Vn.D[0] + ] + FAIL 0--0 111- ---- ---- ---- ---- ---- ---- # Advanced SIMD vector operations +} + +{ + [ + OK 0101 1110 --1- ---- 11-1 11-- ---- ---- # FMULX/FRECPS/FRSQRTS (scalar) + OK 0101 1110 -10- ---- 00-1 11-- ---- ---- # FMULX/FRECPS/FRSQRTS (scalar, FP16) + OK 01-1 1110 1-10 0001 11-1 10-- ---- ---- # FRECPE/FRSQRTE/FRECPX (scalar) + OK 01-1 1110 1111 1001 11-1 10-- ---- ---- # FRECPE/FRSQRTE/FRECPX (scalar, FP16) + ] + FAIL 01-1 111- ---- ---- ---- ---- ---- ---- # Advanced SIMD single-element operations +} + +FAIL 0-00 110- ---- ---- ---- ---- ---- ---- # Advanced SIMD structure load/store +FAIL 1100 1110 ---- ---- ---- ---- ---- ---- # Advanced SIMD cryptography extensions +FAIL 0001 1110 0111 1110 0000 00-- ---- ---- # FJCVTZS + +# These are the "avoidance of doubt" final table of Illegal Advanced SIMD instructions +# We don't actually need to include these, as the default is OK. +# -001 111- ---- ---- ---- ---- ---- ---- # Scalar floating-point operations +# --10 110- ---- ---- ---- ---- ---- ---- # Load/store pair of FP registers +# --01 1100 ---- ---- ---- ---- ---- ---- # Load FP register (PC-relative literal) +# --11 1100 --0- ---- ---- ---- ---- ---- # Load/store FP register (unscaled imm) +# --11 1100 --1- ---- ---- ---- ---- --10 # Load/store FP register (register offset) +# --11 1101 ---- ---- ---- ---- ---- ---- # Load/store FP register (scaled imm) + +FAIL 0000 0100 --1- ---- 1010 ---- ---- ---- # ADR +FAIL 0000 0100 --1- ---- 1011 -0-- ---- ---- # FTSSEL, FEXPA +FAIL 0000 0101 --10 0001 100- ---- ---- ---- # COMPACT +FAIL 0010 0101 --01 100- 1111 000- ---0 ---- # RDFFR, RDFFRS +FAIL 0010 0101 --10 1--- 1001 ---- ---- ---- # WRFFR, SETFFR +FAIL 0100 0101 --0- ---- 1011 ---- ---- ---- # BDEP, BEXT, BGRP +FAIL 0100 0101 000- ---- 0110 1--- ---- ---- # PMULLB, PMULLT (128b result) +FAIL 0110 0100 --1- ---- 1110 01-- ---- ---- # FMMLA, BFMMLA +FAIL 0110 0101 --0- ---- 0000 11-- ---- ---- # FTSMUL +FAIL 0110 0101 --01 0--- 100- ---- ---- ---- # FTMAD +FAIL 0110 0101 --01 1--- 001- ---- ---- ---- # FADDA +FAIL 0100 0101 --0- ---- 1001 10-- ---- ---- # SMMLA, UMMLA, USMMLA +FAIL 0100 0101 --1- ---- 1--- ---- ---- ---- # SVE2 string/histo/crypto instructions +FAIL 1000 010- -00- ---- 10-- ---- ---- ---- # SVE2 32-bit gather NT load (vector+scalar) +FAIL 1000 010- -00- ---- 111- ---- ---- ---- # SVE 32-bit gather prefetch (vector+imm) +FAIL 1000 0100 0-1- ---- 0--- ---- ---- ---- # SVE 32-bit gather prefetch (scalar+vector) +FAIL 1000 010- -01- ---- 1--- ---- ---- ---- # SVE 32-bit gather load (vector+imm) +FAIL 1000 0100 0-0- ---- 0--- ---- ---- ---- # SVE 32-bit gather load byte (scalar+vector) +FAIL 1000 0100 1--- ---- 0--- ---- ---- ---- # SVE 32-bit gather load half (scalar+vector) +FAIL 1000 0101 0--- ---- 0--- ---- ---- ---- # SVE 32-bit gather load word (scalar+vector) +FAIL 1010 010- ---- ---- 011- ---- ---- ---- # SVE contiguous FF load (scalar+scalar) +FAIL 1010 010- ---1 ---- 101- ---- ---- ---- # SVE contiguous NF load (scalar+imm) +FAIL 1010 010- -01- ---- 000- ---- ---- ---- # SVE load & replicate 32 bytes (scalar+scalar) +FAIL 1010 010- -010 ---- 001- ---- ---- ---- # SVE load & replicate 32 bytes (scalar+imm) +FAIL 1100 010- ---- ---- ---- ---- ---- ---- # SVE 64-bit gather load/prefetch +FAIL 1110 010- -00- ---- 001- ---- ---- ---- # SVE2 64-bit scatter NT store (vector+scalar) +FAIL 1110 010- -10- ---- 001- ---- ---- ---- # SVE2 32-bit scatter NT store (vector+scalar) +FAIL 1110 010- ---- ---- 1-0- ---- ---- ---- # SVE scatter store (scalar+32-bit vector) +FAIL 1110 010- ---- ---- 101- ---- ---- ---- # SVE scatter store (misc) diff --git a/target/arm/helper.c b/target/arm/helper.c index f6dcb1a115..67f8ca98f2 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -6269,6 +6269,32 @@ int sme_exception_el(CPUARMState *env, int el) return 0; } +/* This corresponds to the ARM pseudocode function IsFullA64Enabled(). */ +static bool sme_fa64(CPUARMState *env, int el) +{ + if (!cpu_isar_feature(aa64_sme_fa64, env_archcpu(env))) { + return false; + } + + if (el <= 1 && !el_is_in_host(env, el)) { + if (!FIELD_EX64(env->vfp.smcr_el[1], SMCR, FA64)) { + return false; + } + } + if (el <= 2 && arm_is_el2_enabled(env)) { + if (!FIELD_EX64(env->vfp.smcr_el[2], SMCR, FA64)) { + return false; + } + } + if (arm_feature(env, ARM_FEATURE_EL3)) { + if (!FIELD_EX64(env->vfp.smcr_el[3], SMCR, FA64)) { + return false; + } + } + + return true; +} + /* * Given that SVE is enabled, return the vector length for EL. */ @@ -11312,6 +11338,20 @@ static CPUARMTBFlags rebuild_hflags_a32(CPUARMState *env, int fp_el, DP_TBFLAG_ANY(flags, PSTATE__IL, 1); } + /* + * The SME exception we are testing for is raised via + * AArch64.CheckFPAdvSIMDEnabled(), as called from + * AArch32.CheckAdvSIMDOrFPEnabled(). + */ + if (el == 0 + && FIELD_EX64(env->svcr, SVCR, SM) + && (!arm_is_el2_enabled(env) + || (arm_el_is_aa64(env, 2) && !(env->cp15.hcr_el2 & HCR_TGE))) + && arm_el_is_aa64(env, 1) + && !sme_fa64(env, el)) { + DP_TBFLAG_A32(flags, SME_TRAP_NONSTREAMING, 1); + } + return rebuild_hflags_common_32(env, fp_el, mmu_idx, flags); } @@ -11361,6 +11401,7 @@ static CPUARMTBFlags rebuild_hflags_a64(CPUARMState *env, int el, int fp_el, } if (FIELD_EX64(env->svcr, SVCR, SM)) { DP_TBFLAG_A64(flags, PSTATE_SM, 1); + DP_TBFLAG_A64(flags, SME_TRAP_NONSTREAMING, !sme_fa64(env, el)); } DP_TBFLAG_A64(flags, PSTATE_ZA, FIELD_EX64(env->svcr, SVCR, ZA)); } diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index a5f8a6c771..7fab7f64f8 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -1155,7 +1155,7 @@ static void do_vec_ld(DisasContext *s, int destidx, int element, * unallocated-encoding checks (otherwise the syndrome information * for the resulting exception will be incorrect). */ -static bool fp_access_check(DisasContext *s) +static bool fp_access_check_only(DisasContext *s) { if (s->fp_excp_el) { assert(!s->fp_access_checked); @@ -1170,6 +1170,19 @@ static bool fp_access_check(DisasContext *s) return true; } +static bool fp_access_check(DisasContext *s) +{ + if (!fp_access_check_only(s)) { + return false; + } + if (s->sme_trap_nonstreaming && s->is_nonstreaming) { + gen_exception_insn(s, s->pc_curr, EXCP_UDEF, + syn_smetrap(SME_ET_Streaming, false)); + return false; + } + return true; +} + /* Check that SVE access is enabled. If it is, return true. * If not, emit code to generate an appropriate exception and return false. */ @@ -1994,7 +2007,7 @@ static void handle_sys(DisasContext *s, uint32_t insn, bool isread, default: g_assert_not_reached(); } - if ((ri->type & ARM_CP_FPU) && !fp_access_check(s)) { + if ((ri->type & ARM_CP_FPU) && !fp_access_check_only(s)) { return; } else if ((ri->type & ARM_CP_SVE) && !sve_access_check(s)) { return; @@ -14530,6 +14543,23 @@ static void disas_data_proc_simd_fp(DisasContext *s, uint32_t insn) } } +/* + * Include the generated SME FA64 decoder. + */ + +#include "decode-sme-fa64.c.inc" + +static bool trans_OK(DisasContext *s, arg_OK *a) +{ + return true; +} + +static bool trans_FAIL(DisasContext *s, arg_OK *a) +{ + s->is_nonstreaming = true; + return true; +} + /** * is_guarded_page: * @env: The cpu environment @@ -14657,6 +14687,7 @@ static void aarch64_tr_init_disas_context(DisasContextBase *dcbase, dc->mte_active[1] = EX_TBFLAG_A64(tb_flags, MTE0_ACTIVE); dc->pstate_sm = EX_TBFLAG_A64(tb_flags, PSTATE_SM); dc->pstate_za = EX_TBFLAG_A64(tb_flags, PSTATE_ZA); + dc->sme_trap_nonstreaming = EX_TBFLAG_A64(tb_flags, SME_TRAP_NONSTREAMING); dc->vec_len = 0; dc->vec_stride = 0; dc->cp_regs = arm_cpu->cp_regs; @@ -14805,6 +14836,11 @@ static void aarch64_tr_translate_insn(DisasContextBase *dcbase, CPUState *cpu) } } + s->is_nonstreaming = false; + if (s->sme_trap_nonstreaming) { + disas_sme_fa64(s, insn); + } + switch (extract32(insn, 25, 4)) { case 0x0: if (!extract32(insn, 31, 1) || !disas_sme(s, insn)) { diff --git a/target/arm/translate-vfp.c b/target/arm/translate-vfp.c index 82fdbcae53..bd5ae27d09 100644 --- a/target/arm/translate-vfp.c +++ b/target/arm/translate-vfp.c @@ -234,6 +234,18 @@ static bool vfp_access_check_a(DisasContext *s, bool ignore_vfp_enabled) return false; } + /* + * Note that rebuild_hflags_a32 has already accounted for being in EL0 + * and the higher EL in A64 mode, etc. Unlike A64 mode, there do not + * appear to be any insns which touch VFP which are allowed. + */ + if (s->sme_trap_nonstreaming) { + gen_exception_insn(s, s->pc_curr, EXCP_UDEF, + syn_smetrap(SME_ET_Streaming, + s->base.pc_next - s->pc_curr == 2)); + return false; + } + if (!s->vfp_enabled && !ignore_vfp_enabled) { assert(!arm_dc_feature(s, ARM_FEATURE_M)); unallocated_encoding(s); diff --git a/target/arm/translate.c b/target/arm/translate.c index 6617de775f..4ffb095c73 100644 --- a/target/arm/translate.c +++ b/target/arm/translate.c @@ -9378,6 +9378,8 @@ static void arm_tr_init_disas_context(DisasContextBase *dcbase, CPUState *cs) dc->vec_len = EX_TBFLAG_A32(tb_flags, VECLEN); dc->vec_stride = EX_TBFLAG_A32(tb_flags, VECSTRIDE); } + dc->sme_trap_nonstreaming = + EX_TBFLAG_A32(tb_flags, SME_TRAP_NONSTREAMING); } dc->cp_regs = cpu->cp_regs; dc->features = env->features; diff --git a/target/arm/meson.build b/target/arm/meson.build index 6dd7e93643..87e911b27f 100644 --- a/target/arm/meson.build +++ b/target/arm/meson.build @@ -1,6 +1,7 @@ gen = [ decodetree.process('sve.decode', extra_args: '--decode=disas_sve'), decodetree.process('sme.decode', extra_args: '--decode=disas_sme'), + decodetree.process('sme-fa64.decode', extra_args: '--static-decode=disas_sme_fa64'), decodetree.process('neon-shared.decode', extra_args: '--decode=disas_neon_shared'), decodetree.process('neon-dp.decode', extra_args: '--decode=disas_neon_dp'), decodetree.process('neon-ls.decode', extra_args: '--decode=disas_neon_ls'), From patchwork Wed Jul 6 08:23:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 587715 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1ec:0:0:0:0 with SMTP id 12csp2544932map; Wed, 6 Jul 2022 01:52:19 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sz7ppjkPnMYd3RGavGG3NAZvkzbPWrmpj4yAHBmY5cSDGqofC57T5icFEYeyMMMzaa/+6O X-Received: by 2002:a25:2612:0:b0:66e:557c:772e with SMTP id m18-20020a252612000000b0066e557c772emr14672868ybm.256.1657097539411; Wed, 06 Jul 2022 01:52:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657097539; cv=none; d=google.com; s=arc-20160816; b=Hw2JHjuGgNobyrs6nxmuxRBNQLoCTzXp1r+jS9sYN1XppR5RCJHOhkwa569FIVPBkY gIjoTIYv5AC+XD9OfNapD40/KjkPNicUA4AHqW6h93tOWxt+AAifpO9lxm8UZqvkmB57 FUdYNGYcuqGkJiOSr7TP1iSvgrIgYuOxDD2Z8fXggekXwtRKGtKAgrnUytRuYnxT9tee GTWqii6ggzoToAf5WsXKVHhhd/sCP6N4CNGWmMTCV3+UYg27X+GqIfG6YHiNe4pBAv6L jvgJUvfgJpvwU8MK1FB89X3rC4jsE3pTN/E9jYvI2DTXFklszjk3XP+I1PIlAhYPJQaj E1VA== 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=4m+iHIMfbnBsMZ3ri5BagDQ5TJ6WuhbAqlKM6iP5vPw=; b=dKaxnCTpVthBzbTbPwciJRFrITZAhRd8Vo4Gs8nkT95V4bryIcUGhjPz6nhPlH6OwX YEy14ZLUUyGI1sBpvle9JAOaTnq4K8cYwSNN/JwSpkB0WiglEq/VbxKXmXrpR1TT6oJQ 0BWpH4rVOjSHfDwWWtujiQWozWp0F/wMh8ya133VLRgSFXt+2WbquSzy/VadQxIPV//e 9OFgsXLgh1zheC+VbjtrDLfAIthmWuweCEBH41/mE8gHR+cyQ3fh4dyn9DduSmc+lNef WefEXWzwT7HTMkW94F7vf6QyeaOsyfuG072am8CPl89Tgs0HwgiBHfElw6GKNXIEsbMp uI7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gmUGO8lN; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 127-20020a251185000000b0066d92aba03bsi26934563ybr.126.2022.07.06.01.52.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Jul 2022 01:52:19 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gmUGO8lN; 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]:50100 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o90le-00007q-UV for patch@linaro.org; Wed, 06 Jul 2022 04:52:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48848) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o90Kx-0005qR-IV for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:24:43 -0400 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]:38813) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o90Ki-0000K7-Pk for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:24:42 -0400 Received: by mail-pf1-x436.google.com with SMTP id o12so177249pfp.5 for ; Wed, 06 Jul 2022 01:24:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=4m+iHIMfbnBsMZ3ri5BagDQ5TJ6WuhbAqlKM6iP5vPw=; b=gmUGO8lNlUELF1oZuswjvef4QQbNXesY+rsivVKC8J0kOSBmoWyF8dfcYvnJCXKnbs EsK2pANf67PN0wGHFRGqkfKrrq3DzyvAYJNwe790ayNpyjydOcPS7yHXdHa6ybagwj+C I121pXwUUSRchIb0ovQuM6ni4//N2AQG3nP7KOGgX6VAV4VEzHu4XGrUcDCBI9h78SIM pVBTO8ehjrGNr0SR8S3bs5GZDZmZcVcDOlNhNhZmYZXWY/4fY23QhpiFKI2tGOsRta6+ CrTXhakTSdLbsZfWxUIba5q648kyQxzO5rSkuPknT+Kx61K6Yg5GUwSj17+GAiCqC5xH g80A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=4m+iHIMfbnBsMZ3ri5BagDQ5TJ6WuhbAqlKM6iP5vPw=; b=xCcxNcKfphvF9ytXngfv/SeQ/TV+L+y2iQzuVVMKBesNqngTQqzI9d3COha1wP8Bji H4c0PZqaMD5XBLf+Ufi51FzXZytykpGwNpSF/o9lUVV0wDantPZfPktnUDqQDAtVCerU h0IZoPGMurWel6wi7UCmcVGm7IY0Pxcrmnxuw3Ki5RGzOemrXYQIufG4wYzVmTtB3ylC JLNGTlYwkU0tOZgY7Kcdibg7ejve/xCyX0HwOvc0NJF4ZqJaHsgvkZW6xD6KYw/pum4c i1yG5BzV9X3MpWI2qzWIBD/2sy6dvGKb9QV5wFqmZzZMwrvRQrZgmPbAzGr4FWFlvfaz lEUw== X-Gm-Message-State: AJIora/vfiYHkiWBD4lCoV7UhPHmRGyRRWPfZlK10pUfPuw3lBZN6//V 2D4SE59hQNkFHzFvqdxjatn8ZzQUMkdkv7+f X-Received: by 2002:a05:6a00:1592:b0:525:52ca:bee6 with SMTP id u18-20020a056a00159200b0052552cabee6mr45403178pfk.38.1657095866531; Wed, 06 Jul 2022 01:24:26 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id t17-20020a170902e85100b00162529828aesm25199256plg.109.2022.07.06.01.24.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jul 2022 01:24:26 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v5 04/45] target/arm: Mark ADR as non-streaming Date: Wed, 6 Jul 2022 13:53:30 +0530 Message-Id: <20220706082411.1664825-5-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220706082411.1664825-1-richard.henderson@linaro.org> References: <20220706082411.1664825-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::436; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x436.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Mark ADR as a non-streaming instruction, which should trap if full a64 support is not enabled in streaming mode. Removing entries from sme-fa64.decode is an easy way to see what remains to be done. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/translate.h | 7 +++++++ target/arm/sme-fa64.decode | 1 - target/arm/translate-sve.c | 8 ++++---- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/target/arm/translate.h b/target/arm/translate.h index cbc907c751..e2e619dab2 100644 --- a/target/arm/translate.h +++ b/target/arm/translate.h @@ -566,4 +566,11 @@ uint64_t asimd_imm_const(uint32_t imm, int cmode, int op); static bool trans_##NAME(DisasContext *s, arg_##NAME *a) \ { return dc_isar_feature(FEAT, s) && FUNC(s, __VA_ARGS__); } +#define TRANS_FEAT_NONSTREAMING(NAME, FEAT, FUNC, ...) \ + static bool trans_##NAME(DisasContext *s, arg_##NAME *a) \ + { \ + s->is_nonstreaming = true; \ + return dc_isar_feature(FEAT, s) && FUNC(s, __VA_ARGS__); \ + } + #endif /* TARGET_ARM_TRANSLATE_H */ diff --git a/target/arm/sme-fa64.decode b/target/arm/sme-fa64.decode index 3d90837fc7..73c71abc46 100644 --- a/target/arm/sme-fa64.decode +++ b/target/arm/sme-fa64.decode @@ -59,7 +59,6 @@ FAIL 0001 1110 0111 1110 0000 00-- ---- ---- # FJCVTZS # --11 1100 --1- ---- ---- ---- ---- --10 # Load/store FP register (register offset) # --11 1101 ---- ---- ---- ---- ---- ---- # Load/store FP register (scaled imm) -FAIL 0000 0100 --1- ---- 1010 ---- ---- ---- # ADR FAIL 0000 0100 --1- ---- 1011 -0-- ---- ---- # FTSSEL, FEXPA FAIL 0000 0101 --10 0001 100- ---- ---- ---- # COMPACT FAIL 0010 0101 --01 100- 1111 000- ---0 ---- # RDFFR, RDFFRS diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c index 62b5f3040c..5d1db0d3ff 100644 --- a/target/arm/translate-sve.c +++ b/target/arm/translate-sve.c @@ -1320,10 +1320,10 @@ static bool do_adr(DisasContext *s, arg_rrri *a, gen_helper_gvec_3 *fn) return gen_gvec_ool_zzz(s, fn, a->rd, a->rn, a->rm, a->imm); } -TRANS_FEAT(ADR_p32, aa64_sve, do_adr, a, gen_helper_sve_adr_p32) -TRANS_FEAT(ADR_p64, aa64_sve, do_adr, a, gen_helper_sve_adr_p64) -TRANS_FEAT(ADR_s32, aa64_sve, do_adr, a, gen_helper_sve_adr_s32) -TRANS_FEAT(ADR_u32, aa64_sve, do_adr, a, gen_helper_sve_adr_u32) +TRANS_FEAT_NONSTREAMING(ADR_p32, aa64_sve, do_adr, a, gen_helper_sve_adr_p32) +TRANS_FEAT_NONSTREAMING(ADR_p64, aa64_sve, do_adr, a, gen_helper_sve_adr_p64) +TRANS_FEAT_NONSTREAMING(ADR_s32, aa64_sve, do_adr, a, gen_helper_sve_adr_s32) +TRANS_FEAT_NONSTREAMING(ADR_u32, aa64_sve, do_adr, a, gen_helper_sve_adr_u32) /* *** SVE Integer Misc - Unpredicated Group From patchwork Wed Jul 6 08:23:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 587717 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1ec:0:0:0:0 with SMTP id 12csp2547592map; Wed, 6 Jul 2022 01:55:57 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tv5UkDmLEgzVMniD/FJw92DfowR7BrSOMV7ogc6nOUdEP6HBqpTNlusIaZM9vqzry8ao2a X-Received: by 2002:a81:548a:0:b0:31c:b7d6:b3ca with SMTP id i132-20020a81548a000000b0031cb7d6b3camr11849269ywb.500.1657097757835; Wed, 06 Jul 2022 01:55:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657097757; cv=none; d=google.com; s=arc-20160816; b=rhNmKl/05TwjwXP2HNnDFc0D0MLTs7f7n3Ac14Wwzvt9JMWaOPJNEjPXtCyJYmcygw YeyMQqEBG2d93REB5xQJ/qdSpSqEguxiCVO15JKPAtTbGGz2QSZ9ZOZ0Krnyk0ZM/FJX WYUnsUW9ibAqrC5W2RzJppYYC7d8lbNW6pXfeEusUq4yNkssFDYRJxNhXrXepOwJmfMQ eOlxIUeNuFVYbUF2pBF482Q/zNoULHfqJ9Dgn/hWsFMeDrYOmjjNsMNAuFM/WITNNiB0 VoQ6ngzJrKG+uvje2IykcHw29E78dnmgJJoD5NfumxSE4Z7AEpoDXKdpTvhYIK7QWHca 02Ig== 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=pHHLspKH8W4B5YilQ8WrGPBQ+uTIDLVeEbSmBurKp7U=; b=Fu2mSMgo5Wh7FxoRZUBF1ZqJDGM3BkdF/cT/X8IsUA2wS9gZRBpdJdeGrE4pOZe3fF 7juXTZQzAUH2vM3ZbKqjjdiApk1TgDGSlJgIhu71Wuuf9EuUfivPkkNa6mxJ/lbsf7pG hTyRtAVN5Q+d2rE2ttDFlMgjweZDjHiluEt0TNDtF1rIvBBdZVcDORENRe4WUFiTGC+/ ZSdcbXQprfeh3Go7SyAJ7u8SQuvHUFqlZqYXLWilWJ9CFRIAIzOHO+3ZVkHvC10fM9an /tUrxYMWUNgkhyzlcRSAwa50UEI8YHan7inMA7vth/oAUE6zSBHQX/pChAnCHokkBSJe FgSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Oo9DHuJf; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 145-20020a810897000000b0031cb4d580c7si8515132ywi.374.2022.07.06.01.55.57 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Jul 2022 01:55:57 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Oo9DHuJf; 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]:57670 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o90pA-0005FX-6c for patch@linaro.org; Wed, 06 Jul 2022 04:55:56 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48716) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o90Ko-0005kp-N3 for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:24:34 -0400 Received: from mail-pj1-x102f.google.com ([2607:f8b0:4864:20::102f]:33400) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o90Kk-0000Lh-Qi for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:24:33 -0400 Received: by mail-pj1-x102f.google.com with SMTP id j1-20020a17090aeb0100b001ef777a7befso6444925pjz.0 for ; Wed, 06 Jul 2022 01:24:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pHHLspKH8W4B5YilQ8WrGPBQ+uTIDLVeEbSmBurKp7U=; b=Oo9DHuJfnnmzmLrvY3NJdC9VCgy5EBfaZ0G71Cnqd4YOtS5S3Ah0mUvvuxyc+aTRq0 mmn1Cgv9zEuSRPvxTdQUZo5SZiNlbTaN+rP7y5IGJC37yCyB6e23Jp3Xe6u5PJEltoT4 9TQVsThDooV9fzpqRtr+Hn7D9fsre1H4XeQSTYzKG9EsE1EaWqEK8LW2UzNerAf6hqxI 6EeNvr4uSmAm25eHVphZNjuj8zoOLcv/Cz5u2AoY9k7yhFojAWZOB5zDFdYtiKkyc01t GdCEDMD+mbbfHLmnZ6YcefGzxq+tq0clQuNm4ZnS8rPG9CaWnF5nxoRsBzPFkhGtmZrh F6Cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pHHLspKH8W4B5YilQ8WrGPBQ+uTIDLVeEbSmBurKp7U=; b=AhFDG1RHNMb72lcwVbaQNJVADEuoHOXb1tUbuvCehdot1D02/uDEnmJ53mHEqfG+b/ yMcfg3Rkl2Dye17C6A48an/78qRE6p9dUHdliKSHR86DQbev0wP+Lo2gqgXcUAvCHedT 8VSTcewTAIb+zaBqqQ9BGC8oABr2aqE/ozKo/J32fY8p6e/md4LoUWgd8GT+IINcTD9M cVeh4C+g7KKI8iLDQHRsXmWuI2y9rfBqdzzRFe/tPEMCO3x7lDSeF1Tw2Nz5PSIy2hj4 T+3+psWU18BFR74Mjng1AVRSPhSDAPXtxv7yb1KJUp1do9oPFP4WYb0gcKkz0LyVCvkm wmVQ== X-Gm-Message-State: AJIora9/tcbXOeQKM745LtAnOeoH0zX7Rxr+b1GrV96rXsZtJnA4Yx8x VGmIVYiJRZiHdjJavJQDC5Z7WqUSh+9D84FD X-Received: by 2002:a17:902:c948:b0:16a:58f4:c142 with SMTP id i8-20020a170902c94800b0016a58f4c142mr46645631pla.103.1657095869446; Wed, 06 Jul 2022 01:24:29 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id t17-20020a170902e85100b00162529828aesm25199256plg.109.2022.07.06.01.24.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jul 2022 01:24:28 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v5 05/45] target/arm: Mark RDFFR, WRFFR, SETFFR as non-streaming Date: Wed, 6 Jul 2022 13:53:31 +0530 Message-Id: <20220706082411.1664825-6-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220706082411.1664825-1-richard.henderson@linaro.org> References: <20220706082411.1664825-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102f; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102f.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" Mark these as a non-streaming instructions, which should trap if full a64 support is not enabled in streaming mode. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/sme-fa64.decode | 2 -- target/arm/translate-sve.c | 9 ++++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/target/arm/sme-fa64.decode b/target/arm/sme-fa64.decode index 73c71abc46..fa2b5cbf1a 100644 --- a/target/arm/sme-fa64.decode +++ b/target/arm/sme-fa64.decode @@ -61,8 +61,6 @@ FAIL 0001 1110 0111 1110 0000 00-- ---- ---- # FJCVTZS FAIL 0000 0100 --1- ---- 1011 -0-- ---- ---- # FTSSEL, FEXPA FAIL 0000 0101 --10 0001 100- ---- ---- ---- # COMPACT -FAIL 0010 0101 --01 100- 1111 000- ---0 ---- # RDFFR, RDFFRS -FAIL 0010 0101 --10 1--- 1001 ---- ---- ---- # WRFFR, SETFFR FAIL 0100 0101 --0- ---- 1011 ---- ---- ---- # BDEP, BEXT, BGRP FAIL 0100 0101 000- ---- 0110 1--- ---- ---- # PMULLB, PMULLT (128b result) FAIL 0110 0100 --1- ---- 1110 01-- ---- ---- # FMMLA, BFMMLA diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c index 5d1db0d3ff..d6faec15fe 100644 --- a/target/arm/translate-sve.c +++ b/target/arm/translate-sve.c @@ -1785,7 +1785,8 @@ static bool do_predset(DisasContext *s, int esz, int rd, int pat, bool setflag) TRANS_FEAT(PTRUE, aa64_sve, do_predset, a->esz, a->rd, a->pat, a->s) /* Note pat == 31 is #all, to set all elements. */ -TRANS_FEAT(SETFFR, aa64_sve, do_predset, 0, FFR_PRED_NUM, 31, false) +TRANS_FEAT_NONSTREAMING(SETFFR, aa64_sve, + do_predset, 0, FFR_PRED_NUM, 31, false) /* Note pat == 32 is #unimp, to set no elements. */ TRANS_FEAT(PFALSE, aa64_sve, do_predset, 0, a->rd, 32, false) @@ -1799,11 +1800,13 @@ static bool trans_RDFFR_p(DisasContext *s, arg_RDFFR_p *a) .rd = a->rd, .pg = a->pg, .s = a->s, .rn = FFR_PRED_NUM, .rm = FFR_PRED_NUM, }; + + s->is_nonstreaming = true; return trans_AND_pppp(s, &alt_a); } -TRANS_FEAT(RDFFR, aa64_sve, do_mov_p, a->rd, FFR_PRED_NUM) -TRANS_FEAT(WRFFR, aa64_sve, do_mov_p, FFR_PRED_NUM, a->rn) +TRANS_FEAT_NONSTREAMING(RDFFR, aa64_sve, do_mov_p, a->rd, FFR_PRED_NUM) +TRANS_FEAT_NONSTREAMING(WRFFR, aa64_sve, do_mov_p, FFR_PRED_NUM, a->rn) static bool do_pfirst_pnext(DisasContext *s, arg_rr_esz *a, void (*gen_fn)(TCGv_i32, TCGv_ptr, From patchwork Wed Jul 6 08:23:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 587720 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1ec:0:0:0:0 with SMTP id 12csp2551092map; Wed, 6 Jul 2022 02:01:19 -0700 (PDT) X-Google-Smtp-Source: AGRyM1s8JoY7fbjqIT1hcywargNfR9a4dKbpzfT8bUb+AwZ5MJDVee/p58i+CKN5IybZHphk4jsN X-Received: by 2002:a25:3cc1:0:b0:66c:d89d:aedd with SMTP id j184-20020a253cc1000000b0066cd89daeddmr40180548yba.527.1657098079821; Wed, 06 Jul 2022 02:01:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657098079; cv=none; d=google.com; s=arc-20160816; b=FZ3zTg/tfbydllCfz/kaszkRpllqCxTyYYlcblwuj9/2jsLi13EHhw0rSpdJ5Vh0CU h6cQy8aCjvEzV64/KTzLDBtx36XcSlIB2nkqs6HQ2YG0nwUOjCdIy8263hCeaAfcchtl 1yyS8QoUz2rpD+3EVHaIBnGwO41QWGzhSiAY8GVDZj/YyPZx8lz7+k0JvaaNvGLDBH1E TI016JPd/6DrCAyH6nZXjH6f7eSerDlc7iP6w9U6ReUDWEmQt8TNGNiqS2P1PbuDLV1h AguxOZEby56ALs+2QCtZg+sfWvJ0H0+JvvA3ajq8mvJ1MHnRLKUgYzKUaD9qyd2hj6jR rMWQ== 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=hqPebj8e+A/slNwJFXKTlqvHw3rlOVkEOFZ7HeJe4nE=; b=LbtwgKcWaTxiXf8joxRSm/DVR72va+LZ1NmByp8wwdvq5Tx3boR7OQ2eZgP1fj8ixq j7ilgh507g1zRk+M/oVwg3lL0KMIS3I1NOBTFezuWe+/VUj3JMqpLwWrOY8XpBIbypQa af02zThdcoLlFViQco6I+AKpLmA94UdO2DzKARhRTV6GTlvoAJwLD0wq2JnlhkEe7BLc 0f8hoBTtfxk7E4wYr5xZID30oEeF1sf1fcj51VrB7Z0ztXxYfHA1nVS71D7p9VspcRv1 uiaQogDEilxPe89p/7/itrVFltCVK8Pcmbt7NYIX45AQHBM53gIQYzhkbOi1eIp1rHDb 2G2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MAo6xusE; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 195-20020a8101cc000000b0031c9d6bb1c5si9136207ywb.324.2022.07.06.02.01.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Jul 2022 02:01:19 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=MAo6xusE; 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]:38948 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o90uL-0003F8-F2 for patch@linaro.org; Wed, 06 Jul 2022 05:01:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48778) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o90Kt-0005m5-5N for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:24:39 -0400 Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]:42640) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o90Ko-0000MR-El for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:24:38 -0400 Received: by mail-pj1-x1034.google.com with SMTP id i8-20020a17090a4b8800b001ef8a65bfbdso7526143pjh.1 for ; Wed, 06 Jul 2022 01:24:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=hqPebj8e+A/slNwJFXKTlqvHw3rlOVkEOFZ7HeJe4nE=; b=MAo6xusEZTL25xlVrurkDpv+mMnwNp9MB3y7qNcPz9xChdOxWeYbZGTezduFJ26NyA 713v29v28J5wK+RMHiF523iCHwDRg1IBW5Yk5NsO5xC5cZgd1g9sInmvObwks+Yzd/I7 vlCne3R6JiXwBAYF3/zD30Doq6uQMUr7xOCSKLxJu1/2e10g0blIDQin5xWmcfWAcY9g +Lg/ziKehbmpD9afUAP18foRUbyrL+sbEwuVA8R2O6TISEEGChG2pDOSAGDzqTMRF6Uy VKfWCBrIfTb7/CtOGqNmyb+08wVd7TjyW07D09CGdHJOqpVOK80I8zV8ppSmn7t9NXWf dpuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=hqPebj8e+A/slNwJFXKTlqvHw3rlOVkEOFZ7HeJe4nE=; b=vyYY5wpql/01RRbqMd+0NP4Ud/YzXyOZUjh0anDrzXt/rl9myRUqy1C+UayP9qS1tr OxLlJZuCutbQk5b/PP0vWs4GgbbdegKMjUkQ3IRm2DTVVCx82q1HItiVQKlidGmmMql3 j4k0pDkWDhuEUIEBY5mcxm2h0TI2RwT8sJI52jVtPQluiLpwu9VWVREx8uthP2dS0O7D TcH3n+RfNXkX6g8bf/J74qFnPsc/E3tuFPjO/jQetKph1/oatr56TGpbW80ibnbTLX0/ tZJjLCO2oQBtwZIIK9Ka6IXhCYpU8YmqWBJDXsda7aCGQFelGDzQFvpD22ec7nKjwwWe o3Lg== X-Gm-Message-State: AJIora85w3KBDNfPIjNDofQTHWujpD32E1se/wlSMTUL3Ea1zaoD4fn6 ZAuMzy068spUlpiq4P60EsILaFDAnR45fSoP X-Received: by 2002:a17:902:ccc3:b0:16b:d658:57c3 with SMTP id z3-20020a170902ccc300b0016bd65857c3mr22036104ple.1.1657095872427; Wed, 06 Jul 2022 01:24:32 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id t17-20020a170902e85100b00162529828aesm25199256plg.109.2022.07.06.01.24.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jul 2022 01:24:32 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v5 06/45] target/arm: Mark BDEP, BEXT, BGRP, COMPACT, FEXPA, FTSSEL as non-streaming Date: Wed, 6 Jul 2022 13:53:32 +0530 Message-Id: <20220706082411.1664825-7-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220706082411.1664825-1-richard.henderson@linaro.org> References: <20220706082411.1664825-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1034; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1034.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" Mark these as a non-streaming instructions, which should trap if full a64 support is not enabled in streaming mode. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/sme-fa64.decode | 3 --- target/arm/translate-sve.c | 22 ++++++++++++---------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/target/arm/sme-fa64.decode b/target/arm/sme-fa64.decode index fa2b5cbf1a..4f515939d9 100644 --- a/target/arm/sme-fa64.decode +++ b/target/arm/sme-fa64.decode @@ -59,9 +59,6 @@ FAIL 0001 1110 0111 1110 0000 00-- ---- ---- # FJCVTZS # --11 1100 --1- ---- ---- ---- ---- --10 # Load/store FP register (register offset) # --11 1101 ---- ---- ---- ---- ---- ---- # Load/store FP register (scaled imm) -FAIL 0000 0100 --1- ---- 1011 -0-- ---- ---- # FTSSEL, FEXPA -FAIL 0000 0101 --10 0001 100- ---- ---- ---- # COMPACT -FAIL 0100 0101 --0- ---- 1011 ---- ---- ---- # BDEP, BEXT, BGRP FAIL 0100 0101 000- ---- 0110 1--- ---- ---- # PMULLB, PMULLT (128b result) FAIL 0110 0100 --1- ---- 1110 01-- ---- ---- # FMMLA, BFMMLA FAIL 0110 0101 --0- ---- 0000 11-- ---- ---- # FTSMUL diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c index d6faec15fe..ae48040aa4 100644 --- a/target/arm/translate-sve.c +++ b/target/arm/translate-sve.c @@ -1333,14 +1333,15 @@ static gen_helper_gvec_2 * const fexpa_fns[4] = { NULL, gen_helper_sve_fexpa_h, gen_helper_sve_fexpa_s, gen_helper_sve_fexpa_d, }; -TRANS_FEAT(FEXPA, aa64_sve, gen_gvec_ool_zz, - fexpa_fns[a->esz], a->rd, a->rn, 0) +TRANS_FEAT_NONSTREAMING(FEXPA, aa64_sve, gen_gvec_ool_zz, + fexpa_fns[a->esz], a->rd, a->rn, 0) static gen_helper_gvec_3 * const ftssel_fns[4] = { NULL, gen_helper_sve_ftssel_h, gen_helper_sve_ftssel_s, gen_helper_sve_ftssel_d, }; -TRANS_FEAT(FTSSEL, aa64_sve, gen_gvec_ool_arg_zzz, ftssel_fns[a->esz], a, 0) +TRANS_FEAT_NONSTREAMING(FTSSEL, aa64_sve, gen_gvec_ool_arg_zzz, + ftssel_fns[a->esz], a, 0) /* *** SVE Predicate Logical Operations Group @@ -2536,7 +2537,8 @@ TRANS_FEAT(TRN2_q, aa64_sve_f64mm, gen_gvec_ool_arg_zzz, static gen_helper_gvec_3 * const compact_fns[4] = { NULL, NULL, gen_helper_sve_compact_s, gen_helper_sve_compact_d }; -TRANS_FEAT(COMPACT, aa64_sve, gen_gvec_ool_arg_zpz, compact_fns[a->esz], a, 0) +TRANS_FEAT_NONSTREAMING(COMPACT, aa64_sve, gen_gvec_ool_arg_zpz, + compact_fns[a->esz], a, 0) /* Call the helper that computes the ARM LastActiveElement pseudocode * function, scaled by the element size. This includes the not found @@ -6374,22 +6376,22 @@ static gen_helper_gvec_3 * const bext_fns[4] = { gen_helper_sve2_bext_b, gen_helper_sve2_bext_h, gen_helper_sve2_bext_s, gen_helper_sve2_bext_d, }; -TRANS_FEAT(BEXT, aa64_sve2_bitperm, gen_gvec_ool_arg_zzz, - bext_fns[a->esz], a, 0) +TRANS_FEAT_NONSTREAMING(BEXT, aa64_sve2_bitperm, gen_gvec_ool_arg_zzz, + bext_fns[a->esz], a, 0) static gen_helper_gvec_3 * const bdep_fns[4] = { gen_helper_sve2_bdep_b, gen_helper_sve2_bdep_h, gen_helper_sve2_bdep_s, gen_helper_sve2_bdep_d, }; -TRANS_FEAT(BDEP, aa64_sve2_bitperm, gen_gvec_ool_arg_zzz, - bdep_fns[a->esz], a, 0) +TRANS_FEAT_NONSTREAMING(BDEP, aa64_sve2_bitperm, gen_gvec_ool_arg_zzz, + bdep_fns[a->esz], a, 0) static gen_helper_gvec_3 * const bgrp_fns[4] = { gen_helper_sve2_bgrp_b, gen_helper_sve2_bgrp_h, gen_helper_sve2_bgrp_s, gen_helper_sve2_bgrp_d, }; -TRANS_FEAT(BGRP, aa64_sve2_bitperm, gen_gvec_ool_arg_zzz, - bgrp_fns[a->esz], a, 0) +TRANS_FEAT_NONSTREAMING(BGRP, aa64_sve2_bitperm, gen_gvec_ool_arg_zzz, + bgrp_fns[a->esz], a, 0) static gen_helper_gvec_3 * const cadd_fns[4] = { gen_helper_sve2_cadd_b, gen_helper_sve2_cadd_h, From patchwork Wed Jul 6 08:23:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 587716 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1ec:0:0:0:0 with SMTP id 12csp2545963map; Wed, 6 Jul 2022 01:53:32 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uZOsa4YZR/Pb2XC5VEIuyAIJfRuPFlCAXzPln+xKB9i8NROzKFqhFJDlrB129JpeylHdtu X-Received: by 2002:a05:620a:4514:b0:6af:260f:cdf6 with SMTP id t20-20020a05620a451400b006af260fcdf6mr26590687qkp.565.1657097612127; Wed, 06 Jul 2022 01:53:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657097612; cv=none; d=google.com; s=arc-20160816; b=eqL2abbJpGnoXOeaflQSf/g4MEj42z3tI08ABh1bEiJb8Q/UQJ+NTI30rbO77vfLhy KQhqn2MEBeZZGCLCKWvuRmJXzA6L93kCCYasGxGg6ynQyCjQb4FTh0BP8S3SalI3VJL2 t26Cs2t5pWYetqZHxUgXRxEPD8cGlhLeIom5HosGjyrzzh28MDrMBSLe9fOYOTX6eLdE PNkBAKPcXgx9UoOebsLVcZmptHd4v3yW5ZKl0PxnyKENY5hagQXDTf3UVCls2kIU+kWw nSgbfD1ZQ7F+Yb+tyGE0WyNaTcy4kUFDNOTigBtGyti4bVw1HtI6Fg8dt6xNgIGShjE9 rcfA== 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=Uvyi0DtsyHq/nwl/k8YyGUsnb+NBbEi3/k46msM+NEw=; b=SEau85WRpHA6Vi+jSc6XkNX+tt7w6GmbOA061ytJx2cMv9Byn75SYAPqskFuiPpssN +5jXBZ0ehQhyne7hImJZWwgMrh41AM/AFtGDvu6/jG/0l6kWduuMBkAojsfzLO9dfUBH YoHUozoe8jIVIrpMWxTq6qFYE/Hs/0FrvqjT/TW6psGu9nTCow/Cnp7c7CtWlbjSepZr BIrOxwm+HCZJwU/WymM33Y2rNqySZwolxVRZ1VbQ+7fo+9Qcv8411Q1i3zMDhJSPCMa/ dW4sk1qGfvMHZEhd01JVmrf+AD3eEc5veCDNEP3uAC5Ng/4B2d1/2v5OarpByTzG3ze1 ESbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qwNVcka4; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id b2-20020ac85bc2000000b0031d3c082244si9358312qtb.598.2022.07.06.01.53.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Jul 2022 01:53:32 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qwNVcka4; 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]:53144 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o90mp-0002AK-KS for patch@linaro.org; Wed, 06 Jul 2022 04:53:31 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48784) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o90Kt-0005m6-F8 for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:24:39 -0400 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]:40537) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o90Kp-0000JD-On for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:24:39 -0400 Received: by mail-pj1-x102b.google.com with SMTP id g16-20020a17090a7d1000b001ea9f820449so19584182pjl.5 for ; Wed, 06 Jul 2022 01:24:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Uvyi0DtsyHq/nwl/k8YyGUsnb+NBbEi3/k46msM+NEw=; b=qwNVcka4FVGyiAc2q+W+U8ElTW3KAX0EOBHeG5tOzngyVDlv1Mt5Bgy3MpHPtsgvFw pbclpqdq6yVSbu4uevTW/5kqVwzazzE7itqPkZVkLaiX0IgdkJFbLLB/O0b1uQMMZzmo f0CI08anBxdoKQnF4bt/GMruk7X/WLPA+yAT99HxF7Ics0We6dOvWdfBGLlIEk2Q3RZW 0lkHGIAK8dKrc2EOGyVljUdIwDdRyZKqbQmlI6vKaqVc4ySbOb7otiFETW/r/qe0/BJC Ki5kJ4uhPaHTNeV7NfefLjcO1q4ONFwAOrsKv4UixNHnFoBlhE1MruZYhWYA8ZlKgWJc O6Ow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Uvyi0DtsyHq/nwl/k8YyGUsnb+NBbEi3/k46msM+NEw=; b=0+0/r2e0m8sf0q68IYKkzve/Au/VB8o7nkWXN80R7NWnK+q/VxBqBLl/ggxsY02+UR hliUkiPcB3YdjwySxfmdazfrJNAnZGOY9BHaNfyHi/t8EErpWdR6A9KXJZd/sMJHzMuk zr7rbND2ajD8W2nbLyHAf2/OdwKsX3lGuuvUX//OT2h5JoaOgK5bg5KFl4yuW3jPw+i/ 7doAKJeItT9HkDguBMJBa6x/vw03BQ4MdYF8k/aYP+3nkIwfCNSCCowU49CrvH6yrAOF 1uTbi5H/pe2WHGS63SEuWT2mcTNBxsXMhiP9zuQ+RAoRxsvLhvchBOvlB4GlBy7Tc0du TrFw== X-Gm-Message-State: AJIora/jpnoYuggjMASSL+b0B7LF6CM+H3GV94VmgeEEYO5gq4d//hws 2OtMLEAI7cZnOh93SiUMy9ARiW3vR7R9Ht2M X-Received: by 2002:a17:902:c64b:b0:16b:d51a:dc24 with SMTP id s11-20020a170902c64b00b0016bd51adc24mr21729950pls.48.1657095875003; Wed, 06 Jul 2022 01:24:35 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id t17-20020a170902e85100b00162529828aesm25199256plg.109.2022.07.06.01.24.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jul 2022 01:24:34 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v5 07/45] target/arm: Mark PMULL, FMMLA as non-streaming Date: Wed, 6 Jul 2022 13:53:33 +0530 Message-Id: <20220706082411.1664825-8-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220706082411.1664825-1-richard.henderson@linaro.org> References: <20220706082411.1664825-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102b; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102b.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" Mark these as a non-streaming instructions, which should trap if full a64 support is not enabled in streaming mode. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/sme-fa64.decode | 2 -- target/arm/translate-sve.c | 24 +++++++++++++++--------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/target/arm/sme-fa64.decode b/target/arm/sme-fa64.decode index 4f515939d9..4ff2df82e5 100644 --- a/target/arm/sme-fa64.decode +++ b/target/arm/sme-fa64.decode @@ -59,8 +59,6 @@ FAIL 0001 1110 0111 1110 0000 00-- ---- ---- # FJCVTZS # --11 1100 --1- ---- ---- ---- ---- --10 # Load/store FP register (register offset) # --11 1101 ---- ---- ---- ---- ---- ---- # Load/store FP register (scaled imm) -FAIL 0100 0101 000- ---- 0110 1--- ---- ---- # PMULLB, PMULLT (128b result) -FAIL 0110 0100 --1- ---- 1110 01-- ---- ---- # FMMLA, BFMMLA FAIL 0110 0101 --0- ---- 0000 11-- ---- ---- # FTSMUL FAIL 0110 0101 --01 0--- 100- ---- ---- ---- # FTMAD FAIL 0110 0101 --01 1--- 001- ---- ---- ---- # FADDA diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c index ae48040aa4..4ff2102fc8 100644 --- a/target/arm/translate-sve.c +++ b/target/arm/translate-sve.c @@ -6186,9 +6186,13 @@ static bool do_trans_pmull(DisasContext *s, arg_rrr_esz *a, bool sel) gen_helper_gvec_pmull_q, gen_helper_sve2_pmull_h, NULL, gen_helper_sve2_pmull_d, }; - if (a->esz == 0 - ? !dc_isar_feature(aa64_sve2_pmull128, s) - : !dc_isar_feature(aa64_sve, s)) { + + if (a->esz == 0) { + if (!dc_isar_feature(aa64_sve2_pmull128, s)) { + return false; + } + s->is_nonstreaming = true; + } else if (!dc_isar_feature(aa64_sve, s)) { return false; } return gen_gvec_ool_arg_zzz(s, fns[a->esz], a, sel); @@ -7125,10 +7129,12 @@ DO_ZPZZ_FP(FMINP, aa64_sve2, sve2_fminp_zpzz) * SVE Integer Multiply-Add (unpredicated) */ -TRANS_FEAT(FMMLA_s, aa64_sve_f32mm, gen_gvec_fpst_zzzz, gen_helper_fmmla_s, - a->rd, a->rn, a->rm, a->ra, 0, FPST_FPCR) -TRANS_FEAT(FMMLA_d, aa64_sve_f64mm, gen_gvec_fpst_zzzz, gen_helper_fmmla_d, - a->rd, a->rn, a->rm, a->ra, 0, FPST_FPCR) +TRANS_FEAT_NONSTREAMING(FMMLA_s, aa64_sve_f32mm, gen_gvec_fpst_zzzz, + gen_helper_fmmla_s, a->rd, a->rn, a->rm, a->ra, + 0, FPST_FPCR) +TRANS_FEAT_NONSTREAMING(FMMLA_d, aa64_sve_f64mm, gen_gvec_fpst_zzzz, + gen_helper_fmmla_d, a->rd, a->rn, a->rm, a->ra, + 0, FPST_FPCR) static gen_helper_gvec_4 * const sqdmlal_zzzw_fns[] = { NULL, gen_helper_sve2_sqdmlal_zzzw_h, @@ -7301,8 +7307,8 @@ TRANS_FEAT(BFDOT_zzzz, aa64_sve_bf16, gen_gvec_ool_arg_zzzz, TRANS_FEAT(BFDOT_zzxz, aa64_sve_bf16, gen_gvec_ool_arg_zzxz, gen_helper_gvec_bfdot_idx, a) -TRANS_FEAT(BFMMLA, aa64_sve_bf16, gen_gvec_ool_arg_zzzz, - gen_helper_gvec_bfmmla, a, 0) +TRANS_FEAT_NONSTREAMING(BFMMLA, aa64_sve_bf16, gen_gvec_ool_arg_zzzz, + gen_helper_gvec_bfmmla, a, 0) static bool do_BFMLAL_zzzw(DisasContext *s, arg_rrrr_esz *a, bool sel) { From patchwork Wed Jul 6 08:23:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 587713 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1ec:0:0:0:0 with SMTP id 12csp2544039map; Wed, 6 Jul 2022 01:50:53 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sxdX/QNIo8KQ4jtakVXwRS17uJ22cT0kkrsJuYuZW5GwIAI9atcz5wyKpRJmlZXwPRf+Wq X-Received: by 2002:a05:622a:1884:b0:31d:4bda:e1d3 with SMTP id v4-20020a05622a188400b0031d4bdae1d3mr12037678qtc.296.1657097453680; Wed, 06 Jul 2022 01:50:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657097453; cv=none; d=google.com; s=arc-20160816; b=lzTN4UeiExnoL2b2JyBCjrKLJXyfdx5YKZZPVL3VfCje6nLFlHlOkMWSxgC7C7jCH1 qM2DVaHu1qnvN7XyvBUPHp5iL1PeVLdz7hr29LRu/Tg3/5gE0dF2G6PqLIJFN+tgIYSC hzV6BbXOPbiP5l1KByRzTCGc7i1d+pfERTkm3SubXTa8eB4J3WHnQ06SkR15KdBozZFO Z6F1j56nmNumHNj2bwPTSCdiTV0ONjWwF45nYHSMFxvWo+a4Vnti4Zmr7I6il/Q1gG+a HAI0WlGqk70gRjdjJ9pJ57a4GQSqWCuA4hwm+1/nsa6DEidpaInPAMQ6KyIA++TJzoUv IQQA== 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=dcHardhOi3ouG3QD1ZaU/LIrZV5tMarYA0PaEYIlrzQ=; b=ES4wygi0T9zebn6GfboJlyAAO6DzW2buvBxYeQ6dW6S68tUS4r/z1NJ0H+FxvHNq7t OYKQFZ1g6L5aD9HjwOPPPqyxe0YTi4RWaph51IMhtmcp/+wEFa+bBbxm4Cec1nO2/X2B mNKiPXdd1Qp60x3q9MtmAHxk8CIk/lSOzUoLC1QpeL4hkvdlWOp1S7zX955m7hbxZy5j mwrhNqAenqz5rkrFE/9CvBYIshI9f1uxqhpTUSF2NW15rwVaRM7IMiNEAI9fWmA4vwQd u4W3m1zWcZ/F59/H7W4TaxWNL0qjjQK3gBmZKT1j8npwAcVhL7U6ujBrmPQIrpuz9ujN 2bvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="sfK6dHS/"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id p7-20020a05622a00c700b0031c392743d3si14559084qtw.144.2022.07.06.01.50.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Jul 2022 01:50:53 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="sfK6dHS/"; 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]:47674 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o90kG-0006v9-Qg for patch@linaro.org; Wed, 06 Jul 2022 04:50:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48854) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o90Ky-0005qU-J2 for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:24:45 -0400 Received: from mail-pl1-x636.google.com ([2607:f8b0:4864:20::636]:33294) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o90Ks-0000Mx-Ls for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:24:41 -0400 Received: by mail-pl1-x636.google.com with SMTP id n10so13096692plp.0 for ; Wed, 06 Jul 2022 01:24:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=dcHardhOi3ouG3QD1ZaU/LIrZV5tMarYA0PaEYIlrzQ=; b=sfK6dHS/c4Uh2K6uZDXWEv42T0KKqtzo2O2B4E/bMotQJT7MG8HTakgEkGBkXHOrhf ia2DxAsae14E+n9cS3SwD2q7U5Xa4+T3KuS5Jd5p/2jiH+XVA/ENr1hbj3vTUtaySL5I Jum0RQmfQ2hXtm7I18GUqGEGgG46Gq4tI+xHxM5v1UT4p4CF7UN0EJzZm7lKBGMKGjYy nz91GIwOoaUowJPT/gB6sLN0we3yU76iGArwItLWK02Nxvj6yEo7k/1pjw3+17k4LYPA CQQQQdm8PE3bXWrDjs+OT5w5KfmfwHhO07eZBvcPYHqg4G1CSdAjQMBuKrZUMbwifsrH objA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=dcHardhOi3ouG3QD1ZaU/LIrZV5tMarYA0PaEYIlrzQ=; b=b7vQmb2eKUOivFvZW2scIFTHmS25z+DPnLQYUWb7O5zrt56bthERImKkhs1KBsH/m9 N3osv+vCHYNmEKhrxWWBlZMhAUMir9iKd/9HyrwJug+w5dDCwBgu1Zs/kVz9gBULRwEK App1FuV0e0zfNXZlSTVf9nIJXvm00HKFcmUgdEdcszUKz5+SnqgTKCRxVux+YtxeM477 bM9k/mx/p246XevusHP31Lr/SGNI045+OacwUUArSR0tTdUYZ90FXMnpo/dDVoCHFJlR Ruy2GiBW7tUY3WP0YlA5Xyhs7MexYem+0Kz5rb1lIozonEX2fOZokNdSD6YjolcCyjz7 lOIA== X-Gm-Message-State: AJIora+dCRYBpf4q6x9i9ATb5iremm8iuDIR//gMsYey1O5io32fxADf xPgk9iU8dQ9SeQuAe7CPvvT1yPotSe72DX1g X-Received: by 2002:a17:902:9046:b0:168:b8ee:8164 with SMTP id w6-20020a170902904600b00168b8ee8164mr45436113plz.159.1657095877368; Wed, 06 Jul 2022 01:24:37 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id t17-20020a170902e85100b00162529828aesm25199256plg.109.2022.07.06.01.24.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jul 2022 01:24:37 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v5 08/45] target/arm: Mark FTSMUL, FTMAD, FADDA as non-streaming Date: Wed, 6 Jul 2022 13:53:34 +0530 Message-Id: <20220706082411.1664825-9-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220706082411.1664825-1-richard.henderson@linaro.org> References: <20220706082411.1664825-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::636; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x636.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" Mark these as a non-streaming instructions, which should trap if full a64 support is not enabled in streaming mode. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/sme-fa64.decode | 3 --- target/arm/translate-sve.c | 15 +++++++++++---- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/target/arm/sme-fa64.decode b/target/arm/sme-fa64.decode index 4ff2df82e5..b5eaa2d0fa 100644 --- a/target/arm/sme-fa64.decode +++ b/target/arm/sme-fa64.decode @@ -59,9 +59,6 @@ FAIL 0001 1110 0111 1110 0000 00-- ---- ---- # FJCVTZS # --11 1100 --1- ---- ---- ---- ---- --10 # Load/store FP register (register offset) # --11 1101 ---- ---- ---- ---- ---- ---- # Load/store FP register (scaled imm) -FAIL 0110 0101 --0- ---- 0000 11-- ---- ---- # FTSMUL -FAIL 0110 0101 --01 0--- 100- ---- ---- ---- # FTMAD -FAIL 0110 0101 --01 1--- 001- ---- ---- ---- # FADDA FAIL 0100 0101 --0- ---- 1001 10-- ---- ---- # SMMLA, UMMLA, USMMLA FAIL 0100 0101 --1- ---- 1--- ---- ---- ---- # SVE2 string/histo/crypto instructions FAIL 1000 010- -00- ---- 10-- ---- ---- ---- # SVE2 32-bit gather NT load (vector+scalar) diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c index 4ff2102fc8..d5aad53923 100644 --- a/target/arm/translate-sve.c +++ b/target/arm/translate-sve.c @@ -3861,9 +3861,9 @@ static gen_helper_gvec_3_ptr * const ftmad_fns[4] = { NULL, gen_helper_sve_ftmad_h, gen_helper_sve_ftmad_s, gen_helper_sve_ftmad_d, }; -TRANS_FEAT(FTMAD, aa64_sve, gen_gvec_fpst_zzz, - ftmad_fns[a->esz], a->rd, a->rn, a->rm, a->imm, - a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR) +TRANS_FEAT_NONSTREAMING(FTMAD, aa64_sve, gen_gvec_fpst_zzz, + ftmad_fns[a->esz], a->rd, a->rn, a->rm, a->imm, + a->esz == MO_16 ? FPST_FPCR_F16 : FPST_FPCR) /* *** SVE Floating Point Accumulating Reduction Group @@ -3886,6 +3886,7 @@ static bool trans_FADDA(DisasContext *s, arg_rprr_esz *a) if (a->esz == 0 || !dc_isar_feature(aa64_sve, s)) { return false; } + s->is_nonstreaming = true; if (!sve_access_check(s)) { return true; } @@ -3923,12 +3924,18 @@ static bool trans_FADDA(DisasContext *s, arg_rprr_esz *a) DO_FP3(FADD_zzz, fadd) DO_FP3(FSUB_zzz, fsub) DO_FP3(FMUL_zzz, fmul) -DO_FP3(FTSMUL, ftsmul) DO_FP3(FRECPS, recps) DO_FP3(FRSQRTS, rsqrts) #undef DO_FP3 +static gen_helper_gvec_3_ptr * const ftsmul_fns[4] = { + NULL, gen_helper_gvec_ftsmul_h, + gen_helper_gvec_ftsmul_s, gen_helper_gvec_ftsmul_d +}; +TRANS_FEAT_NONSTREAMING(FTSMUL, aa64_sve, gen_gvec_fpst_arg_zzz, + ftsmul_fns[a->esz], a, 0) + /* *** SVE Floating Point Arithmetic - Predicated Group */ From patchwork Wed Jul 6 08:23:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 587711 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1ec:0:0:0:0 with SMTP id 12csp2539344map; Wed, 6 Jul 2022 01:43:23 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vByUoTrO4JCNXxZ9rrvDQbL9YgGs06oLHiMfnfBSi4l/xJ4dj3otzJ+fWHfn46DKLAIit8 X-Received: by 2002:a81:543:0:b0:31c:88e0:26e6 with SMTP id 64-20020a810543000000b0031c88e026e6mr20905392ywf.210.1657097003032; Wed, 06 Jul 2022 01:43:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657097003; cv=none; d=google.com; s=arc-20160816; b=M5mi47fm63t876xsz/zXSMoqFY2FXJdTc2bCVmM6gPjMiHZ8kf0xHjw8o7R34cAgtr Ul4cOUlWnwnoPHtLSG6A+RbvD9+FbN2makmkDQIUgvsqB/I2YqZgrSaz+a75zrxGuMIg RUpeel0phsF23XKcaKQJ0LQdoEgL8ZACeNlploZSqsoeYNPD8iW/1zWIIMqTxtdsVaQZ LFudVS7I631DKMgq2KXRblhPhAGJmqRPWTAi3aYuI+UBaHn9MiOOpQu7yi/xnp+s3kfE elUUUxVY8538w1wCNPRmyFsqDG7+4JNvJ1nlO2LDZ3bu3LPviUUnCoAtL1joW30TvFNV u8kw== 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=5diXjDkZ8lDduwnyqU3jDTWthnVlvOOyK5gnN0aC3a8=; b=tVvW0x4iaiWqc83zm2ip2SFQWpJ141fYA+AthAuvto1Vkp9eZohLINjiETatDpbD/Y nmtodUtwYRPQ2h8xZIqLw/pQOBoAnjcUAs275ulrJu2cwWZWUaVaD9jX+dPS2C0HcZ4S 93Vpm3heP8Hg8rYhNXoc4RSO7Ovt09Y2k7W5zIbxIm0F2m5KyZYCwG1Ai75j1rd+x480 PyrE8qKYVjKuL5Kja2rK28LPmTKsEWpP7NrI+h4LQ4jygwQpx8CtuSLPTtXikLlukzUE 36y9YIzyR43AamIGwDyzqwT+MsSYf4GFByqLSGeMzQ24jhyK/LxU51Bwcrr6Q1iQ/nHH nEaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jHXmjjrA; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id r145-20020a819a97000000b0031b89797326si44191597ywg.435.2022.07.06.01.43.22 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Jul 2022 01:43:23 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jHXmjjrA; 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]:39580 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o90d0-0001FW-CS for patch@linaro.org; Wed, 06 Jul 2022 04:43:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48852) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o90Ky-0005qT-Iz for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:24:45 -0400 Received: from mail-pj1-x1029.google.com ([2607:f8b0:4864:20::1029]:43640) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o90Kv-0000NL-0B for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:24:42 -0400 Received: by mail-pj1-x1029.google.com with SMTP id o5-20020a17090a3d4500b001ef76490983so10557931pjf.2 for ; Wed, 06 Jul 2022 01:24:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5diXjDkZ8lDduwnyqU3jDTWthnVlvOOyK5gnN0aC3a8=; b=jHXmjjrAnDXE13PnVBQ4Ifm1qsZZM0yNxU+6tt2spDd2XIJE3Cq3W8LZtNyL4iPcSh mA7zq03/uNLU3lQDz8IdmwPmcu89Rvp5gYI+hxOo9yYDBI1arLtbrZMnUuI02xsF1TQa XOHnbBrcFW4yFlZ4Fps4BJxk8mdnkGwXW6Djjo6aPvpXOQyX0RPfcqyyMLudXHY9DING E7QZxCaA48e0OPJRlqKJWvj3v1FDFpJNzI5mpakrYOigiW4/ldzSZ/FK9W2Sewn3atGN YKj9oz9Atqtj7I7sUL/tFwg3yq3QACbjC4ABPMrltJ1F6ajWQU0mPuafTEd7jmFwg6M6 El3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5diXjDkZ8lDduwnyqU3jDTWthnVlvOOyK5gnN0aC3a8=; b=n6W5lmonrYBuec26P9A3uKUFXFSqWyAroNoHlNpxxU/AGaoY66N84xT9QCU3/EemN6 DH5WqHzdZpqwBR5EfumHTfDW+NQjSaCHrH4A/JbNkfXTA5pWMh06yKP5Gg8qTUlknSPy ZCmK7ty9UCi6Wbf4Wa9FxCpufdBGgDV2rwaGs36Mqqiuz7hQNrfpk2VBGtAqQn8X59+G 24OyhKADXkwFik1WT+gL8MPp0Gu6mmwWkEePiGO3GGcMPVcO85gfS6HK4iU4sfUZnZei /J0n1ZOqBJCS4DK+un9f/11o0JKGiUDvXTVC3MVPBFAH37E9gGzg6YN+WwalCUaWHk8p iClg== X-Gm-Message-State: AJIora/1b1uHzJAzED3USE8ugahUJ3bTD+IcOPkpodpaNEbxtHwVPpQy /97oG2XVd21+GGji4MNaLOhy4GNbIx3m3rE4 X-Received: by 2002:a17:90b:3b85:b0:1ec:d979:ca42 with SMTP id pc5-20020a17090b3b8500b001ecd979ca42mr48372072pjb.209.1657095879693; Wed, 06 Jul 2022 01:24:39 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id t17-20020a170902e85100b00162529828aesm25199256plg.109.2022.07.06.01.24.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jul 2022 01:24:39 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v5 09/45] target/arm: Mark SMMLA, UMMLA, USMMLA as non-streaming Date: Wed, 6 Jul 2022 13:53:35 +0530 Message-Id: <20220706082411.1664825-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220706082411.1664825-1-richard.henderson@linaro.org> References: <20220706082411.1664825-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1029; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1029.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" Mark these as a non-streaming instructions, which should trap if full a64 support is not enabled in streaming mode. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/sme-fa64.decode | 1 - target/arm/translate-sve.c | 12 ++++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/target/arm/sme-fa64.decode b/target/arm/sme-fa64.decode index b5eaa2d0fa..3260ea2d64 100644 --- a/target/arm/sme-fa64.decode +++ b/target/arm/sme-fa64.decode @@ -59,7 +59,6 @@ FAIL 0001 1110 0111 1110 0000 00-- ---- ---- # FJCVTZS # --11 1100 --1- ---- ---- ---- ---- --10 # Load/store FP register (register offset) # --11 1101 ---- ---- ---- ---- ---- ---- # Load/store FP register (scaled imm) -FAIL 0100 0101 --0- ---- 1001 10-- ---- ---- # SMMLA, UMMLA, USMMLA FAIL 0100 0101 --1- ---- 1--- ---- ---- ---- # SVE2 string/histo/crypto instructions FAIL 1000 010- -00- ---- 10-- ---- ---- ---- # SVE2 32-bit gather NT load (vector+scalar) FAIL 1000 010- -00- ---- 111- ---- ---- ---- # SVE 32-bit gather prefetch (vector+imm) diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c index d5aad53923..9bbf44f008 100644 --- a/target/arm/translate-sve.c +++ b/target/arm/translate-sve.c @@ -7302,12 +7302,12 @@ TRANS_FEAT(FMLALT_zzxw, aa64_sve2, do_FMLAL_zzxw, a, false, true) TRANS_FEAT(FMLSLB_zzxw, aa64_sve2, do_FMLAL_zzxw, a, true, false) TRANS_FEAT(FMLSLT_zzxw, aa64_sve2, do_FMLAL_zzxw, a, true, true) -TRANS_FEAT(SMMLA, aa64_sve_i8mm, gen_gvec_ool_arg_zzzz, - gen_helper_gvec_smmla_b, a, 0) -TRANS_FEAT(USMMLA, aa64_sve_i8mm, gen_gvec_ool_arg_zzzz, - gen_helper_gvec_usmmla_b, a, 0) -TRANS_FEAT(UMMLA, aa64_sve_i8mm, gen_gvec_ool_arg_zzzz, - gen_helper_gvec_ummla_b, a, 0) +TRANS_FEAT_NONSTREAMING(SMMLA, aa64_sve_i8mm, gen_gvec_ool_arg_zzzz, + gen_helper_gvec_smmla_b, a, 0) +TRANS_FEAT_NONSTREAMING(USMMLA, aa64_sve_i8mm, gen_gvec_ool_arg_zzzz, + gen_helper_gvec_usmmla_b, a, 0) +TRANS_FEAT_NONSTREAMING(UMMLA, aa64_sve_i8mm, gen_gvec_ool_arg_zzzz, + gen_helper_gvec_ummla_b, a, 0) TRANS_FEAT(BFDOT_zzzz, aa64_sve_bf16, gen_gvec_ool_arg_zzzz, gen_helper_gvec_bfdot, a, 0) From patchwork Wed Jul 6 08:23:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 587723 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1ec:0:0:0:0 with SMTP id 12csp2555455map; Wed, 6 Jul 2022 02:06:59 -0700 (PDT) X-Google-Smtp-Source: AGRyM1v4Mt99TN83anWUopnUO11bEQlL46ri7KhhCgKqQpNZndxybiy8v+YgNa1aTuJMu++2FG0D X-Received: by 2002:a37:c204:0:b0:6af:3a2:4a20 with SMTP id i4-20020a37c204000000b006af03a24a20mr27224254qkm.706.1657098419149; Wed, 06 Jul 2022 02:06:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657098419; cv=none; d=google.com; s=arc-20160816; b=pMPw89HjfyMG9EV38GAp1aXigXLv/A17WIZdEoGJRIKPwK+3ATeA6t/VJE7HlHzk5h jI5YpnG4KjC5vxnaMUZOf9KvB2FUhw6UlbWFfMFmqRPesxaTBWVPX+vBrQfbeyPKFOJS iopzj3DvujnrB54MnsdmpqVvoryVS5JxMxcaqMVJjooHAS6rirs+9yR4IJpaqWiSDIDJ DhL5zqj5thlUoJZCvo3Bts6lZWcDRY5Y9iDdn7kvrm4MKy21xukepFY3xogHkdEGWQL+ 7KhaLGlhCQ1sEQRiYhv4OH+ac8p7DNkjdWJGxphnCzAvPlcX8tC+eRcfXgI7mQ7brPGJ V8PQ== 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=eMDZljSMa7lgcdxc4v8wiBGe99d03Zr6CetA/Z+JkFo=; b=aCLPhSlSvLyhs2ew/wHU64NoNzNjnEs2qy4v7X0EyGjZiBQNdhWjDWelC6iKi3T4aw OsA3oPp+BI/uhH+XFpeVKlrwcN6lV5R9w0XDt5371JjDGx7FxjAcVYx15hzW6KXlfEVA w7tlgnjuvkHOqG/9gVGGoIIunBhYH6pQ+nsTwNbQdqehSF21X5iylTEK0DCegjOjzT/I 9cEvOzSFT5d+yGo5DlSbE2enwjphMuUS2h41SgHKWV9xJ9an7DdawmtbQKqffXrJ7lLl nESne2ZRCUS7ekNQcVmQP9tV59ofHAk2evgrQqj4EczODHMUmnvpfqt3t1xofINyb7or EuFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GOWVfceP; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 18-20020ac85752000000b003066570a200si23793011qtx.401.2022.07.06.02.06.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Jul 2022 02:06:59 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GOWVfceP; 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]:47654 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o90zq-0000nG-Nq for patch@linaro.org; Wed, 06 Jul 2022 05:06:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48954) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o90L7-0005wP-3C for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:24:54 -0400 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]:38810) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o90Kz-0000O1-5B for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:24:48 -0400 Received: by mail-pl1-x62a.google.com with SMTP id m14so13058329plg.5 for ; Wed, 06 Jul 2022 01:24:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=eMDZljSMa7lgcdxc4v8wiBGe99d03Zr6CetA/Z+JkFo=; b=GOWVfcePYSz5k/iq92KMZdyKm3lTK9q0yHLDuhFWv/amV0LHTMrLxmc75iBvAbnmc+ 9lD/mztlfIVFf1ggMPmBGrhuaGKdP0XnjN8RmXAv+kh9jBdpEqOApMcejGMhu5EFEZsF DoXpRxLk2rSXvzoMFKeww3ci2zGW047KNiyXj9b7kL5fzTNTk75vVcnwtFCNBCHioKpN /JiGJ09v9xr/qkUABmndvltgRDUdFm2GrpRS5xvMVwqXn2rJtT5RXADuu5xpHe5aqPTf BvXP105/i9FTvg6lp5bx01R7XzTP/qv8xbn8xo1zz7HkLRsBb+oTOQJDLBexRX0tPtVo OLlw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=eMDZljSMa7lgcdxc4v8wiBGe99d03Zr6CetA/Z+JkFo=; b=tm3G6lxJKC13N/ezoJlJYmGunCxy8ervP6HO6B5j2q7nxaoTaBm2CNETt5bfS5XzVH +u1mX1Lkov1w1L1arLPlgooJPKCbFm4l78nNyVnRZQx8GFWIVEZqcdcb4NYaoYizN5XN gDTNZidcrD4Xv68mVS4qiAjXdq5+pCOQhh4p2MVqFuMDLh1HB6JDWQb27Cnlox6yZNVy mx+uo92krQLbDsCqmNyC/7/gRm1VMIpiy76Oauo6VmorgHeO7hOS5yTbqUrECcjI58LQ lSc/Dhu7dqWqBBeC2+udEDFik8/hs1ASIurmJeVJs9lSVro1B+fV7RIu3XfXJTQn3jWJ ltDg== X-Gm-Message-State: AJIora9kHDPLWZeNihuiOFNcg23RjtHIYh7a6KM2qoiQbrgQ5fU4ByM8 0hf+K8sfJcHWYjjldyF6Lc9UGQbT8IeGI+J+ X-Received: by 2002:a17:90b:4a92:b0:1ed:5294:49b4 with SMTP id lp18-20020a17090b4a9200b001ed529449b4mr48602841pjb.127.1657095882204; Wed, 06 Jul 2022 01:24:42 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id t17-20020a170902e85100b00162529828aesm25199256plg.109.2022.07.06.01.24.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jul 2022 01:24:41 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v5 10/45] target/arm: Mark string/histo/crypto as non-streaming Date: Wed, 6 Jul 2022 13:53:36 +0530 Message-Id: <20220706082411.1664825-11-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220706082411.1664825-1-richard.henderson@linaro.org> References: <20220706082411.1664825-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62a; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62a.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" Mark these as non-streaming instructions, which should trap if full a64 support is not enabled in streaming mode. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/sme-fa64.decode | 1 - target/arm/translate-sve.c | 35 ++++++++++++++++++----------------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/target/arm/sme-fa64.decode b/target/arm/sme-fa64.decode index 3260ea2d64..fe462d2ccc 100644 --- a/target/arm/sme-fa64.decode +++ b/target/arm/sme-fa64.decode @@ -59,7 +59,6 @@ FAIL 0001 1110 0111 1110 0000 00-- ---- ---- # FJCVTZS # --11 1100 --1- ---- ---- ---- ---- --10 # Load/store FP register (register offset) # --11 1101 ---- ---- ---- ---- ---- ---- # Load/store FP register (scaled imm) -FAIL 0100 0101 --1- ---- 1--- ---- ---- ---- # SVE2 string/histo/crypto instructions FAIL 1000 010- -00- ---- 10-- ---- ---- ---- # SVE2 32-bit gather NT load (vector+scalar) FAIL 1000 010- -00- ---- 111- ---- ---- ---- # SVE 32-bit gather prefetch (vector+imm) FAIL 1000 0100 0-1- ---- 0--- ---- ---- ---- # SVE 32-bit gather prefetch (scalar+vector) diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c index 9bbf44f008..f8e0716474 100644 --- a/target/arm/translate-sve.c +++ b/target/arm/translate-sve.c @@ -7110,21 +7110,21 @@ DO_SVE2_ZZZ_NARROW(RSUBHNT, rsubhnt) static gen_helper_gvec_flags_4 * const match_fns[4] = { gen_helper_sve2_match_ppzz_b, gen_helper_sve2_match_ppzz_h, NULL, NULL }; -TRANS_FEAT(MATCH, aa64_sve2, do_ppzz_flags, a, match_fns[a->esz]) +TRANS_FEAT_NONSTREAMING(MATCH, aa64_sve2, do_ppzz_flags, a, match_fns[a->esz]) static gen_helper_gvec_flags_4 * const nmatch_fns[4] = { gen_helper_sve2_nmatch_ppzz_b, gen_helper_sve2_nmatch_ppzz_h, NULL, NULL }; -TRANS_FEAT(NMATCH, aa64_sve2, do_ppzz_flags, a, nmatch_fns[a->esz]) +TRANS_FEAT_NONSTREAMING(NMATCH, aa64_sve2, do_ppzz_flags, a, nmatch_fns[a->esz]) static gen_helper_gvec_4 * const histcnt_fns[4] = { NULL, NULL, gen_helper_sve2_histcnt_s, gen_helper_sve2_histcnt_d }; -TRANS_FEAT(HISTCNT, aa64_sve2, gen_gvec_ool_arg_zpzz, - histcnt_fns[a->esz], a, 0) +TRANS_FEAT_NONSTREAMING(HISTCNT, aa64_sve2, gen_gvec_ool_arg_zpzz, + histcnt_fns[a->esz], a, 0) -TRANS_FEAT(HISTSEG, aa64_sve2, gen_gvec_ool_arg_zzz, - a->esz == 0 ? gen_helper_sve2_histseg : NULL, a, 0) +TRANS_FEAT_NONSTREAMING(HISTSEG, aa64_sve2, gen_gvec_ool_arg_zzz, + a->esz == 0 ? gen_helper_sve2_histseg : NULL, a, 0) DO_ZPZZ_FP(FADDP, aa64_sve2, sve2_faddp_zpzz) DO_ZPZZ_FP(FMAXNMP, aa64_sve2, sve2_fmaxnmp_zpzz) @@ -7238,20 +7238,21 @@ TRANS_FEAT(SQRDCMLAH_zzzz, aa64_sve2, gen_gvec_ool_zzzz, TRANS_FEAT(USDOT_zzzz, aa64_sve_i8mm, gen_gvec_ool_arg_zzzz, a->esz == 2 ? gen_helper_gvec_usdot_b : NULL, a, 0) -TRANS_FEAT(AESMC, aa64_sve2_aes, gen_gvec_ool_zz, - gen_helper_crypto_aesmc, a->rd, a->rd, a->decrypt) +TRANS_FEAT_NONSTREAMING(AESMC, aa64_sve2_aes, gen_gvec_ool_zz, + gen_helper_crypto_aesmc, a->rd, a->rd, a->decrypt) -TRANS_FEAT(AESE, aa64_sve2_aes, gen_gvec_ool_arg_zzz, - gen_helper_crypto_aese, a, false) -TRANS_FEAT(AESD, aa64_sve2_aes, gen_gvec_ool_arg_zzz, - gen_helper_crypto_aese, a, true) +TRANS_FEAT_NONSTREAMING(AESE, aa64_sve2_aes, gen_gvec_ool_arg_zzz, + gen_helper_crypto_aese, a, false) +TRANS_FEAT_NONSTREAMING(AESD, aa64_sve2_aes, gen_gvec_ool_arg_zzz, + gen_helper_crypto_aese, a, true) -TRANS_FEAT(SM4E, aa64_sve2_sm4, gen_gvec_ool_arg_zzz, - gen_helper_crypto_sm4e, a, 0) -TRANS_FEAT(SM4EKEY, aa64_sve2_sm4, gen_gvec_ool_arg_zzz, - gen_helper_crypto_sm4ekey, a, 0) +TRANS_FEAT_NONSTREAMING(SM4E, aa64_sve2_sm4, gen_gvec_ool_arg_zzz, + gen_helper_crypto_sm4e, a, 0) +TRANS_FEAT_NONSTREAMING(SM4EKEY, aa64_sve2_sm4, gen_gvec_ool_arg_zzz, + gen_helper_crypto_sm4ekey, a, 0) -TRANS_FEAT(RAX1, aa64_sve2_sha3, gen_gvec_fn_arg_zzz, gen_gvec_rax1, a) +TRANS_FEAT_NONSTREAMING(RAX1, aa64_sve2_sha3, gen_gvec_fn_arg_zzz, + gen_gvec_rax1, a) TRANS_FEAT(FCVTNT_sh, aa64_sve2, gen_gvec_fpst_arg_zpz, gen_helper_sve2_fcvtnt_sh, a, 0, FPST_FPCR) From patchwork Wed Jul 6 08:23:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 587721 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1ec:0:0:0:0 with SMTP id 12csp2551544map; Wed, 6 Jul 2022 02:01:55 -0700 (PDT) X-Google-Smtp-Source: AGRyM1td/wQ6L4HU7MmAHq0UVNjkrG2noutJmK/Fqht/lkvakp0bx5Nd0wlSHORcJ7Ld8NwRdoV4 X-Received: by 2002:a81:9b02:0:b0:31c:9ae4:99ec with SMTP id s2-20020a819b02000000b0031c9ae499ecmr16536049ywg.495.1657098115465; Wed, 06 Jul 2022 02:01:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657098115; cv=none; d=google.com; s=arc-20160816; b=Htk3ljjDREI1BSCoDPlC+MFu2CxoFA//cwb8jrfjS0aFzY/p3OwIpNfIii35xXnvRD 13+CxYzcJpRELoFLSkSnj+PqNPMcSOkWQbSDK1rCsap6Wk76+GoRN5tHZje2Ak50dg7i MUokNTVbI9cfZz2pz9wcSaolNYo9pRdkndX9MDCuCxnnEi+QlVEjFHiqwjEp1gIKkOtZ 2nADvadJk5Xf6TTr5/4y5U9Owr00YvKaUwE89p0Gf02VKQD8a+F+C4aSxBQbVkwF5CIO 4HcOuUjSqtMKZxZfzkMmfHYQIaYprqK9tDsh9ZkvUDztLPuf2clEa17OdmxIdKTaFLuN gIMw== 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=BY/R+8YJ5Dv/43YfnL4nTrVKxj1X4wUM5az+kdRyBN4=; b=ymKrkELE3TOMb+U5nVd+fcEE+H/ieQK295438+2d9zmQ7DF9wwqREQXFqubzAeeK56 A9xUpGnpWZSARHINqgwIII5HIUptfgS5VrsRnA6lJyUEte71rM9Hbyj8xnNbcX7cWqjg BI3ktuhcDH/cXVrUj3s2tFSKFUi/2BYlUinel0PozUqjXo5GpLOXhrNVTorksqv9JwxR Im1CNWB2OCdiTd5Y+kc7NvVXlacbTIL2YpjFUEoHgiLMptI6yhbeU+7Er+2wxhK9qgNs YxKpT0jJMugtqCBTQ8v7ZM2hH5RjPXlr8ZAI42e4QuQEPbKfmOsemeUx+JLY4Hy8E0XW hHHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jtmSVdNx; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id g6-20020a252006000000b0066e0ea50860si17549174ybg.712.2022.07.06.02.01.55 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Jul 2022 02:01:55 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jtmSVdNx; 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]:40114 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o90uw-00040f-UO for patch@linaro.org; Wed, 06 Jul 2022 05:01:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49046) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o90LA-00060d-B3 for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:24:56 -0400 Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]:36510) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o90L1-0000My-4R for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:24:54 -0400 Received: by mail-pj1-x102c.google.com with SMTP id z12-20020a17090a7b8c00b001ef84000b8bso9244768pjc.1 for ; Wed, 06 Jul 2022 01:24:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=BY/R+8YJ5Dv/43YfnL4nTrVKxj1X4wUM5az+kdRyBN4=; b=jtmSVdNxCpfZypHs23Gb8Av1XHSoQYWIGg43qWiEeYEM0OyuTIalh2KSbmoUDeRbyP 29SmMgvHlyg37C6k84UHlOhR6M8TWqtNg77zDVGuhop4DS0u+kQDSU+h9q3aeylHrsh+ cAUmd7BixEQXoZYsBWZDMch+b/qUPU2MORAioy8UN+sNDq/qW0FOXTrGiITxQnBLQp2G 41WFSSybn9rQfDTqB31DVMKT4ZpssuMYJQDHWqSYGpnICKOfZtf9XPZsg6fFSs005eSh UD6Z7Byw1IaFxiuVhP0DORbFnLqpw/qYNXLC+eUHkZR+swWNoA/DgRxVvBwrp1qt7SAY VIIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=BY/R+8YJ5Dv/43YfnL4nTrVKxj1X4wUM5az+kdRyBN4=; b=fIA0VZ1VVM7VnqZNMiJMwHFTa5MZYaOScNwATNDZR2RMXD2bXz5inMTUu1TnPZCyz2 s8UoLhBFAeqI9u4VcyOXEV74ti4RSLwacS3vAu4Ahr/fiGXhUpAiVc5/ZyLdrrs3gQuK /IvPKTIoko0d5C4MShLpyG5sQoNWSiUXVVG1gUj6MewRQVQqfCqRJlMooqZiN+NYiyfn AIrHZLiLylsJ2AmZ4vhBRsxEe3foqrF1XKDnh5YMVGmZA0UWAKe6o1cIpTCL181Fwji/ /nsdgMEzLr9ozC5qOgSrj8UKs0JVb9HDJl95q3OYiRpa36f5JxPETm+YovlaYCjL7uPq Q8pA== X-Gm-Message-State: AJIora+f4Ke1y8pw8wy2w/GUkjmdB+TGo32FTsunVebnTcE5YGT2T8x4 1EVAuiCpxECywGRALE90HxZh2AJDaU/GwNPX X-Received: by 2002:a17:90a:3e09:b0:1ef:8399:398b with SMTP id j9-20020a17090a3e0900b001ef8399398bmr20508411pjc.39.1657095884685; Wed, 06 Jul 2022 01:24:44 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id t17-20020a170902e85100b00162529828aesm25199256plg.109.2022.07.06.01.24.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jul 2022 01:24:44 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v5 11/45] target/arm: Mark gather/scatter load/store as non-streaming Date: Wed, 6 Jul 2022 13:53:37 +0530 Message-Id: <20220706082411.1664825-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220706082411.1664825-1-richard.henderson@linaro.org> References: <20220706082411.1664825-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102c; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102c.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" Mark these as a non-streaming instructions, which should trap if full a64 support is not enabled in streaming mode. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/sme-fa64.decode | 9 --------- target/arm/translate-sve.c | 6 ++++++ 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/target/arm/sme-fa64.decode b/target/arm/sme-fa64.decode index fe462d2ccc..1acc3ae080 100644 --- a/target/arm/sme-fa64.decode +++ b/target/arm/sme-fa64.decode @@ -59,19 +59,10 @@ FAIL 0001 1110 0111 1110 0000 00-- ---- ---- # FJCVTZS # --11 1100 --1- ---- ---- ---- ---- --10 # Load/store FP register (register offset) # --11 1101 ---- ---- ---- ---- ---- ---- # Load/store FP register (scaled imm) -FAIL 1000 010- -00- ---- 10-- ---- ---- ---- # SVE2 32-bit gather NT load (vector+scalar) FAIL 1000 010- -00- ---- 111- ---- ---- ---- # SVE 32-bit gather prefetch (vector+imm) FAIL 1000 0100 0-1- ---- 0--- ---- ---- ---- # SVE 32-bit gather prefetch (scalar+vector) -FAIL 1000 010- -01- ---- 1--- ---- ---- ---- # SVE 32-bit gather load (vector+imm) -FAIL 1000 0100 0-0- ---- 0--- ---- ---- ---- # SVE 32-bit gather load byte (scalar+vector) -FAIL 1000 0100 1--- ---- 0--- ---- ---- ---- # SVE 32-bit gather load half (scalar+vector) -FAIL 1000 0101 0--- ---- 0--- ---- ---- ---- # SVE 32-bit gather load word (scalar+vector) FAIL 1010 010- ---- ---- 011- ---- ---- ---- # SVE contiguous FF load (scalar+scalar) FAIL 1010 010- ---1 ---- 101- ---- ---- ---- # SVE contiguous NF load (scalar+imm) FAIL 1010 010- -01- ---- 000- ---- ---- ---- # SVE load & replicate 32 bytes (scalar+scalar) FAIL 1010 010- -010 ---- 001- ---- ---- ---- # SVE load & replicate 32 bytes (scalar+imm) FAIL 1100 010- ---- ---- ---- ---- ---- ---- # SVE 64-bit gather load/prefetch -FAIL 1110 010- -00- ---- 001- ---- ---- ---- # SVE2 64-bit scatter NT store (vector+scalar) -FAIL 1110 010- -10- ---- 001- ---- ---- ---- # SVE2 32-bit scatter NT store (vector+scalar) -FAIL 1110 010- ---- ---- 1-0- ---- ---- ---- # SVE scatter store (scalar+32-bit vector) -FAIL 1110 010- ---- ---- 101- ---- ---- ---- # SVE scatter store (misc) diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c index f8e0716474..b23c6aa0bf 100644 --- a/target/arm/translate-sve.c +++ b/target/arm/translate-sve.c @@ -5669,6 +5669,7 @@ static bool trans_LD1_zprz(DisasContext *s, arg_LD1_zprz *a) if (!dc_isar_feature(aa64_sve, s)) { return false; } + s->is_nonstreaming = true; if (!sve_access_check(s)) { return true; } @@ -5700,6 +5701,7 @@ static bool trans_LD1_zpiz(DisasContext *s, arg_LD1_zpiz *a) if (!dc_isar_feature(aa64_sve, s)) { return false; } + s->is_nonstreaming = true; if (!sve_access_check(s)) { return true; } @@ -5734,6 +5736,7 @@ static bool trans_LDNT1_zprz(DisasContext *s, arg_LD1_zprz *a) if (!dc_isar_feature(aa64_sve2, s)) { return false; } + s->is_nonstreaming = true; if (!sve_access_check(s)) { return true; } @@ -5857,6 +5860,7 @@ static bool trans_ST1_zprz(DisasContext *s, arg_ST1_zprz *a) if (!dc_isar_feature(aa64_sve, s)) { return false; } + s->is_nonstreaming = true; if (!sve_access_check(s)) { return true; } @@ -5887,6 +5891,7 @@ static bool trans_ST1_zpiz(DisasContext *s, arg_ST1_zpiz *a) if (!dc_isar_feature(aa64_sve, s)) { return false; } + s->is_nonstreaming = true; if (!sve_access_check(s)) { return true; } @@ -5921,6 +5926,7 @@ static bool trans_STNT1_zprz(DisasContext *s, arg_ST1_zprz *a) if (!dc_isar_feature(aa64_sve2, s)) { return false; } + s->is_nonstreaming = true; if (!sve_access_check(s)) { return true; } From patchwork Wed Jul 6 08:23:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 587724 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1ec:0:0:0:0 with SMTP id 12csp2556341map; Wed, 6 Jul 2022 02:07:54 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tMdtqQHzEeHjmWdMQIWM4NFlm/kzJfPJ/9B03EzL+o3lRsG9aoTytSPJk4gZRbhktO1G4W X-Received: by 2002:a05:620a:112a:b0:6af:1bb9:fb91 with SMTP id p10-20020a05620a112a00b006af1bb9fb91mr25809416qkk.229.1657098474783; Wed, 06 Jul 2022 02:07:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657098474; cv=none; d=google.com; s=arc-20160816; b=IInN3vLz8L08kzw4LHAzfEZu448KoIWgNEiFzUsPdkWbpGzGjWVvGgHP5+HbeGlQtT Rvf05Z1oSjugGEI+AhxMo3Yv9ZmRHF9LsXsVMoUQwVvXtb2NY56eNoU8MUWrtzo8qFzI 4fbEIZxvjuylzhdQZLCBgvTlnPMQylXnx5EmBL6xtSovO8gERoAamW/+drSnHf7n6WO7 DUJkKg935ulMl5JvHa6RQX6WK16bfWbynkm5rLl+dG4Cme9KzNcrMAWHtyjOM7Ig9iPF Q7IQT/0jRK2T1qXC9zgkP3wBH1cQUI9rzjCz/TqVfTiPKBURcUYEbTDpQ9EuK6N847fl 5KHA== 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=EEUaOkhoazNVf18b04XDY+SiXA3h6+AppArsj54fhkI=; b=IIESXBQ+H5GkkuhIQYHTM5N4L71KTo386VHnY8Z0FuKDFDvmYdJYUTOwndbvFbNabt XDu+Oz5js+PS3KaqBPtQnjBPRI24N2txkcf+Xq/Dm8q1j12nTiSGtIw7nkAGP/nE03uh DisIO1JPe+AlNdjIB6MqPgACqZyDPGPnZ/5QodmzIoAJ4lWIrV/W2UJDccGaf3cHtoB4 UnOBgZkjgyRMaTQeqe7AnQFVpHiOje6AaX9GN8yevaV/wRrQg0U8vxizU/2ac8LvNO5D GwwahAGTAscMQpMVCPaffIQkexrJ6rMQHZTXQ5+4SomQsFPSpdQwl7Xt5hrV8lIcUxYJ Vh+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Dc2Rhn/G"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id g135-20020a379d8d000000b006aedb9f0a74si18260544qke.748.2022.07.06.02.07.54 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Jul 2022 02:07:54 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="Dc2Rhn/G"; 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]:49214 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o910k-0001no-C0 for patch@linaro.org; Wed, 06 Jul 2022 05:07:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49044) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o90LA-00060c-BM for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:24:56 -0400 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]:42587) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o90L6-0000PE-PV for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:24:55 -0400 Received: by mail-pl1-x629.google.com with SMTP id 5so7180343plk.9 for ; Wed, 06 Jul 2022 01:24:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=EEUaOkhoazNVf18b04XDY+SiXA3h6+AppArsj54fhkI=; b=Dc2Rhn/GE6Cawcsf+Oabi9Dy+4q8QWvqd55zrUXjFp8CB3M3LKh+lhY1mEV/5zXhrU MAXAr8bxApdsZn0uGB2P6UhajfNEnqbaBqRAN77BHGtBsMWZ3o0sriA4itnP8vB8GpXb lpqp3c0oqWTbsrxzhZH4PKoWSn9LaLatLzpZs9YlZ1hRaKA5tIq3GuApiIqX4HPNxNBG RFSN06LsJVrDKqePZR0YhyBj75PSu7aivNul9hd6rcTPKjmfdFbjyJ4euyzlB4nYBfYy kNqG/TRxLhgtLg+0ExTfEXj3nr5VVeUIz0OEFWJYF3FnD+Dh2qD50EAW01RsYhzmuY8B xEOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=EEUaOkhoazNVf18b04XDY+SiXA3h6+AppArsj54fhkI=; b=i+VAzaIas1RY6j556wzQcH++tHhT/kOSpQxwj1eePSkrybCkYMVREyKAlkqx+m2mOn ZXdc17RkdTWW5Yh0RPfV8Z/tTnKHjZsOURCT0FbM9z3SzRWUJA1G3IIPMce+Q/zFm4ez jTwwjJjovmipgiIAbXm5DLzakRo88krioi1BQFp5YHAH9vizpJYXu0R3s/ewQquEhiWz TOG9ylaUYxm/KR6V+mWEdnAdMTKmXkzNHcEllR4Ulg5eM/UdOGtZk0jd8b4TEHMGBg46 tXMYy/42N7USQ/acBDgq2hbz87hjiihFCEvo0H7gkeONYnzmKd7eyLDxyUDyfNhHb/w+ ZHCw== X-Gm-Message-State: AJIora9necO6LEJir3MeI4EiTSDRkuqBHH/xMMxlv6HPI44utAHx+/ir v0d4QD8ufuXvdIAqstIM9KViIof1bY2uk1/o X-Received: by 2002:a17:90a:db96:b0:1ef:8c86:eb09 with SMTP id h22-20020a17090adb9600b001ef8c86eb09mr15659132pjv.22.1657095887035; Wed, 06 Jul 2022 01:24:47 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id t17-20020a170902e85100b00162529828aesm25199256plg.109.2022.07.06.01.24.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jul 2022 01:24:46 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v5 12/45] target/arm: Mark gather prefetch as non-streaming Date: Wed, 6 Jul 2022 13:53:38 +0530 Message-Id: <20220706082411.1664825-13-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220706082411.1664825-1-richard.henderson@linaro.org> References: <20220706082411.1664825-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::629; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x629.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" Mark these as a non-streaming instructions, which should trap if full a64 support is not enabled in streaming mode. In this case, introduce PRF_ns (prefetch non-streaming) to handle the checks. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/sme-fa64.decode | 3 --- target/arm/sve.decode | 10 +++++----- target/arm/translate-sve.c | 11 +++++++++++ 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/target/arm/sme-fa64.decode b/target/arm/sme-fa64.decode index 1acc3ae080..7d4c33fb5b 100644 --- a/target/arm/sme-fa64.decode +++ b/target/arm/sme-fa64.decode @@ -59,10 +59,7 @@ FAIL 0001 1110 0111 1110 0000 00-- ---- ---- # FJCVTZS # --11 1100 --1- ---- ---- ---- ---- --10 # Load/store FP register (register offset) # --11 1101 ---- ---- ---- ---- ---- ---- # Load/store FP register (scaled imm) -FAIL 1000 010- -00- ---- 111- ---- ---- ---- # SVE 32-bit gather prefetch (vector+imm) -FAIL 1000 0100 0-1- ---- 0--- ---- ---- ---- # SVE 32-bit gather prefetch (scalar+vector) FAIL 1010 010- ---- ---- 011- ---- ---- ---- # SVE contiguous FF load (scalar+scalar) FAIL 1010 010- ---1 ---- 101- ---- ---- ---- # SVE contiguous NF load (scalar+imm) FAIL 1010 010- -01- ---- 000- ---- ---- ---- # SVE load & replicate 32 bytes (scalar+scalar) FAIL 1010 010- -010 ---- 001- ---- ---- ---- # SVE load & replicate 32 bytes (scalar+imm) -FAIL 1100 010- ---- ---- ---- ---- ---- ---- # SVE 64-bit gather load/prefetch diff --git a/target/arm/sve.decode b/target/arm/sve.decode index a54feb2f61..908643d7d9 100644 --- a/target/arm/sve.decode +++ b/target/arm/sve.decode @@ -1183,10 +1183,10 @@ LD1RO_zpri 1010010 .. 01 0.... 001 ... ..... ..... \ @rpri_load_msz nreg=0 # SVE 32-bit gather prefetch (scalar plus 32-bit scaled offsets) -PRF 1000010 00 -1 ----- 0-- --- ----- 0 ---- +PRF_ns 1000010 00 -1 ----- 0-- --- ----- 0 ---- # SVE 32-bit gather prefetch (vector plus immediate) -PRF 1000010 -- 00 ----- 111 --- ----- 0 ---- +PRF_ns 1000010 -- 00 ----- 111 --- ----- 0 ---- # SVE contiguous prefetch (scalar plus immediate) PRF 1000010 11 1- ----- 0-- --- ----- 0 ---- @@ -1223,13 +1223,13 @@ LD1_zpiz 1100010 .. 01 ..... 1.. ... ..... ..... \ @rpri_g_load esz=3 # SVE 64-bit gather prefetch (scalar plus 64-bit scaled offsets) -PRF 1100010 00 11 ----- 1-- --- ----- 0 ---- +PRF_ns 1100010 00 11 ----- 1-- --- ----- 0 ---- # SVE 64-bit gather prefetch (scalar plus unpacked 32-bit scaled offsets) -PRF 1100010 00 -1 ----- 0-- --- ----- 0 ---- +PRF_ns 1100010 00 -1 ----- 0-- --- ----- 0 ---- # SVE 64-bit gather prefetch (vector plus immediate) -PRF 1100010 -- 00 ----- 111 --- ----- 0 ---- +PRF_ns 1100010 -- 00 ----- 111 --- ----- 0 ---- ### SVE Memory Store Group diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c index b23c6aa0bf..bbf3bf2119 100644 --- a/target/arm/translate-sve.c +++ b/target/arm/translate-sve.c @@ -5971,6 +5971,17 @@ static bool trans_PRF_rr(DisasContext *s, arg_PRF_rr *a) return true; } +static bool trans_PRF_ns(DisasContext *s, arg_PRF_ns *a) +{ + if (!dc_isar_feature(aa64_sve, s)) { + return false; + } + /* Prefetch is a nop within QEMU. */ + s->is_nonstreaming = true; + (void)sve_access_check(s); + return true; +} + /* * Move Prefix * From patchwork Wed Jul 6 08:23:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 587722 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1ec:0:0:0:0 with SMTP id 12csp2551617map; Wed, 6 Jul 2022 02:01:59 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uki0JuM4F5G+hOKIkb7ed0mIgMGyps5BWb1wltDzo5H7C6Jw/0ioKC1VG2TCRIzclHwmDN X-Received: by 2002:ac8:5a92:0:b0:31a:b4ce:166f with SMTP id c18-20020ac85a92000000b0031ab4ce166fmr32046954qtc.239.1657098119833; Wed, 06 Jul 2022 02:01:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657098119; cv=none; d=google.com; s=arc-20160816; b=PCVHrdoab1SZuab36VUbazDnfC7v/a8TN8z8yDEftpzCSoh8bPiVNCNEFtJxgzs0lZ CEgWJS/hr9IaAXPZ0tDU7u7UPaxsf4uZ1ad7KCsQsSvvCYVsDk9yoHmim4lAC5msU9cD Y6701sqlP1wnQhaWmuWyJO0BjHkFV0JRo6j4oJ83UOxa5pk2BHkr1Qvu27z3w5aDQxJp oErljvfdm+ctMynHtdSE+PRNzGzGGXxXkSExJBqtBZvEFHT5Nkg713WkwYYIeEluZZ3D vsAGv7lp21i8akVX+FORcQMtkjCVzZMsXg1cEQ/HZgFtE79GrP3nNWPm75ZlDIddEgG6 r6hQ== 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=3fycTpR631CAyDn0p7xxlDZ9oFm740riIb23T+ghRkc=; b=KgTJaTXaRb3e85lXnRhlSUe7EhaHYwjo0ENbplf5om2ep3ddeG7kcDCrxoe9YMDXoT WDaFoNZxp/v/NGj1kmU7Fl1eH5MLj+tiASp3R+imTwJReWrbvDW/7MA04LM0GrgcDo1G hYX4WCXcqXEBnfXyJMhnMOD7TgNERRxv+InaOqEE1zSfQ8mHABkEr21hA28O7wa654bp Ad4cwnclppSazPgzgPu3C4Gg7POpRR4ce2yo28TKrlVVULJ9B+y/S4QEZXwhCegfsDia edj2HODAccsy+oVEPRea0eHt0CIC2bQSQFO5qbYR85BHPHC4BhM2dHJVKaRFmp7Jh6yr NxaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GkfpssZ3; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id h18-20020ac85852000000b00317ca6f541dsi15672156qth.518.2022.07.06.02.01.59 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Jul 2022 02:01:59 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GkfpssZ3; 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]:40650 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o90v1-0004My-DF for patch@linaro.org; Wed, 06 Jul 2022 05:01:59 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49048) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o90LA-00060e-Bk for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:24:56 -0400 Received: from mail-pj1-x1029.google.com ([2607:f8b0:4864:20::1029]:39445) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o90L6-0000PU-S7 for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:24:55 -0400 Received: by mail-pj1-x1029.google.com with SMTP id v4-20020a17090abb8400b001ef966652a3so5142449pjr.4 for ; Wed, 06 Jul 2022 01:24:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3fycTpR631CAyDn0p7xxlDZ9oFm740riIb23T+ghRkc=; b=GkfpssZ3zDqg3a2hEsIIUnMan3aEYwz0l+ZG8gYBuXNobkfxMOLo4SmeK92tLQ218i 1b6RLycoN5u/BryOhh7+vmbieDN/twcdUmyH3aWardqGV5vWm+XZ2nndcSeIh2Y+HZrW FopuesK7mJ8M6RebWkA66PTfgurKpfo+XG5TJ2AYxVeeYLI9kQNtQesZCXKrT4RjNS73 65QBswAvBob3eFpE6ce2L8mPbmdrLINcD5tUAYVpcYRbi3RX8UG8BsFG10H+AbYcYy61 rCE+pB9+BZ57t7QJTxAnYX3zOZTkTEWU8NqoYWkh+ttIkZTaPVvyo4Cihv6fREQtPSk5 7liA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3fycTpR631CAyDn0p7xxlDZ9oFm740riIb23T+ghRkc=; b=AKhCg3ONaJUN45zHBpaNIkQuE/sosWNrG8D/Adx2dUH15YRWDshW+vyUZ7GyHqzlFa RF4XYjpOKgFbIK4D53rp988r+g6klU0bh/t10zANT/I27jfbVuGu+NA+0ICQIZJx1qFM k8pwHQejjuNR3aQKtBa1i5BTey2cPd6sj4ixzezbqt8ap84KBZOA9GhmLdkNlyHOZ1OL kw/YBw1AwSlhVwT69O6hBGWRNxq06J3qvd6lHUiPWXOzdGA2mRKY/w0dGUXSB4uAV8Iu +3ZtY9JSmA76V/5Yes7jwPacQI3oK8QGwklJTrvAbZJkdisXC9x3oYFrjqI0Wq4e7wA6 /8sw== X-Gm-Message-State: AJIora+xClYguGcV2OKQ7tE+UgOYTF2VnV6bgBbVpEbi89vMfdVkcFU/ 3XCc8GUNIvLm1Ui1hreTbV+lDvZG5ZFUFMgi X-Received: by 2002:a17:90b:343:b0:1ef:b65d:f4d8 with SMTP id fh3-20020a17090b034300b001efb65df4d8mr1902757pjb.187.1657095889488; Wed, 06 Jul 2022 01:24:49 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id t17-20020a170902e85100b00162529828aesm25199256plg.109.2022.07.06.01.24.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jul 2022 01:24:49 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v5 13/45] target/arm: Mark LDFF1 and LDNF1 as non-streaming Date: Wed, 6 Jul 2022 13:53:39 +0530 Message-Id: <20220706082411.1664825-14-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220706082411.1664825-1-richard.henderson@linaro.org> References: <20220706082411.1664825-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1029; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1029.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" Mark these as a non-streaming instructions, which should trap if full a64 support is not enabled in streaming mode. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/sme-fa64.decode | 2 -- target/arm/translate-sve.c | 2 ++ 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/target/arm/sme-fa64.decode b/target/arm/sme-fa64.decode index 7d4c33fb5b..2b5432bf85 100644 --- a/target/arm/sme-fa64.decode +++ b/target/arm/sme-fa64.decode @@ -59,7 +59,5 @@ FAIL 0001 1110 0111 1110 0000 00-- ---- ---- # FJCVTZS # --11 1100 --1- ---- ---- ---- ---- --10 # Load/store FP register (register offset) # --11 1101 ---- ---- ---- ---- ---- ---- # Load/store FP register (scaled imm) -FAIL 1010 010- ---- ---- 011- ---- ---- ---- # SVE contiguous FF load (scalar+scalar) -FAIL 1010 010- ---1 ---- 101- ---- ---- ---- # SVE contiguous NF load (scalar+imm) FAIL 1010 010- -01- ---- 000- ---- ---- ---- # SVE load & replicate 32 bytes (scalar+scalar) FAIL 1010 010- -010 ---- 001- ---- ---- ---- # SVE load & replicate 32 bytes (scalar+imm) diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c index bbf3bf2119..5182ee4c06 100644 --- a/target/arm/translate-sve.c +++ b/target/arm/translate-sve.c @@ -4805,6 +4805,7 @@ static bool trans_LDFF1_zprr(DisasContext *s, arg_rprr_load *a) if (!dc_isar_feature(aa64_sve, s)) { return false; } + s->is_nonstreaming = true; if (sve_access_check(s)) { TCGv_i64 addr = new_tmp_a64(s); tcg_gen_shli_i64(addr, cpu_reg(s, a->rm), dtype_msz(a->dtype)); @@ -4906,6 +4907,7 @@ static bool trans_LDNF1_zpri(DisasContext *s, arg_rpri_load *a) if (!dc_isar_feature(aa64_sve, s)) { return false; } + s->is_nonstreaming = true; if (sve_access_check(s)) { int vsz = vec_full_reg_size(s); int elements = vsz >> dtype_esz[a->dtype]; From patchwork Wed Jul 6 08:23:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 587718 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1ec:0:0:0:0 with SMTP id 12csp2548026map; Wed, 6 Jul 2022 01:56:52 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uyLIaUvoNYl45OSp93FQbCV2PHsXFjrUO1JjwyzqigJ1+Jp7i0ltEw/cbIbhCTqLyTW1rN X-Received: by 2002:a05:620a:46aa:b0:6af:225e:5c7d with SMTP id bq42-20020a05620a46aa00b006af225e5c7dmr26609549qkb.621.1657097812217; Wed, 06 Jul 2022 01:56:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657097812; cv=none; d=google.com; s=arc-20160816; b=IzX7wlvQgoGqi8Wmto2YEVfRvhJkKetH17LxZjGKIpEtcrc6ti3cqYZSkkOdVmyPFG d1eiUiW/sUco2AGsSIsCZJChc9sprbMqc866c5i1WL5tBTfmwRJa64MF4NvXL+a6lMkv w/5wejkUZDThjbhcNUwzLwZ4dU+5a6wgm5Tfyp4qxnZm5ValGbTwaj0nobgpJHJrONR9 vtzbJwUQwSxolMODsuF4E1ENQE4G0t2rfd593CT90DZf6CkY0Eak7d/fYidyy+4Ef2Ps 8DvxLL1Z64nabYeZdK/W0EKW9Dt55dfrojFZNdLIx99xrdV5kGAABb1YpHirchXKunc7 KZMA== 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=Eedjnu3eOCixQFi7+Gzy6ksLbMXPKA3RAkF+Pv5QpfE=; b=YgA25tEjSeNMgKQ/gmo4ABEYf1mRxNNkrgNPuHwZ5+uFL9t1OOtYf36cJRUUNQ4qpE PJwbg7bDGn9xWrhLwIPdXHsXgSQZ4WWoVYv+Qugubm0dUOucq4/k6Y1JCXkTBk0kL696 tmWz5sfwesR+UtdxlSXwzYLY8s2vRTgEAj2zs5yvml0vDypg05+TvMb3X7E+t4sgm0iu u/J9EjrCKEMr8URqWEGtRp6BFNdHi+J+NpSrVzce2otBoPrX3DvFC4KpNzaGFp43JVxh FEiU2FTWya0vk6x5LTijrLNXMEefckVYB7eRGkLqJWxBoVRa4vAmfM27grloN/FTM+S4 Toxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=H01LvzvO; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id e13-20020ac84e4d000000b0031d33d46804si12865477qtw.504.2022.07.06.01.56.52 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Jul 2022 01:56:52 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=H01LvzvO; 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]:59960 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o90q3-0006mK-NL for patch@linaro.org; Wed, 06 Jul 2022 04:56:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49042) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o90LA-00060b-BP for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:24:56 -0400 Received: from mail-pj1-x102c.google.com ([2607:f8b0:4864:20::102c]:44558) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o90L6-0000Ii-Vo for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:24:55 -0400 Received: by mail-pj1-x102c.google.com with SMTP id o3-20020a17090a744300b001ef8f7f3dddso6604094pjk.3 for ; Wed, 06 Jul 2022 01:24:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Eedjnu3eOCixQFi7+Gzy6ksLbMXPKA3RAkF+Pv5QpfE=; b=H01LvzvOYZW3CFGR7dq3rf9nEaKtAXvhRucok/5cHA2o4e/5WHcn88277RBxXFdqEW yluoA5U7vF42pgTiJ/DMVwC2hn0h3IvMil1V2KKAEH3qnkQNhtvpPRw+eEyXelXbYcbr 4CDVh+6jWo0uT805IPW01Hg3EyUc8mIx6Mg1EnK5T5XWunbykkZnuZYa0b7iv/i2xYB+ sxQ03OFt4A8LYZ5LBzNq5IWgIJH8PZ05zGTO95c7PQoy95Ee75HEnzOYs9IZwbZkWNFN aJKYCiBynJX6c7DVh/2Eb4eQrzCasO4b8Tzn/qcBUV7Va36ZHWEm5KwzlxyZaHzq4dEa x7xg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Eedjnu3eOCixQFi7+Gzy6ksLbMXPKA3RAkF+Pv5QpfE=; b=zSrtVYEOSKaYNGwRccVGXWdE6B+W/iV5jXvhTOhaxuWw8NjxER5N6hUjxG1lZgOSgs S4Pz06T/fFrsf2SlwSC6siJMDf/S+z8lOT70V4VO+24SbGUxEaK6MzMlgTHF8eorvlo5 0uxQ9jwe+HnQUadO/b8/rz/4jS2FDFQ+iTJsGymh/zIUf3cjCIHreuxFliC+m8e0jErR S3Z4vPXUsMXe4oo8ua26XaDIoUsfzEqgC92klRQH7G77H81t7HjdPnVORYuikrhle1dY UVBq3taJPKzb6L9NLt0dvsDrMfJyNvwXYRSqrt3G6cIdTG37kRqq23usTf2XBFUocyvv P0Vw== X-Gm-Message-State: AJIora8G87oDJd+jVL6gGr9J7qQnCSnUTBcoB1cxH5CepvcMhWBQ6jSU hAmoyoVaaAQj+QQhVKNaSt5ThINnX8NIzDhM X-Received: by 2002:a17:90b:4ac9:b0:1ec:9bd1:92ff with SMTP id mh9-20020a17090b4ac900b001ec9bd192ffmr46198081pjb.178.1657095892266; Wed, 06 Jul 2022 01:24:52 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id t17-20020a170902e85100b00162529828aesm25199256plg.109.2022.07.06.01.24.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jul 2022 01:24:51 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v5 14/45] target/arm: Mark LD1RO as non-streaming Date: Wed, 6 Jul 2022 13:53:40 +0530 Message-Id: <20220706082411.1664825-15-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220706082411.1664825-1-richard.henderson@linaro.org> References: <20220706082411.1664825-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102c; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102c.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" Mark these as a non-streaming instructions, which should trap if full a64 support is not enabled in streaming mode. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/sme-fa64.decode | 3 --- target/arm/translate-sve.c | 2 ++ 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/target/arm/sme-fa64.decode b/target/arm/sme-fa64.decode index 2b5432bf85..47708ccc8d 100644 --- a/target/arm/sme-fa64.decode +++ b/target/arm/sme-fa64.decode @@ -58,6 +58,3 @@ FAIL 0001 1110 0111 1110 0000 00-- ---- ---- # FJCVTZS # --11 1100 --0- ---- ---- ---- ---- ---- # Load/store FP register (unscaled imm) # --11 1100 --1- ---- ---- ---- ---- --10 # Load/store FP register (register offset) # --11 1101 ---- ---- ---- ---- ---- ---- # Load/store FP register (scaled imm) - -FAIL 1010 010- -01- ---- 000- ---- ---- ---- # SVE load & replicate 32 bytes (scalar+scalar) -FAIL 1010 010- -010 ---- 001- ---- ---- ---- # SVE load & replicate 32 bytes (scalar+imm) diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c index 5182ee4c06..96e934c1ea 100644 --- a/target/arm/translate-sve.c +++ b/target/arm/translate-sve.c @@ -5062,6 +5062,7 @@ static bool trans_LD1RO_zprr(DisasContext *s, arg_rprr_load *a) if (a->rm == 31) { return false; } + s->is_nonstreaming = true; if (sve_access_check(s)) { TCGv_i64 addr = new_tmp_a64(s); tcg_gen_shli_i64(addr, cpu_reg(s, a->rm), dtype_msz(a->dtype)); @@ -5076,6 +5077,7 @@ static bool trans_LD1RO_zpri(DisasContext *s, arg_rpri_load *a) if (!dc_isar_feature(aa64_sve_f64mm, s)) { return false; } + s->is_nonstreaming = true; if (sve_access_check(s)) { TCGv_i64 addr = new_tmp_a64(s); tcg_gen_addi_i64(addr, cpu_reg_sp(s, a->rn), a->imm * 32); From patchwork Wed Jul 6 08:23:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 587719 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1ec:0:0:0:0 with SMTP id 12csp2549831map; Wed, 6 Jul 2022 01:59:46 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vpg29FBvcdW7t2bzBzQkCtb7+WRb9Y7pWOGB1CseYoajY0TCR1FfGSvuFSu6LDDkLVMTVW X-Received: by 2002:a81:6a85:0:b0:31c:8624:b065 with SMTP id f127-20020a816a85000000b0031c8624b065mr22732360ywc.64.1657097986294; Wed, 06 Jul 2022 01:59:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657097986; cv=none; d=google.com; s=arc-20160816; b=U/5paI/m5H9x9lDwtqxRtC4zOgqBYBoRCVNpFai4tbhNbag0F0+PjU6lsGM8m3Z5GS RmZ2oEvpvPlM/G5ByRi9Wl9X4qYcYNO3rpyEKHQbFdtmxKCcArcN7iX16CoEgB6w+puE LeZIRO9XXzwoqqCJs0oxeAA1Wm8MDbR/VEaFXReLV4zKN3n1/SpIG+lXcD6IY4ZDYxrM A52sNOZwmnA5A55L4pPqmE2IkvQWzav1lAIZUS5MANfuD2MN9bvq/kOZ62HNIRIBueCl /jBs8kKgc2PKKmD3xbdq/YBCq9InVk1e+BApox/z8oTpNbm40nnV0tKKVxGD0Rpfd4ic T1RQ== 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=PhJtFSrquOFUVO5QY9Q5zh4pNEWnYjCw2RgtobhuW2s=; b=keogXGeu8s0tLzlcZemh7xH8ByptsXGNA/epVHVfPt9vv8LMAOO7Uf38hNhgixE46r 65IJG0ftuT3GgNQ/YZycW9tEKq88K1POMgshMYLl6C/v+d1WE6H+LCQlvpHZvcprq1Jw q8Hpu69+p1oJS3N2apq9YOEbkuSnuCPFOvEIQtJnk/0+Io2a0OinX4Ucq9ZLxQ9y38cj fZIK8BxhusEj203UInAeb4dxPY3bnwxFbj0fE+NsLZveoUbrk7Y1bDulo9pBusDJkhsh oGAZ2sucsjv6N1h2QyDx1WlWqw8h2yjOMyWWvztXUChjlabD8o0s0uj3b8BnJ9NXrN2D sPWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="InQ1T/RN"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d66-20020a25e645000000b0066e2766ca27si13400557ybh.333.2022.07.06.01.59.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Jul 2022 01:59:46 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="InQ1T/RN"; 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]:37148 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o90sr-00022p-PZ for patch@linaro.org; Wed, 06 Jul 2022 04:59:45 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49136) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o90LD-00062H-4s for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:24:59 -0400 Received: from mail-pl1-x62f.google.com ([2607:f8b0:4864:20::62f]:40584) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o90LA-0000QJ-2z for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:24:58 -0400 Received: by mail-pl1-x62f.google.com with SMTP id b2so13044366plx.7 for ; Wed, 06 Jul 2022 01:24:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=PhJtFSrquOFUVO5QY9Q5zh4pNEWnYjCw2RgtobhuW2s=; b=InQ1T/RN1FSGUZR4yPyN5eUxjgUYpEgJKgM976T5+xv9fYn4hymprDs91Rz1TJG+hu pGHv+c3mxCZGAC2oatBgahx1E7oKmgl6q6ffJwEovF9S+2RwlwkMGSX5p+6LhXPraTLq nnLLiRbStcxD2dDm3xj+ah/uqjwGJYtUtJ8Zkn8OERwpLuJ1PXI3t4oc0a5HTGStSa3B BsRvD4MQwI74KX84zgDi/UEfrR4SqCpky2v8MiFfLAlht+6OQMpZmSSufzm5WncIIqth ewitVKSO2pb1pZWQCu1xlaCW2CnNcCXifWNTJzk7aLLr8MNHRs/Y8IBhNhizkjxmdKPG I3OA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=PhJtFSrquOFUVO5QY9Q5zh4pNEWnYjCw2RgtobhuW2s=; b=Sriurc1m9h0YvPTncYIsANh0yC61ofsPHkZk0sA1tVf5yjSieVJ1watp7ShlT+WqOj 4ezJ1ouAPLz3fRc9z5RHId0CY/SoE0P9uNyZz3s7OkNEGs/oAAHHOWxIINOxPK9Veog0 /rKqCuAs8JvcJSu7A0LqLyh4qR/sV86DvTS7TJjgxvZFmKjJN1dMMMwShWbO0XjbS9Hk emNobpFmv6aveOBm+5FQA8xyLSg4r0BNJfiv21WbrISUHO/oqCsvsCiqIE9T7d/BVRK0 aOxK0qF8JPfcSTRTta+H64xYguIedNOLy6piKzpA8OLkKQ5gOkSum3iCYMz7xe8dW+QD 3XWQ== X-Gm-Message-State: AJIora+vD2mEl12JKofeCf3GxRm59VUN10KPP0xOk1MBbh1MvMkpSKQK qMS8Z5qOTmtiXIcpvRLzz9adTQn9wnOgwsmj X-Received: by 2002:a17:90b:17c6:b0:1ec:dcc8:370a with SMTP id me6-20020a17090b17c600b001ecdcc8370amr48274934pjb.63.1657095894672; Wed, 06 Jul 2022 01:24:54 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id t17-20020a170902e85100b00162529828aesm25199256plg.109.2022.07.06.01.24.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jul 2022 01:24:54 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v5 15/45] target/arm: Add SME enablement checks Date: Wed, 6 Jul 2022 13:53:41 +0530 Message-Id: <20220706082411.1664825-16-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220706082411.1664825-1-richard.henderson@linaro.org> References: <20220706082411.1664825-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62f; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62f.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" These functions will be used to verify that the cpu is in the correct state for a given instruction. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/translate-a64.h | 21 +++++++++++++++++++++ target/arm/translate-a64.c | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+) diff --git a/target/arm/translate-a64.h b/target/arm/translate-a64.h index 789b6e8e78..02fb95e019 100644 --- a/target/arm/translate-a64.h +++ b/target/arm/translate-a64.h @@ -29,6 +29,27 @@ void write_fp_dreg(DisasContext *s, int reg, TCGv_i64 v); bool logic_imm_decode_wmask(uint64_t *result, unsigned int immn, unsigned int imms, unsigned int immr); bool sve_access_check(DisasContext *s); +bool sme_enabled_check(DisasContext *s); +bool sme_enabled_check_with_svcr(DisasContext *s, unsigned); + +/* This function corresponds to CheckStreamingSVEEnabled. */ +static inline bool sme_sm_enabled_check(DisasContext *s) +{ + return sme_enabled_check_with_svcr(s, R_SVCR_SM_MASK); +} + +/* This function corresponds to CheckSMEAndZAEnabled. */ +static inline bool sme_za_enabled_check(DisasContext *s) +{ + return sme_enabled_check_with_svcr(s, R_SVCR_ZA_MASK); +} + +/* Note that this function corresponds to CheckStreamingSVEAndZAEnabled. */ +static inline bool sme_smza_enabled_check(DisasContext *s) +{ + return sme_enabled_check_with_svcr(s, R_SVCR_SM_MASK | R_SVCR_ZA_MASK); +} + TCGv_i64 clean_data_tbi(DisasContext *s, TCGv_i64 addr); TCGv_i64 gen_mte_check1(DisasContext *s, TCGv_i64 addr, bool is_write, bool tag_checked, int log2_size); diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index 7fab7f64f8..b16d81bf19 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -1216,6 +1216,40 @@ static bool sme_access_check(DisasContext *s) return true; } +/* This function corresponds to CheckSMEEnabled. */ +bool sme_enabled_check(DisasContext *s) +{ + /* + * Note that unlike sve_excp_el, we have not constrained sme_excp_el + * to be zero when fp_excp_el has priority. This is because we need + * sme_excp_el by itself for cpregs access checks. + */ + if (!s->fp_excp_el || s->sme_excp_el < s->fp_excp_el) { + s->fp_access_checked = true; + return sme_access_check(s); + } + return fp_access_check_only(s); +} + +/* Common subroutine for CheckSMEAnd*Enabled. */ +bool sme_enabled_check_with_svcr(DisasContext *s, unsigned req) +{ + if (!sme_enabled_check(s)) { + return false; + } + if (FIELD_EX64(req, SVCR, SM) && !s->pstate_sm) { + gen_exception_insn(s, s->pc_curr, EXCP_UDEF, + syn_smetrap(SME_ET_NotStreaming, false)); + return false; + } + if (FIELD_EX64(req, SVCR, ZA) && !s->pstate_za) { + gen_exception_insn(s, s->pc_curr, EXCP_UDEF, + syn_smetrap(SME_ET_InactiveZA, false)); + return false; + } + return true; +} + /* * This utility function is for doing register extension with an * optional shift. You will likely want to pass a temporary for the From patchwork Wed Jul 6 08:23:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 587725 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1ec:0:0:0:0 with SMTP id 12csp2556520map; Wed, 6 Jul 2022 02:08:07 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vlWI05XL5tsvGyWyS16WNrP/g8zlwFIfbhQ156iD5A8IEG5VONWTXmR089PwI1YFFJZlWX X-Received: by 2002:a05:620a:2a0e:b0:6b4:68a0:39fe with SMTP id o14-20020a05620a2a0e00b006b468a039femr8884307qkp.3.1657098487174; Wed, 06 Jul 2022 02:08:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657098487; cv=none; d=google.com; s=arc-20160816; b=Uw/zjm7sLPnwzkfkmu4IObYYVtofT9pxQtojkeC+sZiGDMRYz3IoPyXfHqF8EajCOk forhIhl2giqvWkJueddWMACAU+fmbRkFaWvNLtoCIK1cFe3jD1GdBzPZLjPaJTR6LQjA nEEEmMGy+PXuhTEu5OiVpmAO0E4a6FnBMbQNOpvovmbO9wDD0+CZH41qw36+kF1OKsfC 2XpI3h9J1zHQgCna7G79xHpyqK/HrYL9NRMzY88TbqX5DEJaJxEVOfSZHDU8X02Dbngu 7Vhfkm0dGUC+ZaWFC8zzwe9JngQrCJnjndYLbWf3g7cqO1ltGEnpzc0/sakt1GBwXHCm HRVg== 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=0yTWCJ1DktZzYQTXntYaiEXNGmdccKtN6uvynpzt0IU=; b=XWXHzJVNxaFbLzlqWmu6f1PQRf+5GohE03L6wJt+sCy8C6FTzgRuZ39UM0svdsz7T6 +elD1EmRAqYRtert45YUAC25WHyCVAHZUN/WyNJEE1GApF29vvES7tt99Vtu0wlQS6fG 8E3UC2TO7VPMN/Fh1EBRFNxWy0nYe7BNijGEG4eIIj6v1p2neoCahpPbZBAZh49gyJ4n TxdBnEu59Ff71TNNS7GSMLPUNaYycz0FZHvkF5pF834wk6SJl0nUDrzYYOeuwruy+Arg bjU/ASqKGYhCS0fkW1EWA4o05IQNtuZupHZWDarDufBrzqqWaBv1rmYYYVNfaxx7chrN 97lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="sj63h/zR"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id l16-20020a05620a28d000b006b23b8e723bsi12703093qkp.11.2022.07.06.02.08.07 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Jul 2022 02:08:07 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="sj63h/zR"; 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]:49960 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o910w-0002Jf-Oq for patch@linaro.org; Wed, 06 Jul 2022 05:08:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49174) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o90LE-00065w-CQ for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:25:00 -0400 Received: from mail-pl1-x629.google.com ([2607:f8b0:4864:20::629]:39762) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o90LC-0000RE-My for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:25:00 -0400 Received: by mail-pl1-x629.google.com with SMTP id c13so9307847pla.6 for ; Wed, 06 Jul 2022 01:24:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=0yTWCJ1DktZzYQTXntYaiEXNGmdccKtN6uvynpzt0IU=; b=sj63h/zRkWhQLZV9P/R0rqi1ghEtjEY97oRVCuNVCOoUkDgvv6Umtn4sgBwnuniBCV +u6unh0OcSM9qLEbGSOm/Df8tB6EM8EI0YkoUKcJmm5sShEVf5/m/pTvITRX4AVTVqzk 9KntLE76vW2qjze8Z9KOaKBD1eqMc7udqZ50K0SMWZFdQtonZFEvrtFar9ddOibSIuRb uSKYrs+8swPcUrwkbItQaBhR9Yj3FelLDyh7RmRlsei4jdnt4idTTLt1zs6DYY9d/anX KBoaiBeXy110uTqbcjIlING7IhCb2od+rPM4qC+lTMhCazyN+/GXgr0haEW8ANzMn0/m TewA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0yTWCJ1DktZzYQTXntYaiEXNGmdccKtN6uvynpzt0IU=; b=6MI3QzXmu2NH6B2jgTEfMyqAIqwGPpdFc5NVYDfl2Bi6BIpjBqnCSR798q7iJQ0How IEav70op2OCqe1a3ayFrALL5N7IWJJR2NLQxtutEPzWq4+2ZnEXGKDBJTwfwYEkqlb9m xzOW8ZLepTk580GI+e4lukWVNjlHTbHLzT5Ya64HONynwabRolgH2uWdMcy2gWma1NMW uHnSOZMPVtS5z7uElQG0Qtov4DFNofrInRefKFuC8M80LD3eipA3s9k69oTUz53OHmeL hh4/fSLA1Ss7AzINVnpFZyBDD4ROjqCtvq9Rbwj0KZog+hTCmF6yCzK1R/VUgD7pNhCd EsOw== X-Gm-Message-State: AJIora+8GK3ICoiZ3gPdyEucAZu2YSFvNc41GiDL/6lgdvpiC4HRKmpO 89Iv1u5fFKe/wfdHFMlBqlLrkqnQqiW//wGK X-Received: by 2002:a17:90b:390d:b0:1ed:3058:45e5 with SMTP id ob13-20020a17090b390d00b001ed305845e5mr46625701pjb.141.1657095896980; Wed, 06 Jul 2022 01:24:56 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id t17-20020a170902e85100b00162529828aesm25199256plg.109.2022.07.06.01.24.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jul 2022 01:24:56 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v5 16/45] target/arm: Handle SME in sve_access_check Date: Wed, 6 Jul 2022 13:53:42 +0530 Message-Id: <20220706082411.1664825-17-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220706082411.1664825-1-richard.henderson@linaro.org> References: <20220706082411.1664825-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::629; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x629.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" The pseudocode for CheckSVEEnabled gains a check for Streaming SVE mode, and for SME present but SVE absent. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/translate-a64.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/target/arm/translate-a64.c b/target/arm/translate-a64.c index b16d81bf19..b7b64f7358 100644 --- a/target/arm/translate-a64.c +++ b/target/arm/translate-a64.c @@ -1183,21 +1183,31 @@ static bool fp_access_check(DisasContext *s) return true; } -/* Check that SVE access is enabled. If it is, return true. +/* + * Check that SVE access is enabled. If it is, return true. * If not, emit code to generate an appropriate exception and return false. + * This function corresponds to CheckSVEEnabled(). */ bool sve_access_check(DisasContext *s) { - if (s->sve_excp_el) { - assert(!s->sve_access_checked); - s->sve_access_checked = true; - + if (s->pstate_sm || !dc_isar_feature(aa64_sve, s)) { + assert(dc_isar_feature(aa64_sme, s)); + if (!sme_sm_enabled_check(s)) { + goto fail_exit; + } + } else if (s->sve_excp_el) { gen_exception_insn_el(s, s->pc_curr, EXCP_UDEF, syn_sve_access_trap(), s->sve_excp_el); - return false; + goto fail_exit; } s->sve_access_checked = true; return fp_access_check(s); + + fail_exit: + /* Assert that we only raise one exception per instruction. */ + assert(!s->sve_access_checked); + s->sve_access_checked = true; + return false; } /* From patchwork Wed Jul 6 08:23:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 587727 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1ec:0:0:0:0 with SMTP id 12csp2558318map; Wed, 6 Jul 2022 02:10:40 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sS+tyQX4DtvPdgRQZ51dBIAzBr55fqJv0jEta8dRs5yU1aoilSIdhJNegOqjmKk/JLskfw X-Received: by 2002:a05:622a:4b:b0:31a:17ce:eebd with SMTP id y11-20020a05622a004b00b0031a17ceeebdmr32287619qtw.621.1657098640727; Wed, 06 Jul 2022 02:10:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657098640; cv=none; d=google.com; s=arc-20160816; b=aJyBeQ0/YhUFI7Z+0r8P5Akjp5jlvkEmn3ykclGQ828TJA7xGRbLZ3Gi9dxlJYc94q bXz4MK+VStnVWsNUGRmKRaWpuISnfJPp37ZRdKNgRElXU8IOXzFRjyEQmvtRaQHFL/H7 6PDCXEu5z2R7yDYN40qD8jo/QKw7HgxZY35yFxzFMu9jH3HHRDfbh1UxnG8M/V8AlT1E 12TEB0U0Mlzvb/x2qckDcI2Tws3hdBuPpNePor3R5D0ape8Vw3r9Z4bAyjBhJnQuJC2c igDmygSPhCsPSB5gP8DL9JwnMsh91YNJVDaOrr3ttKQP+PvNKQn503oNOP1stR930f6d 0TSA== 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=KwsMd3cs1kMRtBrVlO0pZElFPRsZqBMQRBB6JbUzQes=; b=sC8DDun+K3UUq25lvocWewtidgLqJuwkP6X4Zii5gakOwvqVLMM/cJ1seJHL+DUN7d 0Tb6XE9rSvoA8StJuMs7Q0AiUiibiyU2p4SMOlC6sXCeZCnZMaanEvngnA0bqBPRvAYE ugtHcvl7Bv1NI9crtI8oNNhRpbReSkMLMODLbbf/WVj6o9GzBNRm9uuwnbd4t1d0orxD 06VHwgkKGKgWa/rS22lIfB2NWF0omuzDFQUf+2JEEM1s42ywjmRaccgx5tOZwFmMvIGZ HSqZhr/xO/+i9yU6oDtPt/NbOQo2b4e70MUAHGRRme8Kd0jKg7z1gz/JQ/Npex78viOt PzXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="iawU5/78"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ay32-20020a05622a22a000b0031d36f7ed04si8135050qtb.528.2022.07.06.02.10.40 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Jul 2022 02:10:40 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="iawU5/78"; 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]:57636 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o913Q-0007cg-6n for patch@linaro.org; Wed, 06 Jul 2022 05:10:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49218) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o90LG-0006Af-CH for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:25:05 -0400 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]:33290) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o90LE-0000Mi-O1 for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:25:02 -0400 Received: by mail-pl1-x632.google.com with SMTP id n10so13097341plp.0 for ; Wed, 06 Jul 2022 01:25:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=KwsMd3cs1kMRtBrVlO0pZElFPRsZqBMQRBB6JbUzQes=; b=iawU5/781n0h5P5w3Yci6+x3JiCI3jh+kUDROHXJOtZvmUGroIVHe/efdLxuYyq+sD 3k8Xg2biWNQNDy8r80Nn0dP80nHlV141tdkiE2/oQOWBLY3fpVvIvjYyIyPqa0TpXx2/ L+aqzkO868m1895MZ2qcETVVQ6Vvq1Ii7vUyafqkap/LQ8vlVdBcoNV/wTJmz6iDDUxt 51eldjHyC9l8NkMOfaKujKKs1xEq71WQfhcoY4+BZQw152wbLNk+QbtNJ2/Np8MMsm2v t4oJ1dPvfgouGnpbCIbNtJ56YQ5ThPHQd9YOWIQKzFrDKQH5PWuUR8HzAskz+ZxkegHO i5ZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=KwsMd3cs1kMRtBrVlO0pZElFPRsZqBMQRBB6JbUzQes=; b=p5yIx9s2yEk+uuo8wbM9UWOEXVCFnhnSKLMkrF9eTolAjxgynUlSDxDz0HaG4R6WAP JF3YV4bPqa1PfRw0A290iFnYoPNENHyrjPWVDKNkfACg80Nvri3uPXLtMRJR8Fwzhbqz AsfLVGYlqg9FQSKCTJS53IkeAheJcRwXO5mBc2k1hG2q35yn4x+vKtdQyenXbUYLLRfS awpuHvVcCbsyoa3MzDH10xi22Iekv/jM+TKkgodADdsH9p5z1Z6iRZjdQDPctapIXU2U pc8FTql11BE1crqwshD5r8FKokyZGTGtvJKolh/nA1ZSRvzs4YoSHXvqDzNEjs0+YoYc nCMA== X-Gm-Message-State: AJIora9jrUwVS2+pdOl5ps5iXbgJwi5jEljeBFfm8G2hcIrL/T/1er8v RFBp0Tc5ACYWfyitkrB4gMbRwL5dsfU9DXCa X-Received: by 2002:a17:90b:1b07:b0:1ec:c617:a314 with SMTP id nu7-20020a17090b1b0700b001ecc617a314mr45944585pjb.214.1657095899881; Wed, 06 Jul 2022 01:24:59 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id t17-20020a170902e85100b00162529828aesm25199256plg.109.2022.07.06.01.24.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jul 2022 01:24:59 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v5 17/45] target/arm: Implement SME RDSVL, ADDSVL, ADDSPL Date: Wed, 6 Jul 2022 13:53:43 +0530 Message-Id: <20220706082411.1664825-18-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220706082411.1664825-1-richard.henderson@linaro.org> References: <20220706082411.1664825-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=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" These SME instructions are nominally within the SVE decode space, so we add them to sve.decode and translate-sve.c. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- v4: Add streaming_{vec,pred}_reg_size. --- target/arm/translate-a64.h | 12 ++++++++++++ target/arm/sve.decode | 5 ++++- target/arm/translate-sve.c | 38 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 54 insertions(+), 1 deletion(-) diff --git a/target/arm/translate-a64.h b/target/arm/translate-a64.h index 02fb95e019..099d3d11d6 100644 --- a/target/arm/translate-a64.h +++ b/target/arm/translate-a64.h @@ -128,6 +128,12 @@ static inline int vec_full_reg_size(DisasContext *s) return s->vl; } +/* Return the byte size of the vector register, SVL / 8. */ +static inline int streaming_vec_reg_size(DisasContext *s) +{ + return s->svl; +} + /* * Return the offset info CPUARMState of the predicate vector register Pn. * Note for this purpose, FFR is P16. @@ -143,6 +149,12 @@ static inline int pred_full_reg_size(DisasContext *s) return s->vl >> 3; } +/* Return the byte size of the predicate register, SVL / 64. */ +static inline int streaming_pred_reg_size(DisasContext *s) +{ + return s->svl >> 3; +} + /* * Round up the size of a register to a size allowed by * the tcg vector infrastructure. Any operation which uses this diff --git a/target/arm/sve.decode b/target/arm/sve.decode index 908643d7d9..95af08c139 100644 --- a/target/arm/sve.decode +++ b/target/arm/sve.decode @@ -449,14 +449,17 @@ INDEX_ri 00000100 esz:2 1 imm:s5 010001 rn:5 rd:5 # SVE index generation (register start, register increment) INDEX_rr 00000100 .. 1 ..... 010011 ..... ..... @rd_rn_rm -### SVE Stack Allocation Group +### SVE / Streaming SVE Stack Allocation Group # SVE stack frame adjustment ADDVL 00000100 001 ..... 01010 ...... ..... @rd_rn_i6 +ADDSVL 00000100 001 ..... 01011 ...... ..... @rd_rn_i6 ADDPL 00000100 011 ..... 01010 ...... ..... @rd_rn_i6 +ADDSPL 00000100 011 ..... 01011 ...... ..... @rd_rn_i6 # SVE stack frame size RDVL 00000100 101 11111 01010 imm:s6 rd:5 +RDSVL 00000100 101 11111 01011 imm:s6 rd:5 ### SVE Bitwise Shift - Unpredicated Group diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c index 96e934c1ea..95016e49e9 100644 --- a/target/arm/translate-sve.c +++ b/target/arm/translate-sve.c @@ -1286,6 +1286,19 @@ static bool trans_ADDVL(DisasContext *s, arg_ADDVL *a) return true; } +static bool trans_ADDSVL(DisasContext *s, arg_ADDSVL *a) +{ + if (!dc_isar_feature(aa64_sme, s)) { + return false; + } + if (sme_enabled_check(s)) { + TCGv_i64 rd = cpu_reg_sp(s, a->rd); + TCGv_i64 rn = cpu_reg_sp(s, a->rn); + tcg_gen_addi_i64(rd, rn, a->imm * streaming_vec_reg_size(s)); + } + return true; +} + static bool trans_ADDPL(DisasContext *s, arg_ADDPL *a) { if (!dc_isar_feature(aa64_sve, s)) { @@ -1299,6 +1312,19 @@ static bool trans_ADDPL(DisasContext *s, arg_ADDPL *a) return true; } +static bool trans_ADDSPL(DisasContext *s, arg_ADDSPL *a) +{ + if (!dc_isar_feature(aa64_sme, s)) { + return false; + } + if (sme_enabled_check(s)) { + TCGv_i64 rd = cpu_reg_sp(s, a->rd); + TCGv_i64 rn = cpu_reg_sp(s, a->rn); + tcg_gen_addi_i64(rd, rn, a->imm * streaming_pred_reg_size(s)); + } + return true; +} + static bool trans_RDVL(DisasContext *s, arg_RDVL *a) { if (!dc_isar_feature(aa64_sve, s)) { @@ -1311,6 +1337,18 @@ static bool trans_RDVL(DisasContext *s, arg_RDVL *a) return true; } +static bool trans_RDSVL(DisasContext *s, arg_RDSVL *a) +{ + if (!dc_isar_feature(aa64_sme, s)) { + return false; + } + if (sme_enabled_check(s)) { + TCGv_i64 reg = cpu_reg(s, a->rd); + tcg_gen_movi_i64(reg, a->imm * streaming_vec_reg_size(s)); + } + return true; +} + /* *** SVE Compute Vector Address Group */ From patchwork Wed Jul 6 08:23:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 587726 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1ec:0:0:0:0 with SMTP id 12csp2556672map; Wed, 6 Jul 2022 02:08:17 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sMQNLnBBykk885vO9TjMsKh83jQPX/yoIsi8XE3g2MeVmOz+s52qJyXE5BhCpIy/5YUi48 X-Received: by 2002:ad4:596f:0:b0:472:bd40:9a5c with SMTP id eq15-20020ad4596f000000b00472bd409a5cmr24915896qvb.129.1657098497398; Wed, 06 Jul 2022 02:08:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657098497; cv=none; d=google.com; s=arc-20160816; b=YXbFAxpfyywNX0CI+tseJ+59T3n4rY3wNd5PN4mBAndj+x22IgQJi8pdJl7PTUHmDH 5zyHUTlMmj/3eq7qbgSVayAw0yZio4lVBwzg8Vn4OwZcrA84D7X0jQxAB8p2L753tMFw Vi8KmmPitqJjLfeuiHHAyPN6cHuiIjsNOOYSjwOW5WY6mgpOPFtyQtAOcjwtB1BaIkZg aCjIOHTsH3IOwc/wz3Cp9Sjz9Q+AFi8dVshIJSqQODjobh7hk9S7NOJsGf+VMYgzCz0q MuZLqZkOhTqx5gUWzm1ndmgqSn6zgganCjwCuS4+NcqDrnH7wO6AZAPrMMZ0YRizlmd3 IhCA== 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=8q6UgHZNxgLAwjYyD3emx4pnHnGEMm3xg5CqdRKZ5yA=; b=J4MeMa00yiJJCI/U7YWiDt1lYcJOuJe3H+OhEOfvSIDExBgVUEQUiTdetU9rcs4pHU 4k6nc49NDF2vm6cAc5Q+2fw/hcbKA7EGR37xWvErWTFcK+e14ae//6lyNytWMCReQjQo rycKa93r8XYCK1BYM2kG7vmmeokeitMBg22taCE46aP/vFCp1IVKjzFJ87Zau08wZ3iT jDprpuB1UT5KEWduYMWWx+h/+i2a7g/7PQmx2qoLCeE2wQwpR6aYhUATTM6VBvC2b+G1 P3NcmoJpbmmkLRh6rdcpVmg85BC8Lh2VevzoJdg00JMAAzEAeW33YuI0QM1GAS9DzzQh hrNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NuXoMnXn; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id q9-20020a05621419e900b0046aedb726c2si5113541qvc.272.2022.07.06.02.08.17 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Jul 2022 02:08:17 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=NuXoMnXn; 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]:50798 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o9116-0002zX-Vj for patch@linaro.org; Wed, 06 Jul 2022 05:08:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49350) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o90LP-0006Jh-KT for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:25:11 -0400 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]:41603) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o90LI-0000b7-Sa for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:25:11 -0400 Received: by mail-pj1-x102e.google.com with SMTP id o31-20020a17090a0a2200b001ef7bd037bbso9762902pjo.0 for ; Wed, 06 Jul 2022 01:25:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8q6UgHZNxgLAwjYyD3emx4pnHnGEMm3xg5CqdRKZ5yA=; b=NuXoMnXnfDmcOUZGSDzlpkHavqVKjx+UMW6mQRx7rkCl+/D6pwSBAdxqWFL95y3nNe OLizIG56JLeziIkqo8ANNaW5NfP4CBFH0KB9xd0aRwDS9MtxTzj6C6vd4fprcCYhuqCv MH/iL/wASq5iKXFAluXnmYH1Y9KIkgKG1leoWVUpkhMBuZcAUC48DPqjGu8honUMD7Fq 19iPFzaYFjUB+690Tl/gtPp7poIXQ8cQYoqpv26/TdGT7mIHqSKNVh6kqsOfUm9cJQLt 3ZPTwZK1stc/kIu/G0LJ+U1/2nj3wq7VbBx4KmAS+kz9P09jRl8EO43T9GI1uiC37Z4T Pqgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=8q6UgHZNxgLAwjYyD3emx4pnHnGEMm3xg5CqdRKZ5yA=; b=zHV3nOGwLrG0j7jOIuL4J055ZmdIP75ZZrb48ME3XZHDsc3QocdD9+i3Xev7usW8Iu MSiq45Nv8UzMvjlFgZCzqAO3gHHvNtj1B3m7YCGZIL80NgFzu15k4H+w+DgAeT6eSf8U eHDsL7bNlKbUGea5tStkSsqEAp0k99gTytFQWnDW6llCih4BGbQ4K67DkjBadCr6WS8Q orkruAImmlz0oXATDIDZU8UH0F2kMCF1sk5M3yOnR2zsMzAmZQJN6AAcIpF+RuxLS63c 42KFplAQ4/dAWZXzhAVoeXvI4BB/ZfcZO3XwR9RrSa9o3JL76EVDurzcYr9Sskk7kz70 ONKA== X-Gm-Message-State: AJIora+kMYx+YfZUBuEgDVg7MD2NzaefqUuyE6rVpMgd6BL+wvuJgxia kWbYWCjjShp2nQBCqTkZ+I9irjM3gD8zqo3v X-Received: by 2002:a17:90a:ca89:b0:1ef:7de9:ac45 with SMTP id y9-20020a17090aca8900b001ef7de9ac45mr23548856pjt.59.1657095902990; Wed, 06 Jul 2022 01:25:02 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id t17-20020a170902e85100b00162529828aesm25199256plg.109.2022.07.06.01.25.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jul 2022 01:25:02 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v5 18/45] target/arm: Implement SME ZERO Date: Wed, 6 Jul 2022 13:53:44 +0530 Message-Id: <20220706082411.1664825-19-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220706082411.1664825-1-richard.henderson@linaro.org> References: <20220706082411.1664825-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102e; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102e.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" Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- v4: Fix ZA[] comment in helper_sme_zero. --- target/arm/helper-sme.h | 2 ++ target/arm/sme.decode | 4 ++++ target/arm/sme_helper.c | 25 +++++++++++++++++++++++++ target/arm/translate-sme.c | 13 +++++++++++++ 4 files changed, 44 insertions(+) diff --git a/target/arm/helper-sme.h b/target/arm/helper-sme.h index 3bd48c235f..c4ee1f09e4 100644 --- a/target/arm/helper-sme.h +++ b/target/arm/helper-sme.h @@ -19,3 +19,5 @@ DEF_HELPER_FLAGS_2(set_pstate_sm, TCG_CALL_NO_RWG, void, env, i32) DEF_HELPER_FLAGS_2(set_pstate_za, TCG_CALL_NO_RWG, void, env, i32) + +DEF_HELPER_FLAGS_3(sme_zero, TCG_CALL_NO_RWG, void, env, i32, i32) diff --git a/target/arm/sme.decode b/target/arm/sme.decode index c25c031a71..6e4483fdce 100644 --- a/target/arm/sme.decode +++ b/target/arm/sme.decode @@ -18,3 +18,7 @@ # # This file is processed by scripts/decodetree.py # + +### SME Misc + +ZERO 11000000 00 001 00000000000 imm:8 diff --git a/target/arm/sme_helper.c b/target/arm/sme_helper.c index b215725594..eef2df73e1 100644 --- a/target/arm/sme_helper.c +++ b/target/arm/sme_helper.c @@ -59,3 +59,28 @@ void helper_set_pstate_za(CPUARMState *env, uint32_t i) memset(env->zarray, 0, sizeof(env->zarray)); } } + +void helper_sme_zero(CPUARMState *env, uint32_t imm, uint32_t svl) +{ + uint32_t i; + + /* + * Special case clearing the entire ZA space. + * This falls into the CONSTRAINED UNPREDICTABLE zeroing of any + * parts of the ZA storage outside of SVL. + */ + if (imm == 0xff) { + memset(env->zarray, 0, sizeof(env->zarray)); + return; + } + + /* + * Recall that ZAnH.D[m] is spread across ZA[n+8*m], + * so each row is discontiguous within ZA[]. + */ + for (i = 0; i < svl; i++) { + if (imm & (1 << (i % 8))) { + memset(&env->zarray[i], 0, svl); + } + } +} diff --git a/target/arm/translate-sme.c b/target/arm/translate-sme.c index 786c93fb2d..971504559b 100644 --- a/target/arm/translate-sme.c +++ b/target/arm/translate-sme.c @@ -33,3 +33,16 @@ */ #include "decode-sme.c.inc" + + +static bool trans_ZERO(DisasContext *s, arg_ZERO *a) +{ + if (!dc_isar_feature(aa64_sme, s)) { + return false; + } + if (sme_za_enabled_check(s)) { + gen_helper_sme_zero(cpu_env, tcg_constant_i32(a->imm), + tcg_constant_i32(streaming_vec_reg_size(s))); + } + return true; +} From patchwork Wed Jul 6 08:23:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 587731 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1ec:0:0:0:0 with SMTP id 12csp2563642map; Wed, 6 Jul 2022 02:18:34 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vMmQ/iEOTapSwKy1rwSaW9jWgAPid0bPClwofVBiKSAgPsc9S03Ykjg0ezasw2v47s0zxz X-Received: by 2002:a81:315:0:b0:317:6789:a0c1 with SMTP id 21-20020a810315000000b003176789a0c1mr47291515ywd.378.1657099114009; Wed, 06 Jul 2022 02:18:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657099114; cv=none; d=google.com; s=arc-20160816; b=QHSFCtwE9nWsMemGoQBPRnDRpOLoflekSqVkfU/U/pt6jvAU+VBEWpIMhk6TDs4YKD wqn1EtKlYQwSsayPsiE4s/UVmY0yz+O8pdhdmoE877ps3OkqpR5Zc6aMAivFEX58wWAu tD2FLJUjv1eV4rFCFtLjUc1+uX5rDqxxx6e7U1jUU7qBudm+vYAmOvFJ6CWHmatU+M51 1x7UFm7caTyOJlx4qlUW+KjN7o7SHBr6SEBdy59njNTA5NnSyg5PmQEzfAFdJROCuqIP /S6/UZlJiNWYgzpSMzYinsHa0MI3A1rCL1o6Qq6oWnlHdxxqc5ENaqE4O2XrfF0V0Cbg ktDQ== 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=qNmYkPxo7+Ne8/Zu121DMhpn3Zo6a48O3UL1W/tddSQ=; b=y3cx94ncZOLIm0ivXBjPENWsM89/UbzkL9C3NChN0ipc7zSzp2Ns0ya4wV7XNlqCmb K7U2LWXhQh/L8UMcc0K+QUiDPtuBYTHwe6NnyJHqp2PgVzpI56RRV4sLWHwK7G/F58++ rybQKM0p+0LeWr7Ezmt4Rxy4TD+aNjmoWuj/Ad2br9sC0UXTo8JILb4XMmzaGE8zIR4j xGQyRLyyqr9S68uM81+iHhbYSLwzlyh+USm8KLRzYq7fEtN7MQ7ltYyRorl/9UJ3V6nG dNJg1Kw3nlUk2+U2409XY7xG2Xo2VmlIiSD7v8XRRrpLJ/IYswPX52mkdZR/bRvBH8EB qsHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mtTh2qLA; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id a64-20020a251a43000000b0066e1c225721si20975875yba.289.2022.07.06.02.18.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Jul 2022 02:18:33 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mtTh2qLA; 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]:46594 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o91B3-0002Zl-Cc for patch@linaro.org; Wed, 06 Jul 2022 05:18:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49340) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o90LP-0006Jg-8m for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:25:11 -0400 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]:40592) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o90LL-0000dh-Tm for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:25:11 -0400 Received: by mail-pf1-x433.google.com with SMTP id y141so13724702pfb.7 for ; Wed, 06 Jul 2022 01:25:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qNmYkPxo7+Ne8/Zu121DMhpn3Zo6a48O3UL1W/tddSQ=; b=mtTh2qLANDSAT/WefHo3U65GmahptyqRZc0ePscOIHlE5pjFkXMam6fXuqj5aWv0RB ZnZs4W0phbMLpaoZpfswwpCFXY3HGzJEkPUBbzgmmNsbjprziSYfKBolrq1oLnDxPKQp S5CNxW/XS2kNlu8SGr3e/pN/YPSeucZkbM1zljWVCGbTu3y6+QKmZ6YZpEKnEdi81wcC R/qHIxFvC7LKKb5qCZh3FQ3BcruXIePdtiTPcjVHeUo6IMtb89zRnRDbD7IIUYr6UR/l 07ClH+9PXDV6ZNER1OAa6IgmHxOJk4YVR/1iJeYK5B3pPf+oG/9iXDkvJ6pGFk97MeGP iyyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qNmYkPxo7+Ne8/Zu121DMhpn3Zo6a48O3UL1W/tddSQ=; b=SEhmscjcRNjm1PB1fAhyJAxgmz0DumOpGVIiJsxZcvhpBD7yeV8zFUHg3vMZwMRMVC APh7mm7KKLicVrgOPCdUdMRdS/9OuwyylNNTwfvJ8bdBZ6Yd4XJTCYJmJAbg+B/yO5CY jJWO3jmxN/NrchYXCLfvXXSMsdFq0E94ZNFrtZNX994GxFIlQ0wCkkonjO9qQPYpwg45 /lkcofHL+594nHeoM0Us1daUQdiBAte2QR5AP8k5G8vzp+dNAdHUYEdFP0WmOPhnSTtS y+Iwmk3K/fOtmL/85MZGDwkMcl5Y+O0YqxjkKEQi4n3KuZHavuEpL2vdB6OoaIRWQMz4 vVZA== X-Gm-Message-State: AJIora/T65l/CTEiQlXSJs25J7vR9EZeLn6zTZccvdTkDbr1Ue3UOUo/ k0dENaasMU+Hmsjv3jFvPDAx9BiYjHUOeP+B X-Received: by 2002:a05:6a00:15cd:b0:528:4252:7079 with SMTP id o13-20020a056a0015cd00b0052842527079mr24849185pfu.68.1657095906490; Wed, 06 Jul 2022 01:25:06 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id t17-20020a170902e85100b00162529828aesm25199256plg.109.2022.07.06.01.25.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jul 2022 01:25:06 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v5 19/45] target/arm: Implement SME MOVA Date: Wed, 6 Jul 2022 13:53:45 +0530 Message-Id: <20220706082411.1664825-20-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220706082411.1664825-1-richard.henderson@linaro.org> References: <20220706082411.1664825-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::433; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x433.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" We can reuse the SVE functions for implementing moves to/from horizontal tile slices, but we need new ones for moves to/from vertical tile slices. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/helper-sme.h | 12 +++ target/arm/helper-sve.h | 2 + target/arm/translate-a64.h | 8 ++ target/arm/translate.h | 5 ++ target/arm/sme.decode | 15 ++++ target/arm/sme_helper.c | 151 ++++++++++++++++++++++++++++++++++++- target/arm/sve_helper.c | 12 +++ target/arm/translate-sme.c | 127 +++++++++++++++++++++++++++++++ 8 files changed, 331 insertions(+), 1 deletion(-) diff --git a/target/arm/helper-sme.h b/target/arm/helper-sme.h index c4ee1f09e4..154bc73d2e 100644 --- a/target/arm/helper-sme.h +++ b/target/arm/helper-sme.h @@ -21,3 +21,15 @@ DEF_HELPER_FLAGS_2(set_pstate_sm, TCG_CALL_NO_RWG, void, env, i32) DEF_HELPER_FLAGS_2(set_pstate_za, TCG_CALL_NO_RWG, void, env, i32) DEF_HELPER_FLAGS_3(sme_zero, TCG_CALL_NO_RWG, void, env, i32, i32) + +/* Move to/from vertical array slices, i.e. columns, so 'c'. */ +DEF_HELPER_FLAGS_4(sme_mova_cz_b, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(sme_mova_zc_b, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(sme_mova_cz_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(sme_mova_zc_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(sme_mova_cz_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(sme_mova_zc_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(sme_mova_cz_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(sme_mova_zc_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(sme_mova_cz_q, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(sme_mova_zc_q, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) diff --git a/target/arm/helper-sve.h b/target/arm/helper-sve.h index dc629f851a..ab0333400f 100644 --- a/target/arm/helper-sve.h +++ b/target/arm/helper-sve.h @@ -325,6 +325,8 @@ DEF_HELPER_FLAGS_5(sve_sel_zpzz_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_5(sve_sel_zpzz_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_5(sve_sel_zpzz_q, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_5(sve2_addp_zpzz_b, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32) diff --git a/target/arm/translate-a64.h b/target/arm/translate-a64.h index 099d3d11d6..2a7fe6e9e7 100644 --- a/target/arm/translate-a64.h +++ b/target/arm/translate-a64.h @@ -178,6 +178,14 @@ static inline int pred_gvec_reg_size(DisasContext *s) return size_for_gvec(pred_full_reg_size(s)); } +/* Return a newly allocated pointer to the predicate register. */ +static inline TCGv_ptr pred_full_reg_ptr(DisasContext *s, int regno) +{ + TCGv_ptr ret = tcg_temp_new_ptr(); + tcg_gen_addi_ptr(ret, cpu_env, pred_full_reg_offset(s, regno)); + return ret; +} + bool disas_sve(DisasContext *, uint32_t); bool disas_sme(DisasContext *, uint32_t); diff --git a/target/arm/translate.h b/target/arm/translate.h index e2e619dab2..af5d4a7086 100644 --- a/target/arm/translate.h +++ b/target/arm/translate.h @@ -156,6 +156,11 @@ static inline int plus_2(DisasContext *s, int x) return x + 2; } +static inline int plus_12(DisasContext *s, int x) +{ + return x + 12; +} + static inline int times_2(DisasContext *s, int x) { return x * 2; diff --git a/target/arm/sme.decode b/target/arm/sme.decode index 6e4483fdce..241b4895b7 100644 --- a/target/arm/sme.decode +++ b/target/arm/sme.decode @@ -22,3 +22,18 @@ ### SME Misc ZERO 11000000 00 001 00000000000 imm:8 + +### SME Move into/from Array + +%mova_rs 13:2 !function=plus_12 +&mova esz rs pg zr za_imm v:bool to_vec:bool + +MOVA 11000000 esz:2 00000 0 v:1 .. pg:3 zr:5 0 za_imm:4 \ + &mova to_vec=0 rs=%mova_rs +MOVA 11000000 11 00000 1 v:1 .. pg:3 zr:5 0 za_imm:4 \ + &mova to_vec=0 rs=%mova_rs esz=4 + +MOVA 11000000 esz:2 00001 0 v:1 .. pg:3 0 za_imm:4 zr:5 \ + &mova to_vec=1 rs=%mova_rs +MOVA 11000000 11 00001 1 v:1 .. pg:3 0 za_imm:4 zr:5 \ + &mova to_vec=1 rs=%mova_rs esz=4 diff --git a/target/arm/sme_helper.c b/target/arm/sme_helper.c index eef2df73e1..5389e361c3 100644 --- a/target/arm/sme_helper.c +++ b/target/arm/sme_helper.c @@ -19,8 +19,10 @@ #include "qemu/osdep.h" #include "cpu.h" -#include "internals.h" +#include "tcg/tcg-gvec-desc.h" #include "exec/helper-proto.h" +#include "qemu/int128.h" +#include "vec_internal.h" /* ResetSVEState */ void arm_reset_sve_state(CPUARMState *env) @@ -84,3 +86,150 @@ void helper_sme_zero(CPUARMState *env, uint32_t imm, uint32_t svl) } } } + + +/* + * When considering the ZA storage as an array of elements of + * type T, the index within that array of the Nth element of + * a vertical slice of a tile can be calculated like this, + * regardless of the size of type T. This is because the tiles + * are interleaved, so if type T is size N bytes then row 1 of + * the tile is N rows away from row 0. The division by N to + * convert a byte offset into an array index and the multiplication + * by N to convert from vslice-index-within-the-tile to + * the index within the ZA storage cancel out. + */ +#define tile_vslice_index(i) ((i) * sizeof(ARMVectorReg)) + +/* + * When doing byte arithmetic on the ZA storage, the element + * byteoff bytes away in a tile vertical slice is always this + * many bytes away in the ZA storage, regardless of the + * size of the tile element, assuming that byteoff is a multiple + * of the element size. Again this is because of the interleaving + * of the tiles. For instance if we have 1 byte per element then + * each row of the ZA storage has one byte of the vslice data, + * and (counting from 0) byte 8 goes in row 8 of the storage + * at offset (8 * row-size-in-bytes). + * If we have 8 bytes per element then each row of the ZA storage + * has 8 bytes of the data, but there are 8 interleaved tiles and + * so byte 8 of the data goes into row 1 of the tile, + * which is again row 8 of the storage, so the offset is still + * (8 * row-size-in-bytes). Similarly for other element sizes. + */ +#define tile_vslice_offset(byteoff) ((byteoff) * sizeof(ARMVectorReg)) + + +/* + * Move Zreg vector to ZArray column. + */ +#define DO_MOVA_C(NAME, TYPE, H) \ +void HELPER(NAME)(void *za, void *vn, void *vg, uint32_t desc) \ +{ \ + int i, oprsz = simd_oprsz(desc); \ + for (i = 0; i < oprsz; ) { \ + uint16_t pg = *(uint16_t *)(vg + H1_2(i >> 3)); \ + do { \ + if (pg & 1) { \ + *(TYPE *)(za + tile_vslice_offset(i)) = *(TYPE *)(vn + H(i)); \ + } \ + i += sizeof(TYPE); \ + pg >>= sizeof(TYPE); \ + } while (i & 15); \ + } \ +} + +DO_MOVA_C(sme_mova_cz_b, uint8_t, H1) +DO_MOVA_C(sme_mova_cz_h, uint16_t, H2) +DO_MOVA_C(sme_mova_cz_s, uint32_t, H4) + +void HELPER(sme_mova_cz_d)(void *za, void *vn, void *vg, uint32_t desc) +{ + int i, oprsz = simd_oprsz(desc) / 8; + uint8_t *pg = vg; + uint64_t *n = vn; + uint64_t *a = za; + + for (i = 0; i < oprsz; i++) { + if (pg[H1(i)] & 1) { + a[tile_vslice_index(i)] = n[i]; + } + } +} + +void HELPER(sme_mova_cz_q)(void *za, void *vn, void *vg, uint32_t desc) +{ + int i, oprsz = simd_oprsz(desc) / 16; + uint16_t *pg = vg; + Int128 *n = vn; + Int128 *a = za; + + /* + * Int128 is used here simply to copy 16 bytes, and to simplify + * the address arithmetic. + */ + for (i = 0; i < oprsz; i++) { + if (pg[H2(i)] & 1) { + a[tile_vslice_index(i)] = n[i]; + } + } +} + +#undef DO_MOVA_C + +/* + * Move ZArray column to Zreg vector. + */ +#define DO_MOVA_Z(NAME, TYPE, H) \ +void HELPER(NAME)(void *vd, void *za, void *vg, uint32_t desc) \ +{ \ + int i, oprsz = simd_oprsz(desc); \ + for (i = 0; i < oprsz; ) { \ + uint16_t pg = *(uint16_t *)(vg + H1_2(i >> 3)); \ + do { \ + if (pg & 1) { \ + *(TYPE *)(vd + H(i)) = *(TYPE *)(za + tile_vslice_offset(i)); \ + } \ + i += sizeof(TYPE); \ + pg >>= sizeof(TYPE); \ + } while (i & 15); \ + } \ +} + +DO_MOVA_Z(sme_mova_zc_b, uint8_t, H1) +DO_MOVA_Z(sme_mova_zc_h, uint16_t, H2) +DO_MOVA_Z(sme_mova_zc_s, uint32_t, H4) + +void HELPER(sme_mova_zc_d)(void *vd, void *za, void *vg, uint32_t desc) +{ + int i, oprsz = simd_oprsz(desc) / 8; + uint8_t *pg = vg; + uint64_t *d = vd; + uint64_t *a = za; + + for (i = 0; i < oprsz; i++) { + if (pg[H1(i)] & 1) { + d[i] = a[tile_vslice_index(i)]; + } + } +} + +void HELPER(sme_mova_zc_q)(void *vd, void *za, void *vg, uint32_t desc) +{ + int i, oprsz = simd_oprsz(desc) / 16; + uint16_t *pg = vg; + Int128 *d = vd; + Int128 *a = za; + + /* + * Int128 is used here simply to copy 16 bytes, and to simplify + * the address arithmetic. + */ + for (i = 0; i < oprsz; i++, za += sizeof(ARMVectorReg)) { + if (pg[H2(i)] & 1) { + d[i] = a[tile_vslice_index(i)]; + } + } +} + +#undef DO_MOVA_Z diff --git a/target/arm/sve_helper.c b/target/arm/sve_helper.c index 1654c0bbf9..9a26f253e0 100644 --- a/target/arm/sve_helper.c +++ b/target/arm/sve_helper.c @@ -3565,6 +3565,18 @@ void HELPER(sve_sel_zpzz_d)(void *vd, void *vn, void *vm, } } +void HELPER(sve_sel_zpzz_q)(void *vd, void *vn, void *vm, + void *vg, uint32_t desc) +{ + intptr_t i, opr_sz = simd_oprsz(desc) / 16; + Int128 *d = vd, *n = vn, *m = vm; + uint16_t *pg = vg; + + for (i = 0; i < opr_sz; i += 1) { + d[i] = (pg[H2(i)] & 1 ? n : m)[i]; + } +} + /* Two operand comparison controlled by a predicate. * ??? It is very tempting to want to be able to expand this inline * with x86 instructions, e.g. diff --git a/target/arm/translate-sme.c b/target/arm/translate-sme.c index 971504559b..79c33d35c2 100644 --- a/target/arm/translate-sme.c +++ b/target/arm/translate-sme.c @@ -35,6 +35,74 @@ #include "decode-sme.c.inc" +/* + * Resolve tile.size[index] to a host pointer, where tile and index + * are always decoded together, dependent on the element size. + */ +static TCGv_ptr get_tile_rowcol(DisasContext *s, int esz, int rs, + int tile_index, bool vertical) +{ + int tile = tile_index >> (4 - esz); + int index = esz == MO_128 ? 0 : extract32(tile_index, 0, 4 - esz); + int pos, len, offset; + TCGv_i32 tmp; + TCGv_ptr addr; + + /* Compute the final index, which is Rs+imm. */ + tmp = tcg_temp_new_i32(); + tcg_gen_trunc_tl_i32(tmp, cpu_reg(s, rs)); + tcg_gen_addi_i32(tmp, tmp, index); + + /* Prepare a power-of-two modulo via extraction of @len bits. */ + len = ctz32(streaming_vec_reg_size(s)) - esz; + + if (vertical) { + /* + * Compute the byte offset of the index within the tile: + * (index % (svl / size)) * size + * = (index % (svl >> esz)) << esz + * Perform the power-of-two modulo via extraction of the low @len bits. + * Perform the multiply by shifting left by @pos bits. + * Perform these operations simultaneously via deposit into zero. + */ + pos = esz; + tcg_gen_deposit_z_i32(tmp, tmp, pos, len); + + /* + * For big-endian, adjust the indexed column byte offset within + * the uint64_t host words that make up env->zarray[]. + */ + if (HOST_BIG_ENDIAN && esz < MO_64) { + tcg_gen_xori_i32(tmp, tmp, 8 - (1 << esz)); + } + } else { + /* + * Compute the byte offset of the index within the tile: + * (index % (svl / size)) * (size * sizeof(row)) + * = (index % (svl >> esz)) << (esz + log2(sizeof(row))) + */ + pos = esz + ctz32(sizeof(ARMVectorReg)); + tcg_gen_deposit_z_i32(tmp, tmp, pos, len); + + /* Row slices are always aligned and need no endian adjustment. */ + } + + /* The tile byte offset within env->zarray is the row. */ + offset = tile * sizeof(ARMVectorReg); + + /* Include the byte offset of zarray to make this relative to env. */ + offset += offsetof(CPUARMState, zarray); + tcg_gen_addi_i32(tmp, tmp, offset); + + /* Add the byte offset to env to produce the final pointer. */ + addr = tcg_temp_new_ptr(); + tcg_gen_ext_i32_ptr(addr, tmp); + tcg_temp_free_i32(tmp); + tcg_gen_add_ptr(addr, addr, cpu_env); + + return addr; +} + static bool trans_ZERO(DisasContext *s, arg_ZERO *a) { if (!dc_isar_feature(aa64_sme, s)) { @@ -46,3 +114,62 @@ static bool trans_ZERO(DisasContext *s, arg_ZERO *a) } return true; } + +static bool trans_MOVA(DisasContext *s, arg_MOVA *a) +{ + static gen_helper_gvec_4 * const h_fns[5] = { + gen_helper_sve_sel_zpzz_b, gen_helper_sve_sel_zpzz_h, + gen_helper_sve_sel_zpzz_s, gen_helper_sve_sel_zpzz_d, + gen_helper_sve_sel_zpzz_q + }; + static gen_helper_gvec_3 * const cz_fns[5] = { + gen_helper_sme_mova_cz_b, gen_helper_sme_mova_cz_h, + gen_helper_sme_mova_cz_s, gen_helper_sme_mova_cz_d, + gen_helper_sme_mova_cz_q, + }; + static gen_helper_gvec_3 * const zc_fns[5] = { + gen_helper_sme_mova_zc_b, gen_helper_sme_mova_zc_h, + gen_helper_sme_mova_zc_s, gen_helper_sme_mova_zc_d, + gen_helper_sme_mova_zc_q, + }; + + TCGv_ptr t_za, t_zr, t_pg; + TCGv_i32 t_desc; + int svl; + + if (!dc_isar_feature(aa64_sme, s)) { + return false; + } + if (!sme_smza_enabled_check(s)) { + return true; + } + + t_za = get_tile_rowcol(s, a->esz, a->rs, a->za_imm, a->v); + t_zr = vec_full_reg_ptr(s, a->zr); + t_pg = pred_full_reg_ptr(s, a->pg); + + svl = streaming_vec_reg_size(s); + t_desc = tcg_constant_i32(simd_desc(svl, svl, 0)); + + if (a->v) { + /* Vertical slice -- use sme mova helpers. */ + if (a->to_vec) { + zc_fns[a->esz](t_zr, t_za, t_pg, t_desc); + } else { + cz_fns[a->esz](t_za, t_zr, t_pg, t_desc); + } + } else { + /* Horizontal slice -- reuse sve sel helpers. */ + if (a->to_vec) { + h_fns[a->esz](t_zr, t_za, t_zr, t_pg, t_desc); + } else { + h_fns[a->esz](t_za, t_zr, t_za, t_pg, t_desc); + } + } + + tcg_temp_free_ptr(t_za); + tcg_temp_free_ptr(t_zr); + tcg_temp_free_ptr(t_pg); + + return true; +} From patchwork Wed Jul 6 08:23:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 587732 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1ec:0:0:0:0 with SMTP id 12csp2563935map; Wed, 6 Jul 2022 02:19:01 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sDHY6h/gvFCiF37fqkGyGNKFM8pqgpJ/C02t/TwSCiDLtJZgcruovOBiMP4Ls/cJ5k4x1d X-Received: by 2002:a05:620a:294a:b0:6ae:fb7f:831 with SMTP id n10-20020a05620a294a00b006aefb7f0831mr26678148qkp.130.1657099141457; Wed, 06 Jul 2022 02:19:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657099141; cv=none; d=google.com; s=arc-20160816; b=JZcl+yHnmJGJJepHqJ3fYcBeEVX7Ho4mYk/n4xN3SzVlFuD8gbmmJ3wBMNZnWuikBL Kwkygu6pcMbV1n0vwI+ddWIp86QgGyZhk3tIHUF393Ulijjwpk5iLQ/4jPIuyzgGQmtP 7+ktuErj3k8b4OsSAs+djgmU0pJw+BMrvbwkFDy02si1ywJEgQ8HjV+W5lYota7pyJXR hg6jLJz+x7fYYDEUnd0B+busJ9dWPQ6xhbgb8wNBG/o0JA8D5xOfMaDPvwn2OEOqlWeV T7sA3psM5c2/fV6my9RfZZfWRrUQlXNHOQfY91nTsFIsK1d7Bm+NaSWE/JzdqbUTTuBJ 9VbQ== 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=J9YsPnXYtEiZJrbRCqMv3bsXsrFNUGUWMNsYoBJH1OI=; b=bt41MvfFPsUeejO7FZgMmlTjDTMg+WvzAX7LmwVr+QAmte77HgbNzF+hljKtOHkuQV PwdNp2GEddj7zQBJjhGbDA85bToHc6Q9ukuiq/i6+TVluI8tUBPWLRAFnYR+RXkvmsDS RVtSktbx7TK2TY3rZNxatvFadKFAss8VF4WFs0Ou1sPMVXbUbhJWi262oTK91uVMuO2d xEjKN6dVGFE17Lnjl8jvfEbaUE0gRPbM+Hjh2wG3pCEtfPOxarsJBf6d+Ms5Nul6uUqe oeLKPYp9ecmK9xG6k/rTAc9DF7vsivDrDVh+X2rdmxwje8F5SXc0jW+yrjhlWiOZiQ9V 2N2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wFJOZwoI; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ay39-20020a05620a17a700b006af3f4c36f4si13582467qkb.717.2022.07.06.02.19.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Jul 2022 02:19:01 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wFJOZwoI; 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]:47208 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o91BV-0002ys-00 for patch@linaro.org; Wed, 06 Jul 2022 05:19:01 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49444) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o90LT-0006KQ-H7 for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:25:18 -0400 Received: from mail-pl1-x62a.google.com ([2607:f8b0:4864:20::62a]:38810) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o90LP-0000O1-HS for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:25:14 -0400 Received: by mail-pl1-x62a.google.com with SMTP id m14so13059236plg.5 for ; Wed, 06 Jul 2022 01:25:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=J9YsPnXYtEiZJrbRCqMv3bsXsrFNUGUWMNsYoBJH1OI=; b=wFJOZwoI3mh1OfUiz8KKeD6Pq5ibhQUFTTWIrZopZHKAw4uRVO6cml3FupyBLnbA4p YPEW9eCR8/yIWqh4JAfDzZGiKpIBN6mVgx6jQlP3oXLa99jsOZEFg9baUjnlKcaX5K6C MLyYbAmRypKF2lMvV2gjdXiZbo9cZSeOKx0zQmWdsDy+j2fdwh4mtpdMpMERaVmkogu2 TVHXFzb0cI5jdeXf4Mo53wbbVx5e+i45b1XTf/qeS/60ZuOA1MJYMUMem8UiPlHzZLzF wXbqLvz1kLlKPD2BRZKRaly6fLnIEb0Dpyl/EYkW/RgZVmJ0keAx2xsgl/WRTNaPJTg5 owyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=J9YsPnXYtEiZJrbRCqMv3bsXsrFNUGUWMNsYoBJH1OI=; b=eG5X0OVK8k4P7wK1A8FRn5Lfe0p8wg3zrMwNRjDGvAe1Ccw2z/sazwSWruvxAwyLLd 55upBoabGVyoq4pXot/q4Bib8xqiK+kciqU1Ty2waaPHlrMXE6ZfMPFQHYI3bzsMSYQX +RCWTXmRev44lVdpdgrXKQXZxw2TB52+hYsMMGgvXl6giYQaPBRZ63SDFMqFnZaKY/RG gshGnTky5Zg0Il8hIH9B3JxF9X1CScRwvDu0pqF3V1tczy6qBm7fGW0v1rx1v9W0a8mH riAZDcW0fbImkmks6B/iy+2MaTrwjpG8X8HPBZcQ2YiFG0d8qfeZWPcaxnUceJir0kig utqw== X-Gm-Message-State: AJIora+R7GsdADBGvzCQuUBGHPbYgUnwjZo6UBfm891gFbFSQ64kt6Y0 nAFNZ8d7rNmWyOkrDXHjcp/oDrpVwrdtWR0S X-Received: by 2002:a17:90b:388c:b0:1ec:d278:7aa4 with SMTP id mu12-20020a17090b388c00b001ecd2787aa4mr48946062pjb.176.1657095910566; Wed, 06 Jul 2022 01:25:10 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id t17-20020a170902e85100b00162529828aesm25199256plg.109.2022.07.06.01.25.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jul 2022 01:25:10 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v5 20/45] target/arm: Implement SME LD1, ST1 Date: Wed, 6 Jul 2022 13:53:46 +0530 Message-Id: <20220706082411.1664825-21-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220706082411.1664825-1-richard.henderson@linaro.org> References: <20220706082411.1664825-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::62a; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x62a.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" We cannot reuse the SVE functions for LD[1-4] and ST[1-4], because those functions accept only a Zreg register number. For SME, we want to pass a pointer into ZA storage. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/helper-sme.h | 82 +++++ target/arm/sme.decode | 9 + target/arm/sme_helper.c | 595 +++++++++++++++++++++++++++++++++++++ target/arm/translate-sme.c | 70 +++++ 4 files changed, 756 insertions(+) diff --git a/target/arm/helper-sme.h b/target/arm/helper-sme.h index 154bc73d2e..95f6e88bdd 100644 --- a/target/arm/helper-sme.h +++ b/target/arm/helper-sme.h @@ -33,3 +33,85 @@ DEF_HELPER_FLAGS_4(sme_mova_cz_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(sme_mova_zc_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(sme_mova_cz_q, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(sme_mova_zc_q, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) + +DEF_HELPER_FLAGS_5(sme_ld1b_h, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_5(sme_ld1b_v, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_5(sme_ld1b_h_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_5(sme_ld1b_v_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) + +DEF_HELPER_FLAGS_5(sme_ld1h_be_h, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_5(sme_ld1h_le_h, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_5(sme_ld1h_be_v, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_5(sme_ld1h_le_v, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_5(sme_ld1h_be_h_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_5(sme_ld1h_le_h_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_5(sme_ld1h_be_v_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_5(sme_ld1h_le_v_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) + +DEF_HELPER_FLAGS_5(sme_ld1s_be_h, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_5(sme_ld1s_le_h, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_5(sme_ld1s_be_v, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_5(sme_ld1s_le_v, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_5(sme_ld1s_be_h_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_5(sme_ld1s_le_h_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_5(sme_ld1s_be_v_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_5(sme_ld1s_le_v_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) + +DEF_HELPER_FLAGS_5(sme_ld1d_be_h, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_5(sme_ld1d_le_h, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_5(sme_ld1d_be_v, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_5(sme_ld1d_le_v, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_5(sme_ld1d_be_h_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_5(sme_ld1d_le_h_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_5(sme_ld1d_be_v_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_5(sme_ld1d_le_v_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) + +DEF_HELPER_FLAGS_5(sme_ld1q_be_h, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_5(sme_ld1q_le_h, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_5(sme_ld1q_be_v, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_5(sme_ld1q_le_v, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_5(sme_ld1q_be_h_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_5(sme_ld1q_le_h_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_5(sme_ld1q_be_v_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_5(sme_ld1q_le_v_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) + +DEF_HELPER_FLAGS_5(sme_st1b_h, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_5(sme_st1b_v, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_5(sme_st1b_h_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_5(sme_st1b_v_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) + +DEF_HELPER_FLAGS_5(sme_st1h_be_h, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_5(sme_st1h_le_h, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_5(sme_st1h_be_v, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_5(sme_st1h_le_v, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_5(sme_st1h_be_h_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_5(sme_st1h_le_h_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_5(sme_st1h_be_v_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_5(sme_st1h_le_v_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) + +DEF_HELPER_FLAGS_5(sme_st1s_be_h, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_5(sme_st1s_le_h, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_5(sme_st1s_be_v, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_5(sme_st1s_le_v, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_5(sme_st1s_be_h_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_5(sme_st1s_le_h_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_5(sme_st1s_be_v_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_5(sme_st1s_le_v_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) + +DEF_HELPER_FLAGS_5(sme_st1d_be_h, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_5(sme_st1d_le_h, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_5(sme_st1d_be_v, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_5(sme_st1d_le_v, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_5(sme_st1d_be_h_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_5(sme_st1d_le_h_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_5(sme_st1d_be_v_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_5(sme_st1d_le_v_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) + +DEF_HELPER_FLAGS_5(sme_st1q_be_h, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_5(sme_st1q_le_h, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_5(sme_st1q_be_v, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_5(sme_st1q_le_v, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_5(sme_st1q_be_h_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_5(sme_st1q_le_h_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_5(sme_st1q_be_v_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) +DEF_HELPER_FLAGS_5(sme_st1q_le_v_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) diff --git a/target/arm/sme.decode b/target/arm/sme.decode index 241b4895b7..900e3f2a07 100644 --- a/target/arm/sme.decode +++ b/target/arm/sme.decode @@ -37,3 +37,12 @@ MOVA 11000000 esz:2 00001 0 v:1 .. pg:3 0 za_imm:4 zr:5 \ &mova to_vec=1 rs=%mova_rs MOVA 11000000 11 00001 1 v:1 .. pg:3 0 za_imm:4 zr:5 \ &mova to_vec=1 rs=%mova_rs esz=4 + +### SME Memory + +&ldst esz rs pg rn rm za_imm v:bool st:bool + +LDST1 1110000 0 esz:2 st:1 rm:5 v:1 .. pg:3 rn:5 0 za_imm:4 \ + &ldst rs=%mova_rs +LDST1 1110000 111 st:1 rm:5 v:1 .. pg:3 rn:5 0 za_imm:4 \ + &ldst esz=4 rs=%mova_rs diff --git a/target/arm/sme_helper.c b/target/arm/sme_helper.c index 5389e361c3..e8895143c1 100644 --- a/target/arm/sme_helper.c +++ b/target/arm/sme_helper.c @@ -19,10 +19,14 @@ #include "qemu/osdep.h" #include "cpu.h" +#include "internals.h" #include "tcg/tcg-gvec-desc.h" #include "exec/helper-proto.h" +#include "exec/cpu_ldst.h" +#include "exec/exec-all.h" #include "qemu/int128.h" #include "vec_internal.h" +#include "sve_ldst_internal.h" /* ResetSVEState */ void arm_reset_sve_state(CPUARMState *env) @@ -233,3 +237,594 @@ void HELPER(sme_mova_zc_q)(void *vd, void *za, void *vg, uint32_t desc) } #undef DO_MOVA_Z + +/* + * Clear elements in a tile slice comprising len bytes. + */ + +typedef void ClearFn(void *ptr, size_t off, size_t len); + +static void clear_horizontal(void *ptr, size_t off, size_t len) +{ + memset(ptr + off, 0, len); +} + +static void clear_vertical_b(void *vptr, size_t off, size_t len) +{ + for (size_t i = 0; i < len; ++i) { + *(uint8_t *)(vptr + tile_vslice_offset(i + off)) = 0; + } +} + +static void clear_vertical_h(void *vptr, size_t off, size_t len) +{ + for (size_t i = 0; i < len; i += 2) { + *(uint16_t *)(vptr + tile_vslice_offset(i + off)) = 0; + } +} + +static void clear_vertical_s(void *vptr, size_t off, size_t len) +{ + for (size_t i = 0; i < len; i += 4) { + *(uint32_t *)(vptr + tile_vslice_offset(i + off)) = 0; + } +} + +static void clear_vertical_d(void *vptr, size_t off, size_t len) +{ + for (size_t i = 0; i < len; i += 8) { + *(uint64_t *)(vptr + tile_vslice_offset(i + off)) = 0; + } +} + +static void clear_vertical_q(void *vptr, size_t off, size_t len) +{ + for (size_t i = 0; i < len; i += 16) { + memset(vptr + tile_vslice_offset(i + off), 0, 16); + } +} + +/* + * Copy elements from an array into a tile slice comprising len bytes. + */ + +typedef void CopyFn(void *dst, const void *src, size_t len); + +static void copy_horizontal(void *dst, const void *src, size_t len) +{ + memcpy(dst, src, len); +} + +static void copy_vertical_b(void *vdst, const void *vsrc, size_t len) +{ + const uint8_t *src = vsrc; + uint8_t *dst = vdst; + size_t i; + + for (i = 0; i < len; ++i) { + dst[tile_vslice_index(i)] = src[i]; + } +} + +static void copy_vertical_h(void *vdst, const void *vsrc, size_t len) +{ + const uint16_t *src = vsrc; + uint16_t *dst = vdst; + size_t i; + + for (i = 0; i < len / 2; ++i) { + dst[tile_vslice_index(i)] = src[i]; + } +} + +static void copy_vertical_s(void *vdst, const void *vsrc, size_t len) +{ + const uint32_t *src = vsrc; + uint32_t *dst = vdst; + size_t i; + + for (i = 0; i < len / 4; ++i) { + dst[tile_vslice_index(i)] = src[i]; + } +} + +static void copy_vertical_d(void *vdst, const void *vsrc, size_t len) +{ + const uint64_t *src = vsrc; + uint64_t *dst = vdst; + size_t i; + + for (i = 0; i < len / 8; ++i) { + dst[tile_vslice_index(i)] = src[i]; + } +} + +static void copy_vertical_q(void *vdst, const void *vsrc, size_t len) +{ + for (size_t i = 0; i < len; i += 16) { + memcpy(vdst + tile_vslice_offset(i), vsrc + i, 16); + } +} + +/* + * Host and TLB primitives for vertical tile slice addressing. + */ + +#define DO_LD(NAME, TYPE, HOST, TLB) \ +static inline void sme_##NAME##_v_host(void *za, intptr_t off, void *host) \ +{ \ + TYPE val = HOST(host); \ + *(TYPE *)(za + tile_vslice_offset(off)) = val; \ +} \ +static inline void sme_##NAME##_v_tlb(CPUARMState *env, void *za, \ + intptr_t off, target_ulong addr, uintptr_t ra) \ +{ \ + TYPE val = TLB(env, useronly_clean_ptr(addr), ra); \ + *(TYPE *)(za + tile_vslice_offset(off)) = val; \ +} + +#define DO_ST(NAME, TYPE, HOST, TLB) \ +static inline void sme_##NAME##_v_host(void *za, intptr_t off, void *host) \ +{ \ + TYPE val = *(TYPE *)(za + tile_vslice_offset(off)); \ + HOST(host, val); \ +} \ +static inline void sme_##NAME##_v_tlb(CPUARMState *env, void *za, \ + intptr_t off, target_ulong addr, uintptr_t ra) \ +{ \ + TYPE val = *(TYPE *)(za + tile_vslice_offset(off)); \ + TLB(env, useronly_clean_ptr(addr), val, ra); \ +} + +/* + * The ARMVectorReg elements are stored in host-endian 64-bit units. + * For 128-bit quantities, the sequence defined by the Elem[] pseudocode + * corresponds to storing the two 64-bit pieces in little-endian order. + */ +#define DO_LDQ(HNAME, VNAME, BE, HOST, TLB) \ +static inline void HNAME##_host(void *za, intptr_t off, void *host) \ +{ \ + uint64_t val0 = HOST(host), val1 = HOST(host + 8); \ + uint64_t *ptr = za + off; \ + ptr[0] = BE ? val1 : val0, ptr[1] = BE ? val0 : val1; \ +} \ +static inline void VNAME##_v_host(void *za, intptr_t off, void *host) \ +{ \ + HNAME##_host(za, tile_vslice_offset(off), host); \ +} \ +static inline void HNAME##_tlb(CPUARMState *env, void *za, intptr_t off, \ + target_ulong addr, uintptr_t ra) \ +{ \ + uint64_t val0 = TLB(env, useronly_clean_ptr(addr), ra); \ + uint64_t val1 = TLB(env, useronly_clean_ptr(addr + 8), ra); \ + uint64_t *ptr = za + off; \ + ptr[0] = BE ? val1 : val0, ptr[1] = BE ? val0 : val1; \ +} \ +static inline void VNAME##_v_tlb(CPUARMState *env, void *za, intptr_t off, \ + target_ulong addr, uintptr_t ra) \ +{ \ + HNAME##_tlb(env, za, tile_vslice_offset(off), addr, ra); \ +} + +#define DO_STQ(HNAME, VNAME, BE, HOST, TLB) \ +static inline void HNAME##_host(void *za, intptr_t off, void *host) \ +{ \ + uint64_t *ptr = za + off; \ + HOST(host, ptr[BE]); \ + HOST(host + 1, ptr[!BE]); \ +} \ +static inline void VNAME##_v_host(void *za, intptr_t off, void *host) \ +{ \ + HNAME##_host(za, tile_vslice_offset(off), host); \ +} \ +static inline void HNAME##_tlb(CPUARMState *env, void *za, intptr_t off, \ + target_ulong addr, uintptr_t ra) \ +{ \ + uint64_t *ptr = za + off; \ + TLB(env, useronly_clean_ptr(addr), ptr[BE], ra); \ + TLB(env, useronly_clean_ptr(addr + 8), ptr[!BE], ra); \ +} \ +static inline void VNAME##_v_tlb(CPUARMState *env, void *za, intptr_t off, \ + target_ulong addr, uintptr_t ra) \ +{ \ + HNAME##_tlb(env, za, tile_vslice_offset(off), addr, ra); \ +} + +DO_LD(ld1b, uint8_t, ldub_p, cpu_ldub_data_ra) +DO_LD(ld1h_be, uint16_t, lduw_be_p, cpu_lduw_be_data_ra) +DO_LD(ld1h_le, uint16_t, lduw_le_p, cpu_lduw_le_data_ra) +DO_LD(ld1s_be, uint32_t, ldl_be_p, cpu_ldl_be_data_ra) +DO_LD(ld1s_le, uint32_t, ldl_le_p, cpu_ldl_le_data_ra) +DO_LD(ld1d_be, uint64_t, ldq_be_p, cpu_ldq_be_data_ra) +DO_LD(ld1d_le, uint64_t, ldq_le_p, cpu_ldq_le_data_ra) + +DO_LDQ(sve_ld1qq_be, sme_ld1q_be, 1, ldq_be_p, cpu_ldq_be_data_ra) +DO_LDQ(sve_ld1qq_le, sme_ld1q_le, 0, ldq_le_p, cpu_ldq_le_data_ra) + +DO_ST(st1b, uint8_t, stb_p, cpu_stb_data_ra) +DO_ST(st1h_be, uint16_t, stw_be_p, cpu_stw_be_data_ra) +DO_ST(st1h_le, uint16_t, stw_le_p, cpu_stw_le_data_ra) +DO_ST(st1s_be, uint32_t, stl_be_p, cpu_stl_be_data_ra) +DO_ST(st1s_le, uint32_t, stl_le_p, cpu_stl_le_data_ra) +DO_ST(st1d_be, uint64_t, stq_be_p, cpu_stq_be_data_ra) +DO_ST(st1d_le, uint64_t, stq_le_p, cpu_stq_le_data_ra) + +DO_STQ(sve_st1qq_be, sme_st1q_be, 1, stq_be_p, cpu_stq_be_data_ra) +DO_STQ(sve_st1qq_le, sme_st1q_le, 0, stq_le_p, cpu_stq_le_data_ra) + +#undef DO_LD +#undef DO_ST +#undef DO_LDQ +#undef DO_STQ + +/* + * Common helper for all contiguous predicated loads. + */ + +static inline QEMU_ALWAYS_INLINE +void sme_ld1(CPUARMState *env, void *za, uint64_t *vg, + const target_ulong addr, uint32_t desc, const uintptr_t ra, + const int esz, uint32_t mtedesc, bool vertical, + sve_ldst1_host_fn *host_fn, + sve_ldst1_tlb_fn *tlb_fn, + ClearFn *clr_fn, + CopyFn *cpy_fn) +{ + const intptr_t reg_max = simd_oprsz(desc); + const intptr_t esize = 1 << esz; + intptr_t reg_off, reg_last; + SVEContLdSt info; + void *host; + int flags; + + /* Find the active elements. */ + if (!sve_cont_ldst_elements(&info, addr, vg, reg_max, esz, esize)) { + /* The entire predicate was false; no load occurs. */ + clr_fn(za, 0, reg_max); + return; + } + + /* Probe the page(s). Exit with exception for any invalid page. */ + sve_cont_ldst_pages(&info, FAULT_ALL, env, addr, MMU_DATA_LOAD, ra); + + /* Handle watchpoints for all active elements. */ + sve_cont_ldst_watchpoints(&info, env, vg, addr, esize, esize, + BP_MEM_READ, ra); + + /* + * Handle mte checks for all active elements. + * Since TBI must be set for MTE, !mtedesc => !mte_active. + */ + if (mtedesc) { + sve_cont_ldst_mte_check(&info, env, vg, addr, esize, esize, + mtedesc, ra); + } + + flags = info.page[0].flags | info.page[1].flags; + if (unlikely(flags != 0)) { +#ifdef CONFIG_USER_ONLY + g_assert_not_reached(); +#else + /* + * At least one page includes MMIO. + * Any bus operation can fail with cpu_transaction_failed, + * which for ARM will raise SyncExternal. Perform the load + * into scratch memory to preserve register state until the end. + */ + ARMVectorReg scratch = { }; + + reg_off = info.reg_off_first[0]; + reg_last = info.reg_off_last[1]; + if (reg_last < 0) { + reg_last = info.reg_off_split; + if (reg_last < 0) { + reg_last = info.reg_off_last[0]; + } + } + + do { + uint64_t pg = vg[reg_off >> 6]; + do { + if ((pg >> (reg_off & 63)) & 1) { + tlb_fn(env, &scratch, reg_off, addr + reg_off, ra); + } + reg_off += esize; + } while (reg_off & 63); + } while (reg_off <= reg_last); + + cpy_fn(za, &scratch, reg_max); + return; +#endif + } + + /* The entire operation is in RAM, on valid pages. */ + + reg_off = info.reg_off_first[0]; + reg_last = info.reg_off_last[0]; + host = info.page[0].host; + + if (!vertical) { + memset(za, 0, reg_max); + } else if (reg_off) { + clr_fn(za, 0, reg_off); + } + + while (reg_off <= reg_last) { + uint64_t pg = vg[reg_off >> 6]; + do { + if ((pg >> (reg_off & 63)) & 1) { + host_fn(za, reg_off, host + reg_off); + } else if (vertical) { + clr_fn(za, reg_off, esize); + } + reg_off += esize; + } while (reg_off <= reg_last && (reg_off & 63)); + } + + /* + * Use the slow path to manage the cross-page misalignment. + * But we know this is RAM and cannot trap. + */ + reg_off = info.reg_off_split; + if (unlikely(reg_off >= 0)) { + tlb_fn(env, za, reg_off, addr + reg_off, ra); + } + + reg_off = info.reg_off_first[1]; + if (unlikely(reg_off >= 0)) { + reg_last = info.reg_off_last[1]; + host = info.page[1].host; + + do { + uint64_t pg = vg[reg_off >> 6]; + do { + if ((pg >> (reg_off & 63)) & 1) { + host_fn(za, reg_off, host + reg_off); + } else if (vertical) { + clr_fn(za, reg_off, esize); + } + reg_off += esize; + } while (reg_off & 63); + } while (reg_off <= reg_last); + } +} + +static inline QEMU_ALWAYS_INLINE +void sme_ld1_mte(CPUARMState *env, void *za, uint64_t *vg, + target_ulong addr, uint32_t desc, uintptr_t ra, + const int esz, bool vertical, + sve_ldst1_host_fn *host_fn, + sve_ldst1_tlb_fn *tlb_fn, + ClearFn *clr_fn, + CopyFn *cpy_fn) +{ + uint32_t mtedesc = desc >> (SIMD_DATA_SHIFT + SVE_MTEDESC_SHIFT); + int bit55 = extract64(addr, 55, 1); + + /* Remove mtedesc from the normal sve descriptor. */ + desc = extract32(desc, 0, SIMD_DATA_SHIFT + SVE_MTEDESC_SHIFT); + + /* Perform gross MTE suppression early. */ + if (!tbi_check(desc, bit55) || + tcma_check(desc, bit55, allocation_tag_from_addr(addr))) { + mtedesc = 0; + } + + sme_ld1(env, za, vg, addr, desc, ra, esz, mtedesc, vertical, + host_fn, tlb_fn, clr_fn, cpy_fn); +} + +#define DO_LD(L, END, ESZ) \ +void HELPER(sme_ld1##L##END##_h)(CPUARMState *env, void *za, void *vg, \ + target_ulong addr, uint32_t desc) \ +{ \ + sme_ld1(env, za, vg, addr, desc, GETPC(), ESZ, 0, false, \ + sve_ld1##L##L##END##_host, sve_ld1##L##L##END##_tlb, \ + clear_horizontal, copy_horizontal); \ +} \ +void HELPER(sme_ld1##L##END##_v)(CPUARMState *env, void *za, void *vg, \ + target_ulong addr, uint32_t desc) \ +{ \ + sme_ld1(env, za, vg, addr, desc, GETPC(), ESZ, 0, true, \ + sme_ld1##L##END##_v_host, sme_ld1##L##END##_v_tlb, \ + clear_vertical_##L, copy_vertical_##L); \ +} \ +void HELPER(sme_ld1##L##END##_h_mte)(CPUARMState *env, void *za, void *vg, \ + target_ulong addr, uint32_t desc) \ +{ \ + sme_ld1_mte(env, za, vg, addr, desc, GETPC(), ESZ, false, \ + sve_ld1##L##L##END##_host, sve_ld1##L##L##END##_tlb, \ + clear_horizontal, copy_horizontal); \ +} \ +void HELPER(sme_ld1##L##END##_v_mte)(CPUARMState *env, void *za, void *vg, \ + target_ulong addr, uint32_t desc) \ +{ \ + sme_ld1_mte(env, za, vg, addr, desc, GETPC(), ESZ, true, \ + sme_ld1##L##END##_v_host, sme_ld1##L##END##_v_tlb, \ + clear_vertical_##L, copy_vertical_##L); \ +} + +DO_LD(b, , MO_8) +DO_LD(h, _be, MO_16) +DO_LD(h, _le, MO_16) +DO_LD(s, _be, MO_32) +DO_LD(s, _le, MO_32) +DO_LD(d, _be, MO_64) +DO_LD(d, _le, MO_64) +DO_LD(q, _be, MO_128) +DO_LD(q, _le, MO_128) + +#undef DO_LD + +/* + * Common helper for all contiguous predicated stores. + */ + +static inline QEMU_ALWAYS_INLINE +void sme_st1(CPUARMState *env, void *za, uint64_t *vg, + const target_ulong addr, uint32_t desc, const uintptr_t ra, + const int esz, uint32_t mtedesc, bool vertical, + sve_ldst1_host_fn *host_fn, + sve_ldst1_tlb_fn *tlb_fn) +{ + const intptr_t reg_max = simd_oprsz(desc); + const intptr_t esize = 1 << esz; + intptr_t reg_off, reg_last; + SVEContLdSt info; + void *host; + int flags; + + /* Find the active elements. */ + if (!sve_cont_ldst_elements(&info, addr, vg, reg_max, esz, esize)) { + /* The entire predicate was false; no store occurs. */ + return; + } + + /* Probe the page(s). Exit with exception for any invalid page. */ + sve_cont_ldst_pages(&info, FAULT_ALL, env, addr, MMU_DATA_STORE, ra); + + /* Handle watchpoints for all active elements. */ + sve_cont_ldst_watchpoints(&info, env, vg, addr, esize, esize, + BP_MEM_WRITE, ra); + + /* + * Handle mte checks for all active elements. + * Since TBI must be set for MTE, !mtedesc => !mte_active. + */ + if (mtedesc) { + sve_cont_ldst_mte_check(&info, env, vg, addr, esize, esize, + mtedesc, ra); + } + + flags = info.page[0].flags | info.page[1].flags; + if (unlikely(flags != 0)) { +#ifdef CONFIG_USER_ONLY + g_assert_not_reached(); +#else + /* + * At least one page includes MMIO. + * Any bus operation can fail with cpu_transaction_failed, + * which for ARM will raise SyncExternal. We cannot avoid + * this fault and will leave with the store incomplete. + */ + reg_off = info.reg_off_first[0]; + reg_last = info.reg_off_last[1]; + if (reg_last < 0) { + reg_last = info.reg_off_split; + if (reg_last < 0) { + reg_last = info.reg_off_last[0]; + } + } + + do { + uint64_t pg = vg[reg_off >> 6]; + do { + if ((pg >> (reg_off & 63)) & 1) { + tlb_fn(env, za, reg_off, addr + reg_off, ra); + } + reg_off += esize; + } while (reg_off & 63); + } while (reg_off <= reg_last); + return; +#endif + } + + reg_off = info.reg_off_first[0]; + reg_last = info.reg_off_last[0]; + host = info.page[0].host; + + while (reg_off <= reg_last) { + uint64_t pg = vg[reg_off >> 6]; + do { + if ((pg >> (reg_off & 63)) & 1) { + host_fn(za, reg_off, host + reg_off); + } + reg_off += 1 << esz; + } while (reg_off <= reg_last && (reg_off & 63)); + } + + /* + * Use the slow path to manage the cross-page misalignment. + * But we know this is RAM and cannot trap. + */ + reg_off = info.reg_off_split; + if (unlikely(reg_off >= 0)) { + tlb_fn(env, za, reg_off, addr + reg_off, ra); + } + + reg_off = info.reg_off_first[1]; + if (unlikely(reg_off >= 0)) { + reg_last = info.reg_off_last[1]; + host = info.page[1].host; + + do { + uint64_t pg = vg[reg_off >> 6]; + do { + if ((pg >> (reg_off & 63)) & 1) { + host_fn(za, reg_off, host + reg_off); + } + reg_off += 1 << esz; + } while (reg_off & 63); + } while (reg_off <= reg_last); + } +} + +static inline QEMU_ALWAYS_INLINE +void sme_st1_mte(CPUARMState *env, void *za, uint64_t *vg, target_ulong addr, + uint32_t desc, uintptr_t ra, int esz, bool vertical, + sve_ldst1_host_fn *host_fn, + sve_ldst1_tlb_fn *tlb_fn) +{ + uint32_t mtedesc = desc >> (SIMD_DATA_SHIFT + SVE_MTEDESC_SHIFT); + int bit55 = extract64(addr, 55, 1); + + /* Remove mtedesc from the normal sve descriptor. */ + desc = extract32(desc, 0, SIMD_DATA_SHIFT + SVE_MTEDESC_SHIFT); + + /* Perform gross MTE suppression early. */ + if (!tbi_check(desc, bit55) || + tcma_check(desc, bit55, allocation_tag_from_addr(addr))) { + mtedesc = 0; + } + + sme_st1(env, za, vg, addr, desc, ra, esz, mtedesc, + vertical, host_fn, tlb_fn); +} + +#define DO_ST(L, END, ESZ) \ +void HELPER(sme_st1##L##END##_h)(CPUARMState *env, void *za, void *vg, \ + target_ulong addr, uint32_t desc) \ +{ \ + sme_st1(env, za, vg, addr, desc, GETPC(), ESZ, 0, false, \ + sve_st1##L##L##END##_host, sve_st1##L##L##END##_tlb); \ +} \ +void HELPER(sme_st1##L##END##_v)(CPUARMState *env, void *za, void *vg, \ + target_ulong addr, uint32_t desc) \ +{ \ + sme_st1(env, za, vg, addr, desc, GETPC(), ESZ, 0, true, \ + sme_st1##L##END##_v_host, sme_st1##L##END##_v_tlb); \ +} \ +void HELPER(sme_st1##L##END##_h_mte)(CPUARMState *env, void *za, void *vg, \ + target_ulong addr, uint32_t desc) \ +{ \ + sme_st1_mte(env, za, vg, addr, desc, GETPC(), ESZ, false, \ + sve_st1##L##L##END##_host, sve_st1##L##L##END##_tlb); \ +} \ +void HELPER(sme_st1##L##END##_v_mte)(CPUARMState *env, void *za, void *vg, \ + target_ulong addr, uint32_t desc) \ +{ \ + sme_st1_mte(env, za, vg, addr, desc, GETPC(), ESZ, true, \ + sme_st1##L##END##_v_host, sme_st1##L##END##_v_tlb); \ +} + +DO_ST(b, , MO_8) +DO_ST(h, _be, MO_16) +DO_ST(h, _le, MO_16) +DO_ST(s, _be, MO_32) +DO_ST(s, _le, MO_32) +DO_ST(d, _be, MO_64) +DO_ST(d, _le, MO_64) +DO_ST(q, _be, MO_128) +DO_ST(q, _le, MO_128) + +#undef DO_ST diff --git a/target/arm/translate-sme.c b/target/arm/translate-sme.c index 79c33d35c2..42d14b883a 100644 --- a/target/arm/translate-sme.c +++ b/target/arm/translate-sme.c @@ -173,3 +173,73 @@ static bool trans_MOVA(DisasContext *s, arg_MOVA *a) return true; } + +static bool trans_LDST1(DisasContext *s, arg_LDST1 *a) +{ + typedef void GenLdSt1(TCGv_env, TCGv_ptr, TCGv_ptr, TCGv, TCGv_i32); + + /* + * Indexed by [esz][be][v][mte][st], which is (except for load/store) + * also the order in which the elements appear in the function names, + * and so how we must concatenate the pieces. + */ + +#define FN_LS(F) { gen_helper_sme_ld1##F, gen_helper_sme_st1##F } +#define FN_MTE(F) { FN_LS(F), FN_LS(F##_mte) } +#define FN_HV(F) { FN_MTE(F##_h), FN_MTE(F##_v) } +#define FN_END(L, B) { FN_HV(L), FN_HV(B) } + + static GenLdSt1 * const fns[5][2][2][2][2] = { + FN_END(b, b), + FN_END(h_le, h_be), + FN_END(s_le, s_be), + FN_END(d_le, d_be), + FN_END(q_le, q_be), + }; + +#undef FN_LS +#undef FN_MTE +#undef FN_HV +#undef FN_END + + TCGv_ptr t_za, t_pg; + TCGv_i64 addr; + int svl, desc = 0; + bool be = s->be_data == MO_BE; + bool mte = s->mte_active[0]; + + if (!dc_isar_feature(aa64_sme, s)) { + return false; + } + if (!sme_smza_enabled_check(s)) { + return true; + } + + t_za = get_tile_rowcol(s, a->esz, a->rs, a->za_imm, a->v); + t_pg = pred_full_reg_ptr(s, a->pg); + addr = tcg_temp_new_i64(); + + tcg_gen_shli_i64(addr, cpu_reg(s, a->rm), a->esz); + tcg_gen_add_i64(addr, addr, cpu_reg_sp(s, a->rn)); + + if (mte) { + desc = FIELD_DP32(desc, MTEDESC, MIDX, get_mem_index(s)); + desc = FIELD_DP32(desc, MTEDESC, TBI, s->tbid); + desc = FIELD_DP32(desc, MTEDESC, TCMA, s->tcma); + desc = FIELD_DP32(desc, MTEDESC, WRITE, a->st); + desc = FIELD_DP32(desc, MTEDESC, SIZEM1, (1 << a->esz) - 1); + desc <<= SVE_MTEDESC_SHIFT; + } else { + addr = clean_data_tbi(s, addr); + } + svl = streaming_vec_reg_size(s); + desc = simd_desc(svl, svl, desc); + + fns[a->esz][be][a->v][mte][a->st](cpu_env, t_za, t_pg, addr, + tcg_constant_i32(desc)); + + tcg_temp_free_ptr(t_za); + tcg_temp_free_ptr(t_pg); + tcg_temp_free_i64(addr); + return true; +} From patchwork Wed Jul 6 08:23:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 587729 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1ec:0:0:0:0 with SMTP id 12csp2561559map; Wed, 6 Jul 2022 02:15:13 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vtK98yHeyjpteazt9RnjOODrlUyLNcD7OvXQwLJGyGUl2+PUCb0cRjlEcuLceNZGmsWNHI X-Received: by 2002:a05:6214:401c:b0:470:461a:f3e8 with SMTP id kd28-20020a056214401c00b00470461af3e8mr35958779qvb.82.1657098913098; Wed, 06 Jul 2022 02:15:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657098913; cv=none; d=google.com; s=arc-20160816; b=AWnlbVTCQs8V89+uNEeTm2Z6FrOhVKuZxHdoz+qqcvtIj4yjC2Excf/M6fgi52BGjf X+JyGlSSyJXk7dobMU17UtG3a90h8SVqLGLbE+Qwg1vlwCXdlC7wwuxl5614ro5A/o5v 2GMZJ2lfTktvWYGEdOv9JBu8tt7ytIzWuyPLSejsKV71fSQvHWIqBAF/zPhM/uNeuVEc RIN2kqW+z1bCrPQHo6GRbIs1TjIqf+fixNXhd9v464Wc/4+5fEAO8I3O+MOPHlirWKlD gZK6fySA3P2Ww3POEzV2kWxHdVyuJ/hYY4WRt7yUmyRViYkUJ4+7+347CerHGNuY1IlF MBAw== 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=WXFOydNqWu4pd209lRdohDlcMY8B614kNt2CpuhFxBg=; b=rPJf1hrtBgk7J44hHS9DHfex+Mf1J0DdDnIjMgEs7h1dGQmsbbZku9STbZVR8sXCuk yQenlS/Yx6wUQFbBs66unp9X3USPkQ28+mN3xd3EZ62c2d4rrK/8U6gxu7u4OnITZ2Hp 8K1yXWimIauOxKvqVpXqfRLhnruIXklwgkdcg4GVw2OBE2kZlrwttkXLwqE38xloWSV7 oYSAjUZI7nDrmum8Qi97xLH/shLy98um5Qnqb5TbgjqSWRvXrhkwwS++FTnlt5ZolI9a kjYnW6YA2SP3sx+V3Zt23XD8d1epePtKk2eGs3n1x40QwSvL5Rch5qtT/8SJoBTIRDk0 Jlsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="JI/ATYoe"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 15-20020a0562140d0f00b00472c0a6e698si5990660qvh.233.2022.07.06.02.15.13 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Jul 2022 02:15:13 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="JI/ATYoe"; 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]:38882 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o917o-0005fb-JQ for patch@linaro.org; Wed, 06 Jul 2022 05:15:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49452) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o90LV-0006KT-0n for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:25:18 -0400 Received: from mail-pj1-x102f.google.com ([2607:f8b0:4864:20::102f]:34689) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o90LS-0000fA-Ey for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:25:15 -0400 Received: by mail-pj1-x102f.google.com with SMTP id cp18-20020a17090afb9200b001ef79e8484aso6170883pjb.1 for ; Wed, 06 Jul 2022 01:25:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WXFOydNqWu4pd209lRdohDlcMY8B614kNt2CpuhFxBg=; b=JI/ATYoekixrud7Hb4ATmnrtVhfS0Gb7+OrtNiA0g289g6jVAYkC2Diqt7IPHixTMJ BhNnA8umkAUOy/TG7WfqYHpTm7f7aSTukkCfzmc+q9B+ZsphGqk1SRiuW3cgwdbcZOpL vTGuX09Yy53cLdre22AfjQYikWZ7u49jgcI/JgvelzmcbPmqR+IeDAsOvx1/3AVhVm3P MuS9GBoKhcO4zp3uRkO/XxZyhCy7idlFWsnWrTwzv30X1ZAO6VKhBm1vIJMT9Ld6pUeg AF0TrTMNdJwoDZCVABItFfIyVd+fNdSdw/yBwahLIT/dPwjrPW+pmwJfJxW/z9trlO2p hSFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WXFOydNqWu4pd209lRdohDlcMY8B614kNt2CpuhFxBg=; b=TLvWpoLAep1ICU/ES/1l56CEYUhTcNNH3wQhER8AIZYVZVQKyh+v1mHfZ/OrcUhw1s zF7r2cLqhvqCEWMnDPSeUMgwmcz3s+4yvCtebC7tFA1XIvnktmFloC7CYGzEbdUenVAn vXI/PkoXJ6vHn0gpwFo9ZkopHzL7q0Ce6P9Q2uAdCgbXAQRqt8Q/WLCfWE/tuirzR9+x ndwuXF4nbwIPbWPFgnOQzKSfvB+c8VqizWLgej/yxXGH+j3RZ+k2beTpx9gGRm3cf0v/ pYFw6HvWdpcZjADF4QBbeMD45WiQuB4iu8Owd5Bql3tb6UwaSIjxIeu2gECczF5QhVde avIw== X-Gm-Message-State: AJIora90gec5O6b7l0s/8udoODslKiDft8dPhLbMW3wV8yfkNpVnPN81 ahG3JFNQruRv2QKhEQSTJxTIZDmVnQ8wAfKr X-Received: by 2002:a17:90b:33ca:b0:1ec:c617:9660 with SMTP id lk10-20020a17090b33ca00b001ecc6179660mr49445214pjb.95.1657095913287; Wed, 06 Jul 2022 01:25:13 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id t17-20020a170902e85100b00162529828aesm25199256plg.109.2022.07.06.01.25.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jul 2022 01:25:12 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v5 21/45] target/arm: Export unpredicated ld/st from translate-sve.c Date: Wed, 6 Jul 2022 13:53:47 +0530 Message-Id: <20220706082411.1664825-22-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220706082411.1664825-1-richard.henderson@linaro.org> References: <20220706082411.1664825-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102f; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102f.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" Add a TCGv_ptr base argument, which will be cpu_env for SVE. We will reuse this for SME save and restore array insns. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/translate-a64.h | 3 +++ target/arm/translate-sve.c | 48 ++++++++++++++++++++++++++++---------- 2 files changed, 39 insertions(+), 12 deletions(-) diff --git a/target/arm/translate-a64.h b/target/arm/translate-a64.h index 2a7fe6e9e7..ad3762d1ac 100644 --- a/target/arm/translate-a64.h +++ b/target/arm/translate-a64.h @@ -195,4 +195,7 @@ void gen_gvec_xar(unsigned vece, uint32_t rd_ofs, uint32_t rn_ofs, uint32_t rm_ofs, int64_t shift, uint32_t opr_sz, uint32_t max_sz); +void gen_sve_ldr(DisasContext *s, TCGv_ptr, int vofs, int len, int rn, int imm); +void gen_sve_str(DisasContext *s, TCGv_ptr, int vofs, int len, int rn, int imm); + #endif /* TARGET_ARM_TRANSLATE_A64_H */ diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c index 95016e49e9..fd1a173637 100644 --- a/target/arm/translate-sve.c +++ b/target/arm/translate-sve.c @@ -4306,7 +4306,8 @@ TRANS_FEAT(UCVTF_dd, aa64_sve, gen_gvec_fpst_arg_zpz, * The load should begin at the address Rn + IMM. */ -static void do_ldr(DisasContext *s, uint32_t vofs, int len, int rn, int imm) +void gen_sve_ldr(DisasContext *s, TCGv_ptr base, int vofs, + int len, int rn, int imm) { int len_align = QEMU_ALIGN_DOWN(len, 8); int len_remain = len % 8; @@ -4332,7 +4333,7 @@ static void do_ldr(DisasContext *s, uint32_t vofs, int len, int rn, int imm) t0 = tcg_temp_new_i64(); for (i = 0; i < len_align; i += 8) { tcg_gen_qemu_ld_i64(t0, clean_addr, midx, MO_LEUQ); - tcg_gen_st_i64(t0, cpu_env, vofs + i); + tcg_gen_st_i64(t0, base, vofs + i); tcg_gen_addi_i64(clean_addr, clean_addr, 8); } tcg_temp_free_i64(t0); @@ -4345,6 +4346,12 @@ static void do_ldr(DisasContext *s, uint32_t vofs, int len, int rn, int imm) clean_addr = new_tmp_a64_local(s); tcg_gen_mov_i64(clean_addr, t0); + if (base != cpu_env) { + TCGv_ptr b = tcg_temp_local_new_ptr(); + tcg_gen_mov_ptr(b, base); + base = b; + } + gen_set_label(loop); t0 = tcg_temp_new_i64(); @@ -4352,7 +4359,7 @@ static void do_ldr(DisasContext *s, uint32_t vofs, int len, int rn, int imm) tcg_gen_addi_i64(clean_addr, clean_addr, 8); tp = tcg_temp_new_ptr(); - tcg_gen_add_ptr(tp, cpu_env, i); + tcg_gen_add_ptr(tp, base, i); tcg_gen_addi_ptr(i, i, 8); tcg_gen_st_i64(t0, tp, vofs); tcg_temp_free_ptr(tp); @@ -4360,6 +4367,11 @@ static void do_ldr(DisasContext *s, uint32_t vofs, int len, int rn, int imm) tcg_gen_brcondi_ptr(TCG_COND_LTU, i, len_align, loop); tcg_temp_free_ptr(i); + + if (base != cpu_env) { + tcg_temp_free_ptr(base); + assert(len_remain == 0); + } } /* @@ -4388,13 +4400,14 @@ static void do_ldr(DisasContext *s, uint32_t vofs, int len, int rn, int imm) default: g_assert_not_reached(); } - tcg_gen_st_i64(t0, cpu_env, vofs + len_align); + tcg_gen_st_i64(t0, base, vofs + len_align); tcg_temp_free_i64(t0); } } /* Similarly for stores. */ -static void do_str(DisasContext *s, uint32_t vofs, int len, int rn, int imm) +void gen_sve_str(DisasContext *s, TCGv_ptr base, int vofs, + int len, int rn, int imm) { int len_align = QEMU_ALIGN_DOWN(len, 8); int len_remain = len % 8; @@ -4420,7 +4433,7 @@ static void do_str(DisasContext *s, uint32_t vofs, int len, int rn, int imm) t0 = tcg_temp_new_i64(); for (i = 0; i < len_align; i += 8) { - tcg_gen_ld_i64(t0, cpu_env, vofs + i); + tcg_gen_ld_i64(t0, base, vofs + i); tcg_gen_qemu_st_i64(t0, clean_addr, midx, MO_LEUQ); tcg_gen_addi_i64(clean_addr, clean_addr, 8); } @@ -4434,11 +4447,17 @@ static void do_str(DisasContext *s, uint32_t vofs, int len, int rn, int imm) clean_addr = new_tmp_a64_local(s); tcg_gen_mov_i64(clean_addr, t0); + if (base != cpu_env) { + TCGv_ptr b = tcg_temp_local_new_ptr(); + tcg_gen_mov_ptr(b, base); + base = b; + } + gen_set_label(loop); t0 = tcg_temp_new_i64(); tp = tcg_temp_new_ptr(); - tcg_gen_add_ptr(tp, cpu_env, i); + tcg_gen_add_ptr(tp, base, i); tcg_gen_ld_i64(t0, tp, vofs); tcg_gen_addi_ptr(i, i, 8); tcg_temp_free_ptr(tp); @@ -4449,12 +4468,17 @@ static void do_str(DisasContext *s, uint32_t vofs, int len, int rn, int imm) tcg_gen_brcondi_ptr(TCG_COND_LTU, i, len_align, loop); tcg_temp_free_ptr(i); + + if (base != cpu_env) { + tcg_temp_free_ptr(base); + assert(len_remain == 0); + } } /* Predicate register stores can be any multiple of 2. */ if (len_remain) { t0 = tcg_temp_new_i64(); - tcg_gen_ld_i64(t0, cpu_env, vofs + len_align); + tcg_gen_ld_i64(t0, base, vofs + len_align); switch (len_remain) { case 2: @@ -4486,7 +4510,7 @@ static bool trans_LDR_zri(DisasContext *s, arg_rri *a) if (sve_access_check(s)) { int size = vec_full_reg_size(s); int off = vec_full_reg_offset(s, a->rd); - do_ldr(s, off, size, a->rn, a->imm * size); + gen_sve_ldr(s, cpu_env, off, size, a->rn, a->imm * size); } return true; } @@ -4499,7 +4523,7 @@ static bool trans_LDR_pri(DisasContext *s, arg_rri *a) if (sve_access_check(s)) { int size = pred_full_reg_size(s); int off = pred_full_reg_offset(s, a->rd); - do_ldr(s, off, size, a->rn, a->imm * size); + gen_sve_ldr(s, cpu_env, off, size, a->rn, a->imm * size); } return true; } @@ -4512,7 +4536,7 @@ static bool trans_STR_zri(DisasContext *s, arg_rri *a) if (sve_access_check(s)) { int size = vec_full_reg_size(s); int off = vec_full_reg_offset(s, a->rd); - do_str(s, off, size, a->rn, a->imm * size); + gen_sve_str(s, cpu_env, off, size, a->rn, a->imm * size); } return true; } @@ -4525,7 +4549,7 @@ static bool trans_STR_pri(DisasContext *s, arg_rri *a) if (sve_access_check(s)) { int size = pred_full_reg_size(s); int off = pred_full_reg_offset(s, a->rd); - do_str(s, off, size, a->rn, a->imm * size); + gen_sve_str(s, cpu_env, off, size, a->rn, a->imm * size); } return true; } From patchwork Wed Jul 6 08:23:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 587736 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1ec:0:0:0:0 with SMTP id 12csp2567834map; Wed, 6 Jul 2022 02:23:46 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uZSbha1L0MTfvQKWrZRn8qdc70LGYH52sfLisD8G4WI/EjPuH9I9eUNEXq+y7D6UCO6dWz X-Received: by 2002:a37:f503:0:b0:6ae:d9f1:47e with SMTP id l3-20020a37f503000000b006aed9f1047emr25882861qkk.182.1657099426419; Wed, 06 Jul 2022 02:23:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657099426; cv=none; d=google.com; s=arc-20160816; b=ep+HrmV0RsaEmoxk47GeVdvOyiBYSm+9Pe6OnV46z3QuTrWFQdHf1oaAmTfbxG9f1U trdbVqJ7Uy1FcFPbSdw1NIAeJNqGmxk8SDGsVR1R1NHXcImYdpGf3VrX1NrKSIC6RtHS JWupzoSf5QvJPBxLBkIvQSZ/0hq3SBw3ZDxCDuL9S8w9cBmBEuNP/t16JlLg0Zi8JGps TjU888fea+yzWIpUA9CjLWm88VfY3FVJ1MgKJVXwlwqtS7tn9oAKVJ8QEwhm3bEU7Rto R4ycK3Ji7M7NYcmxYfCBrXkzaDXD3HNn5aia+AmSRscwxx0ZGybBjuqkxZTbMRlahH4k hy2w== 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=xubRGg1CD554iutFjuAkV3ppcjr54S3DVLv86vq5+4E=; b=xbGZOrgJUo2I7pXf5O60C0yVcP5JpKjvLD2hbPk9Dsttt4KOQ88XvEQCH2NT+rHyZr Yh0P45I/Hxshzb9bNhdBNN5fxkUvkIGlcdr0h+r33QLfjjzEwzvo7/t9eIDoG9NFIsbs oOwbeecy9ZxDXHBlEafNbwHQxkSe3bl2AgqNIxZ9XbGZ59FnusfFkn7eA1v+dYnve92f fx1//wku1aon4ZiJtdWx+YU7D9abNXqayaBBrHyattkNc/Xp6gKEdDXsTdlzfLzqOPpk NDJ9tHq3Fdrl1i4dsXKec6yXQUYf9qykQl+IAVts9hlkOlbMahapVCtXJxweugSWPFLP V2wQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Rop1Ui4L; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id s8-20020a05620a254800b006a3ae9bbe53si21444554qko.7.2022.07.06.02.23.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Jul 2022 02:23:46 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Rop1Ui4L; 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]:56176 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o91G5-0000lR-WB for patch@linaro.org; Wed, 06 Jul 2022 05:23:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49480) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o90LY-0006LY-8z for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:25:22 -0400 Received: from mail-pg1-x52c.google.com ([2607:f8b0:4864:20::52c]:40660) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o90LW-0000fj-Jb for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:25:20 -0400 Received: by mail-pg1-x52c.google.com with SMTP id i190so848251pge.7 for ; Wed, 06 Jul 2022 01:25:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xubRGg1CD554iutFjuAkV3ppcjr54S3DVLv86vq5+4E=; b=Rop1Ui4LnzcawtHKojmRq9aqxgdrfuE38U3EsPOAcYDbDSrc4WYWDxVDgaDlvFOfV2 ydVSt/oezYT3n6e9QdKsPIxb6qssYbXcKJPsNhWNMrc501+Mb5tdYHzl4nlVxl94Ruw0 KttvyEbGDKhrC18Vf3xYQxSL4na6QqMTQGF35EXDze63/3ZOWCHOcfi5pNilgb4hEhEx iz3cb/8L4RQHCp5nl5ZoyK0wXoMfcVHWHByuBuVKU7M6GFA7xeSKHgWn1AHjaJeGskZc Wt2Zbm+I3zfl1HONxlBHZMyzlmq48BnXtv+bsb3C8ZCaL5di9Egwh9XM7FHYNdkxiiaO 0jng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xubRGg1CD554iutFjuAkV3ppcjr54S3DVLv86vq5+4E=; b=0iogrQsgGrbPW1ASbGf1ubJ1qzofiChskWjWehhz2MMQl2WX39xZvd2+NPZnQ7ugIK T58RktPP3FUd5bxWtKPuZJ32bnyzDvfFZTdH2DrRnEUL5TMNYv9QLg0vjdOEheouvfHT E6e3D1vrUrx++BgnkYmDSUn01OccsJ/MzAfLaVrI4aPnmevjYtqHjNsgDVzb9Y5SCLZa gnfvbSNROvqiQW7sSJKAPZ9Vgk3Zd4OnT8lyk+dPthSj4eg0lp9RWJY0hMmhT5aYOJba AQWirKzGseFQ5FZUk/1S1Kj6r0v3IKLyx9HuoYSVR6TY1hCK17Jj2w66zIZ5i8cDF/7y HLHg== X-Gm-Message-State: AJIora/XUP95ByM+ubiT3re5o/5bTtJeVukg6IptLq8oMm3Fd9Xtof4D NeZU1JjVrHsWAfSiBGbL28ZwojcTwgBDDkeR X-Received: by 2002:a63:42c2:0:b0:412:82c5:45af with SMTP id p185-20020a6342c2000000b0041282c545afmr4877472pga.461.1657095916176; Wed, 06 Jul 2022 01:25:16 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id t17-20020a170902e85100b00162529828aesm25199256plg.109.2022.07.06.01.25.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jul 2022 01:25:15 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v5 22/45] target/arm: Implement SME LDR, STR Date: Wed, 6 Jul 2022 13:53:48 +0530 Message-Id: <20220706082411.1664825-23-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220706082411.1664825-1-richard.henderson@linaro.org> References: <20220706082411.1664825-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" We can reuse the SVE functions for LDR and STR, passing in the base of the ZA vector and a zero offset. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/sme.decode | 7 +++++++ target/arm/translate-sme.c | 24 ++++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/target/arm/sme.decode b/target/arm/sme.decode index 900e3f2a07..f1ebd857a5 100644 --- a/target/arm/sme.decode +++ b/target/arm/sme.decode @@ -46,3 +46,10 @@ LDST1 1110000 0 esz:2 st:1 rm:5 v:1 .. pg:3 rn:5 0 za_imm:4 \ &ldst rs=%mova_rs LDST1 1110000 111 st:1 rm:5 v:1 .. pg:3 rn:5 0 za_imm:4 \ &ldst esz=4 rs=%mova_rs + +&ldstr rv rn imm +@ldstr ....... ... . ...... .. ... rn:5 . imm:4 \ + &ldstr rv=%mova_rs + +LDR 1110000 100 0 000000 .. 000 ..... 0 .... @ldstr +STR 1110000 100 1 000000 .. 000 ..... 0 .... @ldstr diff --git a/target/arm/translate-sme.c b/target/arm/translate-sme.c index 42d14b883a..35c2644812 100644 --- a/target/arm/translate-sme.c +++ b/target/arm/translate-sme.c @@ -243,3 +243,27 @@ static bool trans_LDST1(DisasContext *s, arg_LDST1 *a) tcg_temp_free_i64(addr); return true; } + +typedef void GenLdStR(DisasContext *, TCGv_ptr, int, int, int, int); + +static bool do_ldst_r(DisasContext *s, arg_ldstr *a, GenLdStR *fn) +{ + int svl = streaming_vec_reg_size(s); + int imm = a->imm; + TCGv_ptr base; + + if (!sme_za_enabled_check(s)) { + return true; + } + + /* ZA[n] equates to ZA0H.B[n]. */ + base = get_tile_rowcol(s, MO_8, a->rv, imm, false); + + fn(s, base, 0, svl, a->rn, imm * svl); + + tcg_temp_free_ptr(base); + return true; +} + +TRANS_FEAT(LDR, aa64_sme, do_ldst_r, a, gen_sve_ldr) +TRANS_FEAT(STR, aa64_sme, do_ldst_r, a, gen_sve_str) From patchwork Wed Jul 6 08:23:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 587730 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1ec:0:0:0:0 with SMTP id 12csp2561859map; Wed, 6 Jul 2022 02:15:38 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sLqkWMmWBpWeuU83S8fPps+KM9Or4k/yYXc6l/hu4QF52iEeLY3LGvdCY4iZpIpQsO7/rE X-Received: by 2002:a05:622a:120e:b0:31b:f5d8:c63c with SMTP id y14-20020a05622a120e00b0031bf5d8c63cmr31676835qtx.316.1657098937944; Wed, 06 Jul 2022 02:15:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657098937; cv=none; d=google.com; s=arc-20160816; b=L0ky8UqZYbPa4fDaaUDesHW4T7u76WfAcrXSONaRPWSvBv9tVwFoSshVReM+utxesT WjJFCfL+HNIEOfgjRtKV6DscJj6ftxXdxhksbKdF8Yoe81ja3HnEy4EYQZntBhLDPHm2 fCwEHKArg/QzHWgWZMTRvkwHhd7FgIToMgxonnwy+H65uXHvrBt8E6q11Nnt4sk4AJE6 eQ18HKW2JN4ZMLg22gICnw19gdhkS+zOoDsKO+caYQSj+GTBOOtx6pu2UeVXED4v0Dxp 2K+HfkB9ILuLbxSXSC3014OPhrF+lVYsSL9d9Du86QvbHo4dEpin+/jTI4Prg5kkOEez WzNA== 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=/7USofFy6/R6DxVwNku/PFYigY7yHsE6i1usXBLJ75E=; b=glwwLjj6uz6kvCL2BE02M5gzcwuQlS5CGS2l5oopyvHqU/GKFKx4nbQqOB20xTzT2M FdNb7qIYucrhXIA4tNrnu/XSzadSl+TeYfEVxWIHVU8CoP/k/ULX+4p+diezmfXpmxnu NehBGwIyi8pUdw+obz0El0vvp/IFP6fDOVP2JdhEBiBdOxu0HlXH0emDeEVZIWm9ae1X iKeuQkS0/94/m5jm8kKlzM81XFC83yhXn5Xey6vsEvOXJb8LdWwFhMN+hSKAU65hI9qp caqBdngNWC4qeMjz5DYnF1jMB2W8jcfd3UBfhUBp2wHWEHvxIPsw4EzJFVzB4PE3qPEk ZQqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LyRn1ocZ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id fv18-20020a05622a4a1200b00307cbf812f1si5982595qtb.214.2022.07.06.02.15.37 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Jul 2022 02:15:37 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LyRn1ocZ; 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]:39310 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o918D-0005wy-Eq for patch@linaro.org; Wed, 06 Jul 2022 05:15:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49544) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o90Lb-0006Nz-3R for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:25:24 -0400 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]:35563) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o90LZ-0000gE-1o for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:25:22 -0400 Received: by mail-pf1-x429.google.com with SMTP id x184so349734pfx.2 for ; Wed, 06 Jul 2022 01:25:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/7USofFy6/R6DxVwNku/PFYigY7yHsE6i1usXBLJ75E=; b=LyRn1ocZrr6lmCZ8xNLkfByWAtaHaUBX8RcTA5NnkLu56s5NDJWypMoP+4zIqBn3P3 WqknCD7fxBzzB77BD+6AdgIW8lUqh9z2/TkYzy63wXWU6KDLGoYwwZpa5XUVFaxpC4lU YCFXyWrnlfjxBdp0IU9/Mi/aW3ozioP+6hPXrdXFTgD8WlVYF8+joC7E4iii90h2JyLl fxvmfwYbQRJwBxsiGBR89ZAecWC0eSu3Fit5i/VHjKiukcG3Jl3FNJU7vy0xE/Tx0S9n aA+qA16zLXAwl6c5iUFdSEQGAT7qPbrg8piGCnG0j9Z7YipYiNGrmM3KJjhyPvXcOFZY 6IQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/7USofFy6/R6DxVwNku/PFYigY7yHsE6i1usXBLJ75E=; b=c+xpmSKmNcXuqnqcp3Z1EL+QhMdIOFLBJxSc5WZPaeYl/hirbWoh5XzQ1HlX2WNAy4 LghRM+rxBzbGjP8TqqIpsNHwr9gtTqk/Go0fHgKvMyCvVosnA8IDIuwOb3xOn2RzQXE/ Sh4VaY9rSV5M0DzYtUfxGppaXTQKsumQJJbGTBKl5W74NIIEm6/90ducMVwddmB1gOWR QEZQBvyEYcybAAfC8VFur2G0Z/ieTOknaD/sWO2046aKM8YogWsxfM0oSurPO4721EwN AC31zvXL/NbhDpP/ry6atIk7w2ya8Ru1Q0B8QBgiH8qJybPj25GY77bNpjiLzSXS9dkH 3Jnw== X-Gm-Message-State: AJIora8H7NJ7dCbFhn0ydEdRdokEuB4YbFsfeHXC12duK26WU60CmkWy NCeHRhAJ9Y7tPjDpm3U5LsZYkNYof+pzsAk1 X-Received: by 2002:a63:d449:0:b0:40d:7553:aef6 with SMTP id i9-20020a63d449000000b0040d7553aef6mr33596430pgj.16.1657095919069; Wed, 06 Jul 2022 01:25:19 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id t17-20020a170902e85100b00162529828aesm25199256plg.109.2022.07.06.01.25.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jul 2022 01:25:18 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v5 23/45] target/arm: Implement SME ADDHA, ADDVA Date: Wed, 6 Jul 2022 13:53:49 +0530 Message-Id: <20220706082411.1664825-24-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220706082411.1664825-1-richard.henderson@linaro.org> References: <20220706082411.1664825-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::429; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x429.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- v4: Drop restrict. --- target/arm/helper-sme.h | 5 +++ target/arm/sme.decode | 11 +++++ target/arm/sme_helper.c | 90 ++++++++++++++++++++++++++++++++++++++ target/arm/translate-sme.c | 31 +++++++++++++ 4 files changed, 137 insertions(+) diff --git a/target/arm/helper-sme.h b/target/arm/helper-sme.h index 95f6e88bdd..753e9e624c 100644 --- a/target/arm/helper-sme.h +++ b/target/arm/helper-sme.h @@ -115,3 +115,8 @@ DEF_HELPER_FLAGS_5(sme_st1q_be_h_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i DEF_HELPER_FLAGS_5(sme_st1q_le_h_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) DEF_HELPER_FLAGS_5(sme_st1q_be_v_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) DEF_HELPER_FLAGS_5(sme_st1q_le_v_mte, TCG_CALL_NO_WG, void, env, ptr, ptr, tl, i32) + +DEF_HELPER_FLAGS_5(sme_addha_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_5(sme_addva_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_5(sme_addha_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_5(sme_addva_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32) diff --git a/target/arm/sme.decode b/target/arm/sme.decode index f1ebd857a5..8cb6c4053c 100644 --- a/target/arm/sme.decode +++ b/target/arm/sme.decode @@ -53,3 +53,14 @@ LDST1 1110000 111 st:1 rm:5 v:1 .. pg:3 rn:5 0 za_imm:4 \ LDR 1110000 100 0 000000 .. 000 ..... 0 .... @ldstr STR 1110000 100 1 000000 .. 000 ..... 0 .... @ldstr + +### SME Add Vector to Array + +&adda zad zn pm pn +@adda_32 ........ .. ..... . pm:3 pn:3 zn:5 ... zad:2 &adda +@adda_64 ........ .. ..... . pm:3 pn:3 zn:5 .. zad:3 &adda + +ADDHA_s 11000000 10 01000 0 ... ... ..... 000 .. @adda_32 +ADDVA_s 11000000 10 01000 1 ... ... ..... 000 .. @adda_32 +ADDHA_d 11000000 11 01000 0 ... ... ..... 00 ... @adda_64 +ADDVA_d 11000000 11 01000 1 ... ... ..... 00 ... @adda_64 diff --git a/target/arm/sme_helper.c b/target/arm/sme_helper.c index e8895143c1..10b7c1ad68 100644 --- a/target/arm/sme_helper.c +++ b/target/arm/sme_helper.c @@ -828,3 +828,93 @@ DO_ST(q, _be, MO_128) DO_ST(q, _le, MO_128) #undef DO_ST + +void HELPER(sme_addha_s)(void *vzda, void *vzn, void *vpn, + void *vpm, uint32_t desc) +{ + intptr_t row, col, oprsz = simd_oprsz(desc) / 4; + uint64_t *pn = vpn, *pm = vpm; + uint32_t *zda = vzda, *zn = vzn; + + for (row = 0; row < oprsz; ) { + uint64_t pa = pn[row >> 4]; + do { + if (pa & 1) { + for (col = 0; col < oprsz; ) { + uint64_t pb = pm[col >> 4]; + do { + if (pb & 1) { + zda[tile_vslice_index(row) + col] += zn[col]; + } + pb >>= 4; + } while (++col & 15); + } + } + pa >>= 4; + } while (++row & 15); + } +} + +void HELPER(sme_addha_d)(void *vzda, void *vzn, void *vpn, + void *vpm, uint32_t desc) +{ + intptr_t row, col, oprsz = simd_oprsz(desc) / 8; + uint8_t *pn = vpn, *pm = vpm; + uint64_t *zda = vzda, *zn = vzn; + + for (row = 0; row < oprsz; ++row) { + if (pn[H1(row)] & 1) { + for (col = 0; col < oprsz; ++col) { + if (pm[H1(col)] & 1) { + zda[tile_vslice_index(row) + col] += zn[col]; + } + } + } + } +} + +void HELPER(sme_addva_s)(void *vzda, void *vzn, void *vpn, + void *vpm, uint32_t desc) +{ + intptr_t row, col, oprsz = simd_oprsz(desc) / 4; + uint64_t *pn = vpn, *pm = vpm; + uint32_t *zda = vzda, *zn = vzn; + + for (row = 0; row < oprsz; ) { + uint64_t pa = pn[row >> 4]; + do { + if (pa & 1) { + uint32_t zn_row = zn[row]; + for (col = 0; col < oprsz; ) { + uint64_t pb = pm[col >> 4]; + do { + if (pb & 1) { + zda[tile_vslice_index(row) + col] += zn_row; + } + pb >>= 4; + } while (++col & 15); + } + } + pa >>= 4; + } while (++row & 15); + } +} + +void HELPER(sme_addva_d)(void *vzda, void *vzn, void *vpn, + void *vpm, uint32_t desc) +{ + intptr_t row, col, oprsz = simd_oprsz(desc) / 8; + uint8_t *pn = vpn, *pm = vpm; + uint64_t *zda = vzda, *zn = vzn; + + for (row = 0; row < oprsz; ++row) { + if (pn[H1(row)] & 1) { + uint64_t zn_row = zn[row]; + for (col = 0; col < oprsz; ++col) { + if (pm[H1(col)] & 1) { + zda[tile_vslice_index(row) + col] += zn_row; + } + } + } + } +} diff --git a/target/arm/translate-sme.c b/target/arm/translate-sme.c index 35c2644812..d3b9cdd5c4 100644 --- a/target/arm/translate-sme.c +++ b/target/arm/translate-sme.c @@ -267,3 +267,34 @@ static bool do_ldst_r(DisasContext *s, arg_ldstr *a, GenLdStR *fn) TRANS_FEAT(LDR, aa64_sme, do_ldst_r, a, gen_sve_ldr) TRANS_FEAT(STR, aa64_sme, do_ldst_r, a, gen_sve_str) + +static bool do_adda(DisasContext *s, arg_adda *a, MemOp esz, + gen_helper_gvec_4 *fn) +{ + int svl = streaming_vec_reg_size(s); + uint32_t desc = simd_desc(svl, svl, 0); + TCGv_ptr za, zn, pn, pm; + + if (!sme_smza_enabled_check(s)) { + return true; + } + + /* Sum XZR+zad to find ZAd. */ + za = get_tile_rowcol(s, esz, 31, a->zad, false); + zn = vec_full_reg_ptr(s, a->zn); + pn = pred_full_reg_ptr(s, a->pn); + pm = pred_full_reg_ptr(s, a->pm); + + fn(za, zn, pn, pm, tcg_constant_i32(desc)); + + tcg_temp_free_ptr(za); + tcg_temp_free_ptr(zn); + tcg_temp_free_ptr(pn); + tcg_temp_free_ptr(pm); + return true; +} + +TRANS_FEAT(ADDHA_s, aa64_sme, do_adda, a, MO_32, gen_helper_sme_addha_s) +TRANS_FEAT(ADDVA_s, aa64_sme, do_adda, a, MO_32, gen_helper_sme_addva_s) +TRANS_FEAT(ADDHA_d, aa64_sme_i16i64, do_adda, a, MO_64, gen_helper_sme_addha_d) +TRANS_FEAT(ADDVA_d, aa64_sme_i16i64, do_adda, a, MO_64, gen_helper_sme_addva_d) From patchwork Wed Jul 6 08:23:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 587728 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1ec:0:0:0:0 with SMTP id 12csp2558921map; Wed, 6 Jul 2022 02:11:32 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vklbbmW+8+JbAaFsUxPStWZX5RUEs0GQM0XlvpTaVJ77QGBRY4j5SEhDoS5Z1azwfQ0aQU X-Received: by 2002:ae9:f814:0:b0:6af:1d36:e672 with SMTP id x20-20020ae9f814000000b006af1d36e672mr26456826qkh.115.1657098692844; Wed, 06 Jul 2022 02:11:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657098692; cv=none; d=google.com; s=arc-20160816; b=T+Q5aluD0xAXf3DJx9DA8tsfARFy4x7wvTVtWYcko7UYA9M9sNpgerxyfo0i35NLS9 UCFBWE3Cmj/9mnIWbaBwW9/h1+q3VXq1123YRV1uQyCslxByCeTZM+Gjgks8wh6waO18 7UUa/N1Ee8beGaglJDxYwiMxrd9rtGu7kYTp4RsoiiOnjFrcw5bF3Hz/gycLN6ERadVq 2xvaYd+fc49xvYSo9ezjqsYC90rLVEGtiua+HfxdC16Qkyh/gyBlkC7QBc2ufQPUr+PH ZgXtvynhrU4xdtb9pgNY9SbS3cdquD7FIyXABTdje53s3c5cAca/wJvBDSVzInIpqUew WH/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=/Nd7aoiJ0a4Om5oS4WouR0rEr++9q5c771YPccSG4HM=; b=edHxJp/wullKCZ9z6HTiyUrKUHyi8k+h3d3cFCWLaoLFnS8mtYt8ZvJi2F3c7YqmSu EFivkJC0oKQwMRch1HV76l93fmMUcMNTiUoyv3NeiQC2u2lxXcFoF5OCYpzd4gn3BD/m N60iXi+qVl2P1DOHLK36wJavv05Zp57J9hjkcy8AE7D++UILEmNyMlf0+Ukji+LDYUyK ZWE44T/nPQ2VQiJv4I5njA4dcAq+L5ZhRArv2hF6+n3oZrwKTJxWzkYBZemPy5UrY9jm VQo03fcsXzF8HXI8Mlf7TPzcbUeNnhNtqMe9EUqxpfGQf4oMl388H+htQURjWTPDIQYx mtKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LoK1pMNZ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id y24-20020a05620a0e1800b006a33697bc2csi19664768qkm.236.2022.07.06.02.11.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Jul 2022 02:11:32 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LoK1pMNZ; 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]:59234 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o914G-0000GW-Cn for patch@linaro.org; Wed, 06 Jul 2022 05:11:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49570) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o90Lc-0006O2-I7 for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:25:24 -0400 Received: from mail-pg1-x533.google.com ([2607:f8b0:4864:20::533]:36737) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o90La-0000gp-QG for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:25:24 -0400 Received: by mail-pg1-x533.google.com with SMTP id s206so13467818pgs.3 for ; Wed, 06 Jul 2022 01:25:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/Nd7aoiJ0a4Om5oS4WouR0rEr++9q5c771YPccSG4HM=; b=LoK1pMNZaCDE+QaIRjGwGTG7mcJb+2/vEi3wvhOKPh/7Vv3JBjSa50j1zF1eSA2508 mbfYZFpDmaCykCnbSwSfYw88ojLBxHD+Q3IZivaJNaB7vnclzNYPHb4JSyNiwgS585Wn mx3tK+gnm/+/d8FRuvZShSp8VG14IWR/574j6uQ7G5EV95nHzjJBUAUV2Q0eN0KwT/rp 59dwk6Y8JtgpPY1dUoxNgGTbwxa4W+PVkZg8k5x2TiVJPjk7c4XWAyIjlnZ54HEr/Teh 1ADCi0XrliyesGyOevUs9OCIStlYgeXQ7eAN78PQnZD/5+1IxUzWRf8dSQboSqqKpjYo YXKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=/Nd7aoiJ0a4Om5oS4WouR0rEr++9q5c771YPccSG4HM=; b=8C7EZjxJFVDsR0J9Ob4QUL+wkU49cj//eZXGBqHsZ+dbjqnGBKZTodvwA1ykpBs3Fw YIdA5iNEl97akV8RyhrR4pPVoJNIgEDt4Ebh3H1WjRF43x2rO0FOcfQxY8b0gkrjF5Xf t17zHD3/CpVDuh0UYPLPk0ag01zUDtnjYcUqu3etYp1c/kgkk8mOLWOcB0zSXzx85dg4 QMYo0FLAhKGDl50zIKESJhVubBAUtVkhXjQvCmjf0fbZk95JofNpLC5XAhg4kTXb3ZST IljLVrrLo9RSyTcoeMnEaV2E3+qPeWOYkpoM1B0sl7ApNmxw66EX6lp1l6ykI1s6qbEJ Eepw== X-Gm-Message-State: AJIora8h568j5TRNX4HRcimwPyNAczo5EO/nJbVSKsp6V0Vb6NzEsdQM vUmI0XvGAMylvA4Z0uyH/vPGTVikaOxJ072t X-Received: by 2002:a63:7b18:0:b0:40c:9f14:981 with SMTP id w24-20020a637b18000000b0040c9f140981mr34108077pgc.176.1657095921415; Wed, 06 Jul 2022 01:25:21 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id t17-20020a170902e85100b00162529828aesm25199256plg.109.2022.07.06.01.25.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jul 2022 01:25:20 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v5 24/45] target/arm: Implement FMOPA, FMOPS (non-widening) Date: Wed, 6 Jul 2022 13:53:50 +0530 Message-Id: <20220706082411.1664825-25-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220706082411.1664825-1-richard.henderson@linaro.org> References: <20220706082411.1664825-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::533; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x533.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" Signed-off-by: Richard Henderson --- target/arm/helper-sme.h | 5 +++ target/arm/sme.decode | 9 ++++++ target/arm/sme_helper.c | 63 ++++++++++++++++++++++++++++++++++++++ target/arm/translate-sme.c | 32 +++++++++++++++++++ 4 files changed, 109 insertions(+) diff --git a/target/arm/helper-sme.h b/target/arm/helper-sme.h index 753e9e624c..f50d0fe1d6 100644 --- a/target/arm/helper-sme.h +++ b/target/arm/helper-sme.h @@ -120,3 +120,8 @@ DEF_HELPER_FLAGS_5(sme_addha_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_5(sme_addva_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_5(sme_addha_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_5(sme_addva_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32) + +DEF_HELPER_FLAGS_7(sme_fmopa_s, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_7(sme_fmopa_d, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, ptr, ptr, ptr, i32) diff --git a/target/arm/sme.decode b/target/arm/sme.decode index 8cb6c4053c..ba4774d174 100644 --- a/target/arm/sme.decode +++ b/target/arm/sme.decode @@ -64,3 +64,12 @@ ADDHA_s 11000000 10 01000 0 ... ... ..... 000 .. @adda_32 ADDVA_s 11000000 10 01000 1 ... ... ..... 000 .. @adda_32 ADDHA_d 11000000 11 01000 0 ... ... ..... 00 ... @adda_64 ADDVA_d 11000000 11 01000 1 ... ... ..... 00 ... @adda_64 + +### SME Outer Product + +&op zad zn zm pm pn sub:bool +@op_32 ........ ... zm:5 pm:3 pn:3 zn:5 sub:1 .. zad:2 &op +@op_64 ........ ... zm:5 pm:3 pn:3 zn:5 sub:1 . zad:3 &op + +FMOPA_s 10000000 100 ..... ... ... ..... . 00 .. @op_32 +FMOPA_d 10000000 110 ..... ... ... ..... . 0 ... @op_64 diff --git a/target/arm/sme_helper.c b/target/arm/sme_helper.c index 10b7c1ad68..78ba34f3d2 100644 --- a/target/arm/sme_helper.c +++ b/target/arm/sme_helper.c @@ -25,6 +25,7 @@ #include "exec/cpu_ldst.h" #include "exec/exec-all.h" #include "qemu/int128.h" +#include "fpu/softfloat.h" #include "vec_internal.h" #include "sve_ldst_internal.h" @@ -918,3 +919,65 @@ void HELPER(sme_addva_d)(void *vzda, void *vzn, void *vpn, } } } + +void HELPER(sme_fmopa_s)(void *vza, void *vzn, void *vzm, void *vpn, + void *vpm, void *vst, uint32_t desc) +{ + intptr_t row, col, oprsz = simd_maxsz(desc); + uint32_t neg = simd_data(desc) << 31; + uint16_t *pn = vpn, *pm = vpm; + float_status fpst = *(float_status *)vst; + + set_default_nan_mode(true, &fpst); + + for (row = 0; row < oprsz; ) { + uint16_t pa = pn[H2(row >> 4)]; + do { + if (pa & 1) { + void *vza_row = vza + tile_vslice_offset(row); + uint32_t n = *(uint32_t *)(vzn + row) ^ neg; + + for (col = 0; col < oprsz; ) { + uint16_t pb = pm[H2(col >> 4)]; + do { + if (pb & 1) { + uint32_t *a = vza_row + col; + uint32_t *m = vzm + col; + *a = float32_muladd(n, *m, *a, 0, vst); + } + col += 4; + pb >>= 4; + } while (col & 15); + } + } + row += 4; + pa >>= 4; + } while (row & 15); + } +} + +void HELPER(sme_fmopa_d)(void *vza, void *vzn, void *vzm, void *vpn, + void *vpm, void *vst, uint32_t desc) +{ + intptr_t row, col, oprsz = simd_oprsz(desc) / 8; + uint64_t neg = (uint64_t)simd_data(desc) << 63; + uint64_t *za = vza, *zn = vzn, *zm = vzm; + uint8_t *pn = vpn, *pm = vpm; + float_status fpst = *(float_status *)vst; + + set_default_nan_mode(true, &fpst); + + for (row = 0; row < oprsz; ++row) { + if (pn[H1(row)] & 1) { + uint64_t *za_row = &za[tile_vslice_index(row)]; + uint64_t n = zn[row] ^ neg; + + for (col = 0; col < oprsz; ++col) { + if (pm[H1(col)] & 1) { + uint64_t *a = &za_row[col]; + *a = float64_muladd(n, zm[col], *a, 0, &fpst); + } + } + } + } +} diff --git a/target/arm/translate-sme.c b/target/arm/translate-sme.c index d3b9cdd5c4..fa8f343a7d 100644 --- a/target/arm/translate-sme.c +++ b/target/arm/translate-sme.c @@ -298,3 +298,35 @@ TRANS_FEAT(ADDHA_s, aa64_sme, do_adda, a, MO_32, gen_helper_sme_addha_s) TRANS_FEAT(ADDVA_s, aa64_sme, do_adda, a, MO_32, gen_helper_sme_addva_s) TRANS_FEAT(ADDHA_d, aa64_sme_i16i64, do_adda, a, MO_64, gen_helper_sme_addha_d) TRANS_FEAT(ADDVA_d, aa64_sme_i16i64, do_adda, a, MO_64, gen_helper_sme_addva_d) + +static bool do_outprod_fpst(DisasContext *s, arg_op *a, MemOp esz, + gen_helper_gvec_5_ptr *fn) +{ + int svl = streaming_vec_reg_size(s); + uint32_t desc = simd_desc(svl, svl, a->sub); + TCGv_ptr za, zn, zm, pn, pm, fpst; + + if (!sme_smza_enabled_check(s)) { + return true; + } + + /* Sum XZR+zad to find ZAd. */ + za = get_tile_rowcol(s, esz, 31, a->zad, false); + zn = vec_full_reg_ptr(s, a->zn); + zm = vec_full_reg_ptr(s, a->zm); + pn = pred_full_reg_ptr(s, a->pn); + pm = pred_full_reg_ptr(s, a->pm); + fpst = fpstatus_ptr(FPST_FPCR); + + fn(za, zn, zm, pn, pm, fpst, tcg_constant_i32(desc)); + + tcg_temp_free_ptr(za); + tcg_temp_free_ptr(zn); + tcg_temp_free_ptr(pn); + tcg_temp_free_ptr(pm); + tcg_temp_free_ptr(fpst); + return true; +} + +TRANS_FEAT(FMOPA_s, aa64_sme, do_outprod_fpst, a, MO_32, gen_helper_sme_fmopa_s) +TRANS_FEAT(FMOPA_d, aa64_sme_f64f64, do_outprod_fpst, a, MO_64, gen_helper_sme_fmopa_d) From patchwork Wed Jul 6 08:23:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 587741 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1ec:0:0:0:0 with SMTP id 12csp2575836map; Wed, 6 Jul 2022 02:34:42 -0700 (PDT) X-Google-Smtp-Source: AGRyM1t8hUiamgiG8/UfDWZsVu91PkooMuG0bvYQ7TMbsDvxDLOo45CRn1RpK1clbpqBAl4AJine X-Received: by 2002:a25:d717:0:b0:66e:23cf:7f95 with SMTP id o23-20020a25d717000000b0066e23cf7f95mr23582244ybg.605.1657100082141; Wed, 06 Jul 2022 02:34:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657100082; cv=none; d=google.com; s=arc-20160816; b=wIm4ezVwNmHI0oMmXDt3J2iurehZbIbEYnKbsbNHA8bSs+5G0cvr8CIcDt3Ew975/w 5v+43ZeXGQLD80jaSIP5QwEXCubXUYLT0iFQEIAoLWNPeZH+HiEnb9JfQ/ysh67chnIb g8fGL6SCOS1KsfwvIC9XIM5trGkJFTCND/cCFlY10tWZlzjiPVr7huoIcs/TaQXD0ixU lr1tLzreQFVs2rq3S/ycj6srpaw5JrE+8P1fAuubpBNWZtdCZ1IeOHdtabYSQqNJKbZy SN8nrsDIkfktu8QWpjCSdGl7S5YsP0k0ZIj8DuSafB89DX5ulhBtIgXfPWEUi2dMW8Q+ 3Ndw== 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=x1EMK+9mWFwOGuXDAQlgUoQoDotScJuxq9dzCcNCSVk=; b=V1X97hL0VaiRrXtWy5NwAnF17tR4GACcrBoUltnDMo+UZ8gx2266gSu9+NuZ1NiNja PDCdqCiEw5cV+4Ve14tbTEt75Yi11t5+t36EsebgmVm8F3vmuvyMHCgbhxcGvnW1Ue8y PIDrHFkaqxttfIFhRFJbaVM8/Dvz8M0bjP65iqTKX2jpEmAn1OAX5yWMjJUM3r4KImME UrmAw6qEkfNI/MK4Ey//h++XSLvcM9rwS5f1rszKeAwVNTvI1YN68Vnq841cGc/k+Der +8zGK/j0NPRkFkQ6ZgZ6iRijYBl6mwL94tTH3k4luHs/tzYTwrP8w26nVMTKenef5UKW AOkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=m7LkWGiy; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d185-20020a254fc2000000b0066ea2c92b5csi253071ybb.264.2022.07.06.02.34.42 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Jul 2022 02:34:42 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=m7LkWGiy; 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]:47406 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o91Qf-0005ws-KN for patch@linaro.org; Wed, 06 Jul 2022 05:34:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49616) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o90Lf-0006Qc-S2 for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:25:28 -0400 Received: from mail-pg1-x534.google.com ([2607:f8b0:4864:20::534]:43868) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o90Le-0000he-69 for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:25:27 -0400 Received: by mail-pg1-x534.google.com with SMTP id j184so2808196pge.10 for ; Wed, 06 Jul 2022 01:25:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=x1EMK+9mWFwOGuXDAQlgUoQoDotScJuxq9dzCcNCSVk=; b=m7LkWGiy6uKRtv4m90EpYRWLCWUXL3+didGiHwWLwa5dA56N2l7xSKol22hEaRigJg qQgOyhG8iCIe7d9ZjQbis4ec3lVOeOCYUC+0iiiKF1HY0ahWhUsEIpJcbcEzYUrg4mot iBaMLM+6zVcHWNHSInPYVOhbdKiKu/0xWgILFXMvAgrS6OAmhCAH6UIBHcRl8vEKyg4g S+vLPBJ4e1+VHAGluK1NHF1jGOR/OggFodPO7ixCqLC1alKQ0X0lJRAYeD07NY7swDpg jWuEA+r41YoFAXI0Nrt8WcL995WOvk0GuOIC8wZye8rG5VebxkNEDCNjzA1WmUXIBzpo yl5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=x1EMK+9mWFwOGuXDAQlgUoQoDotScJuxq9dzCcNCSVk=; b=NPeR9BqJPreC2Zp6g/8HYUNTJL0aOhduy7MGxcUr7kH/b9tJOpE5h45ysdXFRgw5SN MkyXmp5IAeaR5cZaTaIO7aS386QjUz/jyHPFaCWZHl2JHpC1ltuu52EA7DEseUMfDKKO KYpx5nF8e5kgdKdJgZuBCZh7mGRFd+/l0CxgZm1tpuypQbyekSAO702WEymj1zG6upWE dkx5EpGYhVuORYCsjt5ZdYT8YEuBsOJwl0OAdTjBrHQ1bWeYdTNYBNglee84hPCWs1bW 5jIgdHYds5OrF86UjU9aS1jRojUJI2IBua57NALDRV1MNCZhcRHzmLg64gmt53torQUl 5HFA== X-Gm-Message-State: AJIora9CXeF60n/MUXFfH5+CTdTT8pY6UFjOq0vRGZdn51GmnWh1xiWO Jdr3ndjKzfQGJ7m+JgSN1HcypZMauyUdMMcN X-Received: by 2002:a63:bf4d:0:b0:40c:4060:f6d with SMTP id i13-20020a63bf4d000000b0040c40600f6dmr33998070pgo.254.1657095924278; Wed, 06 Jul 2022 01:25:24 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id t17-20020a170902e85100b00162529828aesm25199256plg.109.2022.07.06.01.25.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jul 2022 01:25:23 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v5 25/45] target/arm: Implement BFMOPA, BFMOPS Date: Wed, 6 Jul 2022 13:53:51 +0530 Message-Id: <20220706082411.1664825-26-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220706082411.1664825-1-richard.henderson@linaro.org> References: <20220706082411.1664825-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::534; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x534.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" Signed-off-by: Richard Henderson --- target/arm/helper-sme.h | 2 ++ target/arm/sme.decode | 2 ++ target/arm/sme_helper.c | 52 ++++++++++++++++++++++++++++++++++++++ target/arm/translate-sme.c | 30 ++++++++++++++++++++++ 4 files changed, 86 insertions(+) diff --git a/target/arm/helper-sme.h b/target/arm/helper-sme.h index f50d0fe1d6..1d68fb8c74 100644 --- a/target/arm/helper-sme.h +++ b/target/arm/helper-sme.h @@ -125,3 +125,5 @@ DEF_HELPER_FLAGS_7(sme_fmopa_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_7(sme_fmopa_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_6(sme_bfmopa, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, ptr, ptr, i32) diff --git a/target/arm/sme.decode b/target/arm/sme.decode index ba4774d174..afd9c0dffd 100644 --- a/target/arm/sme.decode +++ b/target/arm/sme.decode @@ -73,3 +73,5 @@ ADDVA_d 11000000 11 01000 1 ... ... ..... 00 ... @adda_64 FMOPA_s 10000000 100 ..... ... ... ..... . 00 .. @op_32 FMOPA_d 10000000 110 ..... ... ... ..... . 0 ... @op_64 + +BFMOPA 10000001 100 ..... ... ... ..... . 00 .. @op_32 diff --git a/target/arm/sme_helper.c b/target/arm/sme_helper.c index 78ba34f3d2..4b437bb913 100644 --- a/target/arm/sme_helper.c +++ b/target/arm/sme_helper.c @@ -981,3 +981,55 @@ void HELPER(sme_fmopa_d)(void *vza, void *vzn, void *vzm, void *vpn, } } } + +/* + * Alter PAIR as needed for controlling predicates being false, + * and for NEG on an enabled row element. + */ +static inline uint32_t f16mop_adj_pair(uint32_t pair, uint32_t pg, uint32_t neg) +{ + pair ^= neg; + if (!(pg & 1)) { + pair &= 0xffff0000u; + } + if (!(pg & 4)) { + pair &= 0x0000ffffu; + } + return pair; +} + +void HELPER(sme_bfmopa)(void *vza, void *vzn, void *vzm, void *vpn, + void *vpm, uint32_t desc) +{ + intptr_t row, col, oprsz = simd_maxsz(desc); + uint32_t neg = simd_data(desc) << 15; + uint16_t *pn = vpn, *pm = vpm; + + for (row = 0; row < oprsz; ) { + uint16_t pa = pn[H2(row >> 4)]; + do { + void *vza_row = vza + tile_vslice_offset(row); + uint32_t n = *(uint32_t *)(vzn + row); + + n = f16mop_adj_pair(n, pa, neg); + + for (col = 0; col < oprsz; ) { + uint16_t pb = pm[H2(col >> 4)]; + do { + if ((pa & 0b0101) == 0b0101 || (pb & 0b0101) == 0b0101) { + uint32_t *a = vza_row + col; + uint32_t m = *(uint32_t *)(vzm + col); + + m = f16mop_adj_pair(m, pb, neg); + *a = bfdotadd(*a, n, m); + + col += 4; + pb >>= 4; + } + } while (col & 15); + } + row += 4; + pa >>= 4; + } while (row & 15); + } +} diff --git a/target/arm/translate-sme.c b/target/arm/translate-sme.c index fa8f343a7d..ecb7583c55 100644 --- a/target/arm/translate-sme.c +++ b/target/arm/translate-sme.c @@ -299,6 +299,33 @@ TRANS_FEAT(ADDVA_s, aa64_sme, do_adda, a, MO_32, gen_helper_sme_addva_s) TRANS_FEAT(ADDHA_d, aa64_sme_i16i64, do_adda, a, MO_64, gen_helper_sme_addha_d) TRANS_FEAT(ADDVA_d, aa64_sme_i16i64, do_adda, a, MO_64, gen_helper_sme_addva_d) +static bool do_outprod(DisasContext *s, arg_op *a, MemOp esz, + gen_helper_gvec_5 *fn) +{ + int svl = streaming_vec_reg_size(s); + uint32_t desc = simd_desc(svl, svl, a->sub); + TCGv_ptr za, zn, zm, pn, pm; + + if (!sme_smza_enabled_check(s)) { + return true; + } + + /* Sum XZR+zad to find ZAd. */ + za = get_tile_rowcol(s, esz, 31, a->zad, false); + zn = vec_full_reg_ptr(s, a->zn); + zm = vec_full_reg_ptr(s, a->zm); + pn = pred_full_reg_ptr(s, a->pn); + pm = pred_full_reg_ptr(s, a->pm); + + fn(za, zn, zm, pn, pm, tcg_constant_i32(desc)); + + tcg_temp_free_ptr(za); + tcg_temp_free_ptr(zn); + tcg_temp_free_ptr(pn); + tcg_temp_free_ptr(pm); + return true; +} + static bool do_outprod_fpst(DisasContext *s, arg_op *a, MemOp esz, gen_helper_gvec_5_ptr *fn) { @@ -330,3 +357,6 @@ static bool do_outprod_fpst(DisasContext *s, arg_op *a, MemOp esz, TRANS_FEAT(FMOPA_s, aa64_sme, do_outprod_fpst, a, MO_32, gen_helper_sme_fmopa_s) TRANS_FEAT(FMOPA_d, aa64_sme_f64f64, do_outprod_fpst, a, MO_64, gen_helper_sme_fmopa_d) + +/* TODO: FEAT_EBF16 */ +TRANS_FEAT(BFMOPA, aa64_sme, do_outprod, a, MO_32, gen_helper_sme_bfmopa) From patchwork Wed Jul 6 08:23:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 587735 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1ec:0:0:0:0 with SMTP id 12csp2567772map; Wed, 6 Jul 2022 02:23:41 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sGh55tXUgCqc1gkntG17pw0gAVoDWfN++RdUrCjY5O+cKhnXCS4eK/E8saudiqqDDUbCS+ X-Received: by 2002:a05:620a:2402:b0:6af:19d6:7445 with SMTP id d2-20020a05620a240200b006af19d67445mr26415838qkn.450.1657099421205; Wed, 06 Jul 2022 02:23:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657099421; cv=none; d=google.com; s=arc-20160816; b=HXBW+SlzidCCy6c626wyzy1qIsrc+J8vJZpM6je071MXlQxM2QgFmSIpmz6mSrmTRC uQfWtRdNfgVZkymDo/ufYmJNbzw/+IYDO+AdC5sAuQ890v1XzMRh+8uL7f4dADjhzLbk /UwWz8Wi8qgjCvLgvkyAX/Bctxp8pRMIHlM9O/yBUgC843ReUMdYVdQQuRhuQF0Nwqo/ EkXk7QrX7S8fK5G/+oirEp2cNCFo4XkxuleJ0C5/Bjy5YtSoHca97wog83SXN3uaE9UU Cl78dGR7BO3ehIDvrZGH6Qyf5WtUfZJp9j7MCmGPEbOrrIR+4mSyAdQULPW5dt9hXSeC udoA== 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=lb8gvBs4PPSZA3dl0aQFL5IUdDDY/vtWudRXQbe3gfQ=; b=rpzSO7ZsM3CutLjg1caqTiHzNl+UWdj7loSd2KMjPO+c1xKpkHa5MLi9FzysTXM1DI Pa7v0dhSdQ3Awl/7chHrRHcFprbW9RquvqgCxd+dcm4gwHMKzKoJZ8V3v67Y18f6mLnE GtSHa3bfuUQnciBNQVQjScXh2UXkxzViRuNbU0Yu743RD09vMymkDC97QmdScskiakx0 VApUKFnekGY4U7PZMtN2kaBbHr1npGAmjn/9V8Raw0c0tjE1j0q3Jlpwou2G3NCrqwF0 4Z3MAcVrEgM78QJbx0c/W2veyRsaibdsII0aVHBmh19KfE2k2uvJQripCjveJlINKbvJ h8Cg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wy71BRs9; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id a14-20020ae9e80e000000b006aee42b5060si18785473qkg.119.2022.07.06.02.23.41 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Jul 2022 02:23:41 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wy71BRs9; 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]:55698 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o91G0-0000Pm-PA for patch@linaro.org; Wed, 06 Jul 2022 05:23:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49670) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o90Li-0006Ru-EE for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:25:30 -0400 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]:42823) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o90Lg-0000gD-Ke for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:25:30 -0400 Received: by mail-pf1-x42c.google.com with SMTP id b7so3233110pfb.9 for ; Wed, 06 Jul 2022 01:25:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=lb8gvBs4PPSZA3dl0aQFL5IUdDDY/vtWudRXQbe3gfQ=; b=wy71BRs9PrjNWAjzfpSxb1lMLu1pCIpfYUE1LnSohviOMVpq9NiUuAn03Z0iiIrHjS CON7gIPzHuSI40BZrYviObIwT05wTwKHEwFgkbHUxwStaQQbPq+hFthFRnx6LlR9/+7Y mA/R58d0g8AwgRWv3Oy4Z+PkxcmnL5MoOzyVolMt+gz1Wa85hcSq5ABgX5ZFNIjDbSq0 m9BWqUZ9I8OZzpIpAYDXQHv6Jh6h1ZqWDAycI44BPDy4RuqujcFcVGrwB5vZkZSUOVJG YpBovAIMXTjvgDV2gU4PH/pBMKooQRuHHhFx2u/DEQ8QMzwQj/hbo0kdXBk6bbwDosC+ GSRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=lb8gvBs4PPSZA3dl0aQFL5IUdDDY/vtWudRXQbe3gfQ=; b=GE3japF+iL2mfJXgqGJ1WrSvT0yrjZUaj3dQYKlwCF2+R3JobEbu6YnRlnHM5aU8G8 6XiQqcK25/p6dBFOXQUJgSmvoXG8RH+AJFo3ixaNcsrOV1/IQxy7+lpg8009+auwRRZK z92LJCHCS9Vry4n1zaj6LYBBOw9YSu3/NU1nimgCMSS7WnWfbaMcExHhwAtb6Bpw/l0u E3kEOE5L5IE56Cu8Thlkf48AMeQKCWGaNV34Lj8DKkTPfPHbJJpf+QkVx5F0ZWRJHbOe icNMrW2AdSVHPxpY5SwRtYU7P2V9BNrLCMP2pBngpUwkzHwOISW53K4uB/je3DaKw6Fw ZW2w== X-Gm-Message-State: AJIora9Kcn8/cDBgFIPuwTEQUG5sxLUn5f+CPCz6CdGrgnRU7mjHqF5y 2FDpbPQSfRNIH19S87B+LHAEywZc4IwZW1NJ X-Received: by 2002:a63:b105:0:b0:3fd:a875:d16 with SMTP id r5-20020a63b105000000b003fda8750d16mr33198803pgf.209.1657095927821; Wed, 06 Jul 2022 01:25:27 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id t17-20020a170902e85100b00162529828aesm25199256plg.109.2022.07.06.01.25.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jul 2022 01:25:27 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v5 26/45] target/arm: Implement FMOPA, FMOPS (widening) Date: Wed, 6 Jul 2022 13:53:52 +0530 Message-Id: <20220706082411.1664825-27-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220706082411.1664825-1-richard.henderson@linaro.org> References: <20220706082411.1664825-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42c; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42c.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" Signed-off-by: Richard Henderson --- target/arm/helper-sme.h | 2 ++ target/arm/sme.decode | 1 + target/arm/sme_helper.c | 68 ++++++++++++++++++++++++++++++++++++++ target/arm/translate-sme.c | 1 + 4 files changed, 72 insertions(+) diff --git a/target/arm/helper-sme.h b/target/arm/helper-sme.h index 1d68fb8c74..4d5d05db3a 100644 --- a/target/arm/helper-sme.h +++ b/target/arm/helper-sme.h @@ -121,6 +121,8 @@ DEF_HELPER_FLAGS_5(sme_addva_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_5(sme_addha_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_5(sme_addva_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_7(sme_fmopa_h, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_7(sme_fmopa_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_7(sme_fmopa_d, TCG_CALL_NO_RWG, diff --git a/target/arm/sme.decode b/target/arm/sme.decode index afd9c0dffd..e8d27fd8a0 100644 --- a/target/arm/sme.decode +++ b/target/arm/sme.decode @@ -75,3 +75,4 @@ FMOPA_s 10000000 100 ..... ... ... ..... . 00 .. @op_32 FMOPA_d 10000000 110 ..... ... ... ..... . 0 ... @op_64 BFMOPA 10000001 100 ..... ... ... ..... . 00 .. @op_32 +FMOPA_h 10000001 101 ..... ... ... ..... . 00 .. @op_32 diff --git a/target/arm/sme_helper.c b/target/arm/sme_helper.c index 4b437bb913..e92f53ecab 100644 --- a/target/arm/sme_helper.c +++ b/target/arm/sme_helper.c @@ -998,6 +998,74 @@ static inline uint32_t f16mop_adj_pair(uint32_t pair, uint32_t pg, uint32_t neg) return pair; } +static float32 f16_dotadd(float32 sum, uint32_t e1, uint32_t e2, + float_status *s_std, float_status *s_odd) +{ + float64 e1r = float16_to_float64(e1 & 0xffff, true, s_std); + float64 e1c = float16_to_float64(e1 >> 16, true, s_std); + float64 e2r = float16_to_float64(e2 & 0xffff, true, s_std); + float64 e2c = float16_to_float64(e2 >> 16, true, s_std); + float64 t64; + float32 t32; + + /* + * The ARM pseudocode function FPDot performs both multiplies + * and the add with a single rounding operation. Emulate this + * by performing the first multiply in round-to-odd, then doing + * the second multiply as fused multiply-add, and rounding to + * float32 all in one step. + */ + t64 = float64_mul(e1r, e2r, s_odd); + t64 = float64r32_muladd(e1c, e2c, t64, 0, s_std); + + /* This conversion is exact, because we've already rounded. */ + t32 = float64_to_float32(t64, s_std); + + /* The final accumulation step is not fused. */ + return float32_add(sum, t32, s_std); +} + +void HELPER(sme_fmopa_h)(void *vza, void *vzn, void *vzm, void *vpn, + void *vpm, void *vst, uint32_t desc) +{ + intptr_t row, col, oprsz = simd_maxsz(desc); + uint32_t neg = simd_data(desc) << 15; + uint16_t *pn = vpn, *pm = vpm; + float_status fpst_odd, fpst_std = *(float_status *)vst; + + set_default_nan_mode(true, &fpst_std); + fpst_odd = fpst_std; + set_float_rounding_mode(float_round_to_odd, &fpst_odd); + + for (row = 0; row < oprsz; ) { + uint16_t pa = pn[H2(row >> 4)]; + do { + void *vza_row = vza + tile_vslice_offset(row); + uint32_t n = *(uint32_t *)(vzn + row); + + n = f16mop_adj_pair(n, pa, neg); + + for (col = 0; col < oprsz; ) { + uint16_t pb = pm[H2(col >> 4)]; + do { + if ((pa & 0b0101) == 0b0101 || (pb & 0b0101) == 0b0101) { + uint32_t *a = vza_row + col; + uint32_t m = *(uint32_t *)(vzm + col); + + m = f16mop_adj_pair(m, pb, neg); + *a = f16_dotadd(*a, n, m, &fpst_std, &fpst_odd); + + col += 4; + pb >>= 4; + } + } while (col & 15); + } + row += 4; + pa >>= 4; + } while (row & 15); + } +} + void HELPER(sme_bfmopa)(void *vza, void *vzn, void *vzm, void *vpn, void *vpm, uint32_t desc) { diff --git a/target/arm/translate-sme.c b/target/arm/translate-sme.c index ecb7583c55..c2953b22ce 100644 --- a/target/arm/translate-sme.c +++ b/target/arm/translate-sme.c @@ -355,6 +355,7 @@ static bool do_outprod_fpst(DisasContext *s, arg_op *a, MemOp esz, return true; } +TRANS_FEAT(FMOPA_h, aa64_sme, do_outprod_fpst, a, MO_32, gen_helper_sme_fmopa_h) TRANS_FEAT(FMOPA_s, aa64_sme, do_outprod_fpst, a, MO_32, gen_helper_sme_fmopa_s) TRANS_FEAT(FMOPA_d, aa64_sme_f64f64, do_outprod_fpst, a, MO_64, gen_helper_sme_fmopa_d) From patchwork Wed Jul 6 08:23:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 587733 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1ec:0:0:0:0 with SMTP id 12csp2564062map; Wed, 6 Jul 2022 02:19:10 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sW2TubLBcZ4hzNaQuOLCo6mG42fZ1wBr4Xwq+rrEq9oEVtnv3cNJ8BHAKpVGtAaZmHvXo5 X-Received: by 2002:a25:d095:0:b0:66e:5f4d:ceb0 with SMTP id h143-20020a25d095000000b0066e5f4dceb0mr13323491ybg.330.1657099150766; Wed, 06 Jul 2022 02:19:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657099150; cv=none; d=google.com; s=arc-20160816; b=Ca+tOcQW9rdr3CWA/xnA6sItdnfR0QYSrsg1T1gcgvjTxg0ZvzrTNP0wTbXF5G1tMs 9B5Ibl51Kz4XasHSiLNWfIS7suVodcJO2hKQIB+tXJjC/HXjAepOQ09pM/fFmQZP8wMX mQKgF6Y47Fh8NAFT8eMBaOSfDTeY60cif9bRfVT8Q3+aYwM4mE1dctEMbL7PhE65bqhZ qESt2shZF+WE/NHVvO1rRx+xU5gFQ+khbzLT9vmh15SQlXz16FCCWsGZQvpDm4G/VEIM xI0EBFADpisQNp8+ISkbKjnWGsvemOUY0m7nJ7sEbvPYnfxIgqciE6JDFcjlbtPlT/Jb WxlA== 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=WNtCLwoyRYpaVnRk4zjBhOsbYZJZvCKr4GGrqivYraQ=; b=WlPEwYcwznllOZHuI4lUOzOCVSB/JnzhHKNMpUxYN9j6I4WN+afPN7mEiG97YKHDFI HpUIdwFAQ/m7I5niGQ2m/MiwqNlV0z2MKKFGcfb5uOnqE4QtJ7X0DoTMejKv6qu7KZLw 10/jPWz9kjJSOYOKrOmIRbNTJLwuqpTQzB5PT9Y84s1vRDbzVajGU96mFMPRNWaSWD+1 DJNn4U0d7sbkZ6y8e3ED/vB1RWCtBvWPUAwxxRGfMxvb29vryhBi64ps08LWIaeIfuB1 4ToLWV064jCidNhocMihspjx6oLvvQGN9h5Z+MK09b25Fi38AhUHNEVL7EUpRYOC27E8 T/cA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ajnFTYib; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id v83-20020a252f56000000b0066e52b8fd1esi10135056ybv.135.2022.07.06.02.19.10 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Jul 2022 02:19:10 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ajnFTYib; 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]:48110 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o91Be-0003aF-85 for patch@linaro.org; Wed, 06 Jul 2022 05:19:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49734) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o90Ln-0006XF-FI for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:25:35 -0400 Received: from mail-pg1-x530.google.com ([2607:f8b0:4864:20::530]:35403) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o90Lk-0000kE-Q8 for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:25:35 -0400 Received: by mail-pg1-x530.google.com with SMTP id r22so6548983pgr.2 for ; Wed, 06 Jul 2022 01:25:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WNtCLwoyRYpaVnRk4zjBhOsbYZJZvCKr4GGrqivYraQ=; b=ajnFTYibOLqRqNO6OhcWnhQo/A4Zm79FPh7CNvW+XdZYR2OtXPEIuO3+4rD8JQroQt W2rYP5/hV6EKLqP69TdEC6JptS4NrY8h7nxHuxTG6wd3Q8UwbPV1Zw8N/PA8h27BP4Lx XGxzcDLJilSSvKKLfzzK7V+iqRvGM8auASi/5xTDjA9FS7wHHdHhWDMSlG1qXjbAqcAu l9g89BLVXMz7IdwzQOzhL7ESDQZV418RXfsM2Zlh+g2s/BCoPqSf4wswBjEmX19VGNik 3yXy+s/Fp6ms8xCQA7FDvFnPe2feU0h2NPC5wv81IdyF6tb+zr0M+sGnjII5Ohx+3w4m fSTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WNtCLwoyRYpaVnRk4zjBhOsbYZJZvCKr4GGrqivYraQ=; b=tfhPfQM2A0Zv0UbYhYfcUN8KDFsLEfv7+SNdUOo0Kq3P4rECmlj7qDgogp8dJ0G/2y jtff4n/bgc1WSm2sOEA/xLm7Mt5/wVxtuAeWmW9rdYMI7vrErvSA/B25AvjIe1isFCmt XGAdX5dPWjdlLVC9wbXcA/yo9NVEfwFLObtCgvKdRxp77wVLDIdMPlQLkrlAw+Y/Q8L0 obcXcdk68N8Boxm6ogT2mjqK3g3HmKnwsAjhf0IB3BBUxHIUFkFhYxmEqp2/2oDX366U xZCxFnyj+giq5pcgXwV0NN0c2FUIH2fMtJbv6JbF5Cf8R8Qs0+82eeN3Pp6LYPr/90d4 qs+Q== X-Gm-Message-State: AJIora+ScV2pM+waxmFHFkYBGym3rG62iHxnxaNHi1RwbHEZzYQKOZZ8 FvewpOGxVXQjfv5m4sgYVYSnY3CDunSt4nry X-Received: by 2002:a63:4c07:0:b0:40d:8b81:5638 with SMTP id z7-20020a634c07000000b0040d8b815638mr32762127pga.449.1657095931384; Wed, 06 Jul 2022 01:25:31 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id t17-20020a170902e85100b00162529828aesm25199256plg.109.2022.07.06.01.25.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jul 2022 01:25:30 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v5 27/45] target/arm: Implement SME integer outer product Date: Wed, 6 Jul 2022 13:53:53 +0530 Message-Id: <20220706082411.1664825-28-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220706082411.1664825-1-richard.henderson@linaro.org> References: <20220706082411.1664825-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::530; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x530.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" This is SMOPA, SUMOPA, USMOPA_s, UMOPA, for both Int8 and Int16. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/helper-sme.h | 16 ++++++++ target/arm/sme.decode | 10 +++++ target/arm/sme_helper.c | 82 ++++++++++++++++++++++++++++++++++++++ target/arm/translate-sme.c | 10 +++++ 4 files changed, 118 insertions(+) diff --git a/target/arm/helper-sme.h b/target/arm/helper-sme.h index 4d5d05db3a..d2d544a696 100644 --- a/target/arm/helper-sme.h +++ b/target/arm/helper-sme.h @@ -129,3 +129,19 @@ DEF_HELPER_FLAGS_7(sme_fmopa_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_6(sme_bfmopa, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_6(sme_smopa_s, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_6(sme_umopa_s, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_6(sme_sumopa_s, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_6(sme_usmopa_s, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_6(sme_smopa_d, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_6(sme_umopa_d, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_6(sme_sumopa_d, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_6(sme_usmopa_d, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, ptr, ptr, i32) diff --git a/target/arm/sme.decode b/target/arm/sme.decode index e8d27fd8a0..628804e37a 100644 --- a/target/arm/sme.decode +++ b/target/arm/sme.decode @@ -76,3 +76,13 @@ FMOPA_d 10000000 110 ..... ... ... ..... . 0 ... @op_64 BFMOPA 10000001 100 ..... ... ... ..... . 00 .. @op_32 FMOPA_h 10000001 101 ..... ... ... ..... . 00 .. @op_32 + +SMOPA_s 1010000 0 10 0 ..... ... ... ..... . 00 .. @op_32 +SUMOPA_s 1010000 0 10 1 ..... ... ... ..... . 00 .. @op_32 +USMOPA_s 1010000 1 10 0 ..... ... ... ..... . 00 .. @op_32 +UMOPA_s 1010000 1 10 1 ..... ... ... ..... . 00 .. @op_32 + +SMOPA_d 1010000 0 11 0 ..... ... ... ..... . 0 ... @op_64 +SUMOPA_d 1010000 0 11 1 ..... ... ... ..... . 0 ... @op_64 +USMOPA_d 1010000 1 11 0 ..... ... ... ..... . 0 ... @op_64 +UMOPA_d 1010000 1 11 1 ..... ... ... ..... . 0 ... @op_64 diff --git a/target/arm/sme_helper.c b/target/arm/sme_helper.c index e92f53ecab..be5e79af70 100644 --- a/target/arm/sme_helper.c +++ b/target/arm/sme_helper.c @@ -1101,3 +1101,85 @@ void HELPER(sme_bfmopa)(void *vza, void *vzn, void *vzm, void *vpn, } while (row & 15); } } + +typedef uint64_t IMOPFn(uint64_t, uint64_t, uint64_t, uint8_t, bool); + +static inline void do_imopa(uint64_t *za, uint64_t *zn, uint64_t *zm, + uint8_t *pn, uint8_t *pm, + uint32_t desc, IMOPFn *fn) +{ + intptr_t row, col, oprsz = simd_oprsz(desc) / 8; + bool neg = simd_data(desc); + + for (row = 0; row < oprsz; ++row) { + uint8_t pa = pn[H1(row)]; + uint64_t *za_row = &za[tile_vslice_index(row)]; + uint64_t n = zn[row]; + + for (col = 0; col < oprsz; ++col) { + uint8_t pb = pm[H1(col)]; + uint64_t *a = &za_row[col]; + + *a = fn(n, zm[col], *a, pa & pb, neg); + } + } +} + +#define DEF_IMOP_32(NAME, NTYPE, MTYPE) \ +static uint64_t NAME(uint64_t n, uint64_t m, uint64_t a, uint8_t p, bool neg) \ +{ \ + uint32_t sum0 = 0, sum1 = 0; \ + /* Apply P to N as a mask, making the inactive elements 0. */ \ + n &= expand_pred_b(p); \ + sum0 += (NTYPE)(n >> 0) * (MTYPE)(m >> 0); \ + sum0 += (NTYPE)(n >> 8) * (MTYPE)(m >> 8); \ + sum0 += (NTYPE)(n >> 16) * (MTYPE)(m >> 16); \ + sum0 += (NTYPE)(n >> 24) * (MTYPE)(m >> 24); \ + sum1 += (NTYPE)(n >> 32) * (MTYPE)(m >> 32); \ + sum1 += (NTYPE)(n >> 40) * (MTYPE)(m >> 40); \ + sum1 += (NTYPE)(n >> 48) * (MTYPE)(m >> 48); \ + sum1 += (NTYPE)(n >> 56) * (MTYPE)(m >> 56); \ + if (neg) { \ + sum0 = (uint32_t)a - sum0, sum1 = (uint32_t)(a >> 32) - sum1; \ + } else { \ + sum0 = (uint32_t)a + sum0, sum1 = (uint32_t)(a >> 32) + sum1; \ + } \ + return ((uint64_t)sum1 << 32) | sum0; \ +} + +#define DEF_IMOP_64(NAME, NTYPE, MTYPE) \ +static uint64_t NAME(uint64_t n, uint64_t m, uint64_t a, uint8_t p, bool neg) \ +{ \ + uint64_t sum = 0; \ + /* Apply P to N as a mask, making the inactive elements 0. */ \ + n &= expand_pred_h(p); \ + sum += (NTYPE)(n >> 0) * (MTYPE)(m >> 0); \ + sum += (NTYPE)(n >> 16) * (MTYPE)(m >> 16); \ + sum += (NTYPE)(n >> 32) * (MTYPE)(m >> 32); \ + sum += (NTYPE)(n >> 48) * (MTYPE)(m >> 48); \ + return neg ? a - sum : a + sum; \ +} + +DEF_IMOP_32(smopa_s, int8_t, int8_t) +DEF_IMOP_32(umopa_s, uint8_t, uint8_t) +DEF_IMOP_32(sumopa_s, int8_t, uint8_t) +DEF_IMOP_32(usmopa_s, uint8_t, int8_t) + +DEF_IMOP_64(smopa_d, int16_t, int16_t) +DEF_IMOP_64(umopa_d, uint16_t, uint16_t) +DEF_IMOP_64(sumopa_d, int16_t, uint16_t) +DEF_IMOP_64(usmopa_d, uint16_t, int16_t) + +#define DEF_IMOPH(NAME) \ + void HELPER(sme_##NAME)(void *vza, void *vzn, void *vzm, void *vpn, \ + void *vpm, uint32_t desc) \ + { do_imopa(vza, vzn, vzm, vpn, vpm, desc, NAME); } + +DEF_IMOPH(smopa_s) +DEF_IMOPH(umopa_s) +DEF_IMOPH(sumopa_s) +DEF_IMOPH(usmopa_s) +DEF_IMOPH(smopa_d) +DEF_IMOPH(umopa_d) +DEF_IMOPH(sumopa_d) +DEF_IMOPH(usmopa_d) diff --git a/target/arm/translate-sme.c b/target/arm/translate-sme.c index c2953b22ce..7b87a9df63 100644 --- a/target/arm/translate-sme.c +++ b/target/arm/translate-sme.c @@ -361,3 +361,13 @@ TRANS_FEAT(FMOPA_d, aa64_sme_f64f64, do_outprod_fpst, a, MO_64, gen_helper_sme_f /* TODO: FEAT_EBF16 */ TRANS_FEAT(BFMOPA, aa64_sme, do_outprod, a, MO_32, gen_helper_sme_bfmopa) + +TRANS_FEAT(SMOPA_s, aa64_sme, do_outprod, a, MO_32, gen_helper_sme_smopa_s) +TRANS_FEAT(UMOPA_s, aa64_sme, do_outprod, a, MO_32, gen_helper_sme_umopa_s) +TRANS_FEAT(SUMOPA_s, aa64_sme, do_outprod, a, MO_32, gen_helper_sme_sumopa_s) +TRANS_FEAT(USMOPA_s, aa64_sme, do_outprod, a, MO_32, gen_helper_sme_usmopa_s) + +TRANS_FEAT(SMOPA_d, aa64_sme_i16i64, do_outprod, a, MO_64, gen_helper_sme_smopa_d) +TRANS_FEAT(UMOPA_d, aa64_sme_i16i64, do_outprod, a, MO_64, gen_helper_sme_umopa_d) +TRANS_FEAT(SUMOPA_d, aa64_sme_i16i64, do_outprod, a, MO_64, gen_helper_sme_sumopa_d) +TRANS_FEAT(USMOPA_d, aa64_sme_i16i64, do_outprod, a, MO_64, gen_helper_sme_usmopa_d) From patchwork Wed Jul 6 08:23:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 587737 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1ec:0:0:0:0 with SMTP id 12csp2567875map; Wed, 6 Jul 2022 02:23:51 -0700 (PDT) X-Google-Smtp-Source: AGRyM1v79bBpyaSE5dziJW3gF18MtgHQGvJfigjc4tfunxdObnTkwvBRo5aR2ZYyega4m+QZfGZu X-Received: by 2002:a05:622a:1042:b0:31d:4a3e:dc1f with SMTP id f2-20020a05622a104200b0031d4a3edc1fmr12872986qte.315.1657099431495; Wed, 06 Jul 2022 02:23:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657099431; cv=none; d=google.com; s=arc-20160816; b=GWTXmWfNKc55Id6EtzDyqwZysKNr+sIyuYWubA4lbwO3U9jsYgiWcjq4EXrziqeG0R 0umJZ+zIVYTMAvJZsT97S3rb1G+39536zm1baxTWJ7VMYJTsqzAF/S5keYWKMjqFTjTG aAmsizIdH9FpVcgMwqYUyv5cEB6zpEkawHFvFNgSj83RT3aZiQRTKuztwXae/CmKfGbG 4YSJfBtFZ8sCF5qCbgpjkIlN5RHJbrfCR839HmKjHCS3DANCcXmTWduQJIJDGOQGXM35 EHdWfXiUkwvGZj/Si3lUExo4iiHGAJ41fGU9gBytgGLaMXy5PR7sVD+HJUf6vK8d1nd9 aRVQ== 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=z4hqPmoRZ7cVUM8Y9hb593g0CFOYpdMYGSA5G3fCVmQ=; b=grU7c9OtCta/caJUbG6H89PejP+6lVx0mNJA10KePsz+HeiVKJZhp4O1sJ08MCriHA xod1Il8je7eL7ILKJGdZEFh6/0c6mvhWod+iLELQhGCi6kK8BDK/y/T6riZbj0RpLBh6 jSjKyIdFiLfMUh8lUFQMk0/9D0CtJYmV3BDzteXtUcFXVD8HWxip3474KCanpge7jahX Y5AVmV6mh6TAPPUzxZLk4d+jHvVPqEceG4SD/WmT3JJOK+mbCr+ruPCyRnkft2ElTELx QoQdJuZZYq48P8rJQ6CG+gX5E5GDm462zjvvXYz8s1GNL31UoRde5Z4/EI4JMUJ/dFla IglQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kQN9xa31; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d9-20020ac85ac9000000b0031a2a802d82si18190804qtd.351.2022.07.06.02.23.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Jul 2022 02:23:51 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kQN9xa31; 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]:56404 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o91GB-0000us-0I for patch@linaro.org; Wed, 06 Jul 2022 05:23:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49800) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o90Ls-0006bS-8Q for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:25:40 -0400 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]:40592) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o90Lo-0000dh-Ir for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:25:39 -0400 Received: by mail-pf1-x433.google.com with SMTP id y141so13725560pfb.7 for ; Wed, 06 Jul 2022 01:25:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=z4hqPmoRZ7cVUM8Y9hb593g0CFOYpdMYGSA5G3fCVmQ=; b=kQN9xa31mCVICHCMs4C9zeRWKoZnCF6Qa9PzjDwOpbVKVF7DMJXj52SW2FptVbxN0N FX0T+P89lqZOlVeilXYAypkbplkd266ZlBMkWAeUdJiEs/xZnBgGZ7MAqByT12JcWhiW X7Ko14qIFewZj2uf+l5tMOP5TYd+LmmhRhr69xka6fO7dFdKgWsQPhYTPUYLqjG+ME5D F7MVkto75X2m9A4w1I8HMIxyc+h6nVh2f6Pisfw+pJXyRVl07wHl9AJpEo8WbMRfTZ7O ndrHam+JVHVhG7KVbBfAhcINysSkG/o7GcJUPOV4JZmP8Lhb0FZQ9rC3erI7ptESEZ8w m46w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=z4hqPmoRZ7cVUM8Y9hb593g0CFOYpdMYGSA5G3fCVmQ=; b=xxqgfYe1XLZPpKbmvdCOtoZXiKMxs5pA4J+iEwd6R4S+2+H5TGPGGxYWnV6YBXCGtp 7Z68G16Moyfl5/LuvtKCNRd6z8AsDycU28B0A3ohS1KAPNprv6qTIPuOl4iRD72KWefa DoEO1L1b6E4Se5Dki05mS2PPKfCWZUVAlhcPbrw1LRigUr+OR3e3oTuhOX6eFIiLjI24 8CThtrc0EGsvMz7U12OMWE5I3r5gQ9BAGWwAH/PObfalv0aY/mOfw/A1MhxspFXZDKY8 ILoQiotKVMDMzv5soB7uFng0s1zHdYZLpIJeUNl9DOiOp9Bj5wX96DpaXEugL9RzrBhL mylg== X-Gm-Message-State: AJIora8kJlG6+uXomYW5c7o6A7AE04/trKSw+Z69qk5VCpuwBecQSufH o0zcJVfuh4zLM3j4GErYCj3nsx75MBQzl994 X-Received: by 2002:a63:5366:0:b0:411:415a:5888 with SMTP id t38-20020a635366000000b00411415a5888mr33140204pgl.286.1657095934817; Wed, 06 Jul 2022 01:25:34 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id t17-20020a170902e85100b00162529828aesm25199256plg.109.2022.07.06.01.25.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jul 2022 01:25:34 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v5 28/45] target/arm: Implement PSEL Date: Wed, 6 Jul 2022 13:53:54 +0530 Message-Id: <20220706082411.1664825-29-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220706082411.1664825-1-richard.henderson@linaro.org> References: <20220706082411.1664825-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::433; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x433.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" This is an SVE instruction that operates using the SVE vector length but that it is present only if SME is implemented. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/sve.decode | 20 +++++++++++++ target/arm/translate-sve.c | 57 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+) diff --git a/target/arm/sve.decode b/target/arm/sve.decode index 95af08c139..966803cbb7 100644 --- a/target/arm/sve.decode +++ b/target/arm/sve.decode @@ -1674,3 +1674,23 @@ BFMLALT_zzxw 01100100 11 1 ..... 0100.1 ..... ..... @rrxr_3a esz=2 ### SVE2 floating-point bfloat16 dot-product (indexed) BFDOT_zzxz 01100100 01 1 ..... 010000 ..... ..... @rrxr_2 esz=2 + +### SVE broadcast predicate element + +&psel esz pd pn pm rv imm +%psel_rv 16:2 !function=plus_12 +%psel_imm_b 22:2 19:2 +%psel_imm_h 22:2 20:1 +%psel_imm_s 22:2 +%psel_imm_d 23:1 +@psel ........ .. . ... .. .. pn:4 . pm:4 . pd:4 \ + &psel rv=%psel_rv + +PSEL 00100101 .. 1 ..1 .. 01 .... 0 .... 0 .... \ + @psel esz=0 imm=%psel_imm_b +PSEL 00100101 .. 1 .10 .. 01 .... 0 .... 0 .... \ + @psel esz=1 imm=%psel_imm_h +PSEL 00100101 .. 1 100 .. 01 .... 0 .... 0 .... \ + @psel esz=2 imm=%psel_imm_s +PSEL 00100101 .1 1 000 .. 01 .... 0 .... 0 .... \ + @psel esz=3 imm=%psel_imm_d diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c index fd1a173637..24ffb69a2a 100644 --- a/target/arm/translate-sve.c +++ b/target/arm/translate-sve.c @@ -7419,3 +7419,60 @@ static bool do_BFMLAL_zzxw(DisasContext *s, arg_rrxr_esz *a, bool sel) TRANS_FEAT(BFMLALB_zzxw, aa64_sve_bf16, do_BFMLAL_zzxw, a, false) TRANS_FEAT(BFMLALT_zzxw, aa64_sve_bf16, do_BFMLAL_zzxw, a, true) + +static bool trans_PSEL(DisasContext *s, arg_psel *a) +{ + int vl = vec_full_reg_size(s); + int pl = pred_gvec_reg_size(s); + int elements = vl >> a->esz; + TCGv_i64 tmp, didx, dbit; + TCGv_ptr ptr; + + if (!dc_isar_feature(aa64_sme, s)) { + return false; + } + if (!sve_access_check(s)) { + return true; + } + + tmp = tcg_temp_new_i64(); + dbit = tcg_temp_new_i64(); + didx = tcg_temp_new_i64(); + ptr = tcg_temp_new_ptr(); + + /* Compute the predicate element. */ + tcg_gen_addi_i64(tmp, cpu_reg(s, a->rv), a->imm); + if (is_power_of_2(elements)) { + tcg_gen_andi_i64(tmp, tmp, elements - 1); + } else { + tcg_gen_remu_i64(tmp, tmp, tcg_constant_i64(elements)); + } + + /* Extract the predicate byte and bit indices. */ + tcg_gen_shli_i64(tmp, tmp, a->esz); + tcg_gen_andi_i64(dbit, tmp, 7); + tcg_gen_shri_i64(didx, tmp, 3); + if (HOST_BIG_ENDIAN) { + tcg_gen_xori_i64(didx, didx, 7); + } + + /* Load the predicate word. */ + tcg_gen_trunc_i64_ptr(ptr, didx); + tcg_gen_add_ptr(ptr, ptr, cpu_env); + tcg_gen_ld8u_i64(tmp, ptr, pred_full_reg_offset(s, a->pm)); + + /* Extract the predicate bit and replicate to MO_64. */ + tcg_gen_shr_i64(tmp, tmp, dbit); + tcg_gen_andi_i64(tmp, tmp, 1); + tcg_gen_neg_i64(tmp, tmp); + + /* Apply to either copy the source, or write zeros. */ + tcg_gen_gvec_ands(MO_64, pred_full_reg_offset(s, a->pd), + pred_full_reg_offset(s, a->pn), tmp, pl, pl); + + tcg_temp_free_i64(tmp); + tcg_temp_free_i64(dbit); + tcg_temp_free_i64(didx); + tcg_temp_free_ptr(ptr); + return true; +} From patchwork Wed Jul 6 08:23:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 587743 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1ec:0:0:0:0 with SMTP id 12csp2578386map; Wed, 6 Jul 2022 02:38:58 -0700 (PDT) X-Google-Smtp-Source: AGRyM1s/hQNlnBZ4TyWzJCYhITaAg61pqgbxfPpaKm3LXN/WFY1Zi6u3m5dOynixuCvxAbJ9s5iR X-Received: by 2002:a05:6214:1cc7:b0:470:5371:26ff with SMTP id g7-20020a0562141cc700b00470537126ffmr34506262qvd.9.1657100338415; Wed, 06 Jul 2022 02:38:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657100338; cv=none; d=google.com; s=arc-20160816; b=ClPy8U+rOB3bfc8nYaK/6J4IYTwQfWZ9958CsEZ61d9uyNCc1Jj5OvzvS4Et6cluxN 7u2hua+7CFrRACiY4N0Ugaa4kL9DRttTgdJW/vyqm68LeGCfROheh6MrDUhVb1jajtwZ vKfCRGWkPBbMOw5lJBbANRaWekqWyaKDsltXiDc6RpMA2ZFFnh9FJQlQS52Q481dHFw8 bMIG+fR0bkQ8KZnjE53Xd4JAeAt/HbiNzqR94dWHOd5K9tSsXJzsciqKterRY4dIjTK2 P3Sg1uUd+rA3dQsOH/A8mOXb6Zj5BMBCYB6wyy2P2KvRMDM4MR6BM1U70vhYhwzfYsUp Rz4Q== 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=bq7X2GhXVvfG6Er6nutJ7UEGp/1xvxDoz5E5KPgsbCU=; b=UO+3mb7ArPKMB406n6YHf22xkHmIDAowW4uormGuiUZarPVjLy+jpAKv7idCpSI4aZ NnP25iIDPS/yEBjkcy9kWD+JcrhBFb32iNZ4qAgGEhQh2RcuIMY5UZMyPETcofsO2eBL TBkS1KE5TmW9ZQRU+7zd/LDaXV7gl7dQ38HYJsdHj8Z03o/so4xgQM1BoNU3VH7OGAU+ bRT2hCswXoyIlAlk1KaGhjKmKX3EO7CAHsa4yYrrwLP4FH3OgU0HpFakCVfzxpItqyCM 69NyX6rrVbNG6VYyZnq726NqmNlybzeYxJXy4BKtncHSNO8qC9XNEDT1vV20h0hjJhn2 ozmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=d6Ptz78P; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id js1-20020a0562142aa100b0047046ab70basi19723202qvb.1.2022.07.06.02.38.58 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Jul 2022 02:38:58 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=d6Ptz78P; 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]:58034 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o91Un-0004sF-Vn for patch@linaro.org; Wed, 06 Jul 2022 05:38:58 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49836) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o90Lu-0006dW-42 for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:25:43 -0400 Received: from mail-pg1-x52b.google.com ([2607:f8b0:4864:20::52b]:41737) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o90Lq-0000fk-An for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:25:40 -0400 Received: by mail-pg1-x52b.google.com with SMTP id 23so13442232pgc.8 for ; Wed, 06 Jul 2022 01:25:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=bq7X2GhXVvfG6Er6nutJ7UEGp/1xvxDoz5E5KPgsbCU=; b=d6Ptz78PcfIvBurU0XfR+GIVv4C/cw8l7/SFo+0sWHX4O2rDI8xHnZK1aLInY0sdC0 xC/PsU7iF/OPbH/MFgM7vg7hr3ai664oExtF9+S1FR8Prv+vxMZHASLqla6ACSoskdAL d4khLB3oivkhk7fVnKnCdby+z2WXi4SBKk/WQ3RSwCbFQ6Lhx2JbwNxpeUeGZckaUjiW ijfgDuq3u0yBL7HMk6PpoFKVYPmY/oDzcsc8ClwuErPzlFa52EvaNBGXH3ZkoHuyr4Q/ 3ib4DP+s5+7lNWfmwUMphMWEBt0szEsIi5kIO2qy6jlgoDSoNAPaSsiQ3pWpZHAcSH9F zZcA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=bq7X2GhXVvfG6Er6nutJ7UEGp/1xvxDoz5E5KPgsbCU=; b=jXjMMbxwy4Q0q+oQgqeBgUrQB42zJzEEoGtdg7MNcEcT0MLjJw7ppE83R3Uullwr8s ieVzG5wZjJ957kqdV6z+kxRnXaQRxtAbh2/6QeOUd1CW0bRAnpC+TXH9DXZxX1F0XyCp ClDCBMCO3ZFf3Gem9qYjiygUYTmXjq9c8awTr4vULpku19m0e/iJtVzziIaCnT5KS9us Rk8RPERFuB5zBMYyxIfz1DWRMWnFQJpU1kcgH0IEj96BcxX20R0T6vC0pOXAXDrvOXte zjVlhY8eoLRhqxStYNNrk83SKF5aJ4TY9eJ00cXVxNnn49ZY/oXEctZ8IeCRD/CsSyM6 KVUg== X-Gm-Message-State: AJIora8YV4MmSKUfbkgiundj5Gesj9NtAKMOjQOi41Upw0TSMnG8mkTx dCLQCCvt/eQigbX0Q+BCCMLVx821zgCJzuQv X-Received: by 2002:a63:dd4f:0:b0:411:e30d:6a0a with SMTP id g15-20020a63dd4f000000b00411e30d6a0amr22561093pgj.22.1657095937540; Wed, 06 Jul 2022 01:25:37 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id t17-20020a170902e85100b00162529828aesm25199256plg.109.2022.07.06.01.25.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jul 2022 01:25:37 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v5 29/45] target/arm: Implement REVD Date: Wed, 6 Jul 2022 13:53:55 +0530 Message-Id: <20220706082411.1664825-30-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220706082411.1664825-1-richard.henderson@linaro.org> References: <20220706082411.1664825-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52b; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52b.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" This is an SVE instruction that operates using the SVE vector length but that it is present only if SME is implemented. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/helper-sve.h | 2 ++ target/arm/sve.decode | 1 + target/arm/sve_helper.c | 16 ++++++++++++++++ target/arm/translate-sve.c | 2 ++ 4 files changed, 21 insertions(+) diff --git a/target/arm/helper-sve.h b/target/arm/helper-sve.h index ab0333400f..cc4e1d8948 100644 --- a/target/arm/helper-sve.h +++ b/target/arm/helper-sve.h @@ -719,6 +719,8 @@ DEF_HELPER_FLAGS_4(sve_revh_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(sve_revw_d, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_4(sme_revd_q, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) + DEF_HELPER_FLAGS_4(sve_rbit_b, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(sve_rbit_h, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) DEF_HELPER_FLAGS_4(sve_rbit_s, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, i32) diff --git a/target/arm/sve.decode b/target/arm/sve.decode index 966803cbb7..a9e48f07b4 100644 --- a/target/arm/sve.decode +++ b/target/arm/sve.decode @@ -652,6 +652,7 @@ REVB 00000101 .. 1001 00 100 ... ..... ..... @rd_pg_rn REVH 00000101 .. 1001 01 100 ... ..... ..... @rd_pg_rn REVW 00000101 .. 1001 10 100 ... ..... ..... @rd_pg_rn RBIT 00000101 .. 1001 11 100 ... ..... ..... @rd_pg_rn +REVD 00000101 00 1011 10 100 ... ..... ..... @rd_pg_rn_e0 # SVE vector splice (predicated, destructive) SPLICE 00000101 .. 101 100 100 ... ..... ..... @rdn_pg_rm diff --git a/target/arm/sve_helper.c b/target/arm/sve_helper.c index 9a26f253e0..5de82696b5 100644 --- a/target/arm/sve_helper.c +++ b/target/arm/sve_helper.c @@ -931,6 +931,22 @@ DO_ZPZ_D(sve_revh_d, uint64_t, hswap64) DO_ZPZ_D(sve_revw_d, uint64_t, wswap64) +void HELPER(sme_revd_q)(void *vd, void *vn, void *vg, uint32_t desc) +{ + intptr_t i, opr_sz = simd_oprsz(desc) / 8; + uint64_t *d = vd, *n = vn; + uint8_t *pg = vg; + + for (i = 0; i < opr_sz; i += 2) { + if (pg[H1(i)] & 1) { + uint64_t n0 = n[i + 0]; + uint64_t n1 = n[i + 1]; + d[i + 0] = n1; + d[i + 1] = n0; + } + } +} + DO_ZPZ(sve_rbit_b, uint8_t, H1, revbit8) DO_ZPZ(sve_rbit_h, uint16_t, H1_2, revbit16) DO_ZPZ(sve_rbit_s, uint32_t, H1_4, revbit32) diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c index 24ffb69a2a..9ed3b267fd 100644 --- a/target/arm/translate-sve.c +++ b/target/arm/translate-sve.c @@ -2901,6 +2901,8 @@ TRANS_FEAT(REVH, aa64_sve, gen_gvec_ool_arg_zpz, revh_fns[a->esz], a, 0) TRANS_FEAT(REVW, aa64_sve, gen_gvec_ool_arg_zpz, a->esz == 3 ? gen_helper_sve_revw_d : NULL, a, 0) +TRANS_FEAT(REVD, aa64_sme, gen_gvec_ool_arg_zpz, gen_helper_sme_revd_q, a, 0) + TRANS_FEAT(SPLICE, aa64_sve, gen_gvec_ool_arg_zpzz, gen_helper_sve_splice, a, a->esz) From patchwork Wed Jul 6 08:23:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 587734 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1ec:0:0:0:0 with SMTP id 12csp2564230map; Wed, 6 Jul 2022 02:19:21 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tSDsJ7AerEMbkA2a3H2XUDmhLzzg1EpSf4T5wBdk/JU/dJwCeXAi9MhPuGVPmaq2aY914r X-Received: by 2002:a25:6cc2:0:b0:66c:e387:4c56 with SMTP id h185-20020a256cc2000000b0066ce3874c56mr42020891ybc.260.1657099161864; Wed, 06 Jul 2022 02:19:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657099161; cv=none; d=google.com; s=arc-20160816; b=dHEzcNGcLmJ12MFan+DkPW8ylowllC4PaFwsja64J4+361VLPrcKGVte0dXuiTt8Zn hiPcn5+Rp9L538mpVLDrl3XS8J/pEC1euh6TGk2oEMHXgxEhqXk2eK7fmFT8EA1JB0d2 xDdI9lJfLqK1Vj6qwxuPtJgfxi4Kgt7g+gYMG+QGWyPlenDTFEjE3GoIdC+mfJCojyhZ r3p8Yqz5TNJqg7UHZySRSl1yxTX8S9+6zGZuk8JiBuWhJcke7fjD0Nkb1MwClchmuPde GVXsX0mHeC2+0cs10GfLOt08aU0AH3mgNOwJW1TrX/HZaf5vR4IWpDSoEgVLXU70PdkJ jZMA== 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=xDxZQB7t7jC7e11iBt04ewldeYznmzQBar7IyZiGr2c=; b=AZgp/+OyBxa7QkL2/0ptnNDEqffjR3E5zWgz/KXHGHQAgld0m2oXQsg3n7iq7ROPo9 vst7tIOY2gYIbU9rnBngiqOG6BHGajSNhvSTNHjdduafpP4i9+t0lQ4xN/LebXrUTy/R /w5FfeezpcnEf/hshtalRMqdUXxjUyjfPNWK2PpAD7e6EuHLC0929XfKVtnN1p9VT4xs fLOhBM+LbzGcTmRtZh+t3phbalkVkhfq8hHKnwD1n6YsEJFhvLLifg/BVfBEV3GdvAEL C2hrOooQ6AoKOguyYt8Ida29hf64Asw93mA26SzHUIZPuk78tRq2jgLlpulm9n1RLu9N dDQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mHQ9B5S9; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id y189-20020a814bc6000000b0031c8b9337b1si14344129ywa.448.2022.07.06.02.19.21 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Jul 2022 02:19:21 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mHQ9B5S9; 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]:49136 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o91Bp-0004GL-9s for patch@linaro.org; Wed, 06 Jul 2022 05:19:21 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49860) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o90Lv-0006eb-PP for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:25:43 -0400 Received: from mail-pg1-x52a.google.com ([2607:f8b0:4864:20::52a]:46596) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o90Lt-0000lS-Ry for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:25:43 -0400 Received: by mail-pg1-x52a.google.com with SMTP id s27so13418884pga.13 for ; Wed, 06 Jul 2022 01:25:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xDxZQB7t7jC7e11iBt04ewldeYznmzQBar7IyZiGr2c=; b=mHQ9B5S9w/+Xzi1hEengo43Rb2BSCsX5SiYQ6kmJG/RvtwFGtZf0KwhJ+HaVXip03P nSrQbThHbZFdqh52wII+7Y5cDSpvmuPqDgkdf6IeCqY2izLPAgy3pK2sY2npB35BQS3e MEi7Ix7OXNE7H3GyWaBb5m8ov/6nC//f41rcgcX6zWp1yLQwIWCg6cQufPOiprfL2RG9 gUdQZk15Rr3JOW7mausVauS2bxNUvy5foDAQAzbCjr8YjeYzF2I+WKSBCaNLqTlCm+y4 JA1xgPtEsj1sKSt4wTd9NfgQHsjrfhBOnyeUUw6y/nDO+rJEt8KM+yoU+/NnNbCBAfRj zesQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xDxZQB7t7jC7e11iBt04ewldeYznmzQBar7IyZiGr2c=; b=LiYsOMi6gOcOy/LXZ/znvPO79ctVZQFO3NP0EbroHneuPKTHbFSonf9pU/WZGdP9mb crhgS1STc3Zv6vmIKmUfowEbXh9df+BRzCd/VBXUYPDrVnxMLsxrl2Y9cXE5zvh5wXRP tsirHfqIMGxvXci0uGI/WTjEjk2sOajP1ruGaq1DcCNhPMbqIvCoqizulyTr3JcxS/LI Piq8suld2LzDOwSxyyZyyZYm7ueU7uESiewfoCpHcyi3/wp1mlE10/ww0xKk2gcNYCNI 7zrSSaY5zUNSZ5JRzdevGPKtgKPiC0+GQnN3GV9mRLn/iwmlr7EJbnV7WeP+CX9/El0e aSRQ== X-Gm-Message-State: AJIora+RUX52JiCgeKqa47tm2i1WY0NISm6eVWn+Y/2OcfHgNqMrIiVL p3BUcwRz6GvciLGOtDh6nOUcydcULWAbMAq0 X-Received: by 2002:a63:d315:0:b0:411:bbff:efbc with SMTP id b21-20020a63d315000000b00411bbffefbcmr26256340pgg.342.1657095939972; Wed, 06 Jul 2022 01:25:39 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id t17-20020a170902e85100b00162529828aesm25199256plg.109.2022.07.06.01.25.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jul 2022 01:25:39 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v5 30/45] target/arm: Implement SCLAMP, UCLAMP Date: Wed, 6 Jul 2022 13:53:56 +0530 Message-Id: <20220706082411.1664825-31-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220706082411.1664825-1-richard.henderson@linaro.org> References: <20220706082411.1664825-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52a; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52a.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" This is an SVE instruction that operates using the SVE vector length but that it is present only if SME is implemented. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/helper.h | 18 +++++++ target/arm/sve.decode | 5 ++ target/arm/translate-sve.c | 102 +++++++++++++++++++++++++++++++++++++ target/arm/vec_helper.c | 24 +++++++++ 4 files changed, 149 insertions(+) diff --git a/target/arm/helper.h b/target/arm/helper.h index 3a8ce42ab0..92f36d9dbb 100644 --- a/target/arm/helper.h +++ b/target/arm/helper.h @@ -1019,6 +1019,24 @@ DEF_HELPER_FLAGS_6(gvec_bfmlal, TCG_CALL_NO_RWG, DEF_HELPER_FLAGS_6(gvec_bfmlal_idx, TCG_CALL_NO_RWG, void, ptr, ptr, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_5(gvec_sclamp_b, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_5(gvec_sclamp_h, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_5(gvec_sclamp_s, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_5(gvec_sclamp_d, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, ptr, i32) + +DEF_HELPER_FLAGS_5(gvec_uclamp_b, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_5(gvec_uclamp_h, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_5(gvec_uclamp_s, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, ptr, i32) +DEF_HELPER_FLAGS_5(gvec_uclamp_d, TCG_CALL_NO_RWG, + void, ptr, ptr, ptr, ptr, i32) + #ifdef TARGET_AARCH64 #include "helper-a64.h" #include "helper-sve.h" diff --git a/target/arm/sve.decode b/target/arm/sve.decode index a9e48f07b4..14b3a69c36 100644 --- a/target/arm/sve.decode +++ b/target/arm/sve.decode @@ -1695,3 +1695,8 @@ PSEL 00100101 .. 1 100 .. 01 .... 0 .... 0 .... \ @psel esz=2 imm=%psel_imm_s PSEL 00100101 .1 1 000 .. 01 .... 0 .... 0 .... \ @psel esz=3 imm=%psel_imm_d + +### SVE clamp + +SCLAMP 01000100 .. 0 ..... 110000 ..... ..... @rda_rn_rm +UCLAMP 01000100 .. 0 ..... 110001 ..... ..... @rda_rn_rm diff --git a/target/arm/translate-sve.c b/target/arm/translate-sve.c index 9ed3b267fd..41f8b12259 100644 --- a/target/arm/translate-sve.c +++ b/target/arm/translate-sve.c @@ -7478,3 +7478,105 @@ static bool trans_PSEL(DisasContext *s, arg_psel *a) tcg_temp_free_ptr(ptr); return true; } + +static void gen_sclamp_i32(TCGv_i32 d, TCGv_i32 n, TCGv_i32 m, TCGv_i32 a) +{ + tcg_gen_smax_i32(d, a, n); + tcg_gen_smin_i32(d, d, m); +} + +static void gen_sclamp_i64(TCGv_i64 d, TCGv_i64 n, TCGv_i64 m, TCGv_i64 a) +{ + tcg_gen_smax_i64(d, a, n); + tcg_gen_smin_i64(d, d, m); +} + +static void gen_sclamp_vec(unsigned vece, TCGv_vec d, TCGv_vec n, + TCGv_vec m, TCGv_vec a) +{ + tcg_gen_smax_vec(vece, d, a, n); + tcg_gen_smin_vec(vece, d, d, m); +} + +static void gen_sclamp(unsigned vece, uint32_t d, uint32_t n, uint32_t m, + uint32_t a, uint32_t oprsz, uint32_t maxsz) +{ + static const TCGOpcode vecop[] = { + INDEX_op_smin_vec, INDEX_op_smax_vec, 0 + }; + static const GVecGen4 ops[4] = { + { .fniv = gen_sclamp_vec, + .fno = gen_helper_gvec_sclamp_b, + .opt_opc = vecop, + .vece = MO_8 }, + { .fniv = gen_sclamp_vec, + .fno = gen_helper_gvec_sclamp_h, + .opt_opc = vecop, + .vece = MO_16 }, + { .fni4 = gen_sclamp_i32, + .fniv = gen_sclamp_vec, + .fno = gen_helper_gvec_sclamp_s, + .opt_opc = vecop, + .vece = MO_32 }, + { .fni8 = gen_sclamp_i64, + .fniv = gen_sclamp_vec, + .fno = gen_helper_gvec_sclamp_d, + .opt_opc = vecop, + .vece = MO_64, + .prefer_i64 = TCG_TARGET_REG_BITS == 64 } + }; + tcg_gen_gvec_4(d, n, m, a, oprsz, maxsz, &ops[vece]); +} + +TRANS_FEAT(SCLAMP, aa64_sme, gen_gvec_fn_arg_zzzz, gen_sclamp, a) + +static void gen_uclamp_i32(TCGv_i32 d, TCGv_i32 n, TCGv_i32 m, TCGv_i32 a) +{ + tcg_gen_umax_i32(d, a, n); + tcg_gen_umin_i32(d, d, m); +} + +static void gen_uclamp_i64(TCGv_i64 d, TCGv_i64 n, TCGv_i64 m, TCGv_i64 a) +{ + tcg_gen_umax_i64(d, a, n); + tcg_gen_umin_i64(d, d, m); +} + +static void gen_uclamp_vec(unsigned vece, TCGv_vec d, TCGv_vec n, + TCGv_vec m, TCGv_vec a) +{ + tcg_gen_umax_vec(vece, d, a, n); + tcg_gen_umin_vec(vece, d, d, m); +} + +static void gen_uclamp(unsigned vece, uint32_t d, uint32_t n, uint32_t m, + uint32_t a, uint32_t oprsz, uint32_t maxsz) +{ + static const TCGOpcode vecop[] = { + INDEX_op_umin_vec, INDEX_op_umax_vec, 0 + }; + static const GVecGen4 ops[4] = { + { .fniv = gen_uclamp_vec, + .fno = gen_helper_gvec_uclamp_b, + .opt_opc = vecop, + .vece = MO_8 }, + { .fniv = gen_uclamp_vec, + .fno = gen_helper_gvec_uclamp_h, + .opt_opc = vecop, + .vece = MO_16 }, + { .fni4 = gen_uclamp_i32, + .fniv = gen_uclamp_vec, + .fno = gen_helper_gvec_uclamp_s, + .opt_opc = vecop, + .vece = MO_32 }, + { .fni8 = gen_uclamp_i64, + .fniv = gen_uclamp_vec, + .fno = gen_helper_gvec_uclamp_d, + .opt_opc = vecop, + .vece = MO_64, + .prefer_i64 = TCG_TARGET_REG_BITS == 64 } + }; + tcg_gen_gvec_4(d, n, m, a, oprsz, maxsz, &ops[vece]); +} + +TRANS_FEAT(UCLAMP, aa64_sme, gen_gvec_fn_arg_zzzz, gen_uclamp, a) diff --git a/target/arm/vec_helper.c b/target/arm/vec_helper.c index 9a9c034e36..f59d3b26ea 100644 --- a/target/arm/vec_helper.c +++ b/target/arm/vec_helper.c @@ -2690,3 +2690,27 @@ void HELPER(gvec_bfmlal_idx)(void *vd, void *vn, void *vm, } clear_tail(d, opr_sz, simd_maxsz(desc)); } + +#define DO_CLAMP(NAME, TYPE) \ +void HELPER(NAME)(void *d, void *n, void *m, void *a, uint32_t desc) \ +{ \ + intptr_t i, opr_sz = simd_oprsz(desc); \ + for (i = 0; i < opr_sz; i += sizeof(TYPE)) { \ + TYPE aa = *(TYPE *)(a + i); \ + TYPE nn = *(TYPE *)(n + i); \ + TYPE mm = *(TYPE *)(m + i); \ + TYPE dd = MIN(MAX(aa, nn), mm); \ + *(TYPE *)(d + i) = dd; \ + } \ + clear_tail(d, opr_sz, simd_maxsz(desc)); \ +} + +DO_CLAMP(gvec_sclamp_b, int8_t) +DO_CLAMP(gvec_sclamp_h, int16_t) +DO_CLAMP(gvec_sclamp_s, int32_t) +DO_CLAMP(gvec_sclamp_d, int64_t) + +DO_CLAMP(gvec_uclamp_b, uint8_t) +DO_CLAMP(gvec_uclamp_h, uint16_t) +DO_CLAMP(gvec_uclamp_s, uint32_t) +DO_CLAMP(gvec_uclamp_d, uint64_t) From patchwork Wed Jul 6 08:23:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 587745 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1ec:0:0:0:0 with SMTP id 12csp2580794map; Wed, 6 Jul 2022 02:42:36 -0700 (PDT) X-Google-Smtp-Source: AGRyM1unKmE2Maq/J8RddBF67beAoSlBsPcDQA+SMdaY1tviFfOk0Yf2vACTDpcOIFA46zL6C0s6 X-Received: by 2002:a0c:b284:0:b0:472:6e5e:e2f0 with SMTP id r4-20020a0cb284000000b004726e5ee2f0mr36349722qve.90.1657100556585; Wed, 06 Jul 2022 02:42:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657100556; cv=none; d=google.com; s=arc-20160816; b=dsCwa8Wd/MQ9jqA4UHF0FSjp9tGgYiVNc8kEzjr1Xgw1sfvaS1p6xiAMEa9/1ejGK3 z+D6HcP1zjq1rfI2lHtK7SwnjmrsahXpXDImEJz26HvAflOI8rwGbddgofgTVYpVJmZN x+z7E2EMCAiKwWQA45uLwpzkwMwIhQKS7W58PTP5dSuDwz+QVz60BYUnY1BfxwHuNmLt PXl/fWdt8FKoh9P3dUKBKl9uJvKA3PCq/oDD/FKrhypIT2jGR5HtLtI0Ah9v2XX2WYDB ecNumGut3gA81/lRsCtj2E0gz8M9NhvKXpjHqdOHgmAJI0UwcEss2JCTGmvuXuJKMeIR gBXw== 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=Pfb4nqNRQyJu+x99bnAw+yE0S7aPMHgZg/2pDMgRZBo=; b=XL1xNW5rIOcDOP1+nL+5ENPqwcI/S67ALoNcuqBeoOhxZzj6uaSpw2E+NCKlW9cUWi pnMZVn8lKLtjaub1EIRFbMkW+Rx8P7fNstij2gdROsxl3tcCt0My0rLNMI5bS82wQ1e0 qCvZQCg5TsMPVSz8p5BcCwK1+56F1YspB6Nea4k7sZ82bnkXlWeH7J69zmBBvJ2w/ZOs 06Pc81BomgB/GKIfkiZLOf9FpMvL+EL5EVBdtSKU4/AFeja2XorkcFvC3Yv5hsttvy6v PY+ZZrvZPlT4vXx56K4sh39AAQg8f10cUaIJFuTeTNtaOH3zXA5e2KxDo2PQYvEMpl7F IVHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YVfis2tL; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id if3-20020a0562141c4300b004702b7af6a9si22443882qvb.417.2022.07.06.02.42.36 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Jul 2022 02:42:36 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YVfis2tL; 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]:40498 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o91YJ-0003fB-Kf for patch@linaro.org; Wed, 06 Jul 2022 05:42:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49900) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o90Lx-0006fY-Gy for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:25:45 -0400 Received: from mail-pg1-x531.google.com ([2607:f8b0:4864:20::531]:34365) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o90Lw-0000lw-0f for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:25:45 -0400 Received: by mail-pg1-x531.google.com with SMTP id g4so13477429pgc.1 for ; Wed, 06 Jul 2022 01:25:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Pfb4nqNRQyJu+x99bnAw+yE0S7aPMHgZg/2pDMgRZBo=; b=YVfis2tL6P38QmeZKjMMr3YOtGQlLYhAb46d5OKOxX+M5so3sj+IYWUrp+PNXgH3rb RVg7EhTzkFVjgKeRvpa2AtpHtCM5d04XnqwDB49OEpO7RINf7uMP3TLn/tFdUZSYItlx WcZ0xAS3vCPONwgvNGXrfHzsIbjD35eoZq3cIbtvzS7ttfztRkc1iYzLc9Jdp7KQZmsB 6s0AFp/aB+BtqDs/nd0QG6bd/l708M1skuOP5u1GPJ+HYFQ8INm2ZLubVOMSuuPBLPNV HH+/QIRqiUTEeGPQSni7qCFYl8fggtn4D7ekmm7VXkFYiv+5mvV3U3bZdA8BTjeWaoSq MB9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Pfb4nqNRQyJu+x99bnAw+yE0S7aPMHgZg/2pDMgRZBo=; b=fUwMf19Ba24C7WuY7o/z8wFN0015scyJZHRtKGVbSvfQEEuIvpMmw7SxH+4iQxExck U2zPsvLkdTDQnhjLvnuRFMmhX2LHdCZDYUVU2X6BliuCt/2Cs+atWASGLtr44QaYrKx+ +2FyP8Kagnjx4WgAacmiscdOjwNSFnKejd4C8ES/CGx4hYgwDSF6/8jefoEkoU23TxfZ Ti07fwjICqkjq7ryST1yJJQsGK3FcFwdbM6k5seiUKkG8F6qfg7LL95toL8PjqGu9L0F R1vNiyjopx+MiZIBKn0e5oN/UdZRrQFBJVlvPIpLOfyuBPQq7Gdj7oAc/qMRuMacR3m6 14+Q== X-Gm-Message-State: AJIora/yGb9/PlLFd2/8IJ/jJMV341JR9DPv5MW++XJiuTgqtMOVxN0p Qm5W0UqmZHnuNY5eQxdZvEy9xahnXs/RZhF5 X-Received: by 2002:a63:293:0:b0:412:4f02:950f with SMTP id 141-20020a630293000000b004124f02950fmr11939919pgc.187.1657095942767; Wed, 06 Jul 2022 01:25:42 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id t17-20020a170902e85100b00162529828aesm25199256plg.109.2022.07.06.01.25.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jul 2022 01:25:42 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v5 31/45] target/arm: Reset streaming sve state on exception boundaries Date: Wed, 6 Jul 2022 13:53:57 +0530 Message-Id: <20220706082411.1664825-32-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220706082411.1664825-1-richard.henderson@linaro.org> References: <20220706082411.1664825-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::531; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x531.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" We can handle both exception entry and exception return by hooking into aarch64_sve_change_el. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/helper.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/target/arm/helper.c b/target/arm/helper.c index 67f8ca98f2..11f70725e5 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -11753,6 +11753,19 @@ void aarch64_sve_change_el(CPUARMState *env, int old_el, return; } + old_a64 = old_el ? arm_el_is_aa64(env, old_el) : el0_a64; + new_a64 = new_el ? arm_el_is_aa64(env, new_el) : el0_a64; + + /* + * Both AArch64.TakeException and AArch64.ExceptionReturn + * invoke ResetSVEState when taking an exception from, or + * returning to, AArch32 state when PSTATE.SM is enabled. + */ + if (old_a64 != new_a64 && FIELD_EX64(env->svcr, SVCR, SM)) { + arm_reset_sve_state(env); + return; + } + /* * DDI0584A.d sec 3.2: "If SVE instructions are disabled or trapped * at ELx, or not available because the EL is in AArch32 state, then @@ -11765,10 +11778,8 @@ void aarch64_sve_change_el(CPUARMState *env, int old_el, * we already have the correct register contents when encountering the * vq0->vq0 transition between EL0->EL1. */ - old_a64 = old_el ? arm_el_is_aa64(env, old_el) : el0_a64; old_len = (old_a64 && !sve_exception_el(env, old_el) ? sve_vqm1_for_el(env, old_el) : 0); - new_a64 = new_el ? arm_el_is_aa64(env, new_el) : el0_a64; new_len = (new_a64 && !sve_exception_el(env, new_el) ? sve_vqm1_for_el(env, new_el) : 0); From patchwork Wed Jul 6 08:23:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 587738 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1ec:0:0:0:0 with SMTP id 12csp2571197map; Wed, 6 Jul 2022 02:29:01 -0700 (PDT) X-Google-Smtp-Source: AGRyM1soAOxYQzwpbjMRQfONiQtJl7/pG20nkGOBf21idlS0PZWevMFxSb1/Q25S0BG5JnIpvPAs X-Received: by 2002:a5b:28d:0:b0:663:dcb8:ef54 with SMTP id x13-20020a5b028d000000b00663dcb8ef54mr43854140ybl.203.1657099741271; Wed, 06 Jul 2022 02:29:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657099741; cv=none; d=google.com; s=arc-20160816; b=ZC7srdmw8BDLBpFd9ug5PWC5xYOq65KofFu7ds09TaPl7wkzQyuBYvHq+XsOf2Kcq0 oRnXMRJ9d5kMv3GzZ4wxlfIqJSVV7cwilOYrQ8MYlMT/C6iktXn9dRLzCvzJaYXBU86E Cs1gjVt+iYuzTrcWGaMfdH4kgVjv7oyPRTCK9nAmCJR03KLQSgH9NoteklIZZlUnsFxw 101d/ay+21dzlvm2HAawevjYqvLOT9x6eAAozs/ttxeDbCuyWXdWX6Mnt6iN5jZpeoTn zgYGo39H3XjD+c2+xh3t2ryX3HJ4qS+nPKFHhknbmfsz2i824GccI6Jj3gYcVGnStZ91 mcQQ== 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=asVIVIoowKUhkyzxDq1stWKniA6O4cXXCtHWZbtFt2Q=; b=KljMFY99u/RAslJgV6Xd1jL7Q2rVNUWOa6BOb7DaZlO/WeiKjIzn3y7B7xfWChSXKy GTU7jIjLJBN4e51/nXgQaZ0Dt0nxs1igL6TSY8v9rbQ39ux9DHTXECmzt6YwdmYGpdkl B/AS2sqPIdLq8Zjqs3Nbdo6q5GPYt2hb4LE3RFEjXZq1XSQzYjJp2lr1TsEaVvkIOc0s OMzEVgEn0U7N6+Yr++XtH5c/zdI29EPD7WWICXlmVKTEezVk9VnVtWLAybXImGZuT4CO x4xLL5ErnI2x6RAivH3gsr0Mg13kCD59CLyQXWuwX/PilW80rzhZjgheIHZF/nj0Fx9a YzmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=A4bi2Wt1; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id y140-20020a253292000000b0066e333679cfsi16174825yby.228.2022.07.06.02.29.01 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Jul 2022 02:29:01 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=A4bi2Wt1; 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]:37514 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o91L7-0007Rx-Bn for patch@linaro.org; Wed, 06 Jul 2022 05:28:57 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49934) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o90M0-0006iO-2A for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:25:49 -0400 Received: from mail-pf1-x431.google.com ([2607:f8b0:4864:20::431]:33578) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o90Ly-0000mY-Fa for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:25:47 -0400 Received: by mail-pf1-x431.google.com with SMTP id n12so13789727pfq.0 for ; Wed, 06 Jul 2022 01:25:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=asVIVIoowKUhkyzxDq1stWKniA6O4cXXCtHWZbtFt2Q=; b=A4bi2Wt1/yill0hOQ8JbL5QHzZxSrAqRK9S93r0jrd1wyxlb40kmlfuNT+ukO2kddW gWdrmgqq/6Tdmand/FEIylhEdH6I8ug46Z12RgBeICXgYRPWUbPIPB5K7vy6lKDww6F4 ttnhzJ6qFKkq7c0Yjvq3huNKVtvsen8aNa9StO3gPbP3nAfdFZyYXJbR8QkMeZovXc67 qMyrTI9LQdgxeSKkroiVQQ6oX4cZ0QJhOlp5BoRHN2tY3ycIqDo3m07t0QJ70KYmB2Ka MCtISrNvszJw5+1opdAhUEhps4QDi+89IvAz1sDDp1+cUIIVk8s0RJzunYb0hfkUd+MJ DksA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=asVIVIoowKUhkyzxDq1stWKniA6O4cXXCtHWZbtFt2Q=; b=3dsPFz5sMTZ9DwUHGVo4t/5i0jjN+nAHUqVTWkKTpd0bCN7dzMDOTaXqiywRn9qmBo gUNc+Dv8/rFKSPupltzBY+V1d9YT5RiF4Unowgt6nDQK0UoMjjuelaKO8yzgXBLHspC+ ms7TR9gRGRo7XLxft8yW0mlXllZoNBmkHWpjeXaJ2QIuY7VbSyU6Nu4hThGcz1RBD6dL KnMke6VVav/cuMPnAhOOYh8Q2xgLVEtg95oZKNrIJTer/ll8/KobCoUDdYR1TV/4aKvb RA7cvjRcpa+ISVhY9Bg4U3NPx0o+HEDqGDBOm36IEjKU84Ld+hFFZ/CW55iVdSe7jBPr 3mfg== X-Gm-Message-State: AJIora9jOrWdvusklDdCxCs19Etmko8tjHJOnEaN3oscyhTtGOk5YFbJ QHcyRWtpoFBD6+Cmtp8sAdvvbFwMXVQDHjc9 X-Received: by 2002:aa7:9823:0:b0:525:15b1:3297 with SMTP id q3-20020aa79823000000b0052515b13297mr45774128pfl.13.1657095945261; Wed, 06 Jul 2022 01:25:45 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id t17-20020a170902e85100b00162529828aesm25199256plg.109.2022.07.06.01.25.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jul 2022 01:25:44 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v5 32/45] target/arm: Enable SME for -cpu max Date: Wed, 6 Jul 2022 13:53:58 +0530 Message-Id: <20220706082411.1664825-33-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220706082411.1664825-1-richard.henderson@linaro.org> References: <20220706082411.1664825-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::431; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x431.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Note that SME remains effectively disabled for user-only, because we do not yet set CPACR_EL1.SMEN. This needs to wait until the kernel ABI is implemented. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- docs/system/arm/emulation.rst | 4 ++++ target/arm/cpu64.c | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/docs/system/arm/emulation.rst b/docs/system/arm/emulation.rst index 83b4410065..8e494c8bea 100644 --- a/docs/system/arm/emulation.rst +++ b/docs/system/arm/emulation.rst @@ -65,6 +65,10 @@ the following architecture extensions: - FEAT_SHA512 (Advanced SIMD SHA512 instructions) - FEAT_SM3 (Advanced SIMD SM3 instructions) - FEAT_SM4 (Advanced SIMD SM4 instructions) +- FEAT_SME (Scalable Matrix Extension) +- FEAT_SME_FA64 (Full A64 instruction set in Streaming SVE mode) +- FEAT_SME_F64F64 (Double-precision floating-point outer product instructions) +- FEAT_SME_I16I64 (16-bit to 64-bit integer widening outer product instructions) - FEAT_SPECRES (Speculation restriction instructions) - FEAT_SSBS (Speculative Store Bypass Safe) - FEAT_TLBIOS (TLB invalidate instructions in Outer Shareable domain) diff --git a/target/arm/cpu64.c b/target/arm/cpu64.c index 19188d6cc2..40a0f043d0 100644 --- a/target/arm/cpu64.c +++ b/target/arm/cpu64.c @@ -1018,6 +1018,7 @@ static void aarch64_max_initfn(Object *obj) */ t = FIELD_DP64(t, ID_AA64PFR1, MTE, 3); /* FEAT_MTE3 */ t = FIELD_DP64(t, ID_AA64PFR1, RAS_FRAC, 0); /* FEAT_RASv1p1 + FEAT_DoubleFault */ + t = FIELD_DP64(t, ID_AA64PFR1, SME, 1); /* FEAT_SME */ t = FIELD_DP64(t, ID_AA64PFR1, CSV2_FRAC, 0); /* FEAT_CSV2_2 */ cpu->isar.id_aa64pfr1 = t; @@ -1068,6 +1069,16 @@ static void aarch64_max_initfn(Object *obj) t = FIELD_DP64(t, ID_AA64DFR0, PMUVER, 5); /* FEAT_PMUv3p4 */ cpu->isar.id_aa64dfr0 = t; + t = cpu->isar.id_aa64smfr0; + t = FIELD_DP64(t, ID_AA64SMFR0, F32F32, 1); /* FEAT_SME */ + t = FIELD_DP64(t, ID_AA64SMFR0, B16F32, 1); /* FEAT_SME */ + t = FIELD_DP64(t, ID_AA64SMFR0, F16F32, 1); /* FEAT_SME */ + t = FIELD_DP64(t, ID_AA64SMFR0, I8I32, 0xf); /* FEAT_SME */ + t = FIELD_DP64(t, ID_AA64SMFR0, F64F64, 1); /* FEAT_SME_F64F64 */ + t = FIELD_DP64(t, ID_AA64SMFR0, I16I64, 0xf); /* FEAT_SME_I16I64 */ + t = FIELD_DP64(t, ID_AA64SMFR0, FA64, 1); /* FEAT_SME_FA64 */ + cpu->isar.id_aa64smfr0 = t; + /* Replicate the same data to the 32-bit id registers. */ aa32_max_features(cpu); From patchwork Wed Jul 6 08:23:59 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 587748 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1ec:0:0:0:0 with SMTP id 12csp2583278map; Wed, 6 Jul 2022 02:46:15 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sHUK78qiGqDaoHmTzbR2hqEwmaUZkICYdhBUwxaYtc2znRdTFQzymOUeoAUakHDKbiH2gj X-Received: by 2002:a05:6214:762:b0:472:d7cf:15af with SMTP id f2-20020a056214076200b00472d7cf15afmr18939381qvz.11.1657100775369; Wed, 06 Jul 2022 02:46:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657100775; cv=none; d=google.com; s=arc-20160816; b=YzztauBLWPFmq9hX2eTVZjidEIxAk/Ru+OozXYcSFgYbn3rDHFy44i2+Xe4EQu/hwm gE1h+Q7Cqwh1+1IRxLnzXWs+Qir0xXIuIs7agEKKv1b/SgVuvKIuSBIjSxbjtrlQlUF/ jnE72a0PvfX+SpIayQoOX11cPL25I6r7togGH/qEZsPW7rq1AbZCKs2QVI96Tg1faDyT 3g/77rszGv5iF2/XnQD0yxdrOdJ47BtefeGH/nM7egJszD7wi5LvGA/zW1c2eE5vv1kz +Lw54dBUTPjC6zF2C2v8i6bUOBYpN3UAjvOkR5cut8gnTNebSO9brsG2CvqngO/UGDTZ S5fg== 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=5PME71S11cSPKZ4C3ISqAJ4KA5QkjnbMhk+jE1tP2f8=; b=MFWHrZEGy8K4VNVez9lnrsC3XBOeVAXK4ksTTKjmOLhFYOV5EpbeXCIDx+FQDZSrhI rBkQ8YyBBMKjhNrkbgbWLBAecmEjH/ihUMoAEFSYP0VHGJOqeSNnSPJKFyhIrPyg1Hve QbzhaGMACDRaIEzvjCQHB5LPemjtx6lcea3Z3TdUybLPoBWP5xze/9BHfEdfbC1ICgl7 i4qB/vgHv4XF3Z4l2DdfzwkEtL4C+RvQw/TbaCu4NxsyFlXkzU+Q+ph/bQVFoA8BmJZM sdvQT/rUTmNbHMDV9w2bSsjlW1Clx01eUBncFNzOkuh9Qusu2bRviAotHMYVayzQ5cFW rS8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=n2hNMV3t; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id f19-20020ac80153000000b0031d295405c1si13859875qtg.620.2022.07.06.02.46.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Jul 2022 02:46:15 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=n2hNMV3t; 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]:50030 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o91bq-0001aZ-0o for patch@linaro.org; Wed, 06 Jul 2022 05:46:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49970) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o90M2-0006lA-Ug for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:25:51 -0400 Received: from mail-pf1-x42d.google.com ([2607:f8b0:4864:20::42d]:36515) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o90M1-0000mw-Cq for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:25:50 -0400 Received: by mail-pf1-x42d.google.com with SMTP id 3so3606658pfx.3 for ; Wed, 06 Jul 2022 01:25:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=5PME71S11cSPKZ4C3ISqAJ4KA5QkjnbMhk+jE1tP2f8=; b=n2hNMV3ts2wFxtT24y+x4xXHsfW308Op6TfP7lT4JO/GiK5FErs+ji73c80l6fHUyv Mdk/U+oobIb3pIbkZvTb52ybSO7aWGaE3IWjkhCvxOxBfw55pzU+vOB8HuZivaeyM3TY kyczvzj1yDEn4q+NCaDqfPkkv5lvE4tj9cXP/IuLDA0Y80HEjjrgG0AXLAE3MUi2JMLt Vc+Sx/HjhBBH0SjHrPUdsV9Cu+laH1skrHGDO8/WEcDU1EaFkBGFJQ5emb5YD95XrTCJ 9bHJXh+9pMVdaMmddDwFHdfw+PvkPEf0GJ3jVsjy4bKeqQr+xYkkNbZ+MRzWLrfdw8x5 ptVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=5PME71S11cSPKZ4C3ISqAJ4KA5QkjnbMhk+jE1tP2f8=; b=dj6NZvlhuPAy9b1dPCjSirzM6jp0Q4bx8wG7Aatn6ubUFEaK2SnsI4uB0aWX+B1ztm WjyrAdSB6lZvSPL9ZVVkk2mZmnUVrx4x6on11Wh8DsV327AMA6t4QL8Lhi98qCruDmjz pNa9GCPyOcZ/LCERlW3GeEvsKDSnFnFGiEXhdgGtgKrpa4bE3smbvYZd6sPk9/Um6zW/ AhvN+NHJy465pKY1By0fMKKdJFOMrE5uWSNDNvIidUFytyyCDB7vtDX2M+COoHO4IFlK dUOZ4MDo/fvN/1nhU5rtKKXLxrGW6069ucOkzDbThLCHpC4xOWgP5WXKVd+wxSGFFfqZ XHFQ== X-Gm-Message-State: AJIora+BBndSv3Ua9lHHieXzrB9u1jAUFQaoJAxZp4t80eXVf9PvLqcC wES3BypIfCbF9QDt/suHecTxxvAkPpOJisxs X-Received: by 2002:a63:4b17:0:b0:412:83cf:ecaf with SMTP id y23-20020a634b17000000b0041283cfecafmr4827391pga.105.1657095947553; Wed, 06 Jul 2022 01:25:47 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id t17-20020a170902e85100b00162529828aesm25199256plg.109.2022.07.06.01.25.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jul 2022 01:25:47 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v5 33/45] linux-user/aarch64: Clear tpidr2_el0 if CLONE_SETTLS Date: Wed, 6 Jul 2022 13:53:59 +0530 Message-Id: <20220706082411.1664825-34-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220706082411.1664825-1-richard.henderson@linaro.org> References: <20220706082411.1664825-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42d; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42d.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" Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- linux-user/aarch64/target_cpu.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/linux-user/aarch64/target_cpu.h b/linux-user/aarch64/target_cpu.h index 97a477bd3e..f90359faf2 100644 --- a/linux-user/aarch64/target_cpu.h +++ b/linux-user/aarch64/target_cpu.h @@ -34,10 +34,13 @@ static inline void cpu_clone_regs_parent(CPUARMState *env, unsigned flags) static inline void cpu_set_tls(CPUARMState *env, target_ulong newtls) { - /* Note that AArch64 Linux keeps the TLS pointer in TPIDR; this is + /* + * Note that AArch64 Linux keeps the TLS pointer in TPIDR; this is * different from AArch32 Linux, which uses TPIDRRO. */ env->cp15.tpidr_el[0] = newtls; + /* TPIDR2_EL0 is cleared with CLONE_SETTLS. */ + env->cp15.tpidr2_el0 = 0; } static inline abi_ulong get_sp_from_cpustate(CPUARMState *state) From patchwork Wed Jul 6 08:24:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 587749 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1ec:0:0:0:0 with SMTP id 12csp2586691map; Wed, 6 Jul 2022 02:52:04 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uJDdftUdvIzNoibxCNhJEVF51IP0iGW8HPpgngrxcm+uYZTt/E2o6PB2s73FXmwzP62InS X-Received: by 2002:a05:622a:3cc:b0:317:cdb0:e with SMTP id k12-20020a05622a03cc00b00317cdb0000emr31105313qtx.190.1657101124578; Wed, 06 Jul 2022 02:52:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657101124; cv=none; d=google.com; s=arc-20160816; b=CAscUCFJJ1w1ETT9EpRTCmNW+JNfKcRZDDpyyqtd9gC6LQgwbYoLrlLn+fQ9rx3y2/ /ff8MnBcy1ZKOxFslFvHIMJIOzjYlDqu5IJUa3/ly/BSWRbweCknvuRYpKq4ik3xJq5I trB/UO48RrVuf06T+5HZG7aaBFRTRqA286T++ejZLLj4b773kPsE9fn1y5GUnUekAjlw JAWl+m6PAnp/DSBU3rLKc8yiOYoqxpfQxaroA/GIiJ0SFNeb9a5bdW284ioRKwCjKKBB kBZJirm50RaJ+pC8mN4NezDg3tHJ4+vaKAc4jH4s63Cqxr59edOnivShJjauOnRx/mBx LX4A== 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=QXu/KgUnFX9XdonKOb4RpodqXgfNtkqVhXPaRa0Wz+g=; b=qMaldD8xh17tNEAX8WTkzFzVQQX30nOwZJPt/xaZ2fkpqbxyfrQZ07qmsTccLlARJM 8q3E0q8u2QFF60mGtHquTcDbfnG/ZZUKPjEIy0sKsK5aTorDoYYW3qxZN+fEYprhxyiz 3BfepkUGKv1lAYetTv5QrIC3CZoAqTwoO6b3oFGFzWu1HmOvpjLIzmySgM3ca9nNbl+f bVEc8LiVQl/cmKdR1DCRoaYlCcNZeix6lgyHorqXt9eUWzqM5CUQce4sSCIZrzjAwuwb vav0JpnGR+8M9AIpWy+4N+GR0VgXrTJQaapzvVapjNN3SvgFNAJNqQFSqZiUuWKdkj/C gOxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="vLH8u/YI"; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id u8-20020a05620a454800b006b052945441si16135034qkp.473.2022.07.06.02.52.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Jul 2022 02:52:04 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="vLH8u/YI"; 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]:58546 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o91hU-0007wN-5c for patch@linaro.org; Wed, 06 Jul 2022 05:52:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50010) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o90M5-0006oP-OE for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:25:53 -0400 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]:45869) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o90M3-0000nB-5o for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:25:52 -0400 Received: by mail-pf1-x433.google.com with SMTP id 128so13704299pfv.12 for ; Wed, 06 Jul 2022 01:25:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=QXu/KgUnFX9XdonKOb4RpodqXgfNtkqVhXPaRa0Wz+g=; b=vLH8u/YI6xNxYEqgir1ZeiCndQwgdBo+q/o9gvHh83VvtPfjnuOFng5j5qZUlVptkO zC9ZtRT0OUKcaK5BtjJxZcqIDLjNDpYzOo4Yrogu8y3X8BezJzHfiMYDQjq5xQG6m9Cd kYSJXJfqUrA3pdoHUL6cy/1ZOtUKMUbeRBGKfHU705kU/n+e/wmIJu2gMv0NJ6jRGeMe GDHqpvAszlmFK8TjSzYTDSehB3TnmZd1uVpaQ/pdvOXWcYdPydqFwODtDfLQMP6Z7pzc 4+t/Jfgg41865AqcYK+zFqbgu0ev40xlhFeWZbsOC474WV1Z7eAsDNe8hqq2xROBAF08 M+yA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=QXu/KgUnFX9XdonKOb4RpodqXgfNtkqVhXPaRa0Wz+g=; b=It0Uhe6qKcGMHK5K9uwmo9o7YGiLuNrGDcv7nqDGDvkaRHvvQFtaCMnn0SM8tWZVDY j/VarQqucO1CjNcLXHYsVIFMiTFcqDGOOpFblpkgl+VzMEMMS9OWG7ctHQXinKrYR5lU o50y/AyYJBzEWWvhz5uIVlqO7mTRvwpvhib69i/Z1zgSfkSR+MvlunwuWDtpiXDwJwga Agub6HqN2wcMbh3IeFshVpK+OehgxQdTFM8T+jnWh0iEyMGHz6nqhOUpOIillYxjN9oC mNk7QXX90u9aQ8OFXouY2nOMpY57n5jACADlehUIrPkoDx5LXa0Amla7OsdYoxVygN8p Rxpg== X-Gm-Message-State: AJIora++N65W4JzXwNNbffYBuu9QhShQLkV4cUk18ZuMkpLruK+NK5pW ne/KxzyZl7InrsXHD8GBIJxg48xr7sIigXKX X-Received: by 2002:a05:6a00:1901:b0:4fa:fa9e:42e6 with SMTP id y1-20020a056a00190100b004fafa9e42e6mr45598933pfi.1.1657095949999; Wed, 06 Jul 2022 01:25:49 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id t17-20020a170902e85100b00162529828aesm25199256plg.109.2022.07.06.01.25.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jul 2022 01:25:49 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v5 34/45] linux-user/aarch64: Reset PSTATE.SM on syscalls Date: Wed, 6 Jul 2022 13:54:00 +0530 Message-Id: <20220706082411.1664825-35-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220706082411.1664825-1-richard.henderson@linaro.org> References: <20220706082411.1664825-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::433; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x433.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=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" Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- linux-user/aarch64/cpu_loop.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/linux-user/aarch64/cpu_loop.c b/linux-user/aarch64/cpu_loop.c index f7ef36cd9f..9875d609a9 100644 --- a/linux-user/aarch64/cpu_loop.c +++ b/linux-user/aarch64/cpu_loop.c @@ -89,6 +89,15 @@ void cpu_loop(CPUARMState *env) switch (trapnr) { case EXCP_SWI: + /* + * On syscall, PSTATE.ZA is preserved, along with the ZA matrix. + * PSTATE.SM is cleared, per SMSTOP, which does ResetSVEState. + */ + if (FIELD_EX64(env->svcr, SVCR, SM)) { + env->svcr = FIELD_DP64(env->svcr, SVCR, SM, 0); + arm_rebuild_hflags(env); + arm_reset_sve_state(env); + } ret = do_syscall(env, env->xregs[8], env->xregs[0], From patchwork Wed Jul 6 08:24:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 587740 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1ec:0:0:0:0 with SMTP id 12csp2575526map; Wed, 6 Jul 2022 02:34:15 -0700 (PDT) X-Google-Smtp-Source: AGRyM1usq899CexXf8z0GsYWGTWqHD5/n3i8wIdJ4N022lqU3l19GQKEQDLrbRofssupx9KOID7Y X-Received: by 2002:a05:622a:f:b0:31d:314c:f396 with SMTP id x15-20020a05622a000f00b0031d314cf396mr26010997qtw.191.1657100055667; Wed, 06 Jul 2022 02:34:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657100055; cv=none; d=google.com; s=arc-20160816; b=J9NYU3UhDaiNslrwyVbqbxoT6+67EsaajxDFUdDB6sFMQQqS7xZaL9nwgmPtLqYK1F Lr/PC7b6zc2uNCQZ+q5mU6AFQZnt54Run7Au7TzJjLQs5oNqK/X/7RfOvLqgqH/pBwip gAITFOcVT8pTwn8wTgKfEUNKH1jk40xoijYp5ytaxDnb+cxpFfp4VUyYuZMQm+ePZX4d HeG2P+bp3WfQ0CtPxUy+7B1Mq3WrjxQYy64F+DcEotHyPaVgnMYf4fQJVrI0qlP4cBuj l8hBuJgFJEIiYiNdaVpgupHKbVLvWXsPhqBgpZ8aVLDLaH9sUH1eOIELVr07Av/WZjfr FIYw== 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=FjmC/46ARakxFpcFGMLJHjfrHdRZ+a4Hi4clf4uxgwU=; b=CaqzM9jUG7Y3rb4pLbZ4ljvumerbLk0lm0cNm131qkDAGiVhglWDSRt0+Z/h31uLrN 14Zl1cXhfO6AE67nzZYafoe5uFfr/dw7LaeihqDdJkIdeE8nUMEg3V35Kv4STOIzfbxD iFZ6rQFwEZesh/vzE4NhprNPROPwQOiUeH164/Fz4RogZy8j9XmCdEAzRBlfCPwXxwPe 6kVHK+EQ/EJeGhe5g8+pqX0/bvITuY/Velij2IyEeUjKfINNdzQUsrPPqc8NelkpEkxJ zJLmoALSfV2gdknb8mCfZ5QpNpnOOkA6rtM6RcWB3s32TA54kaB+DIu7pEpc8SLDRf+s ybNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ELVQxAkw; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id bz8-20020a05622a1e8800b002f3ed475c2dsi9526172qtb.491.2022.07.06.02.34.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Jul 2022 02:34:15 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ELVQxAkw; 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]:46426 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o91QF-0005GV-78 for patch@linaro.org; Wed, 06 Jul 2022 05:34:15 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50036) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o90M7-0006sN-2r for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:25:55 -0400 Received: from mail-pg1-x52a.google.com ([2607:f8b0:4864:20::52a]:46596) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o90M5-0000lS-G6 for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:25:54 -0400 Received: by mail-pg1-x52a.google.com with SMTP id s27so13419282pga.13 for ; Wed, 06 Jul 2022 01:25:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=FjmC/46ARakxFpcFGMLJHjfrHdRZ+a4Hi4clf4uxgwU=; b=ELVQxAkwUONMK0N33AvX6XnGRdvzFCuJTCFPymZ3//wepfj99RXyrI7OqhoxBm8rKC 4+fZ9I2HWa00sNbxp1MygpF6Wu9/VbHjV0MtiAeTfvrfSTUkH0XDqaLQPUOGy78+oC02 HPNBtMobtIduXpBVR4yTZaTAFINNIENbunXIhly0SPUWGDdJxvhVkN17JSII1uc50t4y MNZkfLV6K3dITp4/8qE0n5N3k26oLB7Bi/mhpn4Mh2/4sSPs1Mllq1n4kUoMfeuAqxGI UyfNSAWEK8o1NmJtBc0cwIf739datNSRB4VRwwvu/gD2jxfav5/Vh3uaFbU87LfDf19w YwfA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=FjmC/46ARakxFpcFGMLJHjfrHdRZ+a4Hi4clf4uxgwU=; b=RIir9GPOA7uGl0hnbh6OnxQJ3rDkdUliJe1YNrAWrPMzPNmHgE6hWk6bk3hFTqKot4 KTcWhWHWdiLG9jHOrtWUx17AC/Mx1XocFNoxKkNF16Yh853ZuJALhDmrGGSfdqBsVMjY Q11XyAiCHymrv1/q4CBWQqdHLmuOM5yQCGwAI2pg4wyrjKZnAYD/2tSMxRDcHzrkVx00 6o+8cWvFk9ePOjyZe+bRMWeoj5rVguzeGz4kOTJYNkxQ35Or3g+cMdrQscZtxV9GuteX Yq/FumdbOTzd2qY0v5ucSOpnzgXq18NQzLuI4WEjZkBmrEIh1f6gL6Xy6Qk3/s33yAOp d2cg== X-Gm-Message-State: AJIora/tOMW86fIqOS+g4tnrfhyz/zserMoi3eOc+ilG8p/CoHU0DSd2 oFpsJtWhHsU0wnI+R1kipFn9LRANk/m+fqOO X-Received: by 2002:a65:49c5:0:b0:412:6e3e:bd91 with SMTP id t5-20020a6549c5000000b004126e3ebd91mr7555829pgs.221.1657095952247; Wed, 06 Jul 2022 01:25:52 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id t17-20020a170902e85100b00162529828aesm25199256plg.109.2022.07.06.01.25.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jul 2022 01:25:51 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v5 35/45] linux-user/aarch64: Add SM bit to SVE signal context Date: Wed, 6 Jul 2022 13:54:01 +0530 Message-Id: <20220706082411.1664825-36-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220706082411.1664825-1-richard.henderson@linaro.org> References: <20220706082411.1664825-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::52a; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x52a.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" Make sure to zero the currently reserved fields. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- linux-user/aarch64/signal.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/linux-user/aarch64/signal.c b/linux-user/aarch64/signal.c index 7da0e36c6d..3cef2f44cf 100644 --- a/linux-user/aarch64/signal.c +++ b/linux-user/aarch64/signal.c @@ -78,7 +78,8 @@ struct target_extra_context { struct target_sve_context { struct target_aarch64_ctx head; uint16_t vl; - uint16_t reserved[3]; + uint16_t flags; + uint16_t reserved[2]; /* The actual SVE data immediately follows. It is laid out * according to TARGET_SVE_SIG_{Z,P}REG_OFFSET, based off of * the original struct pointer. @@ -101,6 +102,8 @@ struct target_sve_context { #define TARGET_SVE_SIG_CONTEXT_SIZE(VQ) \ (TARGET_SVE_SIG_PREG_OFFSET(VQ, 17)) +#define TARGET_SVE_SIG_FLAG_SM 1 + struct target_rt_sigframe { struct target_siginfo info; struct target_ucontext uc; @@ -177,9 +180,13 @@ static void target_setup_sve_record(struct target_sve_context *sve, { int i, j; + memset(sve, 0, sizeof(*sve)); __put_user(TARGET_SVE_MAGIC, &sve->head.magic); __put_user(size, &sve->head.size); __put_user(vq * TARGET_SVE_VQ_BYTES, &sve->vl); + if (FIELD_EX64(env->svcr, SVCR, SM)) { + __put_user(TARGET_SVE_SIG_FLAG_SM, &sve->flags); + } /* Note that SVE regs are stored as a byte stream, with each byte element * at a subsequent address. This corresponds to a little-endian store From patchwork Wed Jul 6 08:24:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 587751 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1ec:0:0:0:0 with SMTP id 12csp2588989map; Wed, 6 Jul 2022 02:55:09 -0700 (PDT) X-Google-Smtp-Source: AGRyM1u4MEwFJW75ddFlLY18aOpAxFCT1hUg2OIeddEH8byVK/dNCwEu5ed2zqyZ/zT/RBljZFH4 X-Received: by 2002:a05:620a:1aa0:b0:6af:233c:2057 with SMTP id bl32-20020a05620a1aa000b006af233c2057mr25711101qkb.532.1657101309714; Wed, 06 Jul 2022 02:55:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657101309; cv=none; d=google.com; s=arc-20160816; b=K/ZEdq6IbdihMCaHqw+SG2KDNx1CVMRBP6KDCYzd8ARzs0svqan7QkpAGPK0SKWGiQ SmDyq+idOLNEQHvgSLmA4+Lv+dsI6sX2sv6t67Vh5ejTv7fRHKMo2jZVf95ihH6J3vdx FpxROm5rK4t0ZSViufns7J4Ry6N8jwwO0PYEIrzM1aScp9YfDlKvCHFgmDPpAxazODM3 XIXecr5rRpSVTTySKLpi3sYZzNFzXtSp0nNmTU0fuc3jJkE1qJALfkW32j660Dn4Dd90 JJZV3x2Pea7BhY6FWh9eEVKfA80lIpgbpqHWvhNyw1j19RCEwC61HwgQ/A5rJOWdEPcD y0Zg== 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=u6i1Exm7OWbV1UGGZQ+hkV1UWXfqGJYzldSUkhdBqXw=; b=Zdz1FhK7hVHeHePspGwEP8bG+P5XgftXQpqWEhlg4HD5U5Cp8SCxyYYYZ3uNR579xO iamzwMQ6U+Xe2N99PJG92NUi3dxs6cLEDqONoxXekZ3db7NjSNKutUbsxc/pV4WIbM3J ovEPSdnCRJwSBM1XmCPSWDL0LfQ0SYBFS6yxHEmqXksc90Mz+PtG90LmrGBr0/YYm+ri z1wqk2MdxMvYQZxPJLIjBVDGmzLeS09l5g1ztg1YTamfDNLBzq+iE8ZKSQew7tMUjHvY HFvmYj10IPs4tZymNnqOwa9mkZGlqE0IxBpxfNSuG8/iWpxaE18iO5EyXgWnNmfY6jQw ejcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rkOEzuCd; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d25-20020ac847d9000000b0031d478bd407si5363094qtr.539.2022.07.06.02.55.09 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Jul 2022 02:55:09 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=rkOEzuCd; 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]:40148 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o91kT-0006EO-6g for patch@linaro.org; Wed, 06 Jul 2022 05:55:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50070) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o90M9-0006xF-Fo for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:25:57 -0400 Received: from mail-pf1-x429.google.com ([2607:f8b0:4864:20::429]:39437) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o90M7-0000l4-QH for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:25:57 -0400 Received: by mail-pf1-x429.google.com with SMTP id j3so1087091pfb.6 for ; Wed, 06 Jul 2022 01:25:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=u6i1Exm7OWbV1UGGZQ+hkV1UWXfqGJYzldSUkhdBqXw=; b=rkOEzuCdy72QBazxfH4WOLbSjgTeSOVXIAJAtC3bTScY5R+y59a1Z7P9mtNaXxDPIG kdjf2kZ1Ik7QeONBTLnHc2PFEKKFGqlT+8KGKViUxYX1yoycv+WKzbZVPDOO/u6swk6y 4OAXbkI2Pz2YOFHwfg2hYH0CwG4gHTUjxBR9+hvML64zBaFNWl8lzNDjijbhbc1gTd4h v7F3kyN7MW5zEG9+2PHtB28q5q6axS3G34U2V+O/C+DH+6AMGiV5/PdTUHHohAoxBtqw gUsoeXRMm2vBxtODQ+iFZtDKwET9bPesKdOWvr+cOCboT+wfo8SCCo8fcmb0DrCypv8h Do8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=u6i1Exm7OWbV1UGGZQ+hkV1UWXfqGJYzldSUkhdBqXw=; b=2nozEuuCm+K84kFz+zyHbh/lIR6KawLHl0VG5K3m6LiDn71bLhkZhyFkerNTsmYg8g RfJU55FezcjeKDlo7Nv7hrByOCLRdOnGd+w/NKxmedGjIxgPW7rMEcJvOJuJEBk6rPhj nt+6pMFwycLqNLeUb95IiY4VORrLH3t33LkgUzc8nbbJXwGfRNwSiVYdkQ+jLr8KIDWB ppzMz4F0fWvspdy56YSDMl0GVeyMMbyk09hshf01YQ5GYh57i5NvfQ+XWI5wTKfZGSBe CaGwc4u8QYTGmFPX+G7iVHm6O45fCLrbMU97jjGLvj4Jf3Y6VawwFtM4NSxfEnb0GZAh 4H3g== X-Gm-Message-State: AJIora986Nv48JFtTBsp47fca9/qwd6ccy1Ojx5AnUtFI6dzBl8Ib+92 WIo7oX665SCB5N4NH6s1UIL9Gs4PRDUyYolQ X-Received: by 2002:a05:6a00:84d:b0:525:3ce6:9c33 with SMTP id q13-20020a056a00084d00b005253ce69c33mr45074554pfk.47.1657095954501; Wed, 06 Jul 2022 01:25:54 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id t17-20020a170902e85100b00162529828aesm25199256plg.109.2022.07.06.01.25.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jul 2022 01:25:54 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v5 36/45] linux-user/aarch64: Tidy target_restore_sigframe error return Date: Wed, 6 Jul 2022 13:54:02 +0530 Message-Id: <20220706082411.1664825-37-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220706082411.1664825-1-richard.henderson@linaro.org> References: <20220706082411.1664825-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::429; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x429.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=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" Fold the return value setting into the goto, so each point of failure need not do both. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- linux-user/aarch64/signal.c | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/linux-user/aarch64/signal.c b/linux-user/aarch64/signal.c index 3cef2f44cf..8b352abb97 100644 --- a/linux-user/aarch64/signal.c +++ b/linux-user/aarch64/signal.c @@ -287,7 +287,6 @@ static int target_restore_sigframe(CPUARMState *env, struct target_sve_context *sve = NULL; uint64_t extra_datap = 0; bool used_extra = false; - bool err = false; int vq = 0, sve_size = 0; target_restore_general_frame(env, sf); @@ -301,8 +300,7 @@ static int target_restore_sigframe(CPUARMState *env, switch (magic) { case 0: if (size != 0) { - err = true; - goto exit; + goto err; } if (used_extra) { ctx = NULL; @@ -314,8 +312,7 @@ static int target_restore_sigframe(CPUARMState *env, case TARGET_FPSIMD_MAGIC: if (fpsimd || size != sizeof(struct target_fpsimd_context)) { - err = true; - goto exit; + goto err; } fpsimd = (struct target_fpsimd_context *)ctx; break; @@ -329,13 +326,11 @@ static int target_restore_sigframe(CPUARMState *env, break; } } - err = true; - goto exit; + goto err; case TARGET_EXTRA_MAGIC: if (extra || size != sizeof(struct target_extra_context)) { - err = true; - goto exit; + goto err; } __get_user(extra_datap, &((struct target_extra_context *)ctx)->datap); @@ -348,8 +343,7 @@ static int target_restore_sigframe(CPUARMState *env, /* Unknown record -- we certainly didn't generate it. * Did we in fact get out of sync? */ - err = true; - goto exit; + goto err; } ctx = (void *)ctx + size; } @@ -358,17 +352,19 @@ static int target_restore_sigframe(CPUARMState *env, if (fpsimd) { target_restore_fpsimd_record(env, fpsimd); } else { - err = true; + goto err; } /* SVE data, if present, overwrites FPSIMD data. */ if (sve) { target_restore_sve_record(env, sve, vq); } - - exit: unlock_user(extra, extra_datap, 0); - return err; + return 0; + + err: + unlock_user(extra, extra_datap, 0); + return 1; } static abi_ulong get_sigframe(struct target_sigaction *ka, From patchwork Wed Jul 6 08:24:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 587752 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1ec:0:0:0:0 with SMTP id 12csp2591534map; Wed, 6 Jul 2022 02:58:24 -0700 (PDT) X-Google-Smtp-Source: AGRyM1szI7XCXVElg2YfEhCLLxLLfNTS0AFLZZ1oTzVLJWIeh8OvoavPsKnzfuzWxOBoQHjTzENa X-Received: by 2002:a05:6214:250c:b0:472:6e5e:e2f3 with SMTP id gf12-20020a056214250c00b004726e5ee2f3mr35519932qvb.45.1657101504598; Wed, 06 Jul 2022 02:58:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657101504; cv=none; d=google.com; s=arc-20160816; b=hiX/GlvIGjXWSdEyFX1cGJnANF0o/vEeFHgyg6q1K2rzpOcZLyXJXZwuoWmRQU+Bnc 1v/9Muzb3qOCZOeXcY/33cPVFp038X7g1trXbKKbv75SKPPdz0JViiVXPBP2C61pkd5N ajdO1YmP1vM/2nO+Z08+qMb1O2w5P4BkAuW13t+v7FZxo8Wx/Wy4bri9HFGj8LkHhM6P ORZpTKyrYvW2EFq/vAjaxNff9gO/7slq78jhQ/9+t/KbZWHRidQbrTMXgd35x+Bn4l2l gw6NW1ajrLx7Q0OWJ+WDiH0yumWJFgqeOhKOeWfB3bepNxLbvoqHuYVmWOHz5mp0dEnC YPAg== 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=Khgw4zesO+K18d95Nf0OQk5x631DSo+q5LDKVsiqTz0=; b=iuzft0N5e/tyZxZ7VCjLaJI7w12JPDfQM1at+w/YCnzvBYoO1eAeSxXI9xUF00A7O8 BjwzDG3rvQgZ55TGJXKISLUEaaE+OnMkj1v2uo6prGxyCmJYKwVSDW5fgfr8aon/Yz4h j2jO79e4denHr8eEbwmgYV+7haU/wf4UsttWY/eiMDFIjEpQy1dtPlmL8pYreslmM1bY W0MQgmuAD3dDMS2DSF/MYI7+BVR62AmVAFsjbX/gKAwTHOL4Y4ymF9uSKbK5k/NTotGq pasi2j/GiGic/nSu5FYimn5kEMt4XPHvLdag5fCBxoqISflF+aofygaCkDC2CbF/Wku7 gZbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=klMKO6mv; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id jm7-20020ad45ec7000000b00470968cb759si24078762qvb.158.2022.07.06.02.58.24 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Jul 2022 02:58:24 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=klMKO6mv; 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]:48480 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o91na-0003YK-GZ for patch@linaro.org; Wed, 06 Jul 2022 05:58:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50102) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o90MB-0006zd-54 for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:26:01 -0400 Received: from mail-pg1-x531.google.com ([2607:f8b0:4864:20::531]:40668) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o90M9-0000oS-Lm for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:25:58 -0400 Received: by mail-pg1-x531.google.com with SMTP id i190so849458pge.7 for ; Wed, 06 Jul 2022 01:25:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Khgw4zesO+K18d95Nf0OQk5x631DSo+q5LDKVsiqTz0=; b=klMKO6mvB3KdNJ0CCt4yxZTPLq0lPCN2Mn+ZuwEecFjZv+4BrrjeQx98hWownEMZl0 TI17Nco3UKMsf673XD9TapV91k00+foSpg5nuCeZ0n/c7O0BI+Ba92NLH2+bQfU4n/GH uipRtBKN1xyBAYCSTwKmjdbbZDtAWjeFL7qF2MXt1IGNcdGeLhzPT3s6zv1/vlpiszOH SZB+0nFSc/moyUHPKDo2M2z+i6KVFXLhBBma8+g4rvIAAek16ZAJalIDGoVyfRlv0NH0 aTIkO9XnrSdanPjRqf89LwI+/3QGMrTAGrH8QGcDBY/WKbmfS6jXCE7LVdNEgk6nNz6l YSFw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Khgw4zesO+K18d95Nf0OQk5x631DSo+q5LDKVsiqTz0=; b=bX8aLjO19H9EtBnfeo8RNyHnG8ndmpE8OnBLrf6ntd8t4Wg+q5rF8tt4cnlsisb7ns EtDkmUsH39BU59imM4XASiQrMZsw0qfixjUYT1ZpsKr75/pmfT3h06fb6q9UCKxUyzS/ nBRVRy+fVtJ31kFDtQlaFJSx43p4sRrcM8vkbqdgjn1NpOykfLqd9Io+y3Oxv7WMY8d9 RIv/zGqavyg3kqGd345kGaWRWL9mIk8PARw8mSwiFerRBucc52lj8YHbJAR8E8MkgYzq Ic7h5HH+lWa6ct+LaP+ktUIQIJbQzsMnudlalubCiY6chuUIIfF6IvhJsviPArWAT+s1 kSNw== X-Gm-Message-State: AJIora9uCUay9+hfJWXltOCX3XSdbSZBlp5YTkxmVx5EuwKaYYRsR0zr R/T7wMk2zx1+WHpSOGKdvPmuNihPJRcI4Waw X-Received: by 2002:a05:6a00:179c:b0:525:6823:2972 with SMTP id s28-20020a056a00179c00b0052568232972mr46256451pfg.60.1657095956404; Wed, 06 Jul 2022 01:25:56 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id t17-20020a170902e85100b00162529828aesm25199256plg.109.2022.07.06.01.25.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jul 2022 01:25:56 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH v5 37/45] linux-user/aarch64: Do not allow duplicate or short sve records Date: Wed, 6 Jul 2022 13:54:03 +0530 Message-Id: <20220706082411.1664825-38-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220706082411.1664825-1-richard.henderson@linaro.org> References: <20220706082411.1664825-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::531; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x531.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" In parse_user_sigframe, the kernel rejects duplicate sve records, or records that are smaller than the header. We were silently allowing these cases to pass, dropping the record. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- linux-user/aarch64/signal.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/linux-user/aarch64/signal.c b/linux-user/aarch64/signal.c index 8b352abb97..8fbe98d72f 100644 --- a/linux-user/aarch64/signal.c +++ b/linux-user/aarch64/signal.c @@ -318,10 +318,13 @@ static int target_restore_sigframe(CPUARMState *env, break; case TARGET_SVE_MAGIC: + if (sve || size < sizeof(struct target_sve_context)) { + goto err; + } if (cpu_isar_feature(aa64_sve, env_archcpu(env))) { vq = sve_vq(env); sve_size = QEMU_ALIGN_UP(TARGET_SVE_SIG_CONTEXT_SIZE(vq), 16); - if (!sve && size == sve_size) { + if (size == sve_size) { sve = (struct target_sve_context *)ctx; break; } From patchwork Wed Jul 6 08:24:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 587742 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1ec:0:0:0:0 with SMTP id 12csp2577736map; Wed, 6 Jul 2022 02:37:54 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uTFD8HmK+d+I5idP47JOZjQKk29sQLA1N4ykTZYR69XD+Ls4J5ADRQEqh9Hy15VXndxyfE X-Received: by 2002:a05:622a:1010:b0:31d:3789:bf17 with SMTP id d16-20020a05622a101000b0031d3789bf17mr22158640qte.180.1657100274026; Wed, 06 Jul 2022 02:37:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657100274; cv=none; d=google.com; s=arc-20160816; b=SEV2sngbjSuANSfBQsNOaf78qpybedYYvgGsrMTwMAuuwIDXcb6AjNI16PENP08A/X Y31I4svl7+mGQNAqbsKhpIEL9fE5i9NXCwZh0YvCYWP8HHgehQJXKLxuydu5trlFX3q8 +fwdxb+wK13hzmS7SKqeq4x5QFN74W51P0d05RYhtbR5WOy/e5R+6oq84zbvEbMzCIv3 2aplaDKtu8MYK6gJfN6IhpRrXfEu/BAfkj3WwSw24d7XytdqK6XmD/gGy08Y2t2gIGit Ki2QTLFt2c0+c/Q4yHLO/rwo+NSYeRFOKH0pCb4sXgafIaqLPZxs/3I+ys6NoGmsncsG E3Cw== 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=7xmxavNGvmm3BzQ45g11tA0Bzd0iytuo9+dpLfOmZxs=; b=YbRm8v3upwgWi8PX4qqPajFtTAdhOJD2k0qNeT7Ac7H2lfUf1ybRj41l3P1AY3swvI NYxtBFZa3Bt5ERSZL+sgSZ0sogBu/F7w0I88lp98vXZ/nLSFjrYqR4qy6fvJsM1KgfIX ZvIGGuR8dpKqOd3sf2fSjGw1C9/PSemNNWoJdt+LLgbPxl8KfU1xyaqpqMSUh78BGx31 13IjIA/5ctIplsU5vZdHuBKceTGBdRGEQRc3TvlIsTgNSULsrcQOUib02tBdPUsXEYo3 MevE5elByqB5ZNY9jpWidN5/7MBe+xojt9JcexkZu/sTCMkvtbk/V/wgrurBskE4bYi+ dtkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jWghiZ+7; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id r11-20020ac85c8b000000b002f5b6d57d83si23639181qta.24.2022.07.06.02.37.53 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Jul 2022 02:37:54 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=jWghiZ+7; 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]:54470 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o91Tl-0002QA-JI for patch@linaro.org; Wed, 06 Jul 2022 05:37:53 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50142) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o90MD-00070R-Al for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:26:01 -0400 Received: from mail-pf1-x433.google.com ([2607:f8b0:4864:20::433]:43875) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o90MB-0000oT-OB for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:26:00 -0400 Received: by mail-pf1-x433.google.com with SMTP id t3so573515pfq.10 for ; Wed, 06 Jul 2022 01:25:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7xmxavNGvmm3BzQ45g11tA0Bzd0iytuo9+dpLfOmZxs=; b=jWghiZ+7o0TEwoTD0fSZC+qbOSj9nnXc9a0+3OAcCM0mlJDz5y61jheSJrrH0kJzkk k999XcrqxYzjb+08RjJdp4Qef8bKM6jpFvzJXoGqgJi4utjMvIejprfH1JJ4GLgkOctf meBDm7p61QXSSvdpM/UMCrZEX3KD7RWLUW5N/byzoy9g9E5jZFxP0mm2snB4t6z3JSI4 J93PrmQcoJFxukBRotyI8FebM7fTRAuN776fzqbYDnnh3FdjAyn9ts1tXA6H8iQ+sWqo KtAguUgs7Q0I4RSwUpouHs7L+3eJJHOI5NmxrfdmyH/mCul1CSaBVj4N4easaog1HOmQ xQ5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=7xmxavNGvmm3BzQ45g11tA0Bzd0iytuo9+dpLfOmZxs=; b=UTceY9b3LyoEn2KFCqY7O/xw1gHskzrJmdSt/A0SwZdK+6Udl07oEpp7EGBhtaR8LI NgQZWMrSyXkzDpPydTnWG3GJLBrnNcfe/fKlzw0aIYzfALGwLMEw0CQWhHxiOi15DY/E tAnn9Uq7pUzr2nIwZGzTgvAX/Q8AKXxRKSvBOEZOiFe+SB69bysuNBiQ9E6K/GypKrpK GrVIVmvqjczqwlgfXmSwUr9jq4OPqsdRk/5Ec9xB3gL6gT8bFFjKoihnOjmyrSY+u6ux i0EZF8XlxiDkkuNsjoPK6SaPzzqr985o7YR/MxK1gAg3NtEf+V+nYCu94OoJpglH4KJG 3JMg== X-Gm-Message-State: AJIora+Jit3fA3V0wFGa49Y2aehb6R3vyVndOFHlIoYYSMOtsz4JW+/L sHbJ+r3QibbADe4M5xyTLf2Mm/ixW8wQzmNr X-Received: by 2002:a05:6a00:1c88:b0:528:9fc9:533b with SMTP id y8-20020a056a001c8800b005289fc9533bmr4805742pfw.45.1657095958985; Wed, 06 Jul 2022 01:25:58 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id t17-20020a170902e85100b00162529828aesm25199256plg.109.2022.07.06.01.25.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jul 2022 01:25:58 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v5 38/45] linux-user/aarch64: Verify extra record lock succeeded Date: Wed, 6 Jul 2022 13:54:04 +0530 Message-Id: <20220706082411.1664825-39-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220706082411.1664825-1-richard.henderson@linaro.org> References: <20220706082411.1664825-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::433; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x433.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- linux-user/aarch64/signal.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/linux-user/aarch64/signal.c b/linux-user/aarch64/signal.c index 8fbe98d72f..9ff79da4be 100644 --- a/linux-user/aarch64/signal.c +++ b/linux-user/aarch64/signal.c @@ -340,6 +340,9 @@ static int target_restore_sigframe(CPUARMState *env, __get_user(extra_size, &((struct target_extra_context *)ctx)->size); extra = lock_user(VERIFY_READ, extra_datap, extra_size, 0); + if (!extra) { + return 1; + } break; default: From patchwork Wed Jul 6 08:24:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 587744 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1ec:0:0:0:0 with SMTP id 12csp2579946map; Wed, 6 Jul 2022 02:41:24 -0700 (PDT) X-Google-Smtp-Source: AGRyM1u40k71ZBUexU7GOd/H7eDzI0yd+Fx+axfEHDtMT0tX81ZTixP2uVlgwMY9hRH/010myWcW X-Received: by 2002:a05:6902:701:b0:66e:a06d:53d7 with SMTP id k1-20020a056902070100b0066ea06d53d7mr833732ybt.604.1657100484042; Wed, 06 Jul 2022 02:41:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657100484; cv=none; d=google.com; s=arc-20160816; b=ZaINDKgfB5N+Ss/SrcLcAPJwEtILVsfGhIqLFoWvBmKbi5uZpSBq0j+gkZ60d8hIcl 6RVVqudqdUHp1mlm5xEI8rwfrjU4NDqXslP4efqkiHmhTT3I6PDRIkn/5h1Y1uKa8SnD o4N21CvR+VIq6xL1X/ghsWwJjgk2Br85aGdH0NerLKqQhuZ1UxWuuFhxN/IUg80EkB4L B/nXOl1+r8Uzcr0f0ReEOhJMIONJ/iOUPiX+TO2l2dtog9ykdvvico9eOLkdWlfqWmrt Nx/S50ZAywkvR6aYhoCAknDjrz8ihTzfhdUCoHvnAioLPD2MWPils3i9xSVAC95H1KVr ObAw== 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=suiCkAICShG42hE+LmFGlXABJkWbjcp+Qv1m7n85pMU=; b=srwv3Y63TjP4zqfTdDjSi/LmXaxDLaUpjiesgv3SALQQYtG3kW6j0gQlI83j6luAEa BtWEK7U+xGpbu9bkhJY5S90YCIG+Wy2VHHWd2Oi+9QZ1d6fsEfbtJIFsmOYmR+J7zw6b F4KCB182fmDL6NmETTYyi/0JA1KzDmNnPTESl1AODhSGqq/VmWj0hfJ+BkwOv+C+PH3Q lvRL1w1xSwswvM04QNXG7LrWTlYN4e0X4iqW3Q3U1TI3xgRIr5P/FgQB7TKwY+L4K0mE 4kHjM/bjb7rkQTWIw0pO/n1rdT6FQqXNywa1ZHV10HKGnxNUy6cEvmF8nLpDPe6ZU/Rw 6pJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fS6aY3aR; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id f128-20020a255186000000b0066e4993da71si11061816ybb.595.2022.07.06.02.41.23 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Jul 2022 02:41:24 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=fS6aY3aR; 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]:36104 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o91X9-0000eY-El for patch@linaro.org; Wed, 06 Jul 2022 05:41:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50230) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o90ML-00073P-NJ for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:26:10 -0400 Received: from mail-pf1-x42f.google.com ([2607:f8b0:4864:20::42f]:37648) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o90ME-0000pQ-Qv for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:26:09 -0400 Received: by mail-pf1-x42f.google.com with SMTP id w185so10020699pfb.4 for ; Wed, 06 Jul 2022 01:26:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=suiCkAICShG42hE+LmFGlXABJkWbjcp+Qv1m7n85pMU=; b=fS6aY3aRde/oNzQqsP1SjVfUfZNJdYvMtfnR8i4iVRBNLOPd3nE9FB/CSLXPxcYUIw DkXUXHQEoCGYzuvyEJ9CNwIJMzIrvI02CTh9MkXPjMDaqBPWODm+aWbhILfJdDdjOWti /uCJSRER+e76YQPLR4UvbRBvff/oEwfhlqkWXZwdG8yX+XkSciOwvSm/Ovg3NUJTFmR3 9c0Dc4s23a49GsJECbAwEbFIXO7+IPMXNBQ8N3MwN5ezohB9pggarRWyXK8RNizdaKcL z4lVlP+FDjD48BQsDCX76nmN4QyMs56Gm7JdurzWzXwSvvnKXDtK9ZWpNqfBQZ9HXO93 5zwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=suiCkAICShG42hE+LmFGlXABJkWbjcp+Qv1m7n85pMU=; b=s9RgSXZVSgpvQ6tVuZ7UCVI8lsf5Q8td5HJXESGLwj4UB7Bem3Neo19K2UoQltpbT2 jRrqxlqZSJuaGFcwSrYln3i+yVFZlGEua9uLrIyhmQ7fRFJfzEpalROOyNhpQPYVitiv y/2iGTh/bIX+G8JDl0CUJ1nasenrqksD5KcUv5gn6RJuRDr9E+9JQEcAVr/dtZOJFKtT 1imstanVNb8YZTdNcmNAGv4gyUiKxajGrKpUOAeJ7cF3X2/dzNCiyi6EW2v8qOTwNfNt iDeCOE0FAoR+ZDd1puwdOzYHPfq5oAkJXFwlpVqApBpE3LEb2CaNffEtDkDUutz9bvJf uRCA== X-Gm-Message-State: AJIora9eJKiSBV+pMbvjaGjmcwwGi9FdY7dbZTUHowuIQTwWwD+0P6Gd bKZcPl3x5l5tpQRs9QCNZ7KUQMb4KihPe7bN X-Received: by 2002:a05:6a00:2395:b0:525:8980:5dc7 with SMTP id f21-20020a056a00239500b0052589805dc7mr46939596pfc.8.1657095961422; Wed, 06 Jul 2022 01:26:01 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id t17-20020a170902e85100b00162529828aesm25199256plg.109.2022.07.06.01.25.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jul 2022 01:26:01 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v5 39/45] linux-user/aarch64: Move sve record checks into restore Date: Wed, 6 Jul 2022 13:54:05 +0530 Message-Id: <20220706082411.1664825-40-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220706082411.1664825-1-richard.henderson@linaro.org> References: <20220706082411.1664825-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42f; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=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" Move the checks out of the parsing loop and into the restore function. This more closely mirrors the code structure in the kernel, and is slightly clearer. Reject rather than silently skip incorrect VL and SVE record sizes, bringing our checks in to line with those the kernel does. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- linux-user/aarch64/signal.c | 51 +++++++++++++++++++++++++------------ 1 file changed, 35 insertions(+), 16 deletions(-) diff --git a/linux-user/aarch64/signal.c b/linux-user/aarch64/signal.c index 9ff79da4be..22d0b8b4ec 100644 --- a/linux-user/aarch64/signal.c +++ b/linux-user/aarch64/signal.c @@ -250,12 +250,36 @@ static void target_restore_fpsimd_record(CPUARMState *env, } } -static void target_restore_sve_record(CPUARMState *env, - struct target_sve_context *sve, int vq) +static bool target_restore_sve_record(CPUARMState *env, + struct target_sve_context *sve, + int size) { - int i, j; + int i, j, vl, vq; - /* Note that SVE regs are stored as a byte stream, with each byte element + if (!cpu_isar_feature(aa64_sve, env_archcpu(env))) { + return false; + } + + __get_user(vl, &sve->vl); + vq = sve_vq(env); + + /* Reject mismatched VL. */ + if (vl != vq * TARGET_SVE_VQ_BYTES) { + return false; + } + + /* Accept empty record -- used to clear PSTATE.SM. */ + if (size <= sizeof(*sve)) { + return true; + } + + /* Reject non-empty but incomplete record. */ + if (size < TARGET_SVE_SIG_CONTEXT_SIZE(vq)) { + return false; + } + + /* + * Note that SVE regs are stored as a byte stream, with each byte element * at a subsequent address. This corresponds to a little-endian load * of our 64-bit hunks. */ @@ -277,6 +301,7 @@ static void target_restore_sve_record(CPUARMState *env, } } } + return true; } static int target_restore_sigframe(CPUARMState *env, @@ -287,7 +312,7 @@ static int target_restore_sigframe(CPUARMState *env, struct target_sve_context *sve = NULL; uint64_t extra_datap = 0; bool used_extra = false; - int vq = 0, sve_size = 0; + int sve_size = 0; target_restore_general_frame(env, sf); @@ -321,15 +346,9 @@ static int target_restore_sigframe(CPUARMState *env, if (sve || size < sizeof(struct target_sve_context)) { goto err; } - if (cpu_isar_feature(aa64_sve, env_archcpu(env))) { - vq = sve_vq(env); - sve_size = QEMU_ALIGN_UP(TARGET_SVE_SIG_CONTEXT_SIZE(vq), 16); - if (size == sve_size) { - sve = (struct target_sve_context *)ctx; - break; - } - } - goto err; + sve = (struct target_sve_context *)ctx; + sve_size = size; + break; case TARGET_EXTRA_MAGIC: if (extra || size != sizeof(struct target_extra_context)) { @@ -362,8 +381,8 @@ static int target_restore_sigframe(CPUARMState *env, } /* SVE data, if present, overwrites FPSIMD data. */ - if (sve) { - target_restore_sve_record(env, sve, vq); + if (sve && !target_restore_sve_record(env, sve, sve_size)) { + goto err; } unlock_user(extra, extra_datap, 0); return 0; From patchwork Wed Jul 6 08:24:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 587747 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1ec:0:0:0:0 with SMTP id 12csp2581915map; Wed, 6 Jul 2022 02:44:18 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sse3h1/VwB5NQidqbMbKlLH8xOp3t7PeQAIFQ3C2kWbEF2lXbka5Y5cic9XpdF+/SWqHfg X-Received: by 2002:a25:318b:0:b0:66c:b8fa:ba21 with SMTP id x133-20020a25318b000000b0066cb8faba21mr42901493ybx.493.1657100658615; Wed, 06 Jul 2022 02:44:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657100658; cv=none; d=google.com; s=arc-20160816; b=ymrXnQl7xWwVuG2VAyPIVOvbhGfKVrbPs7kF80aTNmcTxSfO4WImJouchuQEBesfk7 Q6mdVkMQUn1DNRftPwt6pmSYi9adG0EgbYh6VHZbyhfIKhqNxkXi4Ct2pwGvtiJVUbUM VgG6OgjbtM/pRCqjFtLoEE8tzjTOJeZq4JnQ693vQID8v1Wf9Oz63NvohdTzgQvtcNEl 9l8HXG0KC8mlhr/49So3jubYqNVkC55d2zRdVYPPkI+AL3zKcZ0odxb2nKvfguO4mDpw eCKX0vjPoDgBiPK4DJC027sm7Q6dMJBYW3B+Fth0PFcmYRoUmAfeBdKlb9YYlzAbhc5n unrw== 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=eZwyJS+DI6VXP8TVU6OuO37fm60h5FhLdjsLlNVqKXk=; b=VkDB0YoGuUt2dHL19FrEEdraNjwnzoXyXdKHMEirbA+aCHSsEvA0pRbL3XY8wLfr8g pEvx3B9rhk9RpwOspuW72gnLuk7W45fqMut9GaCsSFUtkcNSm2iUBp3nNDRz8QIZCsMZ 3rPHrBmA8xn7qn4GhocGbngg1LVaA9PQR9HOzO8KO7qc/qUBmn8T3x0bwnbcyA+DeykR iBOLdsmBOrgWAOcpuN/epmNx5LCktO/4I6laKCokNTVkeebMbHhADZLEpRINJjTMd97W rUyWcys+9u1LhVPWbOYdsJKFse2PadlX00SoUxzB6qHfPQlYIs2XcdJN+d6uQP8A+2J9 4hMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=J7Fqx9iI; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 21-20020a250515000000b0066e3659f87csi13386003ybf.286.2022.07.06.02.44.18 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Jul 2022 02:44:18 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=J7Fqx9iI; 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]:48166 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o91Zy-0000LM-1d for patch@linaro.org; Wed, 06 Jul 2022 05:44:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50606) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o90PH-0000cp-Oz for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:29:13 -0400 Received: from mail-pj1-x1029.google.com ([2607:f8b0:4864:20::1029]:50710) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o90PF-0001DK-O3 for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:29:11 -0400 Received: by mail-pj1-x1029.google.com with SMTP id a15so7835220pjs.0 for ; Wed, 06 Jul 2022 01:29:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=eZwyJS+DI6VXP8TVU6OuO37fm60h5FhLdjsLlNVqKXk=; b=J7Fqx9iIOVWXshZ1siWHTe0Mmciuh6qZI5OYFhx1BFYkd4YtsDpaFNbpikSvmucA7l UGgvu/W/WmERiPO/sk8ahez8Q2NWusDP9bxXDaCbsWUfhDX9BJCevzjaCwCH0hHJ31Lf oIc89EM4ckSv/B8HqKjqrmEiTC2kuJEMOfLLFSZjh4ZQbzdCZUjcofsY+0LZxLulroXh EI+AQWAakGkLggolCzp4iOAbQ8kLrmYFeYaK+JMTFjT7EiDQqiFz1sHS6FzQ5Vg3vT5p ireAZZYWLVh1WPoKaaNWyh7Z+xVSK1oQM+tNSwjS5zyt4IgukJoQNOc59UjDq0xN0nWY XHog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=eZwyJS+DI6VXP8TVU6OuO37fm60h5FhLdjsLlNVqKXk=; b=F1JEchuT30amrLRCYqMu++jCT1opoeJlb1VzIB/f/VZ1S+wnRhF+Rmwuz9D7R47hAj crMKKU4oCNX3FFV3tHwyk4LiNK5hw2pRV8yozEFEK/5mwIqILybSdGUxtJegd7+E3z7W 6X/ZDwGC7o7wYGJAJ2/niWzFqdce5LmBivzqd4yqL3+UoogBPljljfHBCYgPicOdjdQL e+81vePe+SUbh7hUX3cswR//RxJ2XaD3eST/MoM0eYs5sXeNMQgwdlWr1HutqwwH58Dl aMiVhiHWjEptYAmWXmozChfon0U8BkDZyNM2Ua3aqMXMisFEP42EHs68r+3Kr+jGghiN Nwtw== X-Gm-Message-State: AJIora8wsWGS3kurpEqFBfnzMiqJODS64lZUoyjZsZs+dD2HmYO/aCAn 0Us+g8XImbgP593OUOQnf9TgVwjCo9gcsPCq X-Received: by 2002:a17:902:ab96:b0:16a:6db6:2715 with SMTP id f22-20020a170902ab9600b0016a6db62715mr46983471plr.141.1657096147496; Wed, 06 Jul 2022 01:29:07 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id c17-20020a170903235100b0016bdf53b303sm6700529plh.205.2022.07.06.01.29.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jul 2022 01:29:07 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v5 40/45] linux-user/aarch64: Implement SME signal handling Date: Wed, 6 Jul 2022 13:54:06 +0530 Message-Id: <20220706082411.1664825-41-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220706082411.1664825-1-richard.henderson@linaro.org> References: <20220706082411.1664825-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::1029; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x1029.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" Set the SM bit in the SVE record on signal delivery, create the ZA record. Restore SM and ZA state according to the records present on return. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- linux-user/aarch64/signal.c | 167 +++++++++++++++++++++++++++++++++--- 1 file changed, 154 insertions(+), 13 deletions(-) diff --git a/linux-user/aarch64/signal.c b/linux-user/aarch64/signal.c index 22d0b8b4ec..6a2c6e06d2 100644 --- a/linux-user/aarch64/signal.c +++ b/linux-user/aarch64/signal.c @@ -104,6 +104,22 @@ struct target_sve_context { #define TARGET_SVE_SIG_FLAG_SM 1 +#define TARGET_ZA_MAGIC 0x54366345 + +struct target_za_context { + struct target_aarch64_ctx head; + uint16_t vl; + uint16_t reserved[3]; + /* The actual ZA data immediately follows. */ +}; + +#define TARGET_ZA_SIG_REGS_OFFSET \ + QEMU_ALIGN_UP(sizeof(struct target_za_context), TARGET_SVE_VQ_BYTES) +#define TARGET_ZA_SIG_ZAV_OFFSET(VQ, N) \ + (TARGET_ZA_SIG_REGS_OFFSET + (VQ) * TARGET_SVE_VQ_BYTES * (N)) +#define TARGET_ZA_SIG_CONTEXT_SIZE(VQ) \ + TARGET_ZA_SIG_ZAV_OFFSET(VQ, VQ * TARGET_SVE_VQ_BYTES) + struct target_rt_sigframe { struct target_siginfo info; struct target_ucontext uc; @@ -176,9 +192,9 @@ static void target_setup_end_record(struct target_aarch64_ctx *end) } static void target_setup_sve_record(struct target_sve_context *sve, - CPUARMState *env, int vq, int size) + CPUARMState *env, int size) { - int i, j; + int i, j, vq = sve_vq(env); memset(sve, 0, sizeof(*sve)); __put_user(TARGET_SVE_MAGIC, &sve->head.magic); @@ -207,6 +223,35 @@ static void target_setup_sve_record(struct target_sve_context *sve, } } +static void target_setup_za_record(struct target_za_context *za, + CPUARMState *env, int size) +{ + int vq = sme_vq(env); + int vl = vq * TARGET_SVE_VQ_BYTES; + int i, j; + + memset(za, 0, sizeof(*za)); + __put_user(TARGET_ZA_MAGIC, &za->head.magic); + __put_user(size, &za->head.size); + __put_user(vl, &za->vl); + + if (size == TARGET_ZA_SIG_CONTEXT_SIZE(0)) { + return; + } + assert(size == TARGET_ZA_SIG_CONTEXT_SIZE(vq)); + + /* + * Note that ZA vectors are stored as a byte stream, + * with each byte element at a subsequent address. + */ + for (i = 0; i < vl; ++i) { + uint64_t *z = (void *)za + TARGET_ZA_SIG_ZAV_OFFSET(vq, i); + for (j = 0; j < vq * 2; ++j) { + __put_user_e(env->zarray[i].d[j], z + j, le); + } + } +} + static void target_restore_general_frame(CPUARMState *env, struct target_rt_sigframe *sf) { @@ -252,16 +297,28 @@ static void target_restore_fpsimd_record(CPUARMState *env, static bool target_restore_sve_record(CPUARMState *env, struct target_sve_context *sve, - int size) + int size, int *svcr) { - int i, j, vl, vq; + int i, j, vl, vq, flags; + bool sm; - if (!cpu_isar_feature(aa64_sve, env_archcpu(env))) { + __get_user(vl, &sve->vl); + __get_user(flags, &sve->flags); + + sm = flags & TARGET_SVE_SIG_FLAG_SM; + + /* The cpu must support Streaming or Non-streaming SVE. */ + if (sm + ? !cpu_isar_feature(aa64_sme, env_archcpu(env)) + : !cpu_isar_feature(aa64_sve, env_archcpu(env))) { return false; } - __get_user(vl, &sve->vl); - vq = sve_vq(env); + /* + * Note that we cannot use sve_vq() because that depends on the + * current setting of PSTATE.SM, not the state to be restored. + */ + vq = sve_vqm1_for_el_sm(env, 0, sm) + 1; /* Reject mismatched VL. */ if (vl != vq * TARGET_SVE_VQ_BYTES) { @@ -278,6 +335,8 @@ static bool target_restore_sve_record(CPUARMState *env, return false; } + *svcr = FIELD_DP64(*svcr, SVCR, SM, sm); + /* * Note that SVE regs are stored as a byte stream, with each byte element * at a subsequent address. This corresponds to a little-endian load @@ -304,15 +363,57 @@ static bool target_restore_sve_record(CPUARMState *env, return true; } +static bool target_restore_za_record(CPUARMState *env, + struct target_za_context *za, + int size, int *svcr) +{ + int i, j, vl, vq; + + if (!cpu_isar_feature(aa64_sme, env_archcpu(env))) { + return false; + } + + __get_user(vl, &za->vl); + vq = sme_vq(env); + + /* Reject mismatched VL. */ + if (vl != vq * TARGET_SVE_VQ_BYTES) { + return false; + } + + /* Accept empty record -- used to clear PSTATE.ZA. */ + if (size <= TARGET_ZA_SIG_CONTEXT_SIZE(0)) { + return true; + } + + /* Reject non-empty but incomplete record. */ + if (size < TARGET_ZA_SIG_CONTEXT_SIZE(vq)) { + return false; + } + + *svcr = FIELD_DP64(*svcr, SVCR, ZA, 1); + + for (i = 0; i < vl; ++i) { + uint64_t *z = (void *)za + TARGET_ZA_SIG_ZAV_OFFSET(vq, i); + for (j = 0; j < vq * 2; ++j) { + __get_user_e(env->zarray[i].d[j], z + j, le); + } + } + return true; +} + static int target_restore_sigframe(CPUARMState *env, struct target_rt_sigframe *sf) { struct target_aarch64_ctx *ctx, *extra = NULL; struct target_fpsimd_context *fpsimd = NULL; struct target_sve_context *sve = NULL; + struct target_za_context *za = NULL; uint64_t extra_datap = 0; bool used_extra = false; int sve_size = 0; + int za_size = 0; + int svcr = 0; target_restore_general_frame(env, sf); @@ -350,6 +451,14 @@ static int target_restore_sigframe(CPUARMState *env, sve_size = size; break; + case TARGET_ZA_MAGIC: + if (za || size < sizeof(struct target_za_context)) { + goto err; + } + za = (struct target_za_context *)ctx; + za_size = size; + break; + case TARGET_EXTRA_MAGIC: if (extra || size != sizeof(struct target_extra_context)) { goto err; @@ -381,9 +490,16 @@ static int target_restore_sigframe(CPUARMState *env, } /* SVE data, if present, overwrites FPSIMD data. */ - if (sve && !target_restore_sve_record(env, sve, sve_size)) { + if (sve && !target_restore_sve_record(env, sve, sve_size, &svcr)) { goto err; } + if (za && !target_restore_za_record(env, za, za_size, &svcr)) { + goto err; + } + if (env->svcr != svcr) { + env->svcr = svcr; + arm_rebuild_hflags(env); + } unlock_user(extra, extra_datap, 0); return 0; @@ -451,7 +567,8 @@ static void target_setup_frame(int usig, struct target_sigaction *ka, .total_size = offsetof(struct target_rt_sigframe, uc.tuc_mcontext.__reserved), }; - int fpsimd_ofs, fr_ofs, sve_ofs = 0, vq = 0, sve_size = 0; + int fpsimd_ofs, fr_ofs, sve_ofs = 0, za_ofs = 0; + int sve_size = 0, za_size = 0; struct target_rt_sigframe *frame; struct target_rt_frame_record *fr; abi_ulong frame_addr, return_addr; @@ -461,11 +578,20 @@ static void target_setup_frame(int usig, struct target_sigaction *ka, &layout); /* SVE state needs saving only if it exists. */ - if (cpu_isar_feature(aa64_sve, env_archcpu(env))) { - vq = sve_vq(env); - sve_size = QEMU_ALIGN_UP(TARGET_SVE_SIG_CONTEXT_SIZE(vq), 16); + if (cpu_isar_feature(aa64_sve, env_archcpu(env)) || + cpu_isar_feature(aa64_sme, env_archcpu(env))) { + sve_size = QEMU_ALIGN_UP(TARGET_SVE_SIG_CONTEXT_SIZE(sve_vq(env)), 16); sve_ofs = alloc_sigframe_space(sve_size, &layout); } + if (cpu_isar_feature(aa64_sme, env_archcpu(env))) { + /* ZA state needs saving only if it is enabled. */ + if (FIELD_EX64(env->svcr, SVCR, ZA)) { + za_size = TARGET_ZA_SIG_CONTEXT_SIZE(sme_vq(env)); + } else { + za_size = TARGET_ZA_SIG_CONTEXT_SIZE(0); + } + za_ofs = alloc_sigframe_space(za_size, &layout); + } if (layout.extra_ofs) { /* Reserve space for the extra end marker. The standard end marker @@ -512,7 +638,10 @@ static void target_setup_frame(int usig, struct target_sigaction *ka, target_setup_end_record((void *)frame + layout.extra_end_ofs); } if (sve_ofs) { - target_setup_sve_record((void *)frame + sve_ofs, env, vq, sve_size); + target_setup_sve_record((void *)frame + sve_ofs, env, sve_size); + } + if (za_ofs) { + target_setup_za_record((void *)frame + za_ofs, env, za_size); } /* Set up the stack frame for unwinding. */ @@ -536,6 +665,18 @@ static void target_setup_frame(int usig, struct target_sigaction *ka, env->btype = 2; } + /* + * Invoke the signal handler with both SM and ZA disabled. + * When clearing SM, ResetSVEState, per SMSTOP. + */ + if (FIELD_EX64(env->svcr, SVCR, SM)) { + arm_reset_sve_state(env); + } + if (env->svcr) { + env->svcr = 0; + arm_rebuild_hflags(env); + } + if (info) { tswap_siginfo(&frame->info, info); env->xregs[1] = frame_addr + offsetof(struct target_rt_sigframe, info); From patchwork Wed Jul 6 08:24:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 587746 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1ec:0:0:0:0 with SMTP id 12csp2581832map; Wed, 6 Jul 2022 02:44:12 -0700 (PDT) X-Google-Smtp-Source: AGRyM1uMvj/d0j/b58/39i7Y5QdSN3mu3cOD/mCcgpM3/5G1vvQ+LZcWqv3tUC6W3XMUYYd1BORG X-Received: by 2002:a25:2e4f:0:b0:664:e436:e89e with SMTP id b15-20020a252e4f000000b00664e436e89emr42343584ybn.646.1657100652507; Wed, 06 Jul 2022 02:44:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657100652; cv=none; d=google.com; s=arc-20160816; b=V0n5RJh7xEI2zI10uuOdEdGSGC15V7dhuLfN8krdqyQLDkqJHtAdZnWrwdBU/Zs/5F 58K4NxPJ4fTq8LNkyePatWafFxFXIhiHMM6YXh2m0hV9+SLKaGmPS6aczh2xVU0OZSGI Vbc4gGPbI5Q5sn3kP7QbO5Z/vlsF1Vgu5NXbERq40zfcDULp+lQ8A7RUhPd/rmah+xA+ Bdl8gSEepmqJzlKfP3bA7rpgZohRQJoQ+/zs2uRltFj4Sbr7foOOcvwGDKDqtFMaWddD v+T8LpjLOfV7XxWe10l2cUa5O7Uj/ze2pFfmWpt2W0/QN154EIATyKk7Wlk3d6roaXMl uYoA== 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=V2fLCOd7w5RVaZMEE/2yClzk5I5RfuvEjcRKKU0Ql6A=; b=VGD6FpC5HDJkKaVoxzsc2ifN1YczVOZzu/XnAxlyG3vz5PmhPIw+aakn4NJbkd3maW O7pNgjTWRGmo9bR0qLciiSHZVgqvRTtD3BKg8zc8vdfkfDG6+yZ9WbbfN5+oX5K5o2jX gbLulLlVmW/PPc902flUBmw893511STq6ZeVzDW8WjyKOHM8Pot+UGE55TvpqZQL0wor nXKS5csM1AT0rXtWxxBnte4aZ1Kx6Sig/aEmCXKeJ87Polo2unEtjGHGBhL5DIjMrqgn P7Usgma8lwXJ3kcio0VzTZ6uFCpWv7ywstbi2/lQiX+Gy9zodNLWgUtD8LeQFW6KT/zd 0weg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qsZ5LjNo; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id r8-20020a056902154800b0066ea2050be8si736100ybu.9.2022.07.06.02.44.12 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Jul 2022 02:44:12 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=qsZ5LjNo; 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]:47922 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o91Zr-0000Am-VP for patch@linaro.org; Wed, 06 Jul 2022 05:44:12 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50666) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o90PN-0000e9-6L for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:29:17 -0400 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]:43894) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o90PI-0001Dr-1B for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:29:13 -0400 Received: by mail-pf1-x434.google.com with SMTP id t3so579943pfq.10 for ; Wed, 06 Jul 2022 01:29:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=V2fLCOd7w5RVaZMEE/2yClzk5I5RfuvEjcRKKU0Ql6A=; b=qsZ5LjNo8Qf/WXeTA2oQWiDDZhX9rW/OtwK3zFruCPowC2ujdFiBHmv7ALVXOLS+/3 d4yrA0cvtSXI2ehE8qT3NthGNd0ioOvdML1qmjNThtCsfM77JJgYU3MzAp+GzY3RwyUZ NUgAMC3wguD6RX6vL7GCgBwlJPgc11+qcOfyHGvVcR+zE9rZ9BCQaoC0hUhR1GghXsLK F1+Nqqbg1qevx0nqpDIAjMADIiYcgUlmOvi8YHi9XITsjSQHVfl8qbxAZpX486F3pspB 5DSGuNsWoifBs0Fdbw3mBhZ9ojFunocO+nhjD3dRz9uiODj5HejSm4KLL2WxPAGU+gQo 2lcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=V2fLCOd7w5RVaZMEE/2yClzk5I5RfuvEjcRKKU0Ql6A=; b=W0SQdbVThWz0N17FQH18ZtHE2fu68lmqd0PNY3+cCXsyMqJChOzFPvBvqLzMoN0cCj t2bytoFuWRPO0qMOVREsEiMRXvV/kIH6RbIxQdmAeTe0PAAMTYSr/1X+bpjpfxpc17UV wlW8rM8oRtCVzvJ0db8kD7RohWIp5RHByJuPv/Mj7i+9qOiY7pc1SmWI/CsobD7Kh3Qn WCG94aep3Rjgt9qKjPboRmAXq0lSfZKGHqlF/dg8zlzXJY3K2LEDaZmBdqdMQ39cdkCi 3ggp9zKU+Hd7HPt+x1IwPWVTeCOM8sKyoA4GRyB90pXLHWKkIZa240KTEcFCNXxvcq9d 3SjQ== X-Gm-Message-State: AJIora+aAws2W4w6B/IztupyzpnQUjvLYGDdq6LnmGM4P74wgNqyG1xU DSTJkIYXud8Tg8dfXJvjkawCO6wH1OmO5Jk0 X-Received: by 2002:a63:20a:0:b0:411:909f:8ae2 with SMTP id 10-20020a63020a000000b00411909f8ae2mr32602128pgc.132.1657096150724; Wed, 06 Jul 2022 01:29:10 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id c17-20020a170903235100b0016bdf53b303sm6700529plh.205.2022.07.06.01.29.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jul 2022 01:29:10 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v5 41/45] linux-user: Rename sve prctls Date: Wed, 6 Jul 2022 13:54:07 +0530 Message-Id: <20220706082411.1664825-42-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220706082411.1664825-1-richard.henderson@linaro.org> References: <20220706082411.1664825-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" Add "sve" to the sve prctl functions, to distinguish them from the coming "sme" prctls with similar names. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- linux-user/aarch64/target_prctl.h | 8 ++++---- linux-user/syscall.c | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/linux-user/aarch64/target_prctl.h b/linux-user/aarch64/target_prctl.h index 1d440ffbea..40481e6663 100644 --- a/linux-user/aarch64/target_prctl.h +++ b/linux-user/aarch64/target_prctl.h @@ -6,7 +6,7 @@ #ifndef AARCH64_TARGET_PRCTL_H #define AARCH64_TARGET_PRCTL_H -static abi_long do_prctl_get_vl(CPUArchState *env) +static abi_long do_prctl_sve_get_vl(CPUArchState *env) { ARMCPU *cpu = env_archcpu(env); if (cpu_isar_feature(aa64_sve, cpu)) { @@ -14,9 +14,9 @@ static abi_long do_prctl_get_vl(CPUArchState *env) } return -TARGET_EINVAL; } -#define do_prctl_get_vl do_prctl_get_vl +#define do_prctl_sve_get_vl do_prctl_sve_get_vl -static abi_long do_prctl_set_vl(CPUArchState *env, abi_long arg2) +static abi_long do_prctl_sve_set_vl(CPUArchState *env, abi_long arg2) { /* * We cannot support either PR_SVE_SET_VL_ONEXEC or PR_SVE_VL_INHERIT. @@ -47,7 +47,7 @@ static abi_long do_prctl_set_vl(CPUArchState *env, abi_long arg2) } return -TARGET_EINVAL; } -#define do_prctl_set_vl do_prctl_set_vl +#define do_prctl_sve_set_vl do_prctl_sve_set_vl static abi_long do_prctl_reset_keys(CPUArchState *env, abi_long arg2) { diff --git a/linux-user/syscall.c b/linux-user/syscall.c index 669add74c1..cbde82c907 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -6362,11 +6362,11 @@ static abi_long do_prctl_inval1(CPUArchState *env, abi_long arg2) #ifndef do_prctl_set_fp_mode #define do_prctl_set_fp_mode do_prctl_inval1 #endif -#ifndef do_prctl_get_vl -#define do_prctl_get_vl do_prctl_inval0 +#ifndef do_prctl_sve_get_vl +#define do_prctl_sve_get_vl do_prctl_inval0 #endif -#ifndef do_prctl_set_vl -#define do_prctl_set_vl do_prctl_inval1 +#ifndef do_prctl_sve_set_vl +#define do_prctl_sve_set_vl do_prctl_inval1 #endif #ifndef do_prctl_reset_keys #define do_prctl_reset_keys do_prctl_inval1 @@ -6431,9 +6431,9 @@ static abi_long do_prctl(CPUArchState *env, abi_long option, abi_long arg2, case PR_SET_FP_MODE: return do_prctl_set_fp_mode(env, arg2); case PR_SVE_GET_VL: - return do_prctl_get_vl(env); + return do_prctl_sve_get_vl(env); case PR_SVE_SET_VL: - return do_prctl_set_vl(env, arg2); + return do_prctl_sve_set_vl(env, arg2); case PR_PAC_RESET_KEYS: if (arg3 || arg4 || arg5) { return -TARGET_EINVAL; From patchwork Wed Jul 6 08:24:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 587753 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1ec:0:0:0:0 with SMTP id 12csp2597036map; Wed, 6 Jul 2022 03:04:19 -0700 (PDT) X-Google-Smtp-Source: AGRyM1t/IsA8pxS6+WZs9xXRB6iqbuBAmgFqHTAzTbZEil6ZfQRXRDaC4WADdA0oEnhZZOa7QZcQ X-Received: by 2002:a05:620a:2a13:b0:6af:4f71:8d18 with SMTP id o19-20020a05620a2a1300b006af4f718d18mr25616848qkp.211.1657101859210; Wed, 06 Jul 2022 03:04:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657101859; cv=none; d=google.com; s=arc-20160816; b=CTgbVMIVxcir4WIPe5Nn9TascQ/YdCK1nNAa67XqK4IB74+DyXG9JrtIx1T827kzdZ 4eSPevA5vMTtfoJ5VdAsC0FyeyenWfYUov5zcRNGFDShTrgWsHCd064cljIZQKrXZ3Ds n3ECe8D42Bgc/4dHXKBZv8So811UN0foajbZ8ZEDbgGAttQc423EC5ofol47KvUFRzeK Mj2Cw7ZM8U6sGPXxnyc8cq/+2lnAQcJX+xotAuPjPBoIRcbK+9XBrzIObo9b9f7XXIZh 2TJxBeHGPVd3uaAr13DBuEic0mGZyPoraFWL09cc0FABA6p9jJhZPmAvUWleFoCSOkfi AYSw== 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=X5mZq3bLmgR4W3ojlh5flFpHwO5JLZ2jR/5oQWHxRX4=; b=GFZ+JpexIbz1YT+tXQmc+1GH0Y0IXHoZeMTZj4lAHUsOHPOe814ZJQr0i25Z559UOz n8r8d7uMiDrozoDT73Hpa+KvEpizRYhz1MQ/u6j2/BkuAjt9r4MjuhbLxxCZPPgKe0p6 NjVmC076xasAmOQMbotnnlCM6BDVunmTPXIY2Zc0sjU/ZdpBU2cCyEddEUK9hnVWEx9b sEokFNY8V5nuJBN6oKrXAvpsR2cX3sZMbzCINaBv8Vj/OswIRUGxNlN4PdApeOp0U18P 3SI6/uAqW8bI1gghE2BAbHkMKZrb2y20sjIlTCqC4rs9WOd+Zp+gN4pLQZBXuHKR1Djd 7bNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aJbtbWGJ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id u9-20020a0562141c0900b00472efcae1b3si6714547qvc.567.2022.07.06.03.04.19 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Jul 2022 03:04:19 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aJbtbWGJ; 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]:58276 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o91tK-0001vO-Oh for patch@linaro.org; Wed, 06 Jul 2022 06:04:18 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50702) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o90PP-0000gk-03 for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:29:19 -0400 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]:41847) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o90PN-0001EZ-0e for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:29:18 -0400 Received: by mail-pf1-x436.google.com with SMTP id l124so3362423pfl.8 for ; Wed, 06 Jul 2022 01:29:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=X5mZq3bLmgR4W3ojlh5flFpHwO5JLZ2jR/5oQWHxRX4=; b=aJbtbWGJ4wDrX08kMCxatCLxTWr0AmegWwF37SqXrrt/KJiGraCsoGkQqWJ45aHnR8 Ji288xnFdQtHKaQj4KT4P4h+Gav3DLu6Fom1GOIzoH1jHvNJwhhKFNbXmRxhAe8S7jWx NmWyPUDQfiQDc4zb+flbYzgK5Ko4pJ2ulNS4wNKabNMnmBS92+gqMk8dN/HQHg8PgOZv ejo3XJ2zhYtV95lF+SxhVv0wD4jN3RutTh27YTQg8QmlQxNeRNYat3WTgAe3uVK0K1Ph yd6jP/jRSbWPv3s0pWzk+/xdPxuVoZ82U0PJq50EsbuGeTid91ng0oVPVfz60scPLoGP UAOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=X5mZq3bLmgR4W3ojlh5flFpHwO5JLZ2jR/5oQWHxRX4=; b=nmbSzs5Lk6JdCySPqroVve46Ph6HD42637foVAUiaErzhatc38mkI+r2TY6GqukENf aQqHJtn8Ku9Yk57n6jg52bZJBsGWa0wIW7Vsibjgl9ZoXrcgzJIlLh2R6mxLPPTuY7aL eNcsBbxfQvRA3Lv8nQVqEbEZjAsf0QXBzn5HcbaTz384sAjaZPJ9VWR3xVFyc8P+FA/A 8YAVS462slniEo9y+P9UlqdzQ1W99UoHxmnJlatkis4fa2n9PvW9loMSHXgCxINrhyML /i033ARxBJQBxwh6JZFG+afGz3U18uCyGWwbnp4kdcSDz41f6WFvgqEJ2828Bjuv5JHQ PLVg== X-Gm-Message-State: AJIora/CrorFevQNoKioJNvS7sFFOhdIJszOK6tBAub3PNySWDFz0kIo uNK8HvXOJKOeeaF1Rf8GaQZ+Fo6wtFwE5KoK X-Received: by 2002:a05:6a00:a26:b0:528:9831:d935 with SMTP id p38-20020a056a000a2600b005289831d935mr7032819pfh.25.1657096153404; Wed, 06 Jul 2022 01:29:13 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id c17-20020a170903235100b0016bdf53b303sm6700529plh.205.2022.07.06.01.29.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jul 2022 01:29:12 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v5 42/45] linux-user/aarch64: Implement PR_SME_GET_VL, PR_SME_SET_VL Date: Wed, 6 Jul 2022 13:54:08 +0530 Message-Id: <20220706082411.1664825-43-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220706082411.1664825-1-richard.henderson@linaro.org> References: <20220706082411.1664825-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::436; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x436.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" These prctl set the Streaming SVE vector length, which may be completely different from the Normal SVE vector length. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- linux-user/aarch64/target_prctl.h | 48 +++++++++++++++++++++++++++++++ linux-user/syscall.c | 16 +++++++++++ 2 files changed, 64 insertions(+) diff --git a/linux-user/aarch64/target_prctl.h b/linux-user/aarch64/target_prctl.h index 40481e6663..f8f8f88992 100644 --- a/linux-user/aarch64/target_prctl.h +++ b/linux-user/aarch64/target_prctl.h @@ -10,6 +10,7 @@ static abi_long do_prctl_sve_get_vl(CPUArchState *env) { ARMCPU *cpu = env_archcpu(env); if (cpu_isar_feature(aa64_sve, cpu)) { + /* PSTATE.SM is always unset on syscall entry. */ return sve_vq(env) * 16; } return -TARGET_EINVAL; @@ -27,6 +28,7 @@ static abi_long do_prctl_sve_set_vl(CPUArchState *env, abi_long arg2) && arg2 >= 0 && arg2 <= 512 * 16 && !(arg2 & 15)) { uint32_t vq, old_vq; + /* PSTATE.SM is always unset on syscall entry. */ old_vq = sve_vq(env); /* @@ -49,6 +51,52 @@ static abi_long do_prctl_sve_set_vl(CPUArchState *env, abi_long arg2) } #define do_prctl_sve_set_vl do_prctl_sve_set_vl +static abi_long do_prctl_sme_get_vl(CPUArchState *env) +{ + ARMCPU *cpu = env_archcpu(env); + if (cpu_isar_feature(aa64_sme, cpu)) { + return sme_vq(env) * 16; + } + return -TARGET_EINVAL; +} +#define do_prctl_sme_get_vl do_prctl_sme_get_vl + +static abi_long do_prctl_sme_set_vl(CPUArchState *env, abi_long arg2) +{ + /* + * We cannot support either PR_SME_SET_VL_ONEXEC or PR_SME_VL_INHERIT. + * Note the kernel definition of sve_vl_valid allows for VQ=512, + * i.e. VL=8192, even though the architectural maximum is VQ=16. + */ + if (cpu_isar_feature(aa64_sme, env_archcpu(env)) + && arg2 >= 0 && arg2 <= 512 * 16 && !(arg2 & 15)) { + int vq, old_vq; + + old_vq = sme_vq(env); + + /* + * Bound the value of vq, so that we know that it fits into + * the 4-bit field in SMCR_EL1. Because PSTATE.SM is cleared + * on syscall entry, we are not modifying the current SVE + * vector length. + */ + vq = MAX(arg2 / 16, 1); + vq = MIN(vq, 16); + env->vfp.smcr_el[1] = + FIELD_DP64(env->vfp.smcr_el[1], SMCR, LEN, vq - 1); + vq = sme_vq(env); + + if (old_vq != vq) { + /* PSTATE.ZA state is cleared on any change to VQ. */ + env->svcr = FIELD_DP64(env->svcr, SVCR, ZA, 0); + arm_rebuild_hflags(env); + } + return vq * 16; + } + return -TARGET_EINVAL; +} +#define do_prctl_sme_set_vl do_prctl_sme_set_vl + static abi_long do_prctl_reset_keys(CPUArchState *env, abi_long arg2) { ARMCPU *cpu = env_archcpu(env); diff --git a/linux-user/syscall.c b/linux-user/syscall.c index cbde82c907..991b85e6b4 100644 --- a/linux-user/syscall.c +++ b/linux-user/syscall.c @@ -6343,6 +6343,12 @@ abi_long do_arch_prctl(CPUX86State *env, int code, abi_ulong addr) #ifndef PR_SET_SYSCALL_USER_DISPATCH # define PR_SET_SYSCALL_USER_DISPATCH 59 #endif +#ifndef PR_SME_SET_VL +# define PR_SME_SET_VL 63 +# define PR_SME_GET_VL 64 +# define PR_SME_VL_LEN_MASK 0xffff +# define PR_SME_VL_INHERIT (1 << 17) +#endif #include "target_prctl.h" @@ -6383,6 +6389,12 @@ static abi_long do_prctl_inval1(CPUArchState *env, abi_long arg2) #ifndef do_prctl_set_unalign #define do_prctl_set_unalign do_prctl_inval1 #endif +#ifndef do_prctl_sme_get_vl +#define do_prctl_sme_get_vl do_prctl_inval0 +#endif +#ifndef do_prctl_sme_set_vl +#define do_prctl_sme_set_vl do_prctl_inval1 +#endif static abi_long do_prctl(CPUArchState *env, abi_long option, abi_long arg2, abi_long arg3, abi_long arg4, abi_long arg5) @@ -6434,6 +6446,10 @@ static abi_long do_prctl(CPUArchState *env, abi_long option, abi_long arg2, return do_prctl_sve_get_vl(env); case PR_SVE_SET_VL: return do_prctl_sve_set_vl(env, arg2); + case PR_SME_GET_VL: + return do_prctl_sme_get_vl(env); + case PR_SME_SET_VL: + return do_prctl_sme_set_vl(env, arg2); case PR_PAC_RESET_KEYS: if (arg3 || arg4 || arg5) { return -TARGET_EINVAL; From patchwork Wed Jul 6 08:24:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 587754 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1ec:0:0:0:0 with SMTP id 12csp2599653map; Wed, 6 Jul 2022 03:07:32 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tIE2MuQ3PcRMMnkCfn/T5yH+OA3rvh3SdASCB8ddzBfHjsqsA4ehZPW4dZEf6BxjSa4hbS X-Received: by 2002:a05:622a:f:b0:31d:314c:f396 with SMTP id x15-20020a05622a000f00b0031d314cf396mr26093343qtw.191.1657102052834; Wed, 06 Jul 2022 03:07:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657102052; cv=none; d=google.com; s=arc-20160816; b=jDf8vQVLqpJ0iP7AVvNXW/b2v4fbMVk0P2fhP0Ext3VTrdC4/HvCnfy5YyZb85rbRJ 3Q1wnaEmjQkyJZEtJfn5o0u3XFveBFxiVQArH9xQEZJSKh6Qr+4aWcgoBm1ACruyEWBD pxJ5FCr6ooQfSy3VaPnqo9Bsy+hkue1DQJ+/m74XGuKl1HsOSQX9Vu96BcWPWYWGO2g6 U+i67CJGRGA40nlxGtgltxpa6HvwD/lr1VYA5wjwJRnrmsxv7UTFE2AsMbqJ7lBVFCKx PnpSc2tp7wYZK0VcnHhOZf/WOOTF2bj+J27TYppmcvOt1FooEIfL7ggbGy+63JYokJGj fRag== 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=H9uf8O4CUiqyVcmvjic8DcvLpWT2fCMJa8CUUeRGTi0=; b=sx8F56Lz30rj0ogLF5s4iyJ3Hrqz+l+FVwgXkyOinhguuCalXfycKBfkDpQ8JEcuKE oug7ayFe/O2V66dn/Pjxcn0P++xW9I6BI/z0ccxg6K+w32odFDbbz9iNn2IM4qd0143D HUBIewRl7kgSvAk8dyGbEyhZ9W81k3yUWtR+DfVUlpgXm5lMaJhaUMnZBGhOZOVHrURd JwrhNHtes5QQKlEwhShOyVmh6vxTN5//jV0jMAOxpPNVu5nP7BvKtgwKZSxfPOyqgPGq LOzcLz/U9UtgMRM2qXvevTCSJDi/n+qZCyI4ma1be1BEZIvA0lVqaoMk+FW11e0sA4/6 AC4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aOGczq1t; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 1-20020a0562140d0100b004705178cceasi23025922qvh.388.2022.07.06.03.07.32 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Jul 2022 03:07:32 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aOGczq1t; 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]:37616 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o91wS-0007E4-Es for patch@linaro.org; Wed, 06 Jul 2022 06:07:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50734) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o90PQ-0000jJ-8D for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:29:20 -0400 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]:40606) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o90PN-0001Eq-MT for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:29:19 -0400 Received: by mail-pf1-x42b.google.com with SMTP id y141so13732703pfb.7 for ; Wed, 06 Jul 2022 01:29:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=H9uf8O4CUiqyVcmvjic8DcvLpWT2fCMJa8CUUeRGTi0=; b=aOGczq1tt/UVP71V0gMVKd0nMKXqN+C/p5LVs6C9iwibSN388/y4P1lP67oi3eqniB 6m9H2voeLZcxd5AUURcXYyTanWYVRhZDkFDKWB+/R1+qIeDmO/35TIQMQ/tSEX9/oz86 YfM7ddoMNyYyFIn3z8hnvJwf3xBiFWUYgbkMT/WR/WiJgQC43GsJdBoibkVEimdJSDHB KZ4VzI1zDuA6PjpbHDZQYAfqpJ99wmC/dQ5Mr4TVbjsIdLOtPnDf7GOmviG3HhzjEN9A GN6rTXIvf0H6ofBTl+AcxMLezzkjmdRJP3l60bV2ok4cvzZgkL7RRj/sGYwa4BMDIohD vHoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=H9uf8O4CUiqyVcmvjic8DcvLpWT2fCMJa8CUUeRGTi0=; b=DG9vK+hzz6giq4eaGSbP3Vr7Onfk4Ntw8UK6+k8P0R8vgAulgtQdBvUVQB6Yx/VuvG UaiCKimW/L5vhFQDU6gkgnOdbg4r0vqlEiCy9BL8yhh1vMZI4D/Kfg+8UpRBWj13+wdJ pX8dJDnUAZqOd0WyVY5OKj/pUvSzlEyiB7y/upOfrVUX8nrz/G3SZmR6JUQCL/1VQZxM 4Q7wb1xNWkWb3ykG40yroSlKi76niNrDX3T3mPRGhuHG2hgVd9sfZlKrEm4yfF6FmhY+ ugumj+oxM8O3VFltdpu1N3AIgsNVLc96pdnvEvWBt9a8dPVA+AwM7LsSMnQpNag6QopO jAkA== X-Gm-Message-State: AJIora9vR9EMhegJfU903SDsJjMRFisvlnSBUSXC9gPWI0yAPaelDl8C FBio5HH23QmORzsar+/u0JawBHrTwQgkvyxb X-Received: by 2002:a05:6a00:2356:b0:525:7c6e:1dca with SMTP id j22-20020a056a00235600b005257c6e1dcamr45796713pfj.28.1657096156221; Wed, 06 Jul 2022 01:29:16 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id c17-20020a170903235100b0016bdf53b303sm6700529plh.205.2022.07.06.01.29.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jul 2022 01:29:15 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v5 43/45] target/arm: Only set ZEN in reset if SVE present Date: Wed, 6 Jul 2022 13:54:09 +0530 Message-Id: <20220706082411.1664825-44-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220706082411.1664825-1-richard.henderson@linaro.org> References: <20220706082411.1664825-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::42b; envelope-from=richard.henderson@linaro.org; helo=mail-pf1-x42b.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" There's no reason to set CPACR_EL1.ZEN if SVE disabled. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/cpu.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 9c58be8b14..9b54443843 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -204,11 +204,10 @@ static void arm_cpu_reset(DeviceState *dev) /* and to the FP/Neon instructions */ env->cp15.cpacr_el1 = FIELD_DP64(env->cp15.cpacr_el1, CPACR_EL1, FPEN, 3); - /* and to the SVE instructions */ - env->cp15.cpacr_el1 = FIELD_DP64(env->cp15.cpacr_el1, - CPACR_EL1, ZEN, 3); - /* with reasonable vector length */ + /* and to the SVE instructions, with default vector length */ if (cpu_isar_feature(aa64_sve, cpu)) { + env->cp15.cpacr_el1 = FIELD_DP64(env->cp15.cpacr_el1, + CPACR_EL1, ZEN, 3); env->vfp.zcr_el[1] = cpu->sve_default_vq - 1; } /* From patchwork Wed Jul 6 08:24:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 587739 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1ec:0:0:0:0 with SMTP id 12csp2573226map; Wed, 6 Jul 2022 02:31:25 -0700 (PDT) X-Google-Smtp-Source: AGRyM1s7XmU7zcZA+CE3jrINVXnpYEatXmf07q+bnWLybUM3ZoyjxZnaL7tADWlI91cYI9TrxXgf X-Received: by 2002:a81:b50:0:b0:31c:cd9a:c875 with SMTP id 77-20020a810b50000000b0031ccd9ac875mr7878242ywl.411.1657099885458; Wed, 06 Jul 2022 02:31:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657099885; cv=none; d=google.com; s=arc-20160816; b=E7Se4CzLuSH/I+109xxqdIM41njpBzI5iGi02MOiikr2ZMqUcgF9fkzQ0G700tBC/T thWaRoGMRPlDLArCycNmnFM/iOpHaueA9kdZCeb8zHRgl9Ppl8FZbaeGWsJg/Y/M2lYz x+AtlvxphETVjczDt6jj5qr5z/ZB6JdaQ11xbouF1W1hwv4vPWBWhgPvcaWoAp3wEIwL JofXmtc/2Xz69ksB0wwKV2Pqlwy4YjGNB4bJTqsduwUtq7/1AkwzMTRcOIJjk1aYo2QF UwWBJ9pHbPPSSh5smpBEbu/JUnAiwHrIGQ3BMb19+3I1lEBohyAzuhbU5o/vC1mRI9+M agPA== 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=ojyZOIf2uqXDhLYPW4II9jqD/RYb57Q1CkTjNakDECE=; b=Uhzjk66ZChrRTdcRZqXy/qy519mLWa0JgM9QkdU8QY/FUHlesbWg+Mm7kiEN6hWdem c+oy62QG5mi7gA18fgTxirOrlzkzjtmRER3NyPQ4miA4qa5f/R7LGWmJZveJGuAcF5ni 03tz2wOjNmFbrQTDjbnSewlhml1Hl/zjkX4m8k3iY2DsOlA8j+yLhj1PqXafS/YlZwsr CVahC+UEBukRs442jAS2tTKLeC/qN2Z3nuBTpEtI5IWyIZrr06vFGfGv2/dbJdiM5D+8 dZOPNR0kDXhFGSWiEN4ABeubIN33zlEbZ6GLDHEnGy9UwbpTqPsTpyCa2T4JkciRsO+c aQEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LQM7v3FX; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id 188-20020a2510c5000000b0066e81e8beebsi4322238ybq.236.2022.07.06.02.31.25 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Jul 2022 02:31:25 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LQM7v3FX; 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]:41034 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o91NU-0001S1-VM for patch@linaro.org; Wed, 06 Jul 2022 05:31:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50768) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o90PR-0000nd-IY for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:29:21 -0400 Received: from mail-pg1-x530.google.com ([2607:f8b0:4864:20::530]:37735) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o90PQ-0001Fh-1k for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:29:21 -0400 Received: by mail-pg1-x530.google.com with SMTP id bh13so7517504pgb.4 for ; Wed, 06 Jul 2022 01:29:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ojyZOIf2uqXDhLYPW4II9jqD/RYb57Q1CkTjNakDECE=; b=LQM7v3FXJd5OvJvSswIUXN/4OBPEazXdJr5PeQsGQP0h9nE1FuoBSZL6VrABzRgBxt NDnRb6YIJvAnL80N48NTCb+UfmVRa4KMJ7K+877ox2+SvW7vPGCbMwdqnoEOL/UM+jk9 WH4zCMjh4X7A0/Zzd54FV7Npn39gUjcf2odtIZwJdcqMLMWdrAmuPCKLytfxV42d28Hq pVKRY3RIa3niIiDBM5n4EuFpSP2nmeEFQqCsRv/sv6QTxwiMKY+0S8zFg8rtmQwJ3+8H J8v1S7eXxKUX0nTQVbElsH6p/MrBG2Zu8Mo5+oK5nBuSfH9NCY4JKlAxDwoyCb5GTuGe ptCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ojyZOIf2uqXDhLYPW4II9jqD/RYb57Q1CkTjNakDECE=; b=g5cYJarwQWR/j3PFUALA6/qCybUSHs5qaVb1sGb1SxYhn1c//i/Bhh52fTpINogoRR +JbsVAYLJksScU9b02Z+9KgqUou7EPswOWupliG3GRBAXWJmNrjMBakCF4GL7lJaW4py WofHddTZImKrq0gKqNoD20g1McTQINXMKtZGBh8zjuM10HAlMpLl3bt4+NVTGTcVPfOl dyvrLAuSiR3TIfERRb99IqCyy7xY1ZUTddnwy6H7aEifIJEnYf8DVwvBSYNRiEqPp/aZ GVAzsgv/Yhix9hxIk/zSX+teUZyZRR6FqlfJaG+yrhR9Te0hi1PrPkc9kMgV3hl2cGuG lLYw== X-Gm-Message-State: AJIora/p44/vWowd/1uFIc8vs7sqahBEcjderxeL3+quhw6gtdeyb202 KYV44Z/QskCzE0ms1Hu9YEbdZ7UxTX3ZzW7H X-Received: by 2002:a63:6d8b:0:b0:40d:a35:13ed with SMTP id i133-20020a636d8b000000b0040d0a3513edmr34473006pgc.615.1657096158734; Wed, 06 Jul 2022 01:29:18 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id c17-20020a170903235100b0016bdf53b303sm6700529plh.205.2022.07.06.01.29.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jul 2022 01:29:18 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v5 44/45] target/arm: Enable SME for user-only Date: Wed, 6 Jul 2022 13:54:10 +0530 Message-Id: <20220706082411.1664825-45-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220706082411.1664825-1-richard.henderson@linaro.org> References: <20220706082411.1664825-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::530; envelope-from=richard.henderson@linaro.org; helo=mail-pg1-x530.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" Enable SME, TPIDR2_EL0, and FA64 if supported by the cpu. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/arm/cpu.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/target/arm/cpu.c b/target/arm/cpu.c index 9b54443843..5de7e097e9 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -210,6 +210,17 @@ static void arm_cpu_reset(DeviceState *dev) CPACR_EL1, ZEN, 3); env->vfp.zcr_el[1] = cpu->sve_default_vq - 1; } + /* and for SME instructions, with default vector length, and TPIDR2 */ + if (cpu_isar_feature(aa64_sme, cpu)) { + env->cp15.sctlr_el[1] |= SCTLR_EnTP2; + env->cp15.cpacr_el1 = FIELD_DP64(env->cp15.cpacr_el1, + CPACR_EL1, SMEN, 3); + env->vfp.smcr_el[1] = cpu->sme_default_vq - 1; + if (cpu_isar_feature(aa64_sme_fa64, cpu)) { + env->vfp.smcr_el[1] = FIELD_DP64(env->vfp.smcr_el[1], + SMCR, FA64, 1); + } + } /* * Enable 48-bit address space (TODO: take reserved_va into account). * Enable TBI0 but not TBI1. From patchwork Wed Jul 6 08:24:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 587750 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:1ec:0:0:0:0 with SMTP id 12csp2586901map; Wed, 6 Jul 2022 02:52:20 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vqW+sVSINQt/hTqVfl11BBGbqaD4Vk4VzreQ9KH0OU0UmeFjSMlga2I+AfEDvvXZUnlNAX X-Received: by 2002:a05:6214:1c46:b0:472:ef5a:1713 with SMTP id if6-20020a0562141c4600b00472ef5a1713mr15083546qvb.4.1657101140682; Wed, 06 Jul 2022 02:52:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657101140; cv=none; d=google.com; s=arc-20160816; b=po33ejsueh4Q2YusF58Zvjf5P/DvQJ9rXWXezuxxY2fv5CNSaWKj2weOzIBLJiXege FCVsR7N5SrpPzagrvoYRtL6WV0lQPp9sALGy/OAFLHU5r16HiRYcgw/CwqjkBo8rruYH 9oycJsmMdtQml6rAprWnT+yY5QLnSlt/z9SZePgFObO19vm33TuTjCehq0GcLu9oNXTT RmBWwW8aBADcTsL5xUKTEbIyxVzAieILX1vvfmf/Zc4yNA6WEP4iQqPVD74oZPdYeQEF XkLC/tZh9RWfzM1H8BluMwRJP8PX6PdsFVxxNcaRocGbpPjzsYCzJvBmCecJVHwAAp9c jVXA== 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=IH0GiEUf1cl31EpypJHGc9N38GuuWqV/keLjTWnDRUI=; b=aAcItPuxbvZqZb/ce5g9apoKMBEFkbr2SfA+YkwGyGrPruh3UY/s3NU7hKFziC0MbQ ofgrnA1Dkdfv5UGRDC1+zlI35R4jlxoZwMBbK5SRmaFrPQdXO+CQbVZ0gR5g4v2Lcg1o iTOfy3QaJjApXuiupGqNGUZ+qyQe/ngsrA5My9zvgm7K8NsI4cuzxhxFslVhxgMBtogc XZ7fTgKE4puuLwHBWPdnA+MPxXrXdAgCH+O/RcHcCreFOEvKfx9//1hcsBkITBGDZV5m dX7yCgcjrbyxtUVyWNsD3sdo7WibJFO4qv0oIyMvpIXNRyvXBhM/b16FMmuOlu0sWGF3 KS4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Qy062rT5; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ey22-20020a05622a4c1600b0031e8c312652si1729451qtb.454.2022.07.06.02.52.20 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Wed, 06 Jul 2022 02:52:20 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Qy062rT5; 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]:59460 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o91hk-00007d-84 for patch@linaro.org; Wed, 06 Jul 2022 05:52:20 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50802) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o90PX-00010k-7S for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:29:27 -0400 Received: from mail-pj1-x102b.google.com ([2607:f8b0:4864:20::102b]:52138) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o90PS-0001GM-Ki for qemu-devel@nongnu.org; Wed, 06 Jul 2022 04:29:26 -0400 Received: by mail-pj1-x102b.google.com with SMTP id o15so10084072pjh.1 for ; Wed, 06 Jul 2022 01:29:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=IH0GiEUf1cl31EpypJHGc9N38GuuWqV/keLjTWnDRUI=; b=Qy062rT5xiCcqd1nA9P6hms0CJQdmJhYfq0hImy7ZKbvwJfmdOqUSO9m7lKSQKmW1/ wNImjGohUMpXZhePoQzSOws6sP3Q4CUNn5FjlpffoqhF8UzeYP7MRDBFeeWnpazh8jrd /iZy0aTnykm/qOyfhj0hYXFkEMherXCjXBSpaKqU6Je1MoIwsWAshiINThoJMfjuvEx3 aKVzxBlbJYR5SgIglmzrfxhUAuDAVkI0oaGINn8h15bE5+83UNSoPn0VbBIYOxG0eVY7 KpzPhqPuPbF+b9U4MCjG0YZRo/bCevOzWIR3YdOWB1b0qlYoMND77pGUF2czVWSCnMLd rP7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=IH0GiEUf1cl31EpypJHGc9N38GuuWqV/keLjTWnDRUI=; b=OznQB8PcwMyyIHqmCvwxlHan58ybW+T3zmwksO7MLwvN7DKLjfXc0pGKr+2jINsMBA 6vSXhar989BSjfxIdNCMFV+08uOsa+rut0lHEGWEgGerOpyd1dc6z0f8ol2T1V2Redwi MyGnu2vQnfAvJqyfo+I/vTpAdrN5RuRTZnIbjp1HXAHDs08hPbr+C6hgG0Qcl/NwXhgG hbG3r1l6enTzvGNTY/WBAN/0vhwUf7GnIkvPA3aztqXmO/ks2zqe8k20il5J/22V0+ti 11+S8v/+riiFDJfluH644YReUADVYjdfn6/fGVZY8bncBtNvpH6JGHUIw1PC7BOxoPEr c/Ww== X-Gm-Message-State: AJIora9ttmRqdGtWGHtP96IAJJ34l6+hCT5za2/NBR3Ys4M+e9qT45H8 q24GlzS2cTOKWMAu6XmLgwxPCChjJb04BEF/ X-Received: by 2002:a17:902:a60a:b0:168:b5f7:4148 with SMTP id u10-20020a170902a60a00b00168b5f74148mr47174952plq.47.1657096161222; Wed, 06 Jul 2022 01:29:21 -0700 (PDT) Received: from stoup.. ([122.255.60.245]) by smtp.gmail.com with ESMTPSA id c17-20020a170903235100b0016bdf53b303sm6700529plh.205.2022.07.06.01.29.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Jul 2022 01:29:20 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v5 45/45] linux-user/aarch64: Add SME related hwcap entries Date: Wed, 6 Jul 2022 13:54:11 +0530 Message-Id: <20220706082411.1664825-46-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220706082411.1664825-1-richard.henderson@linaro.org> References: <20220706082411.1664825-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::102b; envelope-from=richard.henderson@linaro.org; helo=mail-pj1-x102b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_HELO_TEMPERROR=0.01 autolearn=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" Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- linux-user/elfload.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 1de77c7959..ce902dbd56 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -605,6 +605,18 @@ enum { ARM_HWCAP2_A64_RNG = 1 << 16, ARM_HWCAP2_A64_BTI = 1 << 17, ARM_HWCAP2_A64_MTE = 1 << 18, + ARM_HWCAP2_A64_ECV = 1 << 19, + ARM_HWCAP2_A64_AFP = 1 << 20, + ARM_HWCAP2_A64_RPRES = 1 << 21, + ARM_HWCAP2_A64_MTE3 = 1 << 22, + ARM_HWCAP2_A64_SME = 1 << 23, + ARM_HWCAP2_A64_SME_I16I64 = 1 << 24, + ARM_HWCAP2_A64_SME_F64F64 = 1 << 25, + ARM_HWCAP2_A64_SME_I8I32 = 1 << 26, + ARM_HWCAP2_A64_SME_F16F32 = 1 << 27, + ARM_HWCAP2_A64_SME_B16F32 = 1 << 28, + ARM_HWCAP2_A64_SME_F32F32 = 1 << 29, + ARM_HWCAP2_A64_SME_FA64 = 1 << 30, }; #define ELF_HWCAP get_elf_hwcap() @@ -674,6 +686,14 @@ static uint32_t get_elf_hwcap2(void) GET_FEATURE_ID(aa64_rndr, ARM_HWCAP2_A64_RNG); GET_FEATURE_ID(aa64_bti, ARM_HWCAP2_A64_BTI); GET_FEATURE_ID(aa64_mte, ARM_HWCAP2_A64_MTE); + GET_FEATURE_ID(aa64_sme, (ARM_HWCAP2_A64_SME | + ARM_HWCAP2_A64_SME_F32F32 | + ARM_HWCAP2_A64_SME_B16F32 | + ARM_HWCAP2_A64_SME_F16F32 | + ARM_HWCAP2_A64_SME_I8I32)); + GET_FEATURE_ID(aa64_sme_f64f64, ARM_HWCAP2_A64_SME_F64F64); + GET_FEATURE_ID(aa64_sme_i16i64, ARM_HWCAP2_A64_SME_I16I64); + GET_FEATURE_ID(aa64_sme_fa64, ARM_HWCAP2_A64_SME_FA64); return hwcaps; }