[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v7 44/65] hw/nvdimm: convert UUID property to QAPI-aware registration
- To: qemu-devel@xxxxxxxxxx
- From: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx>
- Date: Tue, 20 Oct 2026 14:46:01 +0400
- 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"
- Cc: Markus Armbruster <armbru@xxxxxxxxxx>, Michael Roth <michael.roth@xxxxxxx>, John Snow <jsnow@xxxxxxxxxx>, Peter Maydell <peter.maydell@xxxxxxxxxx>, Mauro Carvalho Chehab <mchehab+huawei@xxxxxxxxxx>, Pierrick Bouvier <pierrick.bouvier@xxxxxxxxxxxxxxxx>, Paolo Bonzini <pbonzini@xxxxxxxxxx>, Daniel P. Berrangé <berrange@xxxxxxxxxx>, Kostiantyn Kostiuk <kkostiuk@xxxxxxxxxx>, Eric Blake <eblake@xxxxxxxxxx>, David Hildenbrand <david@xxxxxxxxxx>, Igor Mammedov <imammedo@xxxxxxxxxx>, "Edgar E. Iglesias" <edgar.iglesias@xxxxxxxxx>, Jason Wang <jasowangio@xxxxxxxxx>, Marcelo Tosatti <mtosatti@xxxxxxxxxx>, kvm@xxxxxxxxxxxxxxx, Alberto Garcia <berto@xxxxxxxxxx>, Kevin Wolf <kwolf@xxxxxxxxxx>, Hanna Reitz <hreitz@xxxxxxxxxx>, Philippe Mathieu-Daudé <philmd@xxxxxxxxxxxxxxxx>, Zhao Liu <zhao1.liu@xxxxxxxxx>, Jonathan Cameron <jic23@xxxxxxxxxx>, Junjie Cao <junjie.cao@xxxxxxxxx>, Anisa Su <anisa.su@xxxxxxxxxxx>, Elena Ufimtseva <elena.ufimtseva@xxxxxxxxxx>, Jagannathan Raman <jag.raman@xxxxxxxxxx>, John Levon <john.levon@xxxxxxxxxxx>, Thanos Makatos <thanos.makatos@xxxxxxxxxxx>, Cédric Le Goater <clg@xxxxxxxxxx>, Cornelia Huck <cohuck@xxxxxxxxxx>, Eric Farman <farman@xxxxxxxxxxxxx>, Matthew Rosato <mjrosato@xxxxxxxxxxxxx>, Richard Henderson <richard.henderson@xxxxxxxxxx>, Ilya Leoshkevich <iii@xxxxxxxxxxxxx>, qemu-block@xxxxxxxxxx, linux-cxl@xxxxxxxxxxxxxxx, qemu-s390x@xxxxxxxxxx, "Michael S. Tsirkin" <mst@xxxxxxxxxx>, Sergio Lopez <slp@xxxxxxxxxx>, qemu-arm@xxxxxxxxxx, Palmer Dabbelt <palmer@xxxxxxxxxxx>, Alistair Francis <alistair.francis@xxxxxxx>, Weiwei Li <liwei1518@xxxxxxxxx>, Daniel Henrique Barboza <daniel.barboza@xxxxxxxxxxxxxxxx>, Liu Zhiwei <zhiwei_liu@xxxxxxxxxxxxxxxxx>, Chao Liu <chao.liu@xxxxxxxxxxxxxxxxxx>, qemu-riscv@xxxxxxxxxx, Song Gao <17746591750@xxxxxxx>, Bibo Mao <maobibo@xxxxxxxxxxx>, Xianglai Li <lixianglai@xxxxxxxxxxx>, Jiaxun Yang <jiaxun.yang@xxxxxxxxxxx>, Pedro Barbuda <pbarbuda@xxxxxxxxxxxxx>, Mohamed Mediouni <mohamed@xxxxxxxxxxxxxxxx>, Nicholas Piggin <npiggin@xxxxxxxxx>, Harsh Prateek Bora <harshpb@xxxxxxxxxxxxx>, Amit Machhiwal <amachhiw@xxxxxxxxxxxxx>, qemu-ppc@xxxxxxxxxx, Zhang Chen <zhangckid@xxxxxxxxx>, Li Zhijian <lizhijian@xxxxxxxxxxx>, Alistair Francis <alistair@xxxxxxxxxxxxx>, Alexander Graf <graf@xxxxxxxxxx>, "Gonglei (Arei)" <arei.gonglei@xxxxxxxxxx>, zhenwei pi <zhenwei.pi@xxxxxxxxx>, Ani Sinha <anisinha@xxxxxxxxxx>, Luc Michel <luc@xxxxxxxxxx>, Cédric Le Goater <clg@xxxxxxxx>, Jamin Lin <jamin_lin@xxxxxxxxxxxxxx>, Kane Chen <kane_chen@xxxxxxxxxxxxxx>, Samuel Tardieu <sam@xxxxxxxxxxx>, "Denis V. Lunev" <den@xxxxxxxxxx>, FangSheng Huang <FangSheng.Huang@xxxxxxx>, Tyrone Ting <kfting@xxxxxxxxxxx>, Hao Wu <wuhaotsh@xxxxxxxxxx>, Keith Busch <kbusch@xxxxxxxxxx>, Klaus Jensen <its@xxxxxxxxxxxxx>, Jesper Devantier <foss@xxxxxxxxxxx>, Aditya Gupta <adityag@xxxxxxxxxxxxx>, Glenn Miles <milesg@xxxxxxxxxxxxx>, Conor Dooley <conor@xxxxxxxxxx>, Sebastian Huber <sebastian.huber@xxxxxxxxxxxxxxxxxx>, Halil Pasic <pasic@xxxxxxxxxxxxx>, Christian Borntraeger <borntraeger@xxxxxxxxxxxxx>, Jason Herne <jjherne@xxxxxxxxxxxxx>, Titus Rwantare <titusr@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Anthony PERARD <anthony@xxxxxxxxxxxxxx>, Peter Xu <peterx@xxxxxxxxxx>, Chinmay Rath <rathc@xxxxxxxxxxxxx>, Hendrik Brueckner <brueckner@xxxxxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx, Roman Bolshakov <rbolshakov@xxxxxxx>, Phil Dennis-Jordan <phil@xxxxxxxxxxxxx>, Fam Zheng <fam@xxxxxxxxxx>, Farhan Ali <alifm@xxxxxxxxxxxxx>, Alex Williamson <alex@xxxxxxxxxxx>, Tao Tang <tangtao1634@xxxxxxxxxxxxxx>, Stefan Berger <stefanb@xxxxxxxxxxxxxxxxxx>, Fabiano Rosas <farosas@xxxxxxx>, Mark Cave-Ayland <mark.cave-ayland@xxxxxxxxxxxx>, Artyom Tarasenko <atar4qemu@xxxxxxxxx>, Yoshinori Sato <yoshinori.sato@xxxxxxxxx>, Jiri Pirko <jiri@xxxxxxxxxxx>, Eric Auger <eric.auger@xxxxxxxxxx>, Laurent Vivier <lvivier@xxxxxxxxxx>, Marc-André Lureau <marcandre.lureau@xxxxxxxxxx>
- Delivery-date: Tue, 20 Oct 2026 10:57:37 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
Add a QemuUUID_type_info and use object_property_add_qapi() instead of
object_property_add() for the nvdimm UUID property.
The type info is defined manually in uuid.c rather than generated,
since QAPI does not yet support string typedefs. An alternative would
be to extend the QAPI schema language with a 'typedef' construct
(e.g. { 'typedef': 'UUID', 'data': 'str' }), which would let the
generator produce the type info, C typedef, and introspection entry
automatically.
Alternatively, the exposed type being a string, we could change the
property to be str_type_info.
Signed-off-by: Markus Armbruster <armbru@xxxxxxxxxx>
Signed-off-by: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx>
---
hw/mem/nvdimm.c | 4 ++--
include/qemu/uuid.h | 4 ++++
util/uuid.c | 5 +++++
3 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/hw/mem/nvdimm.c b/hw/mem/nvdimm.c
index 123ddc938546..b7ccb5c93678 100644
--- a/hw/mem/nvdimm.c
+++ b/hw/mem/nvdimm.c
@@ -104,8 +104,8 @@ static void nvdimm_init(Object *obj)
nvdimm_get_label_size, nvdimm_set_label_size,
NULL,
NULL);
- object_property_add(obj, NVDIMM_UUID_PROP, "QemuUUID", nvdimm_get_uuid,
- nvdimm_set_uuid, NULL, NULL);
+ object_property_add_qapi(obj, NVDIMM_UUID_PROP, &QemuUUID_type_info,
+ nvdimm_get_uuid, nvdimm_set_uuid, NULL, NULL);
}
static void nvdimm_finalize(Object *obj)
diff --git a/include/qemu/uuid.h b/include/qemu/uuid.h
index 869f84af09dd..ed0c62327d4d 100644
--- a/include/qemu/uuid.h
+++ b/include/qemu/uuid.h
@@ -16,6 +16,8 @@
#ifndef QEMU_UUID_H
#define QEMU_UUID_H
+#include "qapi/qapi-type-info.h"
+
/* Version 4 UUID (pseudo random numbers), RFC4122 4.4. */
@@ -99,4 +101,6 @@ QemuUUID qemu_uuid_bswap(QemuUUID uuid);
uint32_t qemu_uuid_hash(const void *uuid);
+extern const QAPITypeInfo QemuUUID_type_info;
+
#endif
diff --git a/util/uuid.c b/util/uuid.c
index 234619dd5e69..363a03051aba 100644
--- a/util/uuid.c
+++ b/util/uuid.c
@@ -17,6 +17,11 @@
#include "qemu/uuid.h"
#include "qemu/bswap.h"
+const QAPITypeInfo QemuUUID_type_info = {
+ .name = "QemuUUID",
+ .masked_name = "str",
+};
+
void qemu_uuid_generate(QemuUUID *uuid)
{
int i;
--
2.56.0.116.g6de20f6092dc
|