[PATCH v3 00/74] qom/qdev: associate properties with QAPI schema types

Marc-André Lureau posted 74 patches 1 month, 1 week ago
Failed in applying to current master (apply log)
Maintainers: Roman Bolshakov <rbolshakov@ddn.com>, Phil Dennis-Jordan <phil@philjordan.eu>, Paolo Bonzini <pbonzini@redhat.com>, Alexander Graf <graf@amazon.com>, Richard Henderson <richard.henderson@linaro.org>, Pedro Barbuda <pbarbuda@microsoft.com>, Mohamed Mediouni <mohamed@unpredictable.fr>, "Daniel P. Berrangé" <berrange@redhat.com>, "Gonglei (Arei)" <arei.gonglei@huawei.com>, zhenwei pi <zhenwei.pi@linux.dev>, David Hildenbrand <david@kernel.org>, Igor Mammedov <imammedo@redhat.com>, Alistair Francis <alistair.francis@wdc.com>, Tao Tang <tangtao1634@phytium.com.cn>, Stefan Berger <stefanb@linux.vnet.ibm.com>, Alberto Garcia <berto@igalia.com>, Kevin Wolf <kwolf@redhat.com>, Hanna Reitz <hreitz@redhat.com>, "Marc-André Lureau" <marcandre.lureau@redhat.com>, Markus Armbruster <armbru@redhat.com>, Michael Roth <michael.roth@amd.com>, Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>, "Michael S. Tsirkin" <mst@redhat.com>, Ani Sinha <anisinha@redhat.com>, Peter Maydell <peter.maydell@linaro.org>, Stefano Stabellini <sstabellini@kernel.org>, Anthony PERARD <anthony@xenproject.org>, "Edgar E. Iglesias" <edgar.iglesias@gmail.com>, Luc Michel <luc@lmichel.fr>, "Philippe Mathieu-Daudé" <philmd@mailo.com>, Zhao Liu <zhao1.liu@intel.com>, Jonathan Cameron <jic23@kernel.org>, "Cédric Le Goater" <clg@kaod.org>, Steven Lee <steven_lee@aspeedtech.com>, Troy Lee <leetroy@gmail.com>, Jamin Lin <jamin_lin@aspeedtech.com>, Kane Chen <kane_chen@aspeedtech.com>, Andrew Jeffery <andrew@codeconstruct.com.au>, Joel Stanley <joel@jms.id.au>, Glenn Miles <milesg@linux.ibm.com>, Samuel Tardieu <sam@rfc1149.net>, Sergio Lopez <slp@redhat.com>, Marcelo Tosatti <mtosatti@redhat.com>, John Snow <jsnow@redhat.com>, "Denis V. Lunev" <den@openvz.org>, Yoshinori Sato <yoshinori.sato@nifty.com>, Song Gao <17746591750@163.com>, Bibo Mao <maobibo@loongson.cn>, Xianglai Li <lixianglai@loongson.cn>, Jiaxun Yang <jiaxun.yang@flygoat.com>, FangSheng Huang <FangSheng.Huang@amd.com>, Tyrone Ting <kfting@nuvoton.com>, Hao Wu <wuhaotsh@google.com>, Jason Wang <jasowangio@gmail.com>, Jiri Pirko <jiri@resnulli.us>, Keith Busch <kbusch@kernel.org>, Klaus Jensen <its@irrelevant.dk>, Jesper Devantier <foss@defmacro.it>, Nicholas Piggin <npiggin@gmail.com>, Aditya Gupta <adityag@linux.ibm.com>, Harsh Prateek Bora <harshpb@linux.ibm.com>, Elena Ufimtseva <elena.ufimtseva@oracle.com>, Jagannathan Raman <jag.raman@oracle.com>, Conor Dooley <conor@kernel.org>, Sebastian Huber <sebastian.huber@embedded-brains.de>, Palmer Dabbelt <palmer@dabbelt.com>, Weiwei Li <liwei1518@gmail.com>, Daniel Henrique Barboza <daniel.barboza@oss.qualcomm.com>, Liu Zhiwei <zhiwei_liu@linux.alibaba.com>, Chao Liu <chao.liu@processmission.com>, Halil Pasic <pasic@linux.ibm.com>, Christian Borntraeger <borntraeger@linux.ibm.com>, Eric Farman <farman@linux.ibm.com>, Farhan Ali <alifm@linux.ibm.com>, Cornelia Huck <cohuck@redhat.com>, Matthew Rosato <mjrosato@linux.ibm.com>, Ilya Leoshkevich <iii@linux.ibm.com>, Jason Herne <jjherne@linux.ibm.com>, Titus Rwantare <titusr@google.com>, John Levon <john.levon@nutanix.com>, Thanos Makatos <thanos.makatos@nutanix.com>, Alex Williamson <alex@shazbot.org>, Eric Auger <eric.auger@redhat.com>, Fam Zheng <fam@euphon.net>, Peter Xu <peterx@redhat.com>, Fabiano Rosas <farosas@suse.de>, Zhang Chen <zhangckid@gmail.com>, Li Zhijian <lizhijian@fujitsu.com>, Eric Blake <eblake@redhat.com>, Kostiantyn Kostiuk <kkostiuk@redhat.com>, Chinmay Rath <rathc@linux.ibm.com>, Hendrik Brueckner <brueckner@linux.ibm.com>, Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>, Artyom Tarasenko <atar4qemu@gmail.com>, Laurent Vivier <lvivier@redhat.com>
There is a newer version of this series
accel/hvf/hvf-all.c                      |  29 ++--
accel/kvm/kvm-all.c                      |  31 ++--
accel/nitro/nitro-accel.c                |   3 +-
accel/tcg/tcg-all.c                      |   3 +-
accel/whpx/whpx-common.c                 |  58 +++----
authz/list.c                             |  14 +-
backends/cryptodev.c                     |   7 +-
backends/hostmem-file.c                  |  33 ++--
backends/hostmem-memfd.c                 |   3 +-
backends/hostmem.c                       |  20 +--
backends/spdm-socket.c                   |  25 +--
backends/tpm/tpm_util.c                  |   3 +-
block/throttle-groups.c                  |  10 +-
chardev/char-socket.c                    |   3 +-
crypto/secret_common.c                   |  12 +-
crypto/secret_keyring.c                  |   9 +-
crypto/tlscreds.c                        |  12 +-
docs/devel/qapi-code-gen.rst             | 123 +++++++++++++--
docs/interop/virtio-balloon-stats.rst    |  22 +--
event-loop-base.c                        |   7 +-
hw/acpi/ich9.c                           |   3 +-
hw/acpi/pci.c                            |   7 +-
hw/arm/virt.c                            |  31 ++--
hw/block/xen-block.c                     |   3 +-
hw/core/clock.c                          |   3 +-
hw/core/machine-qmp-cmds.c               |   3 +-
hw/core/machine.c                        |  13 +-
hw/core/qdev-prop-internal.h             |  20 +++
hw/core/qdev-properties-system.c         |  97 ++++++------
hw/core/qdev-properties.c                | 180 ++++++++++++++-------
hw/cpu/core.c                            |  10 +-
hw/cxl/cxl-host.c                        |   6 +-
hw/display/apple-gfx-mmio.m              |   2 +-
hw/display/apple-gfx-pci.m               |   2 +-
hw/display/apple-gfx.h                   |   1 +
hw/display/apple-gfx.m                   |   7 +-
hw/gpio/aspeed_gpio.c                    |   5 +-
hw/gpio/aspeed_sgpio.c                   |   3 +-
hw/gpio/pca9552.c                        | 261 ++++++++++++-------------------
hw/gpio/pca9554.c                        | 157 +++++++------------
hw/gpio/stm32l4x5_gpio.c                 |   5 +-
hw/i386/microvm.c                        |  80 ++++------
hw/i386/pc.c                             |  32 ++--
hw/i386/pc_piix.c                        |  61 +++-----
hw/i386/sgx-epc.c                        |   3 +-
hw/i386/x86.c                            | 113 ++++++-------
hw/ide/ide-dev.c                         |   3 +-
hw/input/stellaris_gamepad.c             |   2 +-
hw/intc/apic_common.c                    |   3 +-
hw/intc/arm_gicv3_common.c               |   2 +-
hw/intc/arm_gicv5_common.c               |   4 +-
hw/intc/rx_icu.c                         |   4 +-
hw/loongarch/virt.c                      |  87 +++++------
hw/mem/nvdimm.c                          |  11 +-
hw/mem/pc-dimm.c                         |   3 +-
hw/microblaze/petalogix_s3adsp1800_mmu.c |  19 ++-
hw/misc/arm_sysctl.c                     |   4 +-
hw/misc/aspeed_lpc.c                     |  73 ++++++---
hw/misc/aspeed_sdmc.c                    |   3 +-
hw/misc/mps2-scc.c                       |   2 +-
hw/misc/npcm7xx_mft.c                    |   3 +-
hw/misc/tz-ppc.c                         |  19 +--
hw/misc/xlnx-versal-trng.c               |  15 +-
hw/net/ne2000-isa.c                      |   3 +-
hw/net/rocker/rocker.c                   |   2 +-
hw/net/virtio-net.c                      |   2 +-
hw/nvme/ctrl.c                           |  29 ++--
hw/nvme/nguid.c                          |   3 +-
hw/nvram/xlnx-bbram.c                    |   3 +-
hw/nvram/xlnx-efuse.c                    |   5 +-
hw/nvram/xlnx-versal-efuse-ctrl.c        |   2 +-
hw/pci-bridge/pci_expander_bridge.c      |   3 +-
hw/pci-host/i440fx.c                     |  29 ++--
hw/pci-host/pnv_phb3.c                   |   5 +-
hw/pci-host/pnv_phb4.c                   |   5 +-
hw/pci-host/q35.c                        |   9 +-
hw/pci/pci.c                             |   3 +-
hw/ppc/spapr_caps.c                      |  39 ++---
hw/ppc/spapr_drc.c                       |   5 +-
hw/ppc/spapr_rtc.c                       |  18 ++-
hw/remote/vfio-user-obj.c                |  22 +--
hw/riscv/microchip_pfsoc.c               |   3 +-
hw/riscv/riscv_hart.c                    |   6 +-
hw/riscv/virt.c                          |  52 +++---
hw/rtc/mc146818rtc.c                     |  16 +-
hw/s390x/ccw-device.c                    |   3 +-
hw/s390x/css.c                           |   5 +-
hw/s390x/s390-pci-bus.c                  |   3 +-
hw/s390x/s390-virtio-ccw.c               |   4 +-
hw/s390x/sclpcpi.c                       |   8 +-
hw/s390x/virtio-ccw-mem.c                |   3 +-
hw/sensor/adc128d818.c                   |  16 +-
hw/sensor/adm1266.c                      |   3 +-
hw/sensor/adm1272.c                      |   9 +-
hw/sensor/emc141x.c                      |   9 +-
hw/sensor/isl_pmbus_vr.c                 |  19 +--
hw/sensor/lsm303dlhc_mag.c               |   9 +-
hw/sensor/max34451.c                     |   5 +-
hw/sensor/tmp105.c                       |   3 +-
hw/sensor/tmp421.c                       |   9 +-
hw/usb/dev-storage-classic.c             |   3 +-
hw/vfio-user/pci.c                       |   5 +-
hw/vfio/pci-quirks.c                     |   3 +-
hw/virtio/virtio-balloon.c               |  87 ++++-------
hw/virtio/virtio-iommu-pci.c             |   2 +-
hw/virtio/virtio-mem-pci.c               |   3 +-
hw/virtio/virtio-mem.c                   |  18 ++-
hw/xen/xen-pvh-common.c                  |   9 +-
include/chardev/char.h                   |   8 -
include/hw/block/block.h                 |   2 +-
include/hw/core/qdev-properties-system.h |   2 +
include/hw/core/qdev-properties.h        |  40 +++--
include/hw/cxl/cxl_component.h           |   5 +-
include/hw/i386/pc.h                     |   4 +-
include/qapi/qapi-type-info.h            |  32 ++++
include/qemu/osdep.h                     |  33 ++++
include/qemu/uuid.h                      |   4 +
include/qom/object.h                     | 171 ++++++++++++--------
include/system/spdm-socket.h             |  28 ++--
iothread.c                               |   9 +-
meson.build                              |   2 +
migration/options.c                      |   4 +-
monitor/qmp.c                            |  12 +-
net/colo-compare.c                       |  15 +-
net/dump.c                               |   6 +-
net/filter-buffer.c                      |   3 +-
net/filter.c                             |  10 +-
qapi/common.json                         |  28 ++++
qapi/introspect.json                     |  20 ++-
qapi/machine.json                        | 152 ++++++++++++++++++
qapi/meson.build                         |   4 +
qapi/pragma.json                         |   1 +
qapi/qom.json                            |  10 ++
qapi/sockets.json                        |  20 +++
qga/meson.build                          |   2 +
qom/object.c                             | 236 +++++++++++++---------------
qom/qom-qmp-cmds.c                       |  32 ++--
scripts/qapi/backend.py                  |   9 +-
scripts/qapi/gen.py                      |   2 +-
scripts/qapi/introspect.py               | 107 ++++++-------
scripts/qapi/schema_analysis.py          | 149 ++++++++++++++++++
scripts/qapi/type_infos.py               | 178 +++++++++++++++++++++
system/bootdevice.c                      |   3 +-
system/memory.c                          |  40 +----
target/arm/cpu64.c                       |  11 +-
target/arm/kvm.c                         |   3 +-
target/arm/tcg/cpu64.c                   |   5 +-
target/i386/cpu.c                        |  26 +--
target/i386/kvm/kvm.c                    |  38 +++--
target/i386/kvm/tdx.c                    |   4 +-
target/i386/sev.c                        |  31 ++--
target/i386/whpx/whpx-all.c              | 101 ++++--------
target/ppc/compat.c                      |   3 +-
target/riscv/cpu.c                       |  50 +++---
target/riscv/kvm/kvm-cpu.c               |   7 +-
target/riscv/tcg/tcg-cpu.c               |  13 +-
target/s390x/cpu-system.c                |   4 +-
target/s390x/cpu_models.c                |   5 +-
target/sparc/cpu.c                       |   3 +-
tests/include/meson.build                |   2 +
tests/meson.build                        |   6 +
tests/qapi-schema/meson.build            |   1 +
tests/qtest/qmp-cmd-test.c               |  55 ++++++-
tests/unit/check-qom-proplist.c          |  99 +++++++++---
tests/unit/test-qdev-global-props.c      |  11 +-
tests/unit/test-qdev.c                   |   2 +-
ui/console-vc.c                          |   8 +-
ui/console.c                             |   3 +-
ui/dbus.c                                |  18 ++-
ui/input-linux.c                         |  11 +-
util/thread-context.c                    |   7 +-
util/uuid.c                              |   5 +
172 files changed, 2510 insertions(+), 1699 deletions(-)
[PATCH v3 00/74] qom/qdev: associate properties with QAPI schema types
Posted by Marc-André Lureau 1 month, 1 week ago
Hi,

This series connects QOM and qdev properties to the QAPI type system, so
that management tools can discover the QAPI schema type of each object
property.

Today, QOM properties carry a free-form "type" string ("bool", "uint32",
"OnOffAuto", ..) that has no formal link to the QAPI schema exposed by
query-qmp-schema. Management tools must maintain ad-hoc mappings or rely
on naming conventions to figure out how to interpret property values.

This series adds:
  - A new QAPITypeInfo struct that pairs a property with its QAPI schema
    type name, enum lookup table, and list-element type.

  - A QAPI code generator (qapi-type-infos) that emits a QAPITypeInfo
    instance for every schema-defined type, including the mapping
    between internal C names and the schema name visible to clients.

  - A "qapi-type" field in the ObjectPropertyInfo and
    ObjectPropertyValue QMP structs, populated from the QAPITypeInfo
    when present giving clients a cross-reference into query-qmp-schema
    output.

  - Conversion of all PropertyInfo definitions from the old
    .type/.enum_table strings to the new .qapi_type pointer.

  - Replacement of the generic qdev_prop_array with typed per-element
    array PropertyInfos, removing the arrayinfo/arrayfieldsize
    indirection from struct Property.

  - Removal of the deprecated PropertyInfo.type and .enum_table fields,
    and of the old object_property_add_enum/add_tm APIs.

Along the way, a few pre-existing type mismatches in property
definitions are fixed, the "struct tm" RTC property is replaced with a
proper QAPI StructTm type etc. Introducing more specific types or a
"typedef" to QAPI could help provide better associated type informations
than plain "str" in many cases, for example.

Comments welcome!

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
Changes in v3:
- QAPI analysis redesign (replacing the old "expose name map" from
introspect)
- all non-implicit QAPI types are now introspectable, including QOM-only
types
- QAPITypeInfo.schema_name -> masked_name
- exposes integer signedness and width through query-qmp-schema
- various extra property fixes
- rebase, some patch split or merge

- Link to v2: https://lore.kernel.org/qemu-devel/20260616-qom-qapi-v2-0-cc9396b9c18c@redhat.com

Changes in v2:

- Added kernel-doc documentation for the QAPITypeInfo struct fields.
- Dropped "qom: drop free-form property typename registration", it's
  still needed for array of links to provide useful type names.
- Added qdev_prop_link_list for array-of-links properties, with a
  create function that generates "link<TYPE>List" type names matching the
  existing "link<TYPE>" convention.
- qdev_prop_link now uses &str_type_info instead of "link" (the full
  "link<TYPE>" type name is set at property-add time)
- Simplified DEFINE_PROP_LINK_ARRAY to use qdev_prop_link_list, dropping
  the now-unnecessary _arraytype parameter.
- rebased
- Link to v1: https://lore.kernel.org/qemu-devel/20260510-qom-qapi-v1-0-48ba6a1a1fa5@redhat.com

To: qemu-devel@nongnu.org
Cc: Markus Armbruster <armbru@redhat.com>
Cc: Michael Roth <michael.roth@amd.com>
Cc: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
Cc: "Daniel P. Berrangé" <berrange@redhat.com>
Cc: Philippe Mathieu-Daudé <philmd@mailo.com>

---
Marc-André Lureau (74):
      qapi: add QAPITypeInfo struct definition
      qapi/gen: fix _module_basename for multi-dash 'what' parameters
      qapi: factor out QAPISchemaUsedTypes from introspect visitor
      qapi: register all introspectable types, not just QMP-reachable ones
      qapi: add type-infos generator
      meson: add qapi-type-infos-*.c/h to build
      qom: add qapi_type field to ObjectProperty
      qapi/qom: add qapi-type field to ObjectPropertyInfo
      qom/qmp: populate qapi-type in QMP handlers
      qom: add object_property_set_default_enum()
      qom: add object_{class_}property_add_qapi
      qom: add object_{class_}property_add_qapi_enum
      tests: update check-qom-proplist for QAPI-aware property registration
      qom: convert enum properties to QAPI-aware registration
      qom: remove old enum property registration API
      qom: convert struct properties to QAPI-aware registration
      x86: convert OnOffAuto properties to QAPI-aware registration
      microvm: convert OnOffAuto properties to QAPI-aware registration
      pc: convert OnOffAuto vmport property to QAPI-aware registration
      arm/virt: convert OnOffAuto acpi property to QAPI-aware registration
      riscv/virt: convert OnOffAuto properties to QAPI-aware registration
      loongarch/virt: convert OnOffAuto properties to QAPI-aware registration
      hostmem-file: convert OnOffAuto rom property to QAPI-aware registration
      sev: convert OnOffAuto legacy-vm-type property to QAPI-aware registration
      whpx: convert OnOffAuto hyperv property to QAPI-aware registration
      whpx: convert OnOffAuto arch properties to QAPI-aware registration
      accel/kvm: convert OnOffSplit property to QAPI-aware registration
      whpx: convert OnOffSplit property to QAPI-aware registration
      ppc/spapr-caps: convert to QAPI-aware property registration
      system/memory: fix "priority" property typename
      backends/hostmem: fix property typenames
      backends/hostmem-file: fix "align" property typename
      accel/tcg: fix "tb-size" property typename
      block/throttle-groups: fix throttle properties typename
      event-loop-base: fix property typenames
      iothread: fix poll properties typename
      util/thread-context: fix property typenames
      target/i386: fix CPUID version properties typename
      ppc/pnv: fix phb-id and chip-id properties typename
      backends/hostmem-memfd: fix "hugetlbsize" property typename
      hw/acpi: fix "node" properties typename
      net/colo-compare: fix compare_timeout setter visitor type
      net/colo-compare: fix max_queue_size setter visitor type
      hw/misc/xlnx-versal-trng: add missing getter for fips-fault-events
      qom: convert scalar properties to QAPI-aware registration
      i386/cpu: convert strList property to QAPI-aware registration
      accel/hvf: convert OnOffSplit property to QAPI-aware registration
      i386/x86: convert SgxEPCList property to QAPI-aware registration
      virtio-balloon: convert guest-stats property to QAPI type
      qom: replace object_property_add_tm with StructTm QAPI type
      hw/nvdimm: convert UUID property to QAPI-aware registration
      hw/s390-virtio-ccw: convert loadparm property to QAPI-aware registration
      hw/ppc/spapr_drc: convert fdt property to QAPI-aware registration
      spdm-socket: convert SpdmTransportType to QAPI enum
      hw/gpio/pca955x: use QAPI enums for led and pin properties
      include: add QEMU_REPEAT helper macro
      hw/gpio/pca955x: convert pin/led property to QAPI-aware enum
      hw/pci: change the busnr type to uint8
      qdev: add qapi_type field to PropertyInfo with fallback registration
      qdev: convert core PropertyInfo definitions to use qapi_type
      qdev: adjust PciDevfn declared type
      qdev: convert system PropertyInfo definitions to use qapi_type
      hw: convert device-local PropertyInfo definitions to use qapi_type
      target/riscv: fix incorrect QAPI types and u8 casting
      target/riscv: convert PropertyInfo definitions to use qapi_type
      qdev: convert PropertyInfo definitions to use qapi_type
      qdev: introduce typed array PropertyInfos
      qdev: simplify DEFINE_PROP_ARRAY and remove generic array PropertyInfo
      qdev: remove deprecated PropertyInfo.type and .enum_table fields
      memory: use object_property_add_link for container property
      hw/i386: convert PCSouthBridgeOption to QAPI enum
      qom: use QAPITypeInfo in object_property_get_enum
      qapi: expose integer signedness and width in introspection
      tests/qmp-cmd-test: assert qapi-type resolves in query-qmp-schema

 accel/hvf/hvf-all.c                      |  29 ++--
 accel/kvm/kvm-all.c                      |  31 ++--
 accel/nitro/nitro-accel.c                |   3 +-
 accel/tcg/tcg-all.c                      |   3 +-
 accel/whpx/whpx-common.c                 |  58 +++----
 authz/list.c                             |  14 +-
 backends/cryptodev.c                     |   7 +-
 backends/hostmem-file.c                  |  33 ++--
 backends/hostmem-memfd.c                 |   3 +-
 backends/hostmem.c                       |  20 +--
 backends/spdm-socket.c                   |  25 +--
 backends/tpm/tpm_util.c                  |   3 +-
 block/throttle-groups.c                  |  10 +-
 chardev/char-socket.c                    |   3 +-
 crypto/secret_common.c                   |  12 +-
 crypto/secret_keyring.c                  |   9 +-
 crypto/tlscreds.c                        |  12 +-
 docs/devel/qapi-code-gen.rst             | 123 +++++++++++++--
 docs/interop/virtio-balloon-stats.rst    |  22 +--
 event-loop-base.c                        |   7 +-
 hw/acpi/ich9.c                           |   3 +-
 hw/acpi/pci.c                            |   7 +-
 hw/arm/virt.c                            |  31 ++--
 hw/block/xen-block.c                     |   3 +-
 hw/core/clock.c                          |   3 +-
 hw/core/machine-qmp-cmds.c               |   3 +-
 hw/core/machine.c                        |  13 +-
 hw/core/qdev-prop-internal.h             |  20 +++
 hw/core/qdev-properties-system.c         |  97 ++++++------
 hw/core/qdev-properties.c                | 180 ++++++++++++++-------
 hw/cpu/core.c                            |  10 +-
 hw/cxl/cxl-host.c                        |   6 +-
 hw/display/apple-gfx-mmio.m              |   2 +-
 hw/display/apple-gfx-pci.m               |   2 +-
 hw/display/apple-gfx.h                   |   1 +
 hw/display/apple-gfx.m                   |   7 +-
 hw/gpio/aspeed_gpio.c                    |   5 +-
 hw/gpio/aspeed_sgpio.c                   |   3 +-
 hw/gpio/pca9552.c                        | 261 ++++++++++++-------------------
 hw/gpio/pca9554.c                        | 157 +++++++------------
 hw/gpio/stm32l4x5_gpio.c                 |   5 +-
 hw/i386/microvm.c                        |  80 ++++------
 hw/i386/pc.c                             |  32 ++--
 hw/i386/pc_piix.c                        |  61 +++-----
 hw/i386/sgx-epc.c                        |   3 +-
 hw/i386/x86.c                            | 113 ++++++-------
 hw/ide/ide-dev.c                         |   3 +-
 hw/input/stellaris_gamepad.c             |   2 +-
 hw/intc/apic_common.c                    |   3 +-
 hw/intc/arm_gicv3_common.c               |   2 +-
 hw/intc/arm_gicv5_common.c               |   4 +-
 hw/intc/rx_icu.c                         |   4 +-
 hw/loongarch/virt.c                      |  87 +++++------
 hw/mem/nvdimm.c                          |  11 +-
 hw/mem/pc-dimm.c                         |   3 +-
 hw/microblaze/petalogix_s3adsp1800_mmu.c |  19 ++-
 hw/misc/arm_sysctl.c                     |   4 +-
 hw/misc/aspeed_lpc.c                     |  73 ++++++---
 hw/misc/aspeed_sdmc.c                    |   3 +-
 hw/misc/mps2-scc.c                       |   2 +-
 hw/misc/npcm7xx_mft.c                    |   3 +-
 hw/misc/tz-ppc.c                         |  19 +--
 hw/misc/xlnx-versal-trng.c               |  15 +-
 hw/net/ne2000-isa.c                      |   3 +-
 hw/net/rocker/rocker.c                   |   2 +-
 hw/net/virtio-net.c                      |   2 +-
 hw/nvme/ctrl.c                           |  29 ++--
 hw/nvme/nguid.c                          |   3 +-
 hw/nvram/xlnx-bbram.c                    |   3 +-
 hw/nvram/xlnx-efuse.c                    |   5 +-
 hw/nvram/xlnx-versal-efuse-ctrl.c        |   2 +-
 hw/pci-bridge/pci_expander_bridge.c      |   3 +-
 hw/pci-host/i440fx.c                     |  29 ++--
 hw/pci-host/pnv_phb3.c                   |   5 +-
 hw/pci-host/pnv_phb4.c                   |   5 +-
 hw/pci-host/q35.c                        |   9 +-
 hw/pci/pci.c                             |   3 +-
 hw/ppc/spapr_caps.c                      |  39 ++---
 hw/ppc/spapr_drc.c                       |   5 +-
 hw/ppc/spapr_rtc.c                       |  18 ++-
 hw/remote/vfio-user-obj.c                |  22 +--
 hw/riscv/microchip_pfsoc.c               |   3 +-
 hw/riscv/riscv_hart.c                    |   6 +-
 hw/riscv/virt.c                          |  52 +++---
 hw/rtc/mc146818rtc.c                     |  16 +-
 hw/s390x/ccw-device.c                    |   3 +-
 hw/s390x/css.c                           |   5 +-
 hw/s390x/s390-pci-bus.c                  |   3 +-
 hw/s390x/s390-virtio-ccw.c               |   4 +-
 hw/s390x/sclpcpi.c                       |   8 +-
 hw/s390x/virtio-ccw-mem.c                |   3 +-
 hw/sensor/adc128d818.c                   |  16 +-
 hw/sensor/adm1266.c                      |   3 +-
 hw/sensor/adm1272.c                      |   9 +-
 hw/sensor/emc141x.c                      |   9 +-
 hw/sensor/isl_pmbus_vr.c                 |  19 +--
 hw/sensor/lsm303dlhc_mag.c               |   9 +-
 hw/sensor/max34451.c                     |   5 +-
 hw/sensor/tmp105.c                       |   3 +-
 hw/sensor/tmp421.c                       |   9 +-
 hw/usb/dev-storage-classic.c             |   3 +-
 hw/vfio-user/pci.c                       |   5 +-
 hw/vfio/pci-quirks.c                     |   3 +-
 hw/virtio/virtio-balloon.c               |  87 ++++-------
 hw/virtio/virtio-iommu-pci.c             |   2 +-
 hw/virtio/virtio-mem-pci.c               |   3 +-
 hw/virtio/virtio-mem.c                   |  18 ++-
 hw/xen/xen-pvh-common.c                  |   9 +-
 include/chardev/char.h                   |   8 -
 include/hw/block/block.h                 |   2 +-
 include/hw/core/qdev-properties-system.h |   2 +
 include/hw/core/qdev-properties.h        |  40 +++--
 include/hw/cxl/cxl_component.h           |   5 +-
 include/hw/i386/pc.h                     |   4 +-
 include/qapi/qapi-type-info.h            |  32 ++++
 include/qemu/osdep.h                     |  33 ++++
 include/qemu/uuid.h                      |   4 +
 include/qom/object.h                     | 171 ++++++++++++--------
 include/system/spdm-socket.h             |  28 ++--
 iothread.c                               |   9 +-
 meson.build                              |   2 +
 migration/options.c                      |   4 +-
 monitor/qmp.c                            |  12 +-
 net/colo-compare.c                       |  15 +-
 net/dump.c                               |   6 +-
 net/filter-buffer.c                      |   3 +-
 net/filter.c                             |  10 +-
 qapi/common.json                         |  28 ++++
 qapi/introspect.json                     |  20 ++-
 qapi/machine.json                        | 152 ++++++++++++++++++
 qapi/meson.build                         |   4 +
 qapi/pragma.json                         |   1 +
 qapi/qom.json                            |  10 ++
 qapi/sockets.json                        |  20 +++
 qga/meson.build                          |   2 +
 qom/object.c                             | 236 +++++++++++++---------------
 qom/qom-qmp-cmds.c                       |  32 ++--
 scripts/qapi/backend.py                  |   9 +-
 scripts/qapi/gen.py                      |   2 +-
 scripts/qapi/introspect.py               | 107 ++++++-------
 scripts/qapi/schema_analysis.py          | 149 ++++++++++++++++++
 scripts/qapi/type_infos.py               | 178 +++++++++++++++++++++
 system/bootdevice.c                      |   3 +-
 system/memory.c                          |  40 +----
 target/arm/cpu64.c                       |  11 +-
 target/arm/kvm.c                         |   3 +-
 target/arm/tcg/cpu64.c                   |   5 +-
 target/i386/cpu.c                        |  26 +--
 target/i386/kvm/kvm.c                    |  38 +++--
 target/i386/kvm/tdx.c                    |   4 +-
 target/i386/sev.c                        |  31 ++--
 target/i386/whpx/whpx-all.c              | 101 ++++--------
 target/ppc/compat.c                      |   3 +-
 target/riscv/cpu.c                       |  50 +++---
 target/riscv/kvm/kvm-cpu.c               |   7 +-
 target/riscv/tcg/tcg-cpu.c               |  13 +-
 target/s390x/cpu-system.c                |   4 +-
 target/s390x/cpu_models.c                |   5 +-
 target/sparc/cpu.c                       |   3 +-
 tests/include/meson.build                |   2 +
 tests/meson.build                        |   6 +
 tests/qapi-schema/meson.build            |   1 +
 tests/qtest/qmp-cmd-test.c               |  55 ++++++-
 tests/unit/check-qom-proplist.c          |  99 +++++++++---
 tests/unit/test-qdev-global-props.c      |  11 +-
 tests/unit/test-qdev.c                   |   2 +-
 ui/console-vc.c                          |   8 +-
 ui/console.c                             |   3 +-
 ui/dbus.c                                |  18 ++-
 ui/input-linux.c                         |  11 +-
 util/thread-context.c                    |   7 +-
 util/uuid.c                              |   5 +
 172 files changed, 2510 insertions(+), 1699 deletions(-)
---
base-commit: fa19879df1658f96ac07365fca8835b7decd6995
change-id: 20260510-qom-qapi-fbe0f5060c3f

Best regards,
--  
Marc-André Lureau <marcandre.lureau@redhat.com>


Re: [PATCH v3 00/74] qom/qdev: associate properties with QAPI schema types
Posted by Mark Cave-Ayland 1 month ago
On 18/08/2026 12:10, Marc-André Lureau wrote:

> Hi,
> 
> This series connects QOM and qdev properties to the QAPI type system, so
> that management tools can discover the QAPI schema type of each object
> property.
> 
> Today, QOM properties carry a free-form "type" string ("bool", "uint32",
> "OnOffAuto", ..) that has no formal link to the QAPI schema exposed by
> query-qmp-schema. Management tools must maintain ad-hoc mappings or rely
> on naming conventions to figure out how to interpret property values.
> 
> This series adds:
>    - A new QAPITypeInfo struct that pairs a property with its QAPI schema
>      type name, enum lookup table, and list-element type.
> 
>    - A QAPI code generator (qapi-type-infos) that emits a QAPITypeInfo
>      instance for every schema-defined type, including the mapping
>      between internal C names and the schema name visible to clients.
> 
>    - A "qapi-type" field in the ObjectPropertyInfo and
>      ObjectPropertyValue QMP structs, populated from the QAPITypeInfo
>      when present giving clients a cross-reference into query-qmp-schema
>      output.
> 
>    - Conversion of all PropertyInfo definitions from the old
>      .type/.enum_table strings to the new .qapi_type pointer.
> 
>    - Replacement of the generic qdev_prop_array with typed per-element
>      array PropertyInfos, removing the arrayinfo/arrayfieldsize
>      indirection from struct Property.
> 
>    - Removal of the deprecated PropertyInfo.type and .enum_table fields,
>      and of the old object_property_add_enum/add_tm APIs.
> 
> Along the way, a few pre-existing type mismatches in property
> definitions are fixed, the "struct tm" RTC property is replaced with a
> proper QAPI StructTm type etc. Introducing more specific types or a
> "typedef" to QAPI could help provide better associated type informations
> than plain "str" in many cases, for example.
> 
> Comments welcome!

Thanks for quite a substantial piece work: there is quite a lot to pick 
through in this series which makes review tricky. If you post a new 
version, it might be worth showing an example of the before/after JSON 
to help give some context around the changes: however it feels this is 
going in the right direction, since it works towards the goal of 
allowing a QMP client to introspect everything it needs to know about 
the QAPI type underlying a property.

I've started working through this with a few comments and reviews for 
the patches fixing up types: I wonder if the type fixups could be merged 
separately to help reduce the size of the series?

Question: is the eventual aim to deprecate the use of all the non-qapi 
object functions? Are there many instances left after this series at all?

> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
> Changes in v3:
> - QAPI analysis redesign (replacing the old "expose name map" from
> introspect)
> - all non-implicit QAPI types are now introspectable, including QOM-only
> types
> - QAPITypeInfo.schema_name -> masked_name
> - exposes integer signedness and width through query-qmp-schema
> - various extra property fixes
> - rebase, some patch split or merge
> 
> - Link to v2: https://urldefense.proofpoint.com/v2/url?u=https-3A__lore.kernel.org_qemu-2Ddevel_20260616-2Dqom-2Dqapi-2Dv2-2D0-2Dcc9396b9c18c-40redhat.com&d=DwIDaQ&c=s883GpUCOChKOHiocYtGcg&r=c23RpsaH4D2MKyD3EPJTDa0BAxz6tV8aUJqVSoytEiY&m=LGtC1Otz03Nx6wZrdIv7LRRcAEAYfhyfKJ4dtNt7PCxy3ILcsWudQol0qR9l2c5a&s=Idir-fKu3uFkuRRHZW8ipF3e84xwMMhnVWVuat0zVXs&e=
> 
> Changes in v2:
> 
> - Added kernel-doc documentation for the QAPITypeInfo struct fields.
> - Dropped "qom: drop free-form property typename registration", it's
>    still needed for array of links to provide useful type names.
> - Added qdev_prop_link_list for array-of-links properties, with a
>    create function that generates "link<TYPE>List" type names matching the
>    existing "link<TYPE>" convention.
> - qdev_prop_link now uses &str_type_info instead of "link" (the full
>    "link<TYPE>" type name is set at property-add time)
> - Simplified DEFINE_PROP_LINK_ARRAY to use qdev_prop_link_list, dropping
>    the now-unnecessary _arraytype parameter.
> - rebased
> - Link to v1: https://urldefense.proofpoint.com/v2/url?u=https-3A__lore.kernel.org_qemu-2Ddevel_20260510-2Dqom-2Dqapi-2Dv1-2D0-2D48ba6a1a1fa5-40redhat.com&d=DwIDaQ&c=s883GpUCOChKOHiocYtGcg&r=c23RpsaH4D2MKyD3EPJTDa0BAxz6tV8aUJqVSoytEiY&m=LGtC1Otz03Nx6wZrdIv7LRRcAEAYfhyfKJ4dtNt7PCxy3ILcsWudQol0qR9l2c5a&s=_KgQcnGFWRM8edu2HLa7HFwHHCkp2t6UyriBmPDNk8A&e=
> 
> To: qemu-devel@nongnu.org
> Cc: Markus Armbruster <armbru@redhat.com>
> Cc: Michael Roth <michael.roth@amd.com>
> Cc: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
> Cc: "Daniel P. Berrangé" <berrange@redhat.com>
> Cc: Philippe Mathieu-Daudé <philmd@mailo.com>
> 
> ---
> Marc-André Lureau (74):
>        qapi: add QAPITypeInfo struct definition
>        qapi/gen: fix _module_basename for multi-dash 'what' parameters
>        qapi: factor out QAPISchemaUsedTypes from introspect visitor
>        qapi: register all introspectable types, not just QMP-reachable ones
>        qapi: add type-infos generator
>        meson: add qapi-type-infos-*.c/h to build
>        qom: add qapi_type field to ObjectProperty
>        qapi/qom: add qapi-type field to ObjectPropertyInfo
>        qom/qmp: populate qapi-type in QMP handlers
>        qom: add object_property_set_default_enum()
>        qom: add object_{class_}property_add_qapi
>        qom: add object_{class_}property_add_qapi_enum
>        tests: update check-qom-proplist for QAPI-aware property registration
>        qom: convert enum properties to QAPI-aware registration
>        qom: remove old enum property registration API
>        qom: convert struct properties to QAPI-aware registration
>        x86: convert OnOffAuto properties to QAPI-aware registration
>        microvm: convert OnOffAuto properties to QAPI-aware registration
>        pc: convert OnOffAuto vmport property to QAPI-aware registration
>        arm/virt: convert OnOffAuto acpi property to QAPI-aware registration
>        riscv/virt: convert OnOffAuto properties to QAPI-aware registration
>        loongarch/virt: convert OnOffAuto properties to QAPI-aware registration
>        hostmem-file: convert OnOffAuto rom property to QAPI-aware registration
>        sev: convert OnOffAuto legacy-vm-type property to QAPI-aware registration
>        whpx: convert OnOffAuto hyperv property to QAPI-aware registration
>        whpx: convert OnOffAuto arch properties to QAPI-aware registration
>        accel/kvm: convert OnOffSplit property to QAPI-aware registration
>        whpx: convert OnOffSplit property to QAPI-aware registration
>        ppc/spapr-caps: convert to QAPI-aware property registration
>        system/memory: fix "priority" property typename
>        backends/hostmem: fix property typenames
>        backends/hostmem-file: fix "align" property typename
>        accel/tcg: fix "tb-size" property typename
>        block/throttle-groups: fix throttle properties typename
>        event-loop-base: fix property typenames
>        iothread: fix poll properties typename
>        util/thread-context: fix property typenames
>        target/i386: fix CPUID version properties typename
>        ppc/pnv: fix phb-id and chip-id properties typename
>        backends/hostmem-memfd: fix "hugetlbsize" property typename
>        hw/acpi: fix "node" properties typename
>        net/colo-compare: fix compare_timeout setter visitor type
>        net/colo-compare: fix max_queue_size setter visitor type
>        hw/misc/xlnx-versal-trng: add missing getter for fips-fault-events
>        qom: convert scalar properties to QAPI-aware registration
>        i386/cpu: convert strList property to QAPI-aware registration
>        accel/hvf: convert OnOffSplit property to QAPI-aware registration
>        i386/x86: convert SgxEPCList property to QAPI-aware registration
>        virtio-balloon: convert guest-stats property to QAPI type
>        qom: replace object_property_add_tm with StructTm QAPI type
>        hw/nvdimm: convert UUID property to QAPI-aware registration
>        hw/s390-virtio-ccw: convert loadparm property to QAPI-aware registration
>        hw/ppc/spapr_drc: convert fdt property to QAPI-aware registration
>        spdm-socket: convert SpdmTransportType to QAPI enum
>        hw/gpio/pca955x: use QAPI enums for led and pin properties
>        include: add QEMU_REPEAT helper macro
>        hw/gpio/pca955x: convert pin/led property to QAPI-aware enum
>        hw/pci: change the busnr type to uint8
>        qdev: add qapi_type field to PropertyInfo with fallback registration
>        qdev: convert core PropertyInfo definitions to use qapi_type
>        qdev: adjust PciDevfn declared type
>        qdev: convert system PropertyInfo definitions to use qapi_type
>        hw: convert device-local PropertyInfo definitions to use qapi_type
>        target/riscv: fix incorrect QAPI types and u8 casting
>        target/riscv: convert PropertyInfo definitions to use qapi_type
>        qdev: convert PropertyInfo definitions to use qapi_type
>        qdev: introduce typed array PropertyInfos
>        qdev: simplify DEFINE_PROP_ARRAY and remove generic array PropertyInfo
>        qdev: remove deprecated PropertyInfo.type and .enum_table fields
>        memory: use object_property_add_link for container property
>        hw/i386: convert PCSouthBridgeOption to QAPI enum
>        qom: use QAPITypeInfo in object_property_get_enum
>        qapi: expose integer signedness and width in introspection
>        tests/qmp-cmd-test: assert qapi-type resolves in query-qmp-schema
> 
>   accel/hvf/hvf-all.c                      |  29 ++--
>   accel/kvm/kvm-all.c                      |  31 ++--
>   accel/nitro/nitro-accel.c                |   3 +-
>   accel/tcg/tcg-all.c                      |   3 +-
>   accel/whpx/whpx-common.c                 |  58 +++----
>   authz/list.c                             |  14 +-
>   backends/cryptodev.c                     |   7 +-
>   backends/hostmem-file.c                  |  33 ++--
>   backends/hostmem-memfd.c                 |   3 +-
>   backends/hostmem.c                       |  20 +--
>   backends/spdm-socket.c                   |  25 +--
>   backends/tpm/tpm_util.c                  |   3 +-
>   block/throttle-groups.c                  |  10 +-
>   chardev/char-socket.c                    |   3 +-
>   crypto/secret_common.c                   |  12 +-
>   crypto/secret_keyring.c                  |   9 +-
>   crypto/tlscreds.c                        |  12 +-
>   docs/devel/qapi-code-gen.rst             | 123 +++++++++++++--
>   docs/interop/virtio-balloon-stats.rst    |  22 +--
>   event-loop-base.c                        |   7 +-
>   hw/acpi/ich9.c                           |   3 +-
>   hw/acpi/pci.c                            |   7 +-
>   hw/arm/virt.c                            |  31 ++--
>   hw/block/xen-block.c                     |   3 +-
>   hw/core/clock.c                          |   3 +-
>   hw/core/machine-qmp-cmds.c               |   3 +-
>   hw/core/machine.c                        |  13 +-
>   hw/core/qdev-prop-internal.h             |  20 +++
>   hw/core/qdev-properties-system.c         |  97 ++++++------
>   hw/core/qdev-properties.c                | 180 ++++++++++++++-------
>   hw/cpu/core.c                            |  10 +-
>   hw/cxl/cxl-host.c                        |   6 +-
>   hw/display/apple-gfx-mmio.m              |   2 +-
>   hw/display/apple-gfx-pci.m               |   2 +-
>   hw/display/apple-gfx.h                   |   1 +
>   hw/display/apple-gfx.m                   |   7 +-
>   hw/gpio/aspeed_gpio.c                    |   5 +-
>   hw/gpio/aspeed_sgpio.c                   |   3 +-
>   hw/gpio/pca9552.c                        | 261 ++++++++++++-------------------
>   hw/gpio/pca9554.c                        | 157 +++++++------------
>   hw/gpio/stm32l4x5_gpio.c                 |   5 +-
>   hw/i386/microvm.c                        |  80 ++++------
>   hw/i386/pc.c                             |  32 ++--
>   hw/i386/pc_piix.c                        |  61 +++-----
>   hw/i386/sgx-epc.c                        |   3 +-
>   hw/i386/x86.c                            | 113 ++++++-------
>   hw/ide/ide-dev.c                         |   3 +-
>   hw/input/stellaris_gamepad.c             |   2 +-
>   hw/intc/apic_common.c                    |   3 +-
>   hw/intc/arm_gicv3_common.c               |   2 +-
>   hw/intc/arm_gicv5_common.c               |   4 +-
>   hw/intc/rx_icu.c                         |   4 +-
>   hw/loongarch/virt.c                      |  87 +++++------
>   hw/mem/nvdimm.c                          |  11 +-
>   hw/mem/pc-dimm.c                         |   3 +-
>   hw/microblaze/petalogix_s3adsp1800_mmu.c |  19 ++-
>   hw/misc/arm_sysctl.c                     |   4 +-
>   hw/misc/aspeed_lpc.c                     |  73 ++++++---
>   hw/misc/aspeed_sdmc.c                    |   3 +-
>   hw/misc/mps2-scc.c                       |   2 +-
>   hw/misc/npcm7xx_mft.c                    |   3 +-
>   hw/misc/tz-ppc.c                         |  19 +--
>   hw/misc/xlnx-versal-trng.c               |  15 +-
>   hw/net/ne2000-isa.c                      |   3 +-
>   hw/net/rocker/rocker.c                   |   2 +-
>   hw/net/virtio-net.c                      |   2 +-
>   hw/nvme/ctrl.c                           |  29 ++--
>   hw/nvme/nguid.c                          |   3 +-
>   hw/nvram/xlnx-bbram.c                    |   3 +-
>   hw/nvram/xlnx-efuse.c                    |   5 +-
>   hw/nvram/xlnx-versal-efuse-ctrl.c        |   2 +-
>   hw/pci-bridge/pci_expander_bridge.c      |   3 +-
>   hw/pci-host/i440fx.c                     |  29 ++--
>   hw/pci-host/pnv_phb3.c                   |   5 +-
>   hw/pci-host/pnv_phb4.c                   |   5 +-
>   hw/pci-host/q35.c                        |   9 +-
>   hw/pci/pci.c                             |   3 +-
>   hw/ppc/spapr_caps.c                      |  39 ++---
>   hw/ppc/spapr_drc.c                       |   5 +-
>   hw/ppc/spapr_rtc.c                       |  18 ++-
>   hw/remote/vfio-user-obj.c                |  22 +--
>   hw/riscv/microchip_pfsoc.c               |   3 +-
>   hw/riscv/riscv_hart.c                    |   6 +-
>   hw/riscv/virt.c                          |  52 +++---
>   hw/rtc/mc146818rtc.c                     |  16 +-
>   hw/s390x/ccw-device.c                    |   3 +-
>   hw/s390x/css.c                           |   5 +-
>   hw/s390x/s390-pci-bus.c                  |   3 +-
>   hw/s390x/s390-virtio-ccw.c               |   4 +-
>   hw/s390x/sclpcpi.c                       |   8 +-
>   hw/s390x/virtio-ccw-mem.c                |   3 +-
>   hw/sensor/adc128d818.c                   |  16 +-
>   hw/sensor/adm1266.c                      |   3 +-
>   hw/sensor/adm1272.c                      |   9 +-
>   hw/sensor/emc141x.c                      |   9 +-
>   hw/sensor/isl_pmbus_vr.c                 |  19 +--
>   hw/sensor/lsm303dlhc_mag.c               |   9 +-
>   hw/sensor/max34451.c                     |   5 +-
>   hw/sensor/tmp105.c                       |   3 +-
>   hw/sensor/tmp421.c                       |   9 +-
>   hw/usb/dev-storage-classic.c             |   3 +-
>   hw/vfio-user/pci.c                       |   5 +-
>   hw/vfio/pci-quirks.c                     |   3 +-
>   hw/virtio/virtio-balloon.c               |  87 ++++-------
>   hw/virtio/virtio-iommu-pci.c             |   2 +-
>   hw/virtio/virtio-mem-pci.c               |   3 +-
>   hw/virtio/virtio-mem.c                   |  18 ++-
>   hw/xen/xen-pvh-common.c                  |   9 +-
>   include/chardev/char.h                   |   8 -
>   include/hw/block/block.h                 |   2 +-
>   include/hw/core/qdev-properties-system.h |   2 +
>   include/hw/core/qdev-properties.h        |  40 +++--
>   include/hw/cxl/cxl_component.h           |   5 +-
>   include/hw/i386/pc.h                     |   4 +-
>   include/qapi/qapi-type-info.h            |  32 ++++
>   include/qemu/osdep.h                     |  33 ++++
>   include/qemu/uuid.h                      |   4 +
>   include/qom/object.h                     | 171 ++++++++++++--------
>   include/system/spdm-socket.h             |  28 ++--
>   iothread.c                               |   9 +-
>   meson.build                              |   2 +
>   migration/options.c                      |   4 +-
>   monitor/qmp.c                            |  12 +-
>   net/colo-compare.c                       |  15 +-
>   net/dump.c                               |   6 +-
>   net/filter-buffer.c                      |   3 +-
>   net/filter.c                             |  10 +-
>   qapi/common.json                         |  28 ++++
>   qapi/introspect.json                     |  20 ++-
>   qapi/machine.json                        | 152 ++++++++++++++++++
>   qapi/meson.build                         |   4 +
>   qapi/pragma.json                         |   1 +
>   qapi/qom.json                            |  10 ++
>   qapi/sockets.json                        |  20 +++
>   qga/meson.build                          |   2 +
>   qom/object.c                             | 236 +++++++++++++---------------
>   qom/qom-qmp-cmds.c                       |  32 ++--
>   scripts/qapi/backend.py                  |   9 +-
>   scripts/qapi/gen.py                      |   2 +-
>   scripts/qapi/introspect.py               | 107 ++++++-------
>   scripts/qapi/schema_analysis.py          | 149 ++++++++++++++++++
>   scripts/qapi/type_infos.py               | 178 +++++++++++++++++++++
>   system/bootdevice.c                      |   3 +-
>   system/memory.c                          |  40 +----
>   target/arm/cpu64.c                       |  11 +-
>   target/arm/kvm.c                         |   3 +-
>   target/arm/tcg/cpu64.c                   |   5 +-
>   target/i386/cpu.c                        |  26 +--
>   target/i386/kvm/kvm.c                    |  38 +++--
>   target/i386/kvm/tdx.c                    |   4 +-
>   target/i386/sev.c                        |  31 ++--
>   target/i386/whpx/whpx-all.c              | 101 ++++--------
>   target/ppc/compat.c                      |   3 +-
>   target/riscv/cpu.c                       |  50 +++---
>   target/riscv/kvm/kvm-cpu.c               |   7 +-
>   target/riscv/tcg/tcg-cpu.c               |  13 +-
>   target/s390x/cpu-system.c                |   4 +-
>   target/s390x/cpu_models.c                |   5 +-
>   target/sparc/cpu.c                       |   3 +-
>   tests/include/meson.build                |   2 +
>   tests/meson.build                        |   6 +
>   tests/qapi-schema/meson.build            |   1 +
>   tests/qtest/qmp-cmd-test.c               |  55 ++++++-
>   tests/unit/check-qom-proplist.c          |  99 +++++++++---
>   tests/unit/test-qdev-global-props.c      |  11 +-
>   tests/unit/test-qdev.c                   |   2 +-
>   ui/console-vc.c                          |   8 +-
>   ui/console.c                             |   3 +-
>   ui/dbus.c                                |  18 ++-
>   ui/input-linux.c                         |  11 +-
>   util/thread-context.c                    |   7 +-
>   util/uuid.c                              |   5 +
>   172 files changed, 2510 insertions(+), 1699 deletions(-)
> ---
> base-commit: fa19879df1658f96ac07365fca8835b7decd6995
> change-id: 20260510-qom-qapi-fbe0f5060c3f
> 
> Best regards,
> --
> Marc-André Lureau <marcandre.lureau@redhat.com>

ATB,

Mark.


Re: [PATCH v3 00/74] qom/qdev: associate properties with QAPI schema types
Posted by Marc-André Lureau 1 month ago
Hi

On Tue, Aug 25, 2026 at 7:33 PM Mark Cave-Ayland
<mark.caveayland@nutanix.com> wrote:
>
> On 18/08/2026 12:10, Marc-André Lureau wrote:
>
> > Hi,
> >
> > This series connects QOM and qdev properties to the QAPI type system, so
> > that management tools can discover the QAPI schema type of each object
> > property.
> >
> > Today, QOM properties carry a free-form "type" string ("bool", "uint32",
> > "OnOffAuto", ..) that has no formal link to the QAPI schema exposed by
> > query-qmp-schema. Management tools must maintain ad-hoc mappings or rely
> > on naming conventions to figure out how to interpret property values.
> >
> > This series adds:
> >    - A new QAPITypeInfo struct that pairs a property with its QAPI schema
> >      type name, enum lookup table, and list-element type.
> >
> >    - A QAPI code generator (qapi-type-infos) that emits a QAPITypeInfo
> >      instance for every schema-defined type, including the mapping
> >      between internal C names and the schema name visible to clients.
> >
> >    - A "qapi-type" field in the ObjectPropertyInfo and
> >      ObjectPropertyValue QMP structs, populated from the QAPITypeInfo
> >      when present giving clients a cross-reference into query-qmp-schema
> >      output.
> >
> >    - Conversion of all PropertyInfo definitions from the old
> >      .type/.enum_table strings to the new .qapi_type pointer.
> >
> >    - Replacement of the generic qdev_prop_array with typed per-element
> >      array PropertyInfos, removing the arrayinfo/arrayfieldsize
> >      indirection from struct Property.
> >
> >    - Removal of the deprecated PropertyInfo.type and .enum_table fields,
> >      and of the old object_property_add_enum/add_tm APIs.
> >
> > Along the way, a few pre-existing type mismatches in property
> > definitions are fixed, the "struct tm" RTC property is replaced with a
> > proper QAPI StructTm type etc. Introducing more specific types or a
> > "typedef" to QAPI could help provide better associated type informations
> > than plain "str" in many cases, for example.
> >
> > Comments welcome!
>
> Thanks for quite a substantial piece work: there is quite a lot to pick
> through in this series which makes review tricky. If you post a new
> version, it might be worth showing an example of the before/after JSON
> to help give some context around the changes: however it feels this is

Well, the most significant change is that the query-qmp-schema grew of
about 10% to include types that are not referenced by QMP directly.

And qom-list, qom-list-get, device-list-properties, and
qom-list-properties now return an additional optional "qapi-type"
field to reference the schema types.


> going in the right direction, since it works towards the goal of
> allowing a QMP client to introspect everything it needs to know about
> the QAPI type underlying a property.
>
> I've started working through this with a few comments and reviews for
> the patches fixing up types: I wonder if the type fixups could be merged
> separately to help reduce the size of the series?

Sure, we can cherry-pick the fixes and reduce the new version.

>
> Question: is the eventual aim to deprecate the use of all the non-qapi
> object functions? Are there many instances left after this series at all?

QOM itself uses non-qapi functions, but outside of that, none should be left.

thanks

>
> > Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> > ---
> > Changes in v3:
> > - QAPI analysis redesign (replacing the old "expose name map" from
> > introspect)
> > - all non-implicit QAPI types are now introspectable, including QOM-only
> > types
> > - QAPITypeInfo.schema_name -> masked_name
> > - exposes integer signedness and width through query-qmp-schema
> > - various extra property fixes
> > - rebase, some patch split or merge
> >
> > - Link to v2: https://urldefense.proofpoint.com/v2/url?u=https-3A__lore.kernel.org_qemu-2Ddevel_20260616-2Dqom-2Dqapi-2Dv2-2D0-2Dcc9396b9c18c-40redhat.com&d=DwIDaQ&c=s883GpUCOChKOHiocYtGcg&r=c23RpsaH4D2MKyD3EPJTDa0BAxz6tV8aUJqVSoytEiY&m=LGtC1Otz03Nx6wZrdIv7LRRcAEAYfhyfKJ4dtNt7PCxy3ILcsWudQol0qR9l2c5a&s=Idir-fKu3uFkuRRHZW8ipF3e84xwMMhnVWVuat0zVXs&e=
> >
> > Changes in v2:
> >
> > - Added kernel-doc documentation for the QAPITypeInfo struct fields.
> > - Dropped "qom: drop free-form property typename registration", it's
> >    still needed for array of links to provide useful type names.
> > - Added qdev_prop_link_list for array-of-links properties, with a
> >    create function that generates "link<TYPE>List" type names matching the
> >    existing "link<TYPE>" convention.
> > - qdev_prop_link now uses &str_type_info instead of "link" (the full
> >    "link<TYPE>" type name is set at property-add time)
> > - Simplified DEFINE_PROP_LINK_ARRAY to use qdev_prop_link_list, dropping
> >    the now-unnecessary _arraytype parameter.
> > - rebased
> > - Link to v1: https://urldefense.proofpoint.com/v2/url?u=https-3A__lore.kernel.org_qemu-2Ddevel_20260510-2Dqom-2Dqapi-2Dv1-2D0-2D48ba6a1a1fa5-40redhat.com&d=DwIDaQ&c=s883GpUCOChKOHiocYtGcg&r=c23RpsaH4D2MKyD3EPJTDa0BAxz6tV8aUJqVSoytEiY&m=LGtC1Otz03Nx6wZrdIv7LRRcAEAYfhyfKJ4dtNt7PCxy3ILcsWudQol0qR9l2c5a&s=_KgQcnGFWRM8edu2HLa7HFwHHCkp2t6UyriBmPDNk8A&e=
> >
> > To: qemu-devel@nongnu.org
> > Cc: Markus Armbruster <armbru@redhat.com>
> > Cc: Michael Roth <michael.roth@amd.com>
> > Cc: Pierrick Bouvier <pierrick.bouvier@oss.qualcomm.com>
> > Cc: Paolo Bonzini <pbonzini@redhat.com>
> > Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
> > Cc: "Daniel P. Berrangé" <berrange@redhat.com>
> > Cc: Philippe Mathieu-Daudé <philmd@mailo.com>
> >
> > ---
> > Marc-André Lureau (74):
> >        qapi: add QAPITypeInfo struct definition
> >        qapi/gen: fix _module_basename for multi-dash 'what' parameters
> >        qapi: factor out QAPISchemaUsedTypes from introspect visitor
> >        qapi: register all introspectable types, not just QMP-reachable ones
> >        qapi: add type-infos generator
> >        meson: add qapi-type-infos-*.c/h to build
> >        qom: add qapi_type field to ObjectProperty
> >        qapi/qom: add qapi-type field to ObjectPropertyInfo
> >        qom/qmp: populate qapi-type in QMP handlers
> >        qom: add object_property_set_default_enum()
> >        qom: add object_{class_}property_add_qapi
> >        qom: add object_{class_}property_add_qapi_enum
> >        tests: update check-qom-proplist for QAPI-aware property registration
> >        qom: convert enum properties to QAPI-aware registration
> >        qom: remove old enum property registration API
> >        qom: convert struct properties to QAPI-aware registration
> >        x86: convert OnOffAuto properties to QAPI-aware registration
> >        microvm: convert OnOffAuto properties to QAPI-aware registration
> >        pc: convert OnOffAuto vmport property to QAPI-aware registration
> >        arm/virt: convert OnOffAuto acpi property to QAPI-aware registration
> >        riscv/virt: convert OnOffAuto properties to QAPI-aware registration
> >        loongarch/virt: convert OnOffAuto properties to QAPI-aware registration
> >        hostmem-file: convert OnOffAuto rom property to QAPI-aware registration
> >        sev: convert OnOffAuto legacy-vm-type property to QAPI-aware registration
> >        whpx: convert OnOffAuto hyperv property to QAPI-aware registration
> >        whpx: convert OnOffAuto arch properties to QAPI-aware registration
> >        accel/kvm: convert OnOffSplit property to QAPI-aware registration
> >        whpx: convert OnOffSplit property to QAPI-aware registration
> >        ppc/spapr-caps: convert to QAPI-aware property registration
> >        system/memory: fix "priority" property typename
> >        backends/hostmem: fix property typenames
> >        backends/hostmem-file: fix "align" property typename
> >        accel/tcg: fix "tb-size" property typename
> >        block/throttle-groups: fix throttle properties typename
> >        event-loop-base: fix property typenames
> >        iothread: fix poll properties typename
> >        util/thread-context: fix property typenames
> >        target/i386: fix CPUID version properties typename
> >        ppc/pnv: fix phb-id and chip-id properties typename
> >        backends/hostmem-memfd: fix "hugetlbsize" property typename
> >        hw/acpi: fix "node" properties typename
> >        net/colo-compare: fix compare_timeout setter visitor type
> >        net/colo-compare: fix max_queue_size setter visitor type
> >        hw/misc/xlnx-versal-trng: add missing getter for fips-fault-events
> >        qom: convert scalar properties to QAPI-aware registration
> >        i386/cpu: convert strList property to QAPI-aware registration
> >        accel/hvf: convert OnOffSplit property to QAPI-aware registration
> >        i386/x86: convert SgxEPCList property to QAPI-aware registration
> >        virtio-balloon: convert guest-stats property to QAPI type
> >        qom: replace object_property_add_tm with StructTm QAPI type
> >        hw/nvdimm: convert UUID property to QAPI-aware registration
> >        hw/s390-virtio-ccw: convert loadparm property to QAPI-aware registration
> >        hw/ppc/spapr_drc: convert fdt property to QAPI-aware registration
> >        spdm-socket: convert SpdmTransportType to QAPI enum
> >        hw/gpio/pca955x: use QAPI enums for led and pin properties
> >        include: add QEMU_REPEAT helper macro
> >        hw/gpio/pca955x: convert pin/led property to QAPI-aware enum
> >        hw/pci: change the busnr type to uint8
> >        qdev: add qapi_type field to PropertyInfo with fallback registration
> >        qdev: convert core PropertyInfo definitions to use qapi_type
> >        qdev: adjust PciDevfn declared type
> >        qdev: convert system PropertyInfo definitions to use qapi_type
> >        hw: convert device-local PropertyInfo definitions to use qapi_type
> >        target/riscv: fix incorrect QAPI types and u8 casting
> >        target/riscv: convert PropertyInfo definitions to use qapi_type
> >        qdev: convert PropertyInfo definitions to use qapi_type
> >        qdev: introduce typed array PropertyInfos
> >        qdev: simplify DEFINE_PROP_ARRAY and remove generic array PropertyInfo
> >        qdev: remove deprecated PropertyInfo.type and .enum_table fields
> >        memory: use object_property_add_link for container property
> >        hw/i386: convert PCSouthBridgeOption to QAPI enum
> >        qom: use QAPITypeInfo in object_property_get_enum
> >        qapi: expose integer signedness and width in introspection
> >        tests/qmp-cmd-test: assert qapi-type resolves in query-qmp-schema
> >
> >   accel/hvf/hvf-all.c                      |  29 ++--
> >   accel/kvm/kvm-all.c                      |  31 ++--
> >   accel/nitro/nitro-accel.c                |   3 +-
> >   accel/tcg/tcg-all.c                      |   3 +-
> >   accel/whpx/whpx-common.c                 |  58 +++----
> >   authz/list.c                             |  14 +-
> >   backends/cryptodev.c                     |   7 +-
> >   backends/hostmem-file.c                  |  33 ++--
> >   backends/hostmem-memfd.c                 |   3 +-
> >   backends/hostmem.c                       |  20 +--
> >   backends/spdm-socket.c                   |  25 +--
> >   backends/tpm/tpm_util.c                  |   3 +-
> >   block/throttle-groups.c                  |  10 +-
> >   chardev/char-socket.c                    |   3 +-
> >   crypto/secret_common.c                   |  12 +-
> >   crypto/secret_keyring.c                  |   9 +-
> >   crypto/tlscreds.c                        |  12 +-
> >   docs/devel/qapi-code-gen.rst             | 123 +++++++++++++--
> >   docs/interop/virtio-balloon-stats.rst    |  22 +--
> >   event-loop-base.c                        |   7 +-
> >   hw/acpi/ich9.c                           |   3 +-
> >   hw/acpi/pci.c                            |   7 +-
> >   hw/arm/virt.c                            |  31 ++--
> >   hw/block/xen-block.c                     |   3 +-
> >   hw/core/clock.c                          |   3 +-
> >   hw/core/machine-qmp-cmds.c               |   3 +-
> >   hw/core/machine.c                        |  13 +-
> >   hw/core/qdev-prop-internal.h             |  20 +++
> >   hw/core/qdev-properties-system.c         |  97 ++++++------
> >   hw/core/qdev-properties.c                | 180 ++++++++++++++-------
> >   hw/cpu/core.c                            |  10 +-
> >   hw/cxl/cxl-host.c                        |   6 +-
> >   hw/display/apple-gfx-mmio.m              |   2 +-
> >   hw/display/apple-gfx-pci.m               |   2 +-
> >   hw/display/apple-gfx.h                   |   1 +
> >   hw/display/apple-gfx.m                   |   7 +-
> >   hw/gpio/aspeed_gpio.c                    |   5 +-
> >   hw/gpio/aspeed_sgpio.c                   |   3 +-
> >   hw/gpio/pca9552.c                        | 261 ++++++++++++-------------------
> >   hw/gpio/pca9554.c                        | 157 +++++++------------
> >   hw/gpio/stm32l4x5_gpio.c                 |   5 +-
> >   hw/i386/microvm.c                        |  80 ++++------
> >   hw/i386/pc.c                             |  32 ++--
> >   hw/i386/pc_piix.c                        |  61 +++-----
> >   hw/i386/sgx-epc.c                        |   3 +-
> >   hw/i386/x86.c                            | 113 ++++++-------
> >   hw/ide/ide-dev.c                         |   3 +-
> >   hw/input/stellaris_gamepad.c             |   2 +-
> >   hw/intc/apic_common.c                    |   3 +-
> >   hw/intc/arm_gicv3_common.c               |   2 +-
> >   hw/intc/arm_gicv5_common.c               |   4 +-
> >   hw/intc/rx_icu.c                         |   4 +-
> >   hw/loongarch/virt.c                      |  87 +++++------
> >   hw/mem/nvdimm.c                          |  11 +-
> >   hw/mem/pc-dimm.c                         |   3 +-
> >   hw/microblaze/petalogix_s3adsp1800_mmu.c |  19 ++-
> >   hw/misc/arm_sysctl.c                     |   4 +-
> >   hw/misc/aspeed_lpc.c                     |  73 ++++++---
> >   hw/misc/aspeed_sdmc.c                    |   3 +-
> >   hw/misc/mps2-scc.c                       |   2 +-
> >   hw/misc/npcm7xx_mft.c                    |   3 +-
> >   hw/misc/tz-ppc.c                         |  19 +--
> >   hw/misc/xlnx-versal-trng.c               |  15 +-
> >   hw/net/ne2000-isa.c                      |   3 +-
> >   hw/net/rocker/rocker.c                   |   2 +-
> >   hw/net/virtio-net.c                      |   2 +-
> >   hw/nvme/ctrl.c                           |  29 ++--
> >   hw/nvme/nguid.c                          |   3 +-
> >   hw/nvram/xlnx-bbram.c                    |   3 +-
> >   hw/nvram/xlnx-efuse.c                    |   5 +-
> >   hw/nvram/xlnx-versal-efuse-ctrl.c        |   2 +-
> >   hw/pci-bridge/pci_expander_bridge.c      |   3 +-
> >   hw/pci-host/i440fx.c                     |  29 ++--
> >   hw/pci-host/pnv_phb3.c                   |   5 +-
> >   hw/pci-host/pnv_phb4.c                   |   5 +-
> >   hw/pci-host/q35.c                        |   9 +-
> >   hw/pci/pci.c                             |   3 +-
> >   hw/ppc/spapr_caps.c                      |  39 ++---
> >   hw/ppc/spapr_drc.c                       |   5 +-
> >   hw/ppc/spapr_rtc.c                       |  18 ++-
> >   hw/remote/vfio-user-obj.c                |  22 +--
> >   hw/riscv/microchip_pfsoc.c               |   3 +-
> >   hw/riscv/riscv_hart.c                    |   6 +-
> >   hw/riscv/virt.c                          |  52 +++---
> >   hw/rtc/mc146818rtc.c                     |  16 +-
> >   hw/s390x/ccw-device.c                    |   3 +-
> >   hw/s390x/css.c                           |   5 +-
> >   hw/s390x/s390-pci-bus.c                  |   3 +-
> >   hw/s390x/s390-virtio-ccw.c               |   4 +-
> >   hw/s390x/sclpcpi.c                       |   8 +-
> >   hw/s390x/virtio-ccw-mem.c                |   3 +-
> >   hw/sensor/adc128d818.c                   |  16 +-
> >   hw/sensor/adm1266.c                      |   3 +-
> >   hw/sensor/adm1272.c                      |   9 +-
> >   hw/sensor/emc141x.c                      |   9 +-
> >   hw/sensor/isl_pmbus_vr.c                 |  19 +--
> >   hw/sensor/lsm303dlhc_mag.c               |   9 +-
> >   hw/sensor/max34451.c                     |   5 +-
> >   hw/sensor/tmp105.c                       |   3 +-
> >   hw/sensor/tmp421.c                       |   9 +-
> >   hw/usb/dev-storage-classic.c             |   3 +-
> >   hw/vfio-user/pci.c                       |   5 +-
> >   hw/vfio/pci-quirks.c                     |   3 +-
> >   hw/virtio/virtio-balloon.c               |  87 ++++-------
> >   hw/virtio/virtio-iommu-pci.c             |   2 +-
> >   hw/virtio/virtio-mem-pci.c               |   3 +-
> >   hw/virtio/virtio-mem.c                   |  18 ++-
> >   hw/xen/xen-pvh-common.c                  |   9 +-
> >   include/chardev/char.h                   |   8 -
> >   include/hw/block/block.h                 |   2 +-
> >   include/hw/core/qdev-properties-system.h |   2 +
> >   include/hw/core/qdev-properties.h        |  40 +++--
> >   include/hw/cxl/cxl_component.h           |   5 +-
> >   include/hw/i386/pc.h                     |   4 +-
> >   include/qapi/qapi-type-info.h            |  32 ++++
> >   include/qemu/osdep.h                     |  33 ++++
> >   include/qemu/uuid.h                      |   4 +
> >   include/qom/object.h                     | 171 ++++++++++++--------
> >   include/system/spdm-socket.h             |  28 ++--
> >   iothread.c                               |   9 +-
> >   meson.build                              |   2 +
> >   migration/options.c                      |   4 +-
> >   monitor/qmp.c                            |  12 +-
> >   net/colo-compare.c                       |  15 +-
> >   net/dump.c                               |   6 +-
> >   net/filter-buffer.c                      |   3 +-
> >   net/filter.c                             |  10 +-
> >   qapi/common.json                         |  28 ++++
> >   qapi/introspect.json                     |  20 ++-
> >   qapi/machine.json                        | 152 ++++++++++++++++++
> >   qapi/meson.build                         |   4 +
> >   qapi/pragma.json                         |   1 +
> >   qapi/qom.json                            |  10 ++
> >   qapi/sockets.json                        |  20 +++
> >   qga/meson.build                          |   2 +
> >   qom/object.c                             | 236 +++++++++++++---------------
> >   qom/qom-qmp-cmds.c                       |  32 ++--
> >   scripts/qapi/backend.py                  |   9 +-
> >   scripts/qapi/gen.py                      |   2 +-
> >   scripts/qapi/introspect.py               | 107 ++++++-------
> >   scripts/qapi/schema_analysis.py          | 149 ++++++++++++++++++
> >   scripts/qapi/type_infos.py               | 178 +++++++++++++++++++++
> >   system/bootdevice.c                      |   3 +-
> >   system/memory.c                          |  40 +----
> >   target/arm/cpu64.c                       |  11 +-
> >   target/arm/kvm.c                         |   3 +-
> >   target/arm/tcg/cpu64.c                   |   5 +-
> >   target/i386/cpu.c                        |  26 +--
> >   target/i386/kvm/kvm.c                    |  38 +++--
> >   target/i386/kvm/tdx.c                    |   4 +-
> >   target/i386/sev.c                        |  31 ++--
> >   target/i386/whpx/whpx-all.c              | 101 ++++--------
> >   target/ppc/compat.c                      |   3 +-
> >   target/riscv/cpu.c                       |  50 +++---
> >   target/riscv/kvm/kvm-cpu.c               |   7 +-
> >   target/riscv/tcg/tcg-cpu.c               |  13 +-
> >   target/s390x/cpu-system.c                |   4 +-
> >   target/s390x/cpu_models.c                |   5 +-
> >   target/sparc/cpu.c                       |   3 +-
> >   tests/include/meson.build                |   2 +
> >   tests/meson.build                        |   6 +
> >   tests/qapi-schema/meson.build            |   1 +
> >   tests/qtest/qmp-cmd-test.c               |  55 ++++++-
> >   tests/unit/check-qom-proplist.c          |  99 +++++++++---
> >   tests/unit/test-qdev-global-props.c      |  11 +-
> >   tests/unit/test-qdev.c                   |   2 +-
> >   ui/console-vc.c                          |   8 +-
> >   ui/console.c                             |   3 +-
> >   ui/dbus.c                                |  18 ++-
> >   ui/input-linux.c                         |  11 +-
> >   util/thread-context.c                    |   7 +-
> >   util/uuid.c                              |   5 +
> >   172 files changed, 2510 insertions(+), 1699 deletions(-)
> > ---
> > base-commit: fa19879df1658f96ac07365fca8835b7decd6995
> > change-id: 20260510-qom-qapi-fbe0f5060c3f
> >
> > Best regards,
> > --
> > Marc-André Lureau <marcandre.lureau@redhat.com>
>
> ATB,
>
> Mark.
>
Re: [PATCH v3 00/74] qom/qdev: associate properties with QAPI schema types
Posted by Mark Cave-Ayland 1 month ago
On 26/08/2026 11:40, Marc-André Lureau wrote:

> Hi
> 
> On Tue, Aug 25, 2026 at 7:33 PM Mark Cave-Ayland
> <mark.caveayland@nutanix.com> wrote:
>>
>> On 18/08/2026 12:10, Marc-André Lureau wrote:
>>
>>> Hi,
>>>
>>> This series connects QOM and qdev properties to the QAPI type system, so
>>> that management tools can discover the QAPI schema type of each object
>>> property.
>>>
>>> Today, QOM properties carry a free-form "type" string ("bool", "uint32",
>>> "OnOffAuto", ..) that has no formal link to the QAPI schema exposed by
>>> query-qmp-schema. Management tools must maintain ad-hoc mappings or rely
>>> on naming conventions to figure out how to interpret property values.
>>>
>>> This series adds:
>>>     - A new QAPITypeInfo struct that pairs a property with its QAPI schema
>>>       type name, enum lookup table, and list-element type.
>>>
>>>     - A QAPI code generator (qapi-type-infos) that emits a QAPITypeInfo
>>>       instance for every schema-defined type, including the mapping
>>>       between internal C names and the schema name visible to clients.
>>>
>>>     - A "qapi-type" field in the ObjectPropertyInfo and
>>>       ObjectPropertyValue QMP structs, populated from the QAPITypeInfo
>>>       when present giving clients a cross-reference into query-qmp-schema
>>>       output.
>>>
>>>     - Conversion of all PropertyInfo definitions from the old
>>>       .type/.enum_table strings to the new .qapi_type pointer.
>>>
>>>     - Replacement of the generic qdev_prop_array with typed per-element
>>>       array PropertyInfos, removing the arrayinfo/arrayfieldsize
>>>       indirection from struct Property.
>>>
>>>     - Removal of the deprecated PropertyInfo.type and .enum_table fields,
>>>       and of the old object_property_add_enum/add_tm APIs.
>>>
>>> Along the way, a few pre-existing type mismatches in property
>>> definitions are fixed, the "struct tm" RTC property is replaced with a
>>> proper QAPI StructTm type etc. Introducing more specific types or a
>>> "typedef" to QAPI could help provide better associated type informations
>>> than plain "str" in many cases, for example.
>>>
>>> Comments welcome!
>>
>> Thanks for quite a substantial piece work: there is quite a lot to pick
>> through in this series which makes review tricky. If you post a new
>> version, it might be worth showing an example of the before/after JSON
>> to help give some context around the changes: however it feels this is
> 
> Well, the most significant change is that the query-qmp-schema grew of
> about 10% to include types that are not referenced by QMP directly.
> 
> And qom-list, qom-list-get, device-list-properties, and
> qom-list-properties now return an additional optional "qapi-type"
> field to reference the schema types.

Ack. I had a play with query-qmp-schema which probably isn't the most 
sensible way to look at the changes...
>> going in the right direction, since it works towards the goal of
>> allowing a QMP client to introspect everything it needs to know about
>> the QAPI type underlying a property.
>>
>> I've started working through this with a few comments and reviews for
>> the patches fixing up types: I wonder if the type fixups could be merged
>> separately to help reduce the size of the series?
> 
> Sure, we can cherry-pick the fixes and reduce the new version.

I think it will definitely help since those fixes are easy to review by 
themselves and it will help reduce the overall size.

>> Question: is the eventual aim to deprecate the use of all the non-qapi
>> object functions? Are there many instances left after this series at all?
> 
> QOM itself uses non-qapi functions, but outside of that, none should be left.
I thought that might be the case, but I wasn't sure just from reading 
the cover letter. Does it make sense to go all-in and move the non-QAPI 
functions to a separate, QOM internal-only header at the end of the series?


ATB,

Mark.