From nobody Fri Apr 3 01:25:55 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1774473566; cv=none; d=zohomail.com; s=zohoarc; b=VvFci6fP9QE+k/lsCsrXZ0Xo5v2s/exapGzHlYzsMHskvyA6HtcJ+DIIQT6ugMDk0OhCNRJuURR9IUaoUwf2j/fIgtWcVFCVHxqlYdCx4RsjZems4bc4KV0My528KMToHbZeLGKexVLXefdV/C+6Uu7GnfPtDeMj4SepYVm777A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1774473566; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=sYLEjfbOiczTZUFDQRpJ1WZc2p5N+UskvmbNC3BaZgI=; b=ceaULj0fTAq3l+QUylydZ2ife1smtBk91yQUrvjIBvMeQA0WaOUYUwzEzbcTC70Hk7O7roM8UxvBkXskDWxQ/trqH61CN0pd8KgyCJmtrExDJfhNbwIdKfMPn4HVaSX3vgmrcrf2fEb+RP8Vfx3CbNCyysi8ewdMLAudP50DkwQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1774473566945193.38017732803326; Wed, 25 Mar 2026 14:19:26 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w5Vcf-0001dv-1D; Wed, 25 Mar 2026 17:18:41 -0400 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 1w5Vcd-0001cs-T7 for qemu-devel@nongnu.org; Wed, 25 Mar 2026 17:18:39 -0400 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1w5Vca-0001qw-R5 for qemu-devel@nongnu.org; Wed, 25 Mar 2026 17:18:39 -0400 Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-43b4f48c47cso203710f8f.0 for ; Wed, 25 Mar 2026 14:18:36 -0700 (PDT) Received: from localhost.localdomain (88-187-86-199.subs.proxad.net. [88.187.86.199]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43b9192e3e8sm2917709f8f.5.2026.03.25.14.18.33 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 25 Mar 2026 14:18:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1774473515; x=1775078315; 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=sYLEjfbOiczTZUFDQRpJ1WZc2p5N+UskvmbNC3BaZgI=; b=S/YXUGD6YXLJjanHRcE+nmVClXdBBIv+shjUwLVqpzHsjSCWOIurU23J3IHKTG6HIz uhvIPwqkD+AhruLJ0pJ3f92H2HXBCGbABF6jFDZNwV0Mmt4TF1ytjsC+n6S5Kdf5u5Lj 2l608vgp7PdBM3ka0A9MM1ezJpvqw/lqoeghvr/WHWq86c6ADkE9xdWHIyjNIq0CKI9D 5Wm0GuFb9dZdF6BYZplUS7m5e+lGtTZTWsWoIirzLoemMdGteqROw7tyJ+JzUqUIO/a9 Syg5OJlQBMgZyl4ggpALcHf8WUy0TY1+exvgbDxRu1rOOn8TCrkmDeiuGni9LEzsK1pJ ZjdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774473515; x=1775078315; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=sYLEjfbOiczTZUFDQRpJ1WZc2p5N+UskvmbNC3BaZgI=; b=DEeB/hZpm39imch12Zs76aG4iXQIaWgxpMqJ3PS+NWbfdRSvC4XbyFlCTBs893WWsq M3Y+5b0OnqdzqTv2phA5u+lY3MX0RN5eurhb4wqPvGS4G9nlxrO9VQKKxQOqnsTd1KDY UMtZ75RcsGzuuLDlXJ30s006FrHfrTMl+FHF+i63Pm7rL4DSV6jrIvvCqbnQ3d0piAvZ xq1Ysbcf+BHvT16l8dyVethRnCaaW6hWo/TPydWKFQ2YnxIBYdyAK1yHrrK0Biw8kmer YNNqwrMlVpAA0+TJM3ydaTDPLQepqszN6iNk6Yf/JkOjaisPGZn+t2FMblreS+sow/xY Ei7g== X-Gm-Message-State: AOJu0YyRhAa7cSTKcGp3k64y7ClU1QG+UgVRwPP3z7DP7iuKW/l3LGid TZUcoUZ8gh/3sUahQAB/BF+DAUSYX7HbcajWDCBF0p0miLO5FK2p/bq8Vskadp4n3RgFhNo48VM cE2xzVOA= X-Gm-Gg: ATEYQzyCmUbAvySaZmI4biS8sPAdJ5VGyQ/rMXGiERpxhDmf0x/4poWWyMDihEzY5nU Q99igmrXktDSxOL4lAIzxbk5zRMmNwpfgyEyLeL122PQTCYy88Y7e8B8cVXIuGUXmH+GLuSnbZg 1Gjqrf0wwIQtdVP3+zL7DBzILrJbLU21E8Zd6NW/7KvZVDgEXJJoouNhpOPKw2S3e8YnIYvZ/pH OEuUfOo6GdVcMODuPTm5m1Ul9YwkOexOD+vCeJbUrB8ueN0KLvUZ01kgQC60PcUENU0Ir6OK8To DGIoRWukT1f/v191r+pr342pvA8J31oTCy0YkXNj7Z/HD26WcYI1NEJxNW13C2zuLIi808sJ8Qf vVCb281hc/rlGKv8xx8dzN+KsdvcnBsJikLXFS7ZEN0KAh0pit/xMf/SjatsAmw7Bn4btGRB2UW HORlKKNAXD4EYOk4rdyB5KBtxfbQQueRf/wHZj6uElHu/BJCS6XRKKB8Vnfwo3uwTWxZKjzmbj X-Received: by 2002:a05:6000:2dc7:b0:439:b6d6:723 with SMTP id ffacd0b85a97d-43b88a1bcc5mr7764409f8f.42.1774473514778; Wed, 25 Mar 2026 14:18:34 -0700 (PDT) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Glenn Miles , Mark Cave-Ayland , Nicholas Piggin , qemu-ppc@nongnu.org, Daniel Henrique Barboza , Fabiano Rosas , Alistair Francis , Pierrick Bouvier , =?UTF-8?q?Alex=20Benn=C3=A9e?= , qemu-riscv@nongnu.org, Paolo Bonzini , Artyom Tarasenko , Anton Johansson , Peter Xu , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH-for-11.1 09/10] target/sparc: Replace VMSTATE_VARRAY_MULTIPLY -> VMSTATE_UINTTL_ARRAY Date: Wed, 25 Mar 2026 22:17:27 +0100 Message-ID: <20260325211728.89204-10-philmd@linaro.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260325211728.89204-1-philmd@linaro.org> References: <20260325211728.89204-1-philmd@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=philmd@linaro.org; helo=mail-wr1-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 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: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1774473569744158500 VMSTATE_VARRAY_MULTIPLY() seems to be an "optimized" version of VMSTATE_UINTTL_ARRAY(), and is only used once. Prefer the generic macro, removing the need for the VMS_MULTIPLY_ELEMENTS field. Bump the SPARC CPU migration stream version. Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Pierrick Bouvier --- include/migration/cpu.h | 2 -- include/migration/vmstate.h | 22 +++------------------- migration/vmstate.c | 4 ---- target/sparc/machine.c | 7 +++---- 4 files changed, 6 insertions(+), 29 deletions(-) diff --git a/include/migration/cpu.h b/include/migration/cpu.h index ea411d863ad..05a1ddde343 100644 --- a/include/migration/cpu.h +++ b/include/migration/cpu.h @@ -12,13 +12,11 @@ VMSTATE_UINT64_V(_f, _s, _v) #define VMSTATE_UINTTL_ARRAY_V(_f, _s, _n, _v) \ VMSTATE_UINT64_ARRAY_V(_f, _s, _n, _v) -#define vmstate_info_uinttl vmstate_info_uint64 #else #define VMSTATE_UINTTL_V(_f, _s, _v) \ VMSTATE_UINT32_V(_f, _s, _v) #define VMSTATE_UINTTL_ARRAY_V(_f, _s, _n, _v) \ VMSTATE_UINT32_ARRAY_V(_f, _s, _n, _v) -#define vmstate_info_uinttl vmstate_info_uint32 #endif =20 #define VMSTATE_UINTTL(_f, _s) \ diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h index 62c2abd0c49..663b0c8ae06 100644 --- a/include/migration/vmstate.h +++ b/include/migration/vmstate.h @@ -94,7 +94,7 @@ enum VMStateFlags { VMS_ARRAY_OF_POINTER =3D 0x040, =20 /* The field is an array of variable size. The uint16_t at opaque - * + VMStateField.num_offset (subject to VMS_MULTIPLY_ELEMENTS) + * + VMStateField.num_offset * contains the number of entries in the array. See the VMS_ARRAY * description regarding array handling in general. May not be * combined with VMS_ARRAY or any other VMS_VARRAY*. */ @@ -115,14 +115,14 @@ enum VMStateFlags { VMS_MULTIPLY =3D 0x200, =20 /* The field is an array of variable size. The uint8_t at opaque + - * VMStateField.num_offset (subject to VMS_MULTIPLY_ELEMENTS) + * VMStateField.num_offset * contains the number of entries in the array. See the VMS_ARRAY * description regarding array handling in general. May not be * combined with VMS_ARRAY or any other VMS_VARRAY*. */ VMS_VARRAY_UINT8 =3D 0x400, =20 /* The field is an array of variable size. The uint32_t at opaque - * + VMStateField.num_offset (subject to VMS_MULTIPLY_ELEMENTS) + * + VMStateField.num_offset * contains the number of entries in the array. See the VMS_ARRAY * description regarding array handling in general. May not be * combined with VMS_ARRAY or any other VMS_VARRAY*. */ @@ -139,12 +139,6 @@ enum VMStateFlags { * cause the individual entries to be allocated. */ VMS_ALLOC =3D 0x2000, =20 - /* Multiply the number of entries given by the integer at opaque + - * VMStateField.num_offset (see VMS_VARRAY*) with VMStateField.num - * to determine the number of entries in the array. Only valid in - * combination with one of VMS_VARRAY*. */ - VMS_MULTIPLY_ELEMENTS =3D 0x4000, - /* A structure field that is like VMS_STRUCT, but uses * VMStateField.struct_version_id to tell which version of the * structure we are referencing to use. */ @@ -398,16 +392,6 @@ extern const VMStateInfo vmstate_info_qlist; .offset =3D vmstate_offset_2darray(_state, _field, _type, _n1, _n2= ), \ } =20 -#define VMSTATE_VARRAY_MULTIPLY(_field, _state, _field_num, _multiply, _in= fo, _type) { \ - .name =3D (stringify(_field)), \ - .num_offset =3D vmstate_offset_value(_state, _field_num, uint32_t),\ - .num =3D (_multiply), \ - .info =3D &(_info), \ - .size =3D sizeof(_type), \ - .flags =3D VMS_VARRAY_UINT32|VMS_MULTIPLY_ELEMENTS, \ - .offset =3D vmstate_offset_varray(_state, _field, _type), \ -} - #define VMSTATE_SUB_ARRAY(_field, _state, _start, _num, _version, _info, _= type) { \ .name =3D (stringify(_field)), \ .version_id =3D (_version), \ diff --git a/migration/vmstate.c b/migration/vmstate.c index 4d28364f7ba..e960bc7a7c4 100644 --- a/migration/vmstate.c +++ b/migration/vmstate.c @@ -97,10 +97,6 @@ static int vmstate_n_elems(void *opaque, const VMStateFi= eld *field) n_elems =3D *(uint8_t *)(opaque + field->num_offset); } =20 - if (field->flags & VMS_MULTIPLY_ELEMENTS) { - n_elems *=3D field->num; - } - trace_vmstate_n_elems(field->name, n_elems); return n_elems; } diff --git a/target/sparc/machine.c b/target/sparc/machine.c index 0a449f2f8c6..5f402e098cf 100644 --- a/target/sparc/machine.c +++ b/target/sparc/machine.c @@ -189,9 +189,9 @@ static int cpu_pre_save(void *opaque) * versions are different. */ #ifndef TARGET_SPARC64 -#define SPARC_VMSTATE_VER 7 +#define SPARC_VMSTATE_VER 8 #else -#define SPARC_VMSTATE_VER 9 +#define SPARC_VMSTATE_VER 10 #endif =20 const VMStateDescription vmstate_sparc_cpu =3D { @@ -202,8 +202,7 @@ const VMStateDescription vmstate_sparc_cpu =3D { .fields =3D (const VMStateField[]) { VMSTATE_UINTTL_ARRAY(env.gregs, SPARCCPU, 8), VMSTATE_UINT32(env.nwindows, SPARCCPU), - VMSTATE_VARRAY_MULTIPLY(env.regbase, SPARCCPU, env.nwindows, 16, - vmstate_info_uinttl, target_ulong), + VMSTATE_UINTTL_ARRAY(env.regbase, SPARCCPU, MAX_NWINDOWS * 16 + 8), VMSTATE_CPUDOUBLE_ARRAY(env.fpr, SPARCCPU, TARGET_DPREGS), VMSTATE_UINTTL(env.pc, SPARCCPU), VMSTATE_UINTTL(env.npc, SPARCCPU), --=20 2.53.0