qom: convert struct properties to QAPI-aware registration

Convert all callers of object_property_add() and
object_class_property_add() that register struct-typed properties with
QAPI visitor-based getters/setters to pass QAPITypeInfo.

This enables QMP QOM introspection to report accurate QAPI type
information for struct properties in member @qapi-type. Existing
getters/setters are preserved unchanged.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-ID: <20261101201717.3911097-20-armbru@redhat.com>
This commit is contained in:
Marc-André Lureau authored and Markus Armbruster committed 2026-11-02 19:35:21 +01:00
1 parent 3ee2b14a42
commit fc4e20b83b
10 files changed
+41 -19

No files matched your search

+2 -1
View File
@@ -127,7 +127,8 @@ qauthz_list_class_init(ObjectClass *oc, const void *data)
qauthz_list_prop_get_policy,
qauthz_list_prop_set_policy);
object_class_property_add(oc, "rules", "QAuthZListRule", NULL,
object_class_property_add(oc, "rules", "QAuthZListRule",
&QAuthZListRuleList_type_info,
qauthz_list_prop_get_rules,
qauthz_list_prop_set_rules,
NULL, NULL);
+3 -1
View File
@@ -31,6 +31,7 @@
#include "qemu/thread.h"
#include "system/qtest.h"
#include "qapi/error.h"
#include "qapi/qapi-type-infos-block-core.h"
#include "qapi/qapi-visit-block-core.h"
#include "qom/object.h"
#include "qom/object_interfaces.h"
@@ -991,7 +992,8 @@ static void throttle_group_obj_class_init(ObjectClass *klass,
}
/* ThrottleLimits */
object_class_property_add(klass, "limits", "ThrottleLimits", NULL,
object_class_property_add(klass, "limits", "ThrottleLimits",
&ThrottleLimits_type_info,
throttle_group_get_limits,
throttle_group_set_limits,
NULL, NULL);
+3 -1
View File
@@ -31,6 +31,7 @@
#include "qemu/option.h"
#include "qapi/error.h"
#include "qapi/clone-visitor.h"
#include "qapi/qapi-type-infos-sockets.h"
#include "qapi/qapi-visit-sockets.h"
#include "qemu/yank.h"
#include "trace.h"
@@ -1568,7 +1569,8 @@ static void char_socket_class_init(ObjectClass *oc, const void *data)
cc->chr_listener_cleanup = tcp_chr_listener_cleanup;
cc->chr_get_filename = tcp_chr_get_filename;
object_class_property_add(oc, "addr", "SocketAddress", NULL,
object_class_property_add(oc, "addr", "SocketAddress",
&SocketAddress_type_info,
char_socket_get_addr, NULL,
NULL, NULL);
+8 -4
View File
@@ -18,6 +18,7 @@
#include "hw/core/loader.h"
#include "qemu/error-report.h"
#include "qapi/error.h"
#include "qapi/qapi-type-infos-machine.h"
#include "qapi/qapi-visit-machine.h"
#include "qapi/qapi-commands-machine.h"
#include "qemu/madvise.h"
@@ -1119,20 +1120,22 @@ static void machine_class_init(ObjectClass *oc, const void *data)
object_class_property_set_description(oc, "dumpdtb",
"Dump current dtb to a file and quit");
object_class_property_add(oc, "boot", "BootConfiguration", NULL,
object_class_property_add(oc, "boot", "BootConfiguration",
&BootConfiguration_type_info,
machine_get_boot, machine_set_boot,
NULL, NULL);
object_class_property_set_description(oc, "boot",
"Boot configuration");
object_class_property_add(oc, "smp", "SMPConfiguration", NULL,
object_class_property_add(oc, "smp", "SMPConfiguration",
&SMPConfiguration_type_info,
machine_get_smp, machine_set_smp,
NULL, NULL);
object_class_property_set_description(oc, "smp",
"CPU topology");
object_class_property_add(oc, "smp-cache", "SmpCachePropertiesWrapper",
NULL,
&SmpCachePropertiesWrapper_type_info,
machine_get_smp_cache, machine_set_smp_cache,
NULL, NULL);
object_class_property_set_description(oc, "smp-cache",
@@ -1216,7 +1219,8 @@ static void machine_class_init(ObjectClass *oc, const void *data)
"Set RAM backend"
"Valid value is ID of hostmem based backend");
object_class_property_add(oc, "memory", "MemorySizeConfiguration", NULL,
object_class_property_add(oc, "memory", "MemorySizeConfiguration",
&MemorySizeConfiguration_type_info,
machine_get_mem, machine_set_mem,
NULL, NULL);
object_class_property_set_description(oc, "memory",
+3 -1
View File
@@ -13,6 +13,7 @@
#include "system/qtest.h"
#include "hw/core/boards.h"
#include "qapi/qapi-type-infos-machine.h"
#include "qapi/qapi-visit-machine.h"
#include "hw/cxl/cxl.h"
#include "hw/cxl/cxl_host.h"
@@ -616,7 +617,8 @@ void cxl_machine_init(Object *obj, CXLState *state)
"Set on/off to enable/disable "
"CXL instantiation");
object_property_add(obj, "cxl-fmw", "CXLFixedMemoryWindow", NULL,
object_property_add(obj, "cxl-fmw", "CXLFixedMemoryWindow",
&CXLFixedMemoryWindowOptionsList_type_info,
machine_get_cfmw, machine_set_cfmw,
NULL, state);
object_property_set_description(obj, "cxl-fmw",
+4 -2
View File
@@ -47,6 +47,7 @@
#include "hw/core/boards.h"
#include "hw/remote/machine.h"
#include "qapi/error.h"
#include "qapi/qapi-type-infos-sockets.h"
#include "qapi/qapi-visit-sockets.h"
#include "qapi/qapi-events-misc.h"
#include "qemu/notify.h"
@@ -931,8 +932,9 @@ static void vfu_object_class_init(ObjectClass *klass, const void *data)
k->nr_devs = 0;
object_class_property_add(klass, "socket", "SocketAddress", NULL, NULL,
vfu_object_set_socket, NULL, NULL);
object_class_property_add(klass, "socket", "SocketAddress",
&SocketAddress_type_info,
NULL, vfu_object_set_socket, NULL, NULL);
object_class_property_set_description(klass, "socket",
"SocketAddress "
"(ex: type=unix,path=/tmp/sock). "
+3 -1
View File
@@ -8,6 +8,7 @@
#include "qemu/osdep.h"
#include <sys/ioctl.h>
#include "qapi/qapi-type-infos-sockets.h"
#include "qapi-visit-sockets.h"
#include "qemu/error-report.h"
@@ -471,7 +472,8 @@ static void vfio_user_pci_class_init(ObjectClass *klass, const void *data)
device_class_set_legacy_reset(dc, vfio_user_pci_reset);
device_class_set_props(dc, vfio_user_pci_properties);
object_class_property_add(klass, "socket", "SocketAddress", NULL, NULL,
object_class_property_add(klass, "socket", "SocketAddress",
&SocketAddress_type_info, NULL,
vfio_user_pci_set_socket, NULL, NULL);
object_class_property_set_description(klass, "socket",
"SocketAddress (UNIX sockets only)");
+7 -3
View File
@@ -35,6 +35,8 @@
#include "sev.h"
#include "qapi/error.h"
#include "qemu/error-report.h"
#include "qapi/qapi-type-infos-machine.h"
#include "qapi/qapi-type-infos-run-state.h"
#include "qapi/qapi-visit-machine.h"
#include "standard-headers/asm-x86/kvm_para.h"
#include "hw/core/qdev-properties.h"
@@ -10569,11 +10571,12 @@ static void x86_cpu_initfn(Object *obj)
x86_cpu_init_default_topo(cpu);
object_property_add(obj, "feature-words", "X86CPUFeatureWordInfo", NULL,
object_property_add(obj, "feature-words", "X86CPUFeatureWordInfo",
&X86CPUFeatureWordInfoList_type_info,
x86_cpu_get_feature_words,
NULL, NULL, (void *)env->features);
object_property_add(obj, "filtered-features", "X86CPUFeatureWordInfo",
NULL,
&X86CPUFeatureWordInfo_type_info,
x86_cpu_get_feature_words,
NULL, NULL, (void *)cpu->filtered_features);
@@ -11041,7 +11044,8 @@ static void x86_cpu_common_class_init(ObjectClass *oc, const void *data)
#if !defined(CONFIG_USER_ONLY)
object_class_property_add(oc, "crash-information",
"GuestPanicInformation", NULL,
"GuestPanicInformation",
&GuestPanicInformation_type_info,
x86_cpu_get_crash_info_qom, NULL, NULL, NULL);
#endif
+6 -4
View File
@@ -14,6 +14,7 @@
#include "qemu/base64.h"
#include "qemu/mmap-alloc.h"
#include "qapi/error.h"
#include "qapi/qapi-type-infos-sockets.h"
#include "qapi/qapi-visit-sockets.h"
#include "qom/object_interfaces.h"
#include "crypto/hash.h"
@@ -1586,10 +1587,11 @@ static void tdx_guest_init(Object *obj)
tdx_guest_get_mrownerconfig,
tdx_guest_set_mrownerconfig);
object_property_add(obj, "quote-generation-socket", "SocketAddress", NULL,
tdx_guest_get_qgs,
tdx_guest_set_qgs,
NULL, NULL);
object_property_add(obj, "quote-generation-socket", "SocketAddress",
&SocketAddress_type_info,
tdx_guest_get_qgs,
tdx_guest_set_qgs,
NULL, NULL);
tdx->event_notify_vector = -1;
tdx->event_notify_apicid = -1;
+2 -1
View File
@@ -30,6 +30,7 @@
#include "system/reset.h"
#include "qemu/timer.h"
#include "trace.h"
#include "qapi/qapi-type-infos-run-state.h"
#include "qapi/qapi-visit-run-state.h"
#include "system/hw_accel.h"
@@ -138,7 +139,7 @@ void s390_cpu_system_init(Object *obj)
cs->start_powered_off = true;
object_property_add(obj, "crash-information", "GuestPanicInformation",
NULL,
&GuestPanicInformation_type_info,
s390_cpu_get_crash_info_qom, NULL, NULL, NULL);
cpu->env.tod_timer =
timer_new_ns(QEMU_CLOCK_VIRTUAL, s390x_tod_timer, cpu);