From patchwork Tue Jun 7 20:32:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 579353 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5806:0:0:0:0 with SMTP id j6csp5516435max; Tue, 7 Jun 2022 14:13:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzMJaT85zuyvzy4+NUqlre2to8TG4YuzA3txfoLd34PoQHzycNMyFPF5389dgwyY529Qiy/ X-Received: by 2002:a05:6214:194a:b0:464:56ca:5912 with SMTP id q10-20020a056214194a00b0046456ca5912mr34006751qvk.35.1654636425155; Tue, 07 Jun 2022 14:13:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654636425; cv=none; d=google.com; s=arc-20160816; b=04N9r8HEy3chUe69sDCNWG5kgcmUlwWrXH2rlEtGEZv15kQ0Bbr8AzrE2t4MJkCN4W F8e6CfQgHB2aahufqps4LpvSGkR4tSQHKIN1DKhhKhC7qLrzPYJb2kTAZxEgRj4YMtkL 90y8D72PksWGKO6UP10KVNozk1/bHkJUa+1L8vlYiFze3s3qjaK5E55FKr9cGE91R7p8 pBzMZ6hh6l48GEY7OWIYJIid8DjwVDgpbpsmY+QoDxXWK3cPwCI3yw/Gh3hPTfBSlFQx LEkLQ16ikBx0BchjSW+kec2zrAotkPITIRiirJFhS9CuIGXc/V6xXocKMQ3c9LlvyipD 2CVw== 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=EBTWvQZP/RYxFNlEjf8hqWkdSO6h/uW0wx557hiI+xw=; b=SdQF0PDGkf+Yr7qyOC7EeAVr7zG8RNkYCuxJ1UM77a/IXn2NAGWUPxSqxKt9A4raZ+ cYXR4b1KQDpIg1ka6cCajAYSL8RQLS92CZmvYY97yyKuV7JIk5laDL8t8HRL6EBc0hq8 8v6QVoWfe8/WEpm77b5q92Lc+lp6TpbI5YiawuNtvkSG8FWJcJspunQAkHqT/40hF5En i8hlZOxacyebXk6BDWb4PrRbg8rwNN+1Xh/QC4z2fFa1o2GnfxLPV8DhXSMvlIDwGHlU SxdNL32cuGsKUMAGlSvG/TcYS5pY9h0cq4UF0+F04ET+HkiYRNcV5YKJj4TOf/+Bnoj2 3Qig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Mh9AYBq3; 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 t14-20020a05622a148e00b00304f96f6e32si1699242qtx.553.2022.06.07.14.13.45 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 07 Jun 2022 14:13:45 -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=Mh9AYBq3; 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]:41060 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nygWG-0000mg-Js for patch@linaro.org; Tue, 07 Jun 2022 17:13:44 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34290) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nyftW-0008N5-SI for qemu-devel@nongnu.org; Tue, 07 Jun 2022 16:33:42 -0400 Received: from mail-pj1-x102f.google.com ([2607:f8b0:4864:20::102f]:35680) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nyftP-0007GS-Ln for qemu-devel@nongnu.org; Tue, 07 Jun 2022 16:33:42 -0400 Received: by mail-pj1-x102f.google.com with SMTP id o6-20020a17090a0a0600b001e2c6566046so21930494pjo.0 for ; Tue, 07 Jun 2022 13:33: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=EBTWvQZP/RYxFNlEjf8hqWkdSO6h/uW0wx557hiI+xw=; b=Mh9AYBq3cU8LhosEfmERJz+m3mYNjuWH9xNqSnyMa4mOxYWNy5rh9iwg1sZ1n+yQCD npzDdeExp0tm+eIgk0q6g35WAaCxBx7kIGsT+5Fu7kfBa8ICFtC9WA0aWUHKismnfurm drt5mBnDKDR+Euo1qDw8aEAvBsnwLF1/4b9a67E8cmsUU1Zq/QqFopj+6RnmKi5FYcJi HOh6cnrhaJ9kIXJE8k4724hhEpTkNxPZPguMIQzxrlB8IGO8hsE2Sm2346P60khJ19uO 86b0t+naqs31TD0CraQQBrRbkRiuxJbFT8U/qEgZluXiXrTkRN/jY8zOIEvk2TNSGJ3Q gOoA== 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=EBTWvQZP/RYxFNlEjf8hqWkdSO6h/uW0wx557hiI+xw=; b=mQpf4M6m2AQOexcIKQ1bEYOmJztyVXKx4b/xPA/xzODzPs8AVbeoigfisBYsqF10Ly dJrRFWRipDY6tTANCoxjNX2P8VAEGjA7opYSeyJoM+phMMeySQosF7xfDClbJ7PSLdGz inHqTg/2GaYIQqkV5hwE/bWHA6I+W32XFSGhuAzCR4FhM7Zy24+Rkg93gXA53JuJwSv9 qHli4Im73XxonA2jSvuxHz1BAI08CodjC6IFqZZtuQzbmTO0F3i90Stec8ueqbrmzJpL hwoIQQ57R/4RI/iJF8qu/bu5ZIQi5srT6ZpX7mTX/Sl0Qeg9h1CdPc114NigDGHA0DRz khgg== X-Gm-Message-State: AOAM530zvX+Au/JtSkKFcQbKpTCCNErV2izRAlEePWz1QZ+VQ/XlQ7hy wCJ5o1mcZ8Uhgw6U1oTMlArC9ebGAyLJTQ== X-Received: by 2002:a17:903:2112:b0:166:496a:74b5 with SMTP id o18-20020a170903211200b00166496a74b5mr25958473ple.138.1654634014690; Tue, 07 Jun 2022 13:33:34 -0700 (PDT) Received: from stoup.. ([2602:ae:1547:e101:3cf2:c634:5b19:25f6]) by smtp.gmail.com with ESMTPSA id s22-20020a17090aba1600b001d9780b7779sm4227856pjr.15.2022.06.07.13.33.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 13:33:34 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, qemu-arm@nongnu.org Subject: [PATCH v2 29/71] target/arm: Add the SME ZA storage to CPUARMState Date: Tue, 7 Jun 2022 13:32:24 -0700 Message-Id: <20220607203306.657998-30-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220607203306.657998-1-richard.henderson@linaro.org> References: <20220607203306.657998-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=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" Place this late in the resettable section of the structure, to keep the most common element offsets from being > 64k. Signed-off-by: Richard Henderson Reviewed-by: Peter Maydell --- target/arm/cpu.h | 8 ++++++++ target/arm/machine.c | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index b48a80dab7..ef374eefe8 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -694,6 +694,14 @@ typedef struct CPUArchState { } keys; uint64_t scxtnum_el[4]; + + /* + * SME ZA storage -- 256 x 256 byte array, with bytes in host word order, + * as we do with vfp.zregs[]. Because this is so large, keep this toward + * the end of the reset area, to keep the offsets into the rest of the + * structure smaller. + */ + ARMVectorReg zarray[ARM_MAX_VQ * 16]; #endif #if defined(CONFIG_USER_ONLY) diff --git a/target/arm/machine.c b/target/arm/machine.c index 285e387d2c..54c5c62433 100644 --- a/target/arm/machine.c +++ b/target/arm/machine.c @@ -167,6 +167,39 @@ static const VMStateDescription vmstate_sve = { VMSTATE_END_OF_LIST() } }; + +static const VMStateDescription vmstate_vreg = { + .name = "vreg", + .version_id = 1, + .minimum_version_id = 1, + .fields = (VMStateField[]) { + VMSTATE_UINT64_ARRAY(d, ARMVectorReg, ARM_MAX_VQ * 2), + VMSTATE_END_OF_LIST() + } +}; + +static bool za_needed(void *opaque) +{ + ARMCPU *cpu = opaque; + + /* + * When ZA storage is disabled, its contents are discarded. + * It will be zeroed when ZA storage is re-enabled. + */ + return FIELD_EX64(cpu->env.svcr, SVCR, ZA); +} + +static const VMStateDescription vmstate_za = { + .name = "cpu/sme", + .version_id = 1, + .minimum_version_id = 1, + .needed = za_needed, + .fields = (VMStateField[]) { + VMSTATE_STRUCT_ARRAY(env.zarray, ARMCPU, ARM_MAX_VQ * 16, 0, + vmstate_vreg, ARMVectorReg), + VMSTATE_END_OF_LIST() + } +}; #endif /* AARCH64 */ static bool serror_needed(void *opaque) @@ -884,6 +917,7 @@ const VMStateDescription vmstate_arm_cpu = { &vmstate_m_security, #ifdef TARGET_AARCH64 &vmstate_sve, + &vmstate_za, #endif &vmstate_serror, &vmstate_irq_line_state,