> Convert all callers of object_property_add() and
> object_class_property_add() that register struct-typed properties with
> QAPI visitor-based getters/setters to use object_property_add_qapi() and
> object_class_property_add_qapi() instead.
> 
> This replaces the manual string type name with a reference to the
> generated QAPITypeInfo constant, enabling QMP introspection to report
> accurate QAPI type information for struct properties. Existing
> getters/setters are preserved unchanged.
> 
> The cxl-fmw property type is corrected from "CXLFixedMemoryWindow"
> (not a real QAPI type) to "CXLFixedMemoryWindowOptions".
> 
> Signed-off-by: Marc-AndrĂ© Lureau <[email protected]>
> Signed-off-by: Markus Armbruster <[email protected]>
> Message-ID: <[email protected]>
> ---
>  authz/list.c              |  2 +-
>  block/throttle-groups.c   |  5 +++--
>  chardev/char-socket.c     |  3 ++-
>  hw/core/machine.c         | 11 +++++++----
>  hw/cxl/cxl-host.c         |  4 +++-
>  hw/remote/vfio-user-obj.c |  5 +++--
>  hw/vfio-user/pci.c        |  5 +++--
>  target/i386/cpu.c         | 11 ++++++++---
>  target/i386/kvm/tdx.c     |  4 +++-
>  target/s390x/cpu-system.c |  4 +++-
>  10 files changed, 36 insertions(+), 18 deletions(-)
>
> diff --git a/authz/list.c b/authz/list.c
> index 363b2ee12c98..ed3d346004c2 100644
> --- a/authz/list.c
> +++ b/authz/list.c
> @@ -128,7 +128,7 @@ qauthz_list_class_init(ObjectClass *oc, const void *data)
>          .set = qauthz_list_prop_set_policy,
>      ));
>  
> -    object_class_property_add(oc, "rules", "QAuthZListRule",
> +    object_class_property_add_qapi(oc, "rules", &QAuthZListRule_type_info,

It should be actually &QAuthZListRuleList_type_info

>                                qauthz_list_prop_get_rules,
>                                qauthz_list_prop_set_rules,
>                                NULL, NULL);
> diff --git a/block/throttle-groups.c b/block/throttle-groups.c
> index 37814b84fe09..987867477acc 100644
> --- a/block/throttle-groups.c
> +++ b/block/throttle-groups.c
> @@ -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"
> @@ -993,8 +994,8 @@ static void throttle_group_obj_class_init(ObjectClass 
> *klass,
>      }
>  
>      /* ThrottleLimits */
> -    object_class_property_add(klass,
> -                              "limits", "ThrottleLimits",
> +    object_class_property_add_qapi(klass,
> +                              "limits", &ThrottleLimits_type_info,
>                                throttle_group_get_limits,
>                                throttle_group_set_limits,
>                                NULL, NULL);
> diff --git a/chardev/char-socket.c b/chardev/char-socket.c
> index 81bac42a1587..8e0e5d4343aa 100644
> --- a/chardev/char-socket.c
> +++ b/chardev/char-socket.c
> @@ -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,7 @@ 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",
> +    object_class_property_add_qapi(oc, "addr", &SocketAddress_type_info,
>                                char_socket_get_addr, NULL,
>                                NULL, NULL);
>  
> diff --git a/hw/core/machine.c b/hw/core/machine.c
> index d9ac4b419a36..94737e17e66f 100644
> --- a/hw/core/machine.c
> +++ b/hw/core/machine.c
> @@ -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"
> @@ -1118,19 +1119,20 @@ 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",
> +    object_class_property_add_qapi(oc, "boot", &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",
> +    object_class_property_add_qapi(oc, "smp", &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",
> +    object_class_property_add_qapi(oc, "smp-cache",
> +        &SmpCachePropertiesWrapper_type_info,
>          machine_get_smp_cache, machine_set_smp_cache, NULL, NULL);
>      object_class_property_set_description(oc, "smp-cache",
>          "Cache properties list for SMP machine");
> @@ -1212,7 +1214,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",
> +    object_class_property_add_qapi(oc, "memory",
> +        &MemorySizeConfiguration_type_info,
>          machine_get_mem, machine_set_mem,
>          NULL, NULL);
>      object_class_property_set_description(oc, "memory",
> diff --git a/hw/cxl/cxl-host.c b/hw/cxl/cxl-host.c
> index e279ce5fe3ae..41b1ee58bbf3 100644
> --- a/hw/cxl/cxl-host.c
> +++ b/hw/cxl/cxl-host.c
> @@ -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",
> +    object_property_add_qapi(obj, "cxl-fmw",
> +                        &CXLFixedMemoryWindowOptions_type_info,

here &CXLFixedMemoryWindowOptionsList_type_info

>                          machine_get_cfmw, machine_set_cfmw,
>                          NULL, state);
>      object_property_set_description(obj, "cxl-fmw",
> diff --git a/hw/remote/vfio-user-obj.c b/hw/remote/vfio-user-obj.c
> index a0498d218faf..7e6819f670b5 100644
> --- a/hw/remote/vfio-user-obj.c
> +++ b/hw/remote/vfio-user-obj.c
> @@ -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,8 @@ static void vfu_object_class_init(ObjectClass *klass, 
> const void *data)
>  
>      k->nr_devs = 0;
>  
> -    object_class_property_add(klass, "socket", "SocketAddress", NULL,
> -                              vfu_object_set_socket, NULL, NULL);
> +    object_class_property_add_qapi(klass, "socket", &SocketAddress_type_info,
> +                              NULL, vfu_object_set_socket, NULL, NULL);
>      object_class_property_set_description(klass, "socket",
>                                            "SocketAddress "
>                                            "(ex: type=unix,path=/tmp/sock). "
> diff --git a/hw/vfio-user/pci.c b/hw/vfio-user/pci.c
> index 983e1d4ad470..f58c4a0f3965 100644
> --- a/hw/vfio-user/pci.c
> +++ b/hw/vfio-user/pci.c
> @@ -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,8 +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,
> -                              vfio_user_pci_set_socket, NULL, NULL);
> +    object_class_property_add_qapi(klass, "socket", &SocketAddress_type_info,
> +                              NULL, vfio_user_pci_set_socket, NULL, NULL);
>      object_class_property_set_description(klass, "socket",
>                                            "SocketAddress (UNIX sockets 
> only)");
>  
> diff --git a/target/i386/cpu.c b/target/i386/cpu.c
> index 74eebeabd7a7..d15966062494 100644
> --- a/target/i386/cpu.c
> +++ b/target/i386/cpu.c
> @@ -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"
> @@ -10539,10 +10541,12 @@ static void x86_cpu_initfn(Object *obj)
>  
>      x86_cpu_init_default_topo(cpu);
>  
> -    object_property_add(obj, "feature-words", "X86CPUFeatureWordInfo",
> +    object_property_add_qapi(obj, "feature-words",
> +                        &X86CPUFeatureWordInfo_type_info,


and &X86CPUFeatureWordInfoList_type_info

-- 
Marc-AndrĂ© Lureau <[email protected]>


Reply via email to