From patchwork Thu Feb 6 19:56:25 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 862534 Delivered-To: patch@linaro.org Received: by 2002:a5d:51d2:0:b0:385:e875:8a9e with SMTP id n18csp284287wrv; Thu, 6 Feb 2025 11:58:26 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCVCwj2oofldMPovcMjSAqAd47N9tOwSOMQuDTqXriqW1CQ+xlN4HxBAkESkn1bKdopLS0Rtxw==@linaro.org X-Google-Smtp-Source: AGHT+IHidKhihUggorbO+8pp6SAgG+MXkNjzBn4RdqpwYTzesT0/Md3s+618jl4AwHUcXXN9n1D+ X-Received: by 2002:a05:622a:428f:b0:467:6eda:dfc8 with SMTP id d75a77b69052e-47167b1859dmr9979761cf.46.1738871906744; Thu, 06 Feb 2025 11:58:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1738871906; cv=none; d=google.com; s=arc-20240605; b=SxDS7KmiDmLNtNm18XZbFE3CimdlyT5P1b2rIQhJM3eCCgDJYeVBuSzhTMnUGz7hIW 8T4GW8dBJ/fwJG4BXcqD40tN/yzgHDdP1UaeyP+TRvdfOuST1nrxE0yz0J8baLoBwelW qgCM/mngzEC0UDczU4hdmes4U0TK357/e0GbjlQh0DQsiajrG1xF3Ovnp5L6vifBlZsh IXfCoJJgr3DkEONVZRpTbvxS9h68E8IHWNHCsgmwMAtrbVegb4m23RV/caRdjZ4MwTxu MVsCf9LivFdEF5MbSMlEZFUZIIrrIUEVnFr3KHOkfG4+afwGiF2XQ5n2ksefDHaVf/SV A0xA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; 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=1jeL6G+ehP6DAv/JMmuB8zO0ZT9W1TNZmuyontpehM8=; fh=9Ev+QBUhk6P6vR3LT1wYeDLexozsz44nqjfoyPajZCc=; b=NWfemK9QQGPBGx88ORsk99oEHcRnLJB5mhnWfoLZeaDUHHs9RTkFEvW9GpeEHYA0iY TBMbSQVA+35M3YU5t198enfTlbj4tzdxxbZ+wtWEKr/i1v6PcK0gVJTiyE5mObF7NczE A34vLLlffhG98YtLZcXKJDj3KBZD/w4Dwme1f+4GBlf0yjxn3OPD+aDBOmUdk5WQGn1J PZ4mjC367aU0qKpPGZJDB4uS2Yxg+EaRLf4XPeMjFJJKU7aUmBzKGp7jNdnG9So9sq9d Hb+9bOdhs60TjOZH9E551/mZF1Z+zW3puQHPAp5Sb98f0dYjEtIqN6O16jAwYe3ruTry Fyxg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YNppJS2Y; 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; dara=neutral header.i=@linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id d75a77b69052e-47153b902f9si16009291cf.342.2025.02.06.11.58.26 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 06 Feb 2025 11:58:26 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YNppJS2Y; 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; dara=neutral header.i=@linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tg80U-0007O8-Tl; Thu, 06 Feb 2025 14:57:50 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tg809-0007Bc-By for qemu-devel@nongnu.org; Thu, 06 Feb 2025 14:57:29 -0500 Received: from mail-pl1-x633.google.com ([2607:f8b0:4864:20::633]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tg806-0000Tt-Bl for qemu-devel@nongnu.org; Thu, 06 Feb 2025 14:57:28 -0500 Received: by mail-pl1-x633.google.com with SMTP id d9443c01a7336-21f48ebaadfso12072685ad.2 for ; Thu, 06 Feb 2025 11:57:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1738871845; x=1739476645; darn=nongnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=1jeL6G+ehP6DAv/JMmuB8zO0ZT9W1TNZmuyontpehM8=; b=YNppJS2YRyvI7bSdGz4OgVDETMCDIEf2NXYk8gwwQazPgJ8MjWR4gHLC9COJP8+uT7 m18WYJZhLxVkoQ+C+/p9nI1yEgAtWiONDiJ35I03otu8JnR4+iDdeLkOvA9FDJJV3a/y xillf8VyXrKUNBjBhKMjQ0Ii/dWoJ9vR6wGkaK2/niNWT+ft4Qnz02Ww6EqcU1gRxyI4 BWv0AnbCUTrVch4GN7eQOCNZh8univhukpPVblTp04XATCnxs0p+5Gj8dhtgFxMIDw1z cXQMk27IgV1PLmO2/paW1IblXI3kGtxT5KQlUvMiOck3HxbdFcxQvmuYR0bIu6PCdB+u zdHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738871845; x=1739476645; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1jeL6G+ehP6DAv/JMmuB8zO0ZT9W1TNZmuyontpehM8=; b=ePOs1AkAFtJlUu47HM9pxi7KSQAhO6RtmVgCnRCexwzfkL5bGGUJK5/ZYEWUcsmuUj PcAgMq8pav+y8Fw6hxk8k7yt3XI9c3D68U7UNlDWhyxJ9F4mkVxLJgYQMkXmVIThPsxw Bu4FnruQ4rt74D772ectYwiayNlQFQCReA8MfufYEpy1IefERq4sXnF9STjCq9ieVYVI fHnF/zJm5MrC7EUfK486GTlB/6uTYyP+88sLILkUBL2XSIjfGBQtxSrE9KvWmaVT1bzJ XPuP3R9bKsVpSeWqnC7TOfnrzmtV/A/Tl0OWhUie/TyZF8klLtbuJNMmYzqZLMql0M8c df6w== X-Gm-Message-State: AOJu0YyJsN5hhb8vEI8C9PF5W4KWJiDA0J+6BXbx93s3K4aOy5XK2bwI zy2ptpmp++cMkEMStGdRpq6R3fDghyNaOOEjWQvXrpQokuZwXzU9DzoBkJN1RvZY1qOE61Iaq+r H X-Gm-Gg: ASbGncsmGH8naxC9KJ6hWJH+l19oZC5oIx9sPi8pateOwZagcFU0DvAuVLoETgwkMvU JiWkkrK3boF+NFX4LPbvgHp1623TrnMvCP5g/4Jf4UTtdUedEdSUmyEtIpTYh3j20gBvcLU60KG yn+cJzwl4KyOGKk0jQZovirS5EJoIoxy8Cqc5yly5f4kCWd+OjjMk5/RIYNSphpY374V4W2fecc thYYOc14nbAKQYF5i9iuqBeWNtkzbM62yTT7nea20qduPJY1Jast5kTyOXIvQVflUG6RehqzZkp wbLHjkF+RvhpoFE9YgzwjTDcVAtQWyqW3vvbqH4eRbO7BV4= X-Received: by 2002:a05:6a00:84c:b0:725:cfa3:bc6b with SMTP id d2e1a72fcca58-7305d413212mr1174912b3a.3.1738871844884; Thu, 06 Feb 2025 11:57:24 -0800 (PST) Received: from stoup.. (71-212-39-66.tukw.qwest.net. [71.212.39.66]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-73048c16370sm1666993b3a.152.2025.02.06.11.57.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Feb 2025 11:57:24 -0800 (PST) From: Richard Henderson To: qemu-devel@nongnu.org Cc: qemu-arm@nongnu.org Subject: [PATCH 11/61] target/arm: Rename zarray to za_state.za Date: Thu, 6 Feb 2025 11:56:25 -0800 Message-ID: <20250206195715.2150758-12-richard.henderson@linaro.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250206195715.2150758-1-richard.henderson@linaro.org> References: <20250206195715.2150758-1-richard.henderson@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2607:f8b0:4864:20::633; envelope-from=richard.henderson@linaro.org; helo=mail-pl1-x633.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 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org The whole ZA state will also contain ZT0. Make things easier in aarch64_set_svcr to zero both by wrapping them in a common structure. Signed-off-by: Richard Henderson --- target/arm/cpu.h | 48 +++++++++++++++++++--------------- linux-user/aarch64/signal.c | 4 +-- target/arm/cpu.c | 4 +-- target/arm/helper.c | 2 +- target/arm/machine.c | 2 +- target/arm/tcg/sme_helper.c | 6 ++--- target/arm/tcg/translate-sme.c | 4 +-- 7 files changed, 38 insertions(+), 32 deletions(-) diff --git a/target/arm/cpu.h b/target/arm/cpu.h index 42c39ac6bd..938c990854 100644 --- a/target/arm/cpu.h +++ b/target/arm/cpu.h @@ -733,27 +733,33 @@ typedef struct CPUArchState { 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[]. This corresponds to the architectural ZA - * array, where ZA[N] is in the least-significant bytes of env->zarray[N]. - * When SVL is less than the architectural maximum, the accessible - * storage is restricted, such that if the SVL is X bytes the guest can - * see only the bottom X elements of zarray[], and only the least - * significant X bytes of each element of the array. (In other words, - * the observable part is always square.) - * - * The ZA storage can also be considered as a set of square tiles of - * elements of different sizes. The mapping from tiles to the ZA array - * is architecturally defined, such that for tiles of elements of esz - * bytes, the Nth row (or "horizontal slice") of tile T is in - * ZA[T + N * esz]. Note that this means that each tile is not contiguous - * in the ZA storage, because its rows are striped through the ZA array. - * - * 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]; + struct { + /* + * SME ZA storage -- 256 x 256 byte array, with bytes in host + * word order, as we do with vfp.zregs[]. This corresponds to + * the architectural ZA array, where ZA[N] is in the least + * significant bytes of env->za_state.za[N]. + * + * When SVL is less than the architectural maximum, the accessible + * storage is restricted, such that if the SVL is X bytes the guest + * can see only the bottom X elements of zarray[], and only the least + * significant X bytes of each element of the array. (In other words, + * the observable part is always square.) + * + * The ZA storage can also be considered as a set of square tiles of + * elements of different sizes. The mapping from tiles to the ZA array + * is architecturally defined, such that for tiles of elements of esz + * bytes, the Nth row (or "horizontal slice") of tile T is in + * ZA[T + N * esz]. Note that this means that each tile is not + * contiguous in the ZA storage, because its rows are striped through + * the ZA array. + * + * 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 za[ARM_MAX_VQ * 16]; + } za_state; #endif struct CPUBreakpoint *cpu_breakpoint[16]; diff --git a/linux-user/aarch64/signal.c b/linux-user/aarch64/signal.c index bc7a13800d..d50cab78d8 100644 --- a/linux-user/aarch64/signal.c +++ b/linux-user/aarch64/signal.c @@ -248,7 +248,7 @@ static void target_setup_za_record(struct target_za_context *za, 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); + __put_user_e(env->za_state.za[i].d[j], z + j, le); } } } @@ -397,7 +397,7 @@ static bool target_restore_za_record(CPUARMState *env, 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); + __get_user_e(env->za_state.za[i].d[j], z + j, le); } } return true; diff --git a/target/arm/cpu.c b/target/arm/cpu.c index ba08c05ec6..813cb45276 100644 --- a/target/arm/cpu.c +++ b/target/arm/cpu.c @@ -1369,8 +1369,8 @@ static void aarch64_cpu_dump_state(CPUState *cs, FILE *f, int flags) qemu_fprintf(f, "ZA[%0*d]=", svl_lg10, i); for (j = zcr_len; j >= 0; --j) { qemu_fprintf(f, "%016" PRIx64 ":%016" PRIx64 "%c", - env->zarray[i].d[2 * j + 1], - env->zarray[i].d[2 * j], + env->za_state.za[i].d[2 * j + 1], + env->za_state.za[i].d[2 * j], j ? ':' : '\n'); } } diff --git a/target/arm/helper.c b/target/arm/helper.c index 7d95eae997..e5f06bc288 100644 --- a/target/arm/helper.c +++ b/target/arm/helper.c @@ -6438,7 +6438,7 @@ void aarch64_set_svcr(CPUARMState *env, uint64_t new, uint64_t mask) * when disabled either. */ if (change & new & R_SVCR_ZA_MASK) { - memset(env->zarray, 0, sizeof(env->zarray)); + memset(&env->za_state, 0, sizeof(env->za_state)); } if (tcg_enabled()) { diff --git a/target/arm/machine.c b/target/arm/machine.c index 978249fb71..d41da414b3 100644 --- a/target/arm/machine.c +++ b/target/arm/machine.c @@ -315,7 +315,7 @@ static const VMStateDescription vmstate_za = { .minimum_version_id = 1, .needed = za_needed, .fields = (const VMStateField[]) { - VMSTATE_STRUCT_ARRAY(env.zarray, ARMCPU, ARM_MAX_VQ * 16, 0, + VMSTATE_STRUCT_ARRAY(env.za_state.za, ARMCPU, ARM_MAX_VQ * 16, 0, vmstate_vreg, ARMVectorReg), VMSTATE_END_OF_LIST() } diff --git a/target/arm/tcg/sme_helper.c b/target/arm/tcg/sme_helper.c index d4562502dd..45f6cdfcb4 100644 --- a/target/arm/tcg/sme_helper.c +++ b/target/arm/tcg/sme_helper.c @@ -39,12 +39,12 @@ void helper_sme_zero(CPUARMState *env, uint32_t imm, uint32_t svl) uint32_t i; /* - * Special case clearing the entire ZA space. + * Special case clearing the entire ZArray. * 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)); + memset(env->za_state.za, 0, sizeof(env->za_state.za)); return; } @@ -54,7 +54,7 @@ void helper_sme_zero(CPUARMState *env, uint32_t imm, uint32_t svl) */ for (i = 0; i < svl; i++) { if (imm & (1 << (i % 8))) { - memset(&env->zarray[i], 0, svl); + memset(&env->za_state.za[i], 0, svl); } } } diff --git a/target/arm/tcg/translate-sme.c b/target/arm/tcg/translate-sme.c index 51175c923e..e8b3578174 100644 --- a/target/arm/tcg/translate-sme.c +++ b/target/arm/tcg/translate-sme.c @@ -92,7 +92,7 @@ static TCGv_ptr get_tile_rowcol(DisasContext *s, int esz, int rs, offset = tile * sizeof(ARMVectorReg); /* Include the byte offset of zarray to make this relative to env. */ - offset += offsetof(CPUARMState, zarray); + offset += offsetof(CPUARMState, za_state.za); tcg_gen_addi_i32(tmp, tmp, offset); /* Add the byte offset to env to produce the final pointer. */ @@ -112,7 +112,7 @@ static TCGv_ptr get_tile(DisasContext *s, int esz, int tile) TCGv_ptr addr = tcg_temp_new_ptr(); int offset; - offset = tile * sizeof(ARMVectorReg) + offsetof(CPUARMState, zarray); + offset = tile * sizeof(ARMVectorReg) + offsetof(CPUARMState, za_state.za); tcg_gen_addi_ptr(addr, tcg_env, offset); return addr;