From patchwork Mon Jun 20 17:51: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: 583181 Delivered-To: patch@linaro.org Received: by 2002:a05:7000:5036:0:0:0:0 with SMTP id e22csp924871mab; Mon, 20 Jun 2022 11:08:05 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tPYMqZDnkhiYEEAruYksIbPUfh/S5jK4n5PDT/Vzwk5IsZKmPGJdM7WF0Hfw7Il7aafOU4 X-Received: by 2002:a05:620a:2297:b0:6a6:aaed:a18b with SMTP id o23-20020a05620a229700b006a6aaeda18bmr17560545qkh.322.1655748484912; Mon, 20 Jun 2022 11:08:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655748484; cv=none; d=google.com; s=arc-20160816; b=W0OOJPAX7XKv8aHlpqdhc4cTCTAxCrWZE6pUEK8UAMyob196uqdLWnsGpmM+FA1uM9 O4vM/0Je+12wekfi4SKmbYvYwpsXeiaOXP9+UaQyf4L4os7BPerYMyU/+HkIXVMa3QNA bxAiuk/JjP6xQ8o99QxBmmKo95bWdJUMn9FZMk/hJomTX6S2vU0bYRJcBFgkpnXwGal6 ZZfo87+ztKKcpuJTnaCjA7usBqmrr2DVcBBQmF/i2h5hR2i2F4j2YUmx0Cpz4yRpfL1M T4SkL67lcrQQ2f6MaHhLPjVp42awGyvcoSGwnyFcr+HaVShf/s/egT67S+sg4lat64jj dpCg== 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=bZQ/+9oH8WDS9FGV3y9tSTDQVCQZ26UllDhjGlm8djg=; b=aHiEDMPABW9AJeAEuxHD9P9sgTnukTuhUhAXRpLb5SSuhwKvvg+vva0aK2IjeNnSmh mJxPrKdqJEQ1kw4dIx5taAovcn1fMvS+KIT5dIyvbIt77FxGNO1bqvs12S6qt8hGaZ1C x/ULrnNjSO/dWM5T7V8/k6rk9eE9EuRDbYFIm2pZHeSc+tirqZDLqP7QfyPdK/GZ6xM0 NrMQIZey3ep7R2/EmcnSRtZBEo/Zkh71T+0TxSJOvh9hNzlT4IyhelfH6mddBwWrkayy r8INzPeeDai3PXbJN/CEFJx6DAH/I1AiHEJA40gw6FZL7c7c0SKNpu0BSQeeYOToRreD jztA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=pUchknfO; 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 2-20020ac84e82000000b0030665f60e2esi9267005qtp.591.2022.06.20.11.08.04 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 20 Jun 2022 11:08: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=pUchknfO; 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]:52082 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o3Loi-0006bc-Dz for patch@linaro.org; Mon, 20 Jun 2022 14:08:04 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41920) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o3LZv-0005h8-Rj for qemu-devel@nongnu.org; Mon, 20 Jun 2022 13:52:47 -0400 Received: from mail-pf1-x42c.google.com ([2607:f8b0:4864:20::42c]:40538) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o3LZt-0001Nz-Q6 for qemu-devel@nongnu.org; Mon, 20 Jun 2022 13:52:47 -0400 Received: by mail-pf1-x42c.google.com with SMTP id c205so4147669pfc.7 for ; Mon, 20 Jun 2022 10:52: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=bZQ/+9oH8WDS9FGV3y9tSTDQVCQZ26UllDhjGlm8djg=; b=pUchknfOpwJ/0g5CCmOSVvKIsUzP8B/CnSDyLfgjxFK1W8mNMMK6eFY/IcB48g33jK SAccq0K76KO8PS9d3nkvbnTpCq+bWAzWz/Tbsa1AjhYgMQmWGSOZVFFMpWPBdckkzhWt l5Ud3XAsb/xPhITnYmHiw/uxdFu7BPCFbjwc1vJyXVMBGmBq/sTsojON5KxC64wU99r1 JxtqlbvVJe+yggCfEkRUVE8LtpWD5RyYzLbl6oLHPGtHNOBhr3sLb4ybXR/VC4ciNm8D Yx/vOF1sFgzSMqE3e9F8JcluopLqmSAmrMLXj98iZlPo0CM+eSB7HTpP0hwLOqj8hdGN +Fhg== 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=bZQ/+9oH8WDS9FGV3y9tSTDQVCQZ26UllDhjGlm8djg=; b=HyQIS6FS8hK86OS5gkPglnK1vjHaKYc4CwkHAx9ZjyRamSEyUSAOBDn2WfbatYYVPi 5xUFZ8R+3tKTFWxzfHSu/rxdxmwrJnwKOCkxmqnH0QY9xWKaY45Ircg+3MXfKaOLLHjh Lo+hM1V1cTWuhBto8y9yU/wS9ahHNCTOZoP7NkdS+4c5p8FSFVP69AGar77m3OY/Scaz rVsQZcN3LkJ2X5+O2YTGaUByij/8cS729kI3Kb9fCPeDU82Z/yyTeoAyykaR/vrJCRSS Dzkk6A5EUv19Zbi6aFdVyfaIroCH6++v60Ur0KUlkg+sJm9zyXphWA1RzrB70PP1vWBh SEWw== X-Gm-Message-State: AJIora+015cCRmN1tYDL4CIA3/z7BhUvngl7FP2shqMdjSErSrXGwOT5 f9aUQlxMwGfXsE45JCzriWj3NTAKWs6plg== X-Received: by 2002:a05:6a00:23ca:b0:525:28b4:9e3b with SMTP id g10-20020a056a0023ca00b0052528b49e3bmr3563538pfc.43.1655747564483; Mon, 20 Jun 2022 10:52:44 -0700 (PDT) Received: from stoup.. ([2602:47:d49e:3c01:a3e0:8a80:7b85:aea6]) by smtp.gmail.com with ESMTPSA id j14-20020aa7928e000000b00525133f98adsm5138138pfa.146.2022.06.20.10.52.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Jun 2022 10:52:44 -0700 (PDT) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org, Peter Maydell Subject: [PATCH v3 09/51] target/arm: Add the SME ZA storage to CPUARMState Date: Mon, 20 Jun 2022 10:51:53 -0700 Message-Id: <20220620175235.60881-10-richard.henderson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220620175235.60881-1-richard.henderson@linaro.org> References: <20220620175235.60881-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" Place this late in the resettable section of the structure, to keep the most common element offsets from being > 64k. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- 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 05d369e690..c3c7ec697d 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,