From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 30E50606A31A for ; Wed, 21 Oct 2026 10:39:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=F+5RUplZ Received: from list by lists.xenproject.org with outflank-mailman.1455855.1669949 (Exim 4.92) (envelope-from ) id 1xJTj8-0004Vs-TA; Wed, 21 Oct 2026 10:39:22 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 1455855.1669949; Wed, 21 Oct 2026 10:39:22 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1xJTj8-0004Vk-PO; Wed, 21 Oct 2026 10:39:22 +0000 Received: by outflank-mailman (input) for mailman id 1455855; Tue, 20 Oct 2026 13:25:53 +0000 Received: from mx.expurgate.net ([195.190.135.10]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1xJ9qj-0002IX-Hw for xen-devel@lists.xenproject.org; Tue, 20 Oct 2026 13:25:53 +0000 Received: from mx.expurgate.net (helo=localhost) by mx.expurgate.net with esmtp id 1xJ9qi-00DKpW-Up for xen-devel@lists.xenproject.org; Tue, 20 Oct 2026 15:25:52 +0200 Received: from [10.42.69.12] (helo=localhost) by localhost with ESMTP (eXpurgate MTA 0.9.1) (envelope-from ) id 6ad76bdd-e002-0a2a0a5209dd-0a2a450c9984-16 for ; Tue, 20 Oct 2026 15:25:52 +0200 Received: from [170.10.133.124] (helo=us-smtp-delivery-124.mimecast.com) by tlsNG-d25034.mxtls.expurgate.net with ESMTPS (eXpurgate 4.57.1) (envelope-from ) id 6ad76bdf-f479-0a2a450c0019-aa0a857c5e6d-3 for ; Tue, 20 Oct 2026 15:25:52 +0200 Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-402-GpgImfhOMWa0lumUFG9c1g-1; Tue, 20 Oct 2026 13:25:47 +0000 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id D737F1800BDD; Tue, 20 Oct 2026 13:25:39 +0000 (UTC) Received: from blackfin.pond.sub.org (unknown [10.44.22.5]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id EA9B818005B3; Tue, 20 Oct 2026 13:25:35 +0000 (UTC) Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 71D8121E6A04; Tue, 20 Oct 2026 15:25:33 +0200 (CEST) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Post: List-Help: List-Subscribe: , Precedence: list Sender: "Xen-devel" Authentication-Results: eu.smtp.expurgate.cloud; dkim=pass header.s=mimecast20190719 header.d=redhat.com header.i="@redhat.com" header.h="From:Subject:Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding:In-Reply-To:References" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1792502751; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=A/2pHd+aS8DA34XJvVp3LyaeljRYqqdyzYtr5T0L1kw=; b=F+5RUplZlFA/aNN08lauJ+UTGkc6AiwT8Rx1h8d9T3ifJ58aVfPcVayvSNRZMCUnhODbYg ojZoObdiC1LiiZBmfEpepFwYikN8ckTkb45g8FCUcv1FGzqYmHbTWvqQqWrZc7UpAwNqLf h4uM8Apoh3gxxtZ0ZCNIUPVt+Ah7tDw= X-MC-Unique: GpgImfhOMWa0lumUFG9c1g-1 X-Mimecast-MFC-AGG-ID: GpgImfhOMWa0lumUFG9c1g_1792502743 From: Markus Armbruster To: =?utf-8?Q?Marc-Andr=C3=A9?= Lureau Cc: qemu-devel@nongnu.org, Michael Roth , John Snow , Peter Maydell , Mauro Carvalho Chehab , Pierrick Bouvier , Paolo Bonzini , Daniel P. =?utf-8?Q?Berrang=C3=A9?= , Kostiantyn Kostiuk , Eric Blake , David Hildenbrand , Igor Mammedov , "Edgar E. Iglesias" , Jason Wang , Marcelo Tosatti , kvm@vger.kernel.org, Alberto Garcia , Kevin Wolf , Hanna Reitz , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= , Zhao Liu , Jonathan Cameron , Junjie Cao , Anisa Su , Elena Ufimtseva , Jagannathan Raman , John Levon , Thanos Makatos , =?utf-8?Q?C=C3=A9dric?= Le Goater , Cornelia Huck , Eric Farman , Matthew Rosato , Richard Henderson , Ilya Leoshkevich , qemu-block@nongnu.org, linux-cxl@vger.kernel.org, qemu-s390x@nongnu.org, "Michael S. Tsirkin" , Sergio Lopez , qemu-arm@nongnu.org, Palmer Dabbelt , Alistair Francis , Weiwei Li , Daniel Henrique Barboza , Liu Zhiwei , Chao Liu , qemu-riscv@nongnu.org, Song Gao <17746591750@163.com>, Bibo Mao , Xianglai Li , Jiaxun Yang , Pedro Barbuda , Mohamed Mediouni , Nicholas Piggin , Harsh Prateek Bora , Amit Machhiwal , qemu-ppc@nongnu.org, Zhang Chen , Li Zhijian , Alistair Francis , Alexander Graf , "Gonglei (Arei)" , zhenwei pi , Ani Sinha , Luc Michel , =?utf-8?Q?C=C3=A9dric?= Le Goater , Jamin Lin , Kane Chen , Samuel Tardieu , "Denis V. Lunev" , FangSheng Huang , Tyrone Ting , Hao Wu , Keith Busch , Klaus Jensen , Jesper Devantier , Aditya Gupta , Glenn Miles , Conor Dooley , Sebastian Huber , Halil Pasic , Christian Borntraeger , Jason Herne , Titus Rwantare , Stefano Stabellini , Anthony PERARD , Peter Xu , Chinmay Rath , Hendrik Brueckner , xen-devel@lists.xenproject.org, Roman Bolshakov , Phil Dennis-Jordan , Fam Zheng , Farhan Ali , Alex Williamson , Tao Tang , Stefan Berger , Fabiano Rosas , Mark Cave-Ayland , Artyom Tarasenko , Yoshinori Sato , Jiri Pirko , Eric Auger , Laurent Vivier Subject: Re: [PATCH v7 43/65] qom: replace object_property_add_tm with StructTm QAPI type In-Reply-To: <20261020-qom-qapi-v7-43-431a86b02b58@redhat.com> (=?utf-8?Q?=22Marc-Andr=C3=A9?= Lureau"'s message of "Tue, 20 Oct 2026 14:46:00 +0400") References: <20261020-qom-qapi-v7-0-431a86b02b58@redhat.com> <20261020-qom-qapi-v7-43-431a86b02b58@redhat.com> Date: Tue, 20 Oct 2026 15:25:33 +0200 Message-ID: <874iegpkqa.fsf@pond.sub.org> User-Agent: Gnus/5.13 (Gnus v5.13) X-Archived-By: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 X-Mimecast-MFC-PROC-ID: W6Eqtq9_NUEoEzIQ7YdJHWxL2OWvy5TyfI6zkw9FnRQ_1792502743 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-purgate-ID: tlsNG-d25034/1792502752-01CC3A5B-04F31F7B/0/0 X-purgate-type: clean X-purgate-size: 9014 X-Spam-Status: No, score=-17.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_PASS, SPF_PASS,UNPARSEABLE_RELAY,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 Marc-Andr=C3=A9 Lureau writes: > Define a StructTm QAPI struct in common.json matching the existing > "struct tm" property wire format (tm_year, tm_mon, tm_mday, tm_hour, > tm_min, tm_sec as int32). > > Convert the two callers (mc146818rtc and spapr_rtc) to use > object_property_add_qapi() with a standard ObjectPropertyAccessor > that populates a StructTm and calls the generated visitor. > > Remove object_property_add_tm(), object_class_property_add_tm(), > the TMProperty type, and the property_get_tm() helper from > qom/object.c, along with their declarations in object.h. > > Reviewed-by: Amit Machhiwal > Signed-off-by: Markus Armbruster > Signed-off-by: Marc-Andr=C3=A9 Lureau > --- > hw/ppc/spapr_rtc.c | 24 +++++++++++++++--- > hw/rtc/mc146818rtc.c | 22 ++++++++++++++--- > include/qom/object.h | 29 ---------------------- > qapi/common.json | 28 +++++++++++++++++++++ > qapi/pragma.json | 1 + > qom/object.c | 69 ----------------------------------------------= ------ > 6 files changed, 69 insertions(+), 104 deletions(-) > > diff --git a/hw/ppc/spapr_rtc.c b/hw/ppc/spapr_rtc.c > index 1f7d2d8f898b..5105cf538f64 100644 > --- a/hw/ppc/spapr_rtc.c > +++ b/hw/ppc/spapr_rtc.c > @@ -33,6 +33,9 @@ > #include "migration/vmstate.h" > #include "qapi/error.h" > #include "qapi/qapi-events-misc.h" > +#include "qapi/qapi-type-infos-common.h" > +#include "qapi/qapi-visit-common.h" > +#include "qapi/visitor.h" > #include "qemu/cutils.h" > #include "qemu/module.h" > =20 > @@ -131,9 +134,23 @@ static void rtas_set_time_of_day(PowerPCCPU *cpu, Sp= aprMachineState *spapr, > rtas_st(rets, 0, RTAS_OUT_SUCCESS); > } > =20 > -static void spapr_rtc_qom_date(Object *obj, struct tm *current_tm, Error= **errp) > +static void spapr_rtc_qom_date(Object *obj, Visitor *v, const char *name= , > + void *opaque, Error **errp) > { > - spapr_rtc_read(SPAPR_RTC(obj), current_tm, NULL); > + struct tm value; > + StructTm tm, *tmp =3D &tm; > + > + spapr_rtc_read(SPAPR_RTC(obj), &value, NULL); > + > + tm =3D (StructTm) { > + .tm_year =3D value.tm_year, > + .tm_mon =3D value.tm_mon, > + .tm_mday =3D value.tm_mday, > + .tm_hour =3D value.tm_hour, > + .tm_min =3D value.tm_min, > + .tm_sec =3D value.tm_sec, > + }; > + visit_type_StructTm(v, name, &tmp, errp); > } > =20 > static void spapr_rtc_realize(DeviceState *dev, Error **errp) > @@ -150,7 +167,8 @@ static void spapr_rtc_realize(DeviceState *dev, Error= **errp) > rtc_ns =3D qemu_clock_get_ns(rtc_clock); > rtc->ns_offset =3D host_s * NANOSECONDS_PER_SECOND - rtc_ns; > =20 > - object_property_add_tm(OBJECT(rtc), "date", spapr_rtc_qom_date); > + object_property_add_qapi(OBJECT(rtc), "date", &StructTm_type_info, > + spapr_rtc_qom_date, NULL, NULL, NULL); The @type reported by qom-list & friends changes from "struct tm" (visible at the end of this patch) to to "StuctTm". Such changes can be compatibility breaks. Same "this is okay" argument as for the previous patch, and same request: please note the change in the commit message. > } > =20 > static const VMStateDescription vmstate_spapr_rtc =3D { > diff --git a/hw/rtc/mc146818rtc.c b/hw/rtc/mc146818rtc.c > index ba396435d1af..6010f8587ce0 100644 > --- a/hw/rtc/mc146818rtc.c > +++ b/hw/rtc/mc146818rtc.c > @@ -42,6 +42,8 @@ > #include "migration/vmstate.h" > #include "qapi/error.h" > #include "qapi/qapi-events-misc.h" > +#include "qapi/qapi-type-infos-common.h" > +#include "qapi/qapi-visit-common.h" > #include "qapi/visitor.h" > #include "trace.h" > =20 > @@ -854,12 +856,25 @@ static const MemoryRegionOps cmos_ops =3D { > .endianness =3D DEVICE_LITTLE_ENDIAN, > }; > =20 > -static void rtc_get_date(Object *obj, struct tm *current_tm, Error **err= p) > +static void rtc_get_date(Object *obj, Visitor *v, const char *name, > + void *opaque, Error **errp) > { > MC146818RtcState *s =3D MC146818_RTC(obj); > + struct tm value; > + StructTm tm, *tmp =3D &tm; > =20 > rtc_update_time(s); > - rtc_get_time(s, current_tm); > + rtc_get_time(s, &value); > + > + tm =3D (StructTm) { > + .tm_year =3D value.tm_year, > + .tm_mon =3D value.tm_mon, > + .tm_mday =3D value.tm_mday, > + .tm_hour =3D value.tm_hour, > + .tm_min =3D value.tm_min, > + .tm_sec =3D value.tm_sec, > + }; > + visit_type_StructTm(v, name, &tmp, errp); > } > =20 > static void rtc_realizefn(DeviceState *dev, Error **errp) > @@ -1019,7 +1034,8 @@ static void rtc_class_initfn(ObjectClass *klass, co= nst void *data) > device_class_set_props(dc, mc146818rtc_properties); > set_bit(DEVICE_CATEGORY_MISC, dc->categories); > =20 > - object_class_property_add_tm(klass, "date", rtc_get_date); > + object_class_property_add_qapi(klass, "date", &StructTm_type_info, > + rtc_get_date, NULL, NULL, NULL); > } > =20 > static const TypeInfo mc146818rtc_info =3D { > diff --git a/include/qom/object.h b/include/qom/object.h > index e04be4caed57..29cbd84b8d03 100644 > --- a/include/qom/object.h > +++ b/include/qom/object.h > @@ -2156,35 +2156,6 @@ object_class_property_add_qapi(ObjectClass *klass, > ObjectPropertyRelease *release, > void *opaque); > =20 > -/** > - * object_property_add_tm: > - * @obj: the object to add a property to > - * @name: the name of the property > - * @get: the getter or NULL if the property is write-only. > - * > - * Add a read-only struct tm valued property using a getter function. > - * This function will add a property of type 'struct tm'. > - * > - * Returns: The newly added property on success, or %NULL on failure. > - */ > -ObjectProperty *object_property_add_tm(Object *obj, const char *name, > - void (*get)(Object *, struct tm *, Error **)= ); > - > -/** > - * object_class_property_add_tm: > - * @klass: the object class to add a property to > - * @name: the name of the property > - * @get: the getter or NULL if the property is write-only. > - * > - * Add a read-only struct tm valued property using a getter function. > - * This function will add a property of type 'struct tm'. > - * > - * Returns: The newly added property on success, or %NULL on failure. > - */ > -ObjectProperty *object_class_property_add_tm(ObjectClass *klass, > - const char *name, > - void (*get)(Object *, struct tm *, Error **)= ); > - > typedef enum { > /* Automatically add a getter to the property */ > OBJ_PROP_FLAG_READ =3D 1 << 0, > diff --git a/qapi/common.json b/qapi/common.json > index 1352e664b23e..222037ea0b32 100644 > --- a/qapi/common.json > +++ b/qapi/common.json > @@ -218,3 +218,31 @@ > ## > { 'enum': 'EndianMode', > 'data': [ 'unspecified', 'little', 'big' ] } > + > +## > +# @StructTm: > +# > +# Broken-down time. Field semantics match C ``struct tm``. Again, please use the revised syntax for introductions. > +# > +# @tm_year: years since 1900 > +# > +# @tm_mon: months since January (0-11) > +# > +# @tm_mday: day of the month (1-31) > +# > +# @tm_hour: hours since midnight (0-23) > +# > +# @tm_min: minutes after the hour (0-59) > +# > +# @tm_sec: seconds after the minute (0-59, 60-61 for leap seconds) > +# > +# Since: 11.2 Same "do we care?" as for the previous patch. > +## > +{ 'struct': 'StructTm', > + 'data': { > + 'tm_year': 'int32', > + 'tm_mon': 'int32', > + 'tm_mday': 'int32', > + 'tm_hour': 'int32', > + 'tm_min': 'int32', > + 'tm_sec': 'int32' } } > diff --git a/qapi/pragma.json b/qapi/pragma.json > index 342cedc42e76..9be2819a46bd 100644 > --- a/qapi/pragma.json > +++ b/qapi/pragma.json > @@ -109,6 +109,7 @@ # Externally visible types whose member names may use uppercase Not this patch's fault, but here goes anyway: the comment should be "may use uppercase or '_'". I'll fix it. 'member-name-exceptions': [ # visible in: 'ACPISlotType', # query-acpi-ospm-status [...] > 'QKeyCode', # send-key, input-sent-event > 'QapiErrorClass', # QMP error replies > 'SshHostKeyCheckMode', # blockdev-add, -blockdev > + 'StructTm', # qom-get of RTC date property > 'SysEmuTarget', # query-cpu-fast, query-target > 'UuidInfo', # query-uuid > 'VncClientInfo', # query-vnc, query-vnc-servers, ... [...]