[PATCH v7 00/65] Hi

marcandre.lureau@redhat.com posted 65 patches 1 month ago
Failed in applying to current master (apply log)
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                   |   4 +-
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             |  92 ++++++++++-
docs/interop/virtio-balloon-stats.rst    |  22 +--
docs/sphinx/qapidoc.py                   |   2 +-
event-loop-base.c                        |   7 +-
hw/acpi/ich9.c                           |   1 +
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               |   4 +-
hw/core/machine.c                        |  13 +-
hw/core/qdev-prop-internal.h             |  23 +++
hw/core/qdev-properties-system.c         |  97 ++++++------
hw/core/qdev-properties.c                | 182 ++++++++++++++-------
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                        |  10 +-
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                           |   3 +-
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                       |  24 ++-
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                     |  22 ++-
hw/s390x/ccw-device.c                    |   3 +-
hw/s390x/css.c                           |   5 +-
hw/s390x/s390-pci-bus.c                  |   3 +-
hw/s390x/s390-virtio-ccw.c               |  11 +-
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            |  31 ++++
include/qemu/osdep.h                     |  33 ++++
include/qemu/uuid.h                      |   4 +
include/qom/object.h                     | 186 +++++++++++++++-------
iothread.c                               |   9 +-
meson.build                              |   1 +
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/machine.json                        | 152 ++++++++++++++++++
qapi/meson.build                         |   4 +
qapi/pragma.json                         |   1 +
qapi/qom.json                            |  10 ++
qga/meson.build                          |   2 +
qom/object.c                             | 237 +++++++++++++---------------
qom/qom-qmp-cmds.c                       |  47 +++---
scripts/qapi/backend.py                  |   2 +
scripts/qapi/gen.py                      |   2 +-
scripts/qapi/introspect.py               |  74 +++------
scripts/qapi/schema.py                   |  57 +++++--
scripts/qapi/type_infos.py               | 163 +++++++++++++++++++
system/bootdevice.c                      |   3 +-
system/memory.c                          |   5 +-
target/arm/cpu64.c                       |  11 +-
target/arm/kvm.c                         |   3 +-
target/arm/tcg/cpu64.c                   |  11 +-
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                       |  47 +++---
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 +
170 files changed, 2317 insertions(+), 1628 deletions(-)
[PATCH v7 00/65] Hi
Posted by marcandre.lureau@redhat.com 1 month ago
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.

Changes in v7:
- fixed a few more mis-typed list properties
- use designated initializers for StructTm fields
- assert enum get() returns >= or an error
- a few commit message and code comment tweaks
- rebased, add r-b trailers

Changes in v6:
- Rebase, resolve a few conflicts
- Replace old PATCH 03-04 by new PATCH 01-06, adjust PATCH 09 [old
  PATCH 05]
- Fix temporary build breakage: convert PCSouthBridgeOption only when
  it gets QAPIfied [PATCH 62], delay removal of old interface until
  after that [PATCH 63].
- Clean up checkpatch long line warnings, except leave the ones in
  PATCH 38 for later

Changes in v5:
- make "masked_name" mandatory, skip QType QAPITypeInfo generation
- added/split "hw/ppc/spapr_caps: fix property type name" patch
- added "qapi: select introspectable types directly", simplifying type discovery
- fixed an include path
- doc adjustments
- rebased, collect r-b trailers
- Link to v4: https://lore.kernel.org/qemu-devel/20260904-qom-qapi-v4-0-a985f168e938@redhat.com

Changes in v4:
- new patch "qom/qmp: populate description & default-value"
- added gtk-doc comments for class_property_add_qapi*()
- correct some property types to reflect the visitor
- collected rb, rebased
- Link to v3: https://lore.kernel.org/qemu-devel/20260818-qom-qapi-v3-0-24b8bbbe3d86@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

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
Marc-André Lureau (59):
      qapi: add QAPITypeInfo struct definition
      qapi/gen: fix _module_basename for multi-dash 'what' parameters
      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/qmp: populate description & default-value in qom_property_info()
      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 QAPI enum properties to QAPI-aware registration
      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
      hw/ppc/spapr_caps: fix property type name
      ppc/spapr-caps: convert to QAPI-aware property registration
      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
      hw/s390x: convert BootCertificatesList to QAPI-aware registration
      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: 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
      hw/i386: convert PCSouthBridgeOption to QAPI enum
      qom: remove old enum property registration API
      qom: use QAPITypeInfo in object_property_get_enum
      tests/qmp-cmd-test: assert qapi-type resolves in query-qmp-schema

Markus Armbruster (6):
      qapi/schema: Rename .lookup_entity() and tighten return type
      qapi: Ease access to introspection names
      qapi/introspect: Simplify masked name comment emission slighly
      qapi/introspect: Don't elide types
      qapi: QAPISchemaVisitor.visit_needed() is now unused, drop
      qapi/introspect: Tweak integer type masking

 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                   |   4 +-
 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             |  92 ++++++++++-
 docs/interop/virtio-balloon-stats.rst    |  22 +--
 docs/sphinx/qapidoc.py                   |   2 +-
 event-loop-base.c                        |   7 +-
 hw/acpi/ich9.c                           |   1 +
 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               |   4 +-
 hw/core/machine.c                        |  13 +-
 hw/core/qdev-prop-internal.h             |  23 +++
 hw/core/qdev-properties-system.c         |  97 ++++++------
 hw/core/qdev-properties.c                | 182 ++++++++++++++-------
 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                        |  10 +-
 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                           |   3 +-
 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                       |  24 ++-
 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                     |  22 ++-
 hw/s390x/ccw-device.c                    |   3 +-
 hw/s390x/css.c                           |   5 +-
 hw/s390x/s390-pci-bus.c                  |   3 +-
 hw/s390x/s390-virtio-ccw.c               |  11 +-
 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            |  31 ++++
 include/qemu/osdep.h                     |  33 ++++
 include/qemu/uuid.h                      |   4 +
 include/qom/object.h                     | 186 +++++++++++++++-------
 iothread.c                               |   9 +-
 meson.build                              |   1 +
 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/machine.json                        | 152 ++++++++++++++++++
 qapi/meson.build                         |   4 +
 qapi/pragma.json                         |   1 +
 qapi/qom.json                            |  10 ++
 qga/meson.build                          |   2 +
 qom/object.c                             | 237 +++++++++++++---------------
 qom/qom-qmp-cmds.c                       |  47 +++---
 scripts/qapi/backend.py                  |   2 +
 scripts/qapi/gen.py                      |   2 +-
 scripts/qapi/introspect.py               |  74 +++------
 scripts/qapi/schema.py                   |  57 +++++--
 scripts/qapi/type_infos.py               | 163 +++++++++++++++++++
 system/bootdevice.c                      |   3 +-
 system/memory.c                          |   5 +-
 target/arm/cpu64.c                       |  11 +-
 target/arm/kvm.c                         |   3 +-
 target/arm/tcg/cpu64.c                   |  11 +-
 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                       |  47 +++---
 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 +
 170 files changed, 2317 insertions(+), 1628 deletions(-)
---
base-commit: 8967b2fe1b2aaae3c29e207d85fab901d580a2dc
change-id: 20261020-qom-qapi-ceecbb2aa35f

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


Property types changed in this series (was: [PATCH v7 00/65] Hi)
Posted by Markus Armbruster 1 month ago
I used qom-list-types and qom-list-properties to list all properties and
their types, then looked for changes.  This can miss changes in
dynamically created properties; see the note on qom-list-properties in
qapi/qom.json.  Moreover, I ran into a few QOM types where
qom-list-properties is broken.

1. Close misses of QAPI type names change to actual QAPI type names

    old property type           new property type
    ---------------------------------------------
    string                      str
    uint64_t                    uint64
    uint64_t                    size
    int32_t                     int32
    int                         size
    uint32_t                    uint32
    [uint16]                    uint16List
    NotifyVMexitOption          NotifyVmexitOption
    CXLFixedMemoryWindow        CXLFixedMemoryWindowOptionsList

2. Incorrect QAPI type names change to correct ones

    old property type           new property type
    ---------------------------------------------
    SgxEPC                      SgxEPCList
    QAuthZListRule              QAuthZListRuleList
    X86CPUFeatureWordInfo       X86CPUFeatureWordInfoList
    bool                        Pca9552LedState

3. Less than useful QAPI type names change to more useful ones

    old property type           new property type
    ---------------------------------------------
    str                         Pca9552PinState
    str                         Pca9554PinState

4. Lazy crap
 
    old property type           new property type
    ---------------------------------------------
    list                        link<arm-cpu>List
    list                        strList
    list                        uint16List
    list                        uint32List
    list                        uint64List
    list                        uint8List
    struct                      any

    I'm not sure the first one is what it should be.

    I need to have a closer look at the last one.

5. Inventive crap
  
    old property type           new property type
    ---------------------------------------------
    busnr                       uint8
    guest statistics            VirtioBalloonGuestStats
    loadparm                    str
    on|off|split                OnOffSplit
    struct tm                   StructTm

6. An odd duck

    old property type           new property type
    ---------------------------------------------
    str                         int32

    This is pci-device property addr.  See PATCH 54.

On the way, I noted properties with anti-social names:

    QOM type name       property name
    ---------------------------------
    acpi-ged            memhp container[0]
    e500-spin           e500 spin pv device[0]
Re: Property types changed in this series
Posted by Markus Armbruster 1 month ago
Libvirt developers: does libvirt use member @type of the reply of
qom-list, qom-list-properties, qom-list-get?

I'm asking because Marc-André's work changes many values to add a more
useful replacement.  I think we should deprecate @type.  I'd like to
find out whether we need to preserve the values for the deprecation
grace period.

Markus Armbruster <armbru@redhat.com> writes:

> I used qom-list-types and qom-list-properties to list all properties and
> their types, then looked for changes.  This can miss changes in
> dynamically created properties; see the note on qom-list-properties in
> qapi/qom.json.  Moreover, I ran into a few QOM types where
> qom-list-properties is broken.

These are ast2700-a1, ast2700-a2, and several riscv CPUs.  A fix for the
latter has been queued.

> 1. Close misses of QAPI type names change to actual QAPI type names
>
>     old property type           new property type
>     ---------------------------------------------
>     string                      str
>     uint64_t                    uint64
>     uint64_t                    size
>     int32_t                     int32
>     int                         size
>     uint32_t                    uint32
>     [uint16]                    uint16List
>     NotifyVMexitOption          NotifyVmexitOption
>     CXLFixedMemoryWindow        CXLFixedMemoryWindowOptionsList
>
> 2. Incorrect QAPI type names change to correct ones
>
>     old property type           new property type
>     ---------------------------------------------
>     SgxEPC                      SgxEPCList
>     QAuthZListRule              QAuthZListRuleList
>     X86CPUFeatureWordInfo       X86CPUFeatureWordInfoList
>     bool                        Pca9552LedState
>
> 3. Less than useful QAPI type names change to more useful ones
>
>     old property type           new property type
>     ---------------------------------------------
>     str                         Pca9552PinState
>     str                         Pca9554PinState
>
> 4. Lazy crap
>  
>     old property type           new property type
>     ---------------------------------------------
>     list                        link<arm-cpu>List
>     list                        strList
>     list                        uint16List
>     list                        uint32List
>     list                        uint64List
>     list                        uint8List
>     struct                      any
>
>     I'm not sure the first one is what it should be.
>
>     I need to have a closer look at the last one.
>
> 5. Inventive crap
>   
>     old property type           new property type
>     ---------------------------------------------
>     busnr                       uint8
>     guest statistics            VirtioBalloonGuestStats
>     loadparm                    str
>     on|off|split                OnOffSplit
>     struct tm                   StructTm
>
> 6. An odd duck
>
>     old property type           new property type
>     ---------------------------------------------
>     str                         int32
>
>     This is pci-device property addr.  See PATCH 54.
>
> On the way, I noted properties with anti-social names:
>
>     QOM type name       property name
>     ---------------------------------
>     acpi-ged            memhp container[0]
>     e500-spin           e500 spin pv device[0]
Re: Property types changed in this series
Posted by Ján Tomko 1 month ago
On a Thursday in 2026, Markus Armbruster via Devel wrote:
>Libvirt developers: does libvirt use member @type of the reply of
>qom-list, qom-list-properties, qom-list-get?
>

The code for getting CPU properties uses qom-list-get for new QEMUs,
where it checks whether "type" is "bool".

I think that can be easily converted to just check for the JSON type.

Jano

>I'm asking because Marc-André's work changes many values to add a more
>useful replacement.  I think we should deprecate @type.  I'd like to
>find out whether we need to preserve the values for the deprecation
>grace period.
>
ObjectPropertyInfo design (was: [PATCH v7 00/65] Hi)
Posted by Markus Armbruster 1 month ago
Marc-André's series evolves ObjectPropertyInfo and ObjectPropertyValue:
it adds member @qapi-type and changes many values of member @type.

I'd like to take a step back and discuss design.  I trimmed Cc:
accordingly.


= The current interface

qom-list returns information on an object's properties, one
ObjectPropertyInfo per property.

qom-list-properties returns information on properties an instance of a
type is known to have[*], one ObjectPropertyInfo per property.

qom-list-get returns information on the properties of several objects,
one ObjectPropertyValue per property.

ObjectPropertyInfo and ObjectPropertyValue provide @name and @type.

ObjectPropertyInfo additionally provides @description and
@default-value, both optional.

ObjectPropertyValue additionally provides optional @value, absent when
the property cannot be read.

If ObjectPropertyValue was an extension of ObjectPropertyInfo, then
qom-list-get would be a strictly more powerful version of qom-list.
It isn't.  However, I think the information lost when moving from
qom-list to qom-list-get is not useful:

* @description is rarely present (I see under 15% in a quick test).  The
  description text is commonly misleading for QMP.  For instance, qdev
  bool properties have description "on/off".  The possible values are
  actually JSON false and true.

* @default-value can be useful with qom-list-properties, which operates
  on types.  I doubt it is with qom-list, which operates on objects.

Let's pretend @description doesn't exist, and @default-value exists only
with qom-list-properties.

This makes qom-list-get strictly more powerful than qom-list, so let's
further pretend qom-list doesn't exist.


= Simplified interface for the sake of discussion

qom-list-properties returns information on properties an instance of a
type is known to have[*]: @name, @type, and maybe @default-value.

qom-list-get returns information on the properties of several objects:
@name, @type, and maybe @value.


= The meaning of @type

Three cases:

1. For a child property (created with object_property_add_child() etc.),
   @type is "child<T>", where T is the child's QOM type.

2. For a link property (created with object_class_property_add_link()
   etc.), @type is "link<T>", where T is the target's QOM type.

3. For other properties, @type can be anything.  We commonly use QAPI
   type names (occasionally misspelled), and also "well-known" (but
   undocumented) non-QAPI names for primitive types.  Every now and
   then, developers get lazy and use values like "list", or creative and
   use values like "guest statistics".  Nobody has gotten sufficiently
   masochistic to use values starting with "child<" or "link<" so far,
   although nothing would stop that.

Cases 1 and 2 go against the QAPI/QMP design maxim "don't encode stuff
in strings".

Case 3 is is hard to use for anything.  You're forced into stupid and
brittle hardcoding.

Marc-André's work adds a new optional member @qapi_type that refers to a
QAPI type in the output of query-qmp-schema.  It's present for a large
subset of case 3.  When it's present, @type should not be used.

It also cleans up many crap cases of 3, but without making it robust.  I
understand this isn't something the series tries to do, it's just
something that's easier to do than not to do.  If it creates
compatibility problems, we have to not do it.  I hope it doesn't.


= Can we do better?

What information are we trying to convey?  Four cases:

1. Child property: the child's QOM type

2. Link property: the target's QOM type

3. QAPI-backed property: the property's QAPI type

4. Other property: we have nothing useful to offer

Case 4 should go away eventually.

How would we encode this in QAPI on a green field?  With a union, of
course:

    { 'enum': 'ObjectPropertyKind',
      'data': [ 'child', 'link', 'qapi', 'other'] }

    { 'struct': 'ObjectPropertyInfoLink',
      'data': { 'qom-type': 'str' } }

    { 'struct': 'ObjectPropertyInfoQAPI',
      'data': { 'qapi-type': 'str' } }

    { 'union': 'ObjectProperty...',
      'base': { 'kind': 'ObjectPropertyKind',
                ... more ... },
      'discriminator': 'kind',
      'data': {
          'child': 'ObjectPropertyInfoLink',
          'link': 'ObjectPropertyInfoLink',
          'qapi': 'ObjectPropertyInfoQAPI' } }

To make this a compatible evolution of ObjectPropertyInfo, we need
... more ... to be

                'type': 'str',
                '*description': 'str'
                '*default-value': 'any',

Sadly, we need to duplicate the union for ObjectPropertyValue.  There,
... more ... needs to be

                'type': 'str',
                '*value': 'any'

We should deprecate @type.  I'd also deprecate @description.

Thoughts?


[*] It may have more; see the note in the doc comment of
qom-list-properties.
Re: ObjectPropertyInfo design (was: [PATCH v7 00/65] Hi)
Posted by Daniel P. Berrangé 3 weeks, 6 days ago
On Thu, Oct 22, 2026 at 04:04:44PM +0200, Markus Armbruster wrote:
> Marc-André's series evolves ObjectPropertyInfo and ObjectPropertyValue:
> it adds member @qapi-type and changes many values of member @type.
> 
> I'd like to take a step back and discuss design.  I trimmed Cc:
> accordingly.
> 
> 
> = The current interface
> 
> qom-list returns information on an object's properties, one
> ObjectPropertyInfo per property.
> 
> qom-list-properties returns information on properties an instance of a
> type is known to have[*], one ObjectPropertyInfo per property.

This is 

> 
> qom-list-get returns information on the properties of several objects,
> one ObjectPropertyValue per property.

Since 'qom-list-properties' is really introspecting types, rather
than instances, I'd add its companion:

  query-qmp-schema  returns information on properties from
  user creatable QOM objects, via the ObjectOptions union
  which handles data of arbitary complexity and nesting,
  with strictly QAPI types only. Obviously missing QDev
  and other internal only types.

> * @description is rarely present (I see under 15% in a quick test).  The
>   description text is commonly misleading for QMP.  For instance, qdev
>   bool properties have description "on/off".  The possible values are
>   actually JSON false and true.

With query-qmp-schema  we have a description for 100% of properties,
enforced by the QAPI schema parser. Only applies to UserCreatable QOM
objects though.

I see descriptions as primarily a documentation thing for humans, and
perhaps for machines which are trying to generate code frmo QAPI
schema and want to use descriptions for docs. These are both static
querying tasks.

I don't see descriptions as useful for mgmt apps at runtime for
deployed QEMus.

> * @default-value can be useful with qom-list-properties, which operates
>   on types.  I doubt it is with qom-list, which operates on objects.

Likewise, IMHO this is useful info statically, but not at runtime.

> Let's pretend @description doesn't exist, and @default-value exists only
> with qom-list-properties.
> 
> This makes qom-list-get strictly more powerful than qom-list, so let's
> further pretend qom-list doesn't exist.
> 
> 
> = Simplified interface for the sake of discussion
> 
> qom-list-properties returns information on properties an instance of a
> type is known to have[*]: @name, @type, and maybe @default-value.

In the ideal world 'qom-list-properties' would not need to exist,
but it has to for the forseeable future, since none of QDev is
modelled in QAPI schema currently. 

> qom-list-get returns information on the properties of several objects:
> @name, @type, and maybe @value.
> 
> 
> = The meaning of @type
> 
> Three cases:
> 
> 1. For a child property (created with object_property_add_child() etc.),
>    @type is "child<T>", where T is the child's QOM type.
> 
> 2. For a link property (created with object_class_property_add_link()
>    etc.), @type is "link<T>", where T is the target's QOM type.
> 
> 3. For other properties, @type can be anything.  We commonly use QAPI
>    type names (occasionally misspelled), and also "well-known" (but
>    undocumented) non-QAPI names for primitive types.  Every now and
>    then, developers get lazy and use values like "list", or creative and
>    use values like "guest statistics".  Nobody has gotten sufficiently
>    masochistic to use values starting with "child<" or "link<" so far,
>    although nothing would stop that.
> 
> Cases 1 and 2 go against the QAPI/QMP design maxim "don't encode stuff
> in strings".

They're not particular nice internally either as part of QDev/QOM.
ie this is gross as a design approach:

  static inline bool object_property_is_child(ObjectProperty *prop)
  {
    return strstart(prop->type, "child<", NULL);
  }

> Case 3 is is hard to use for anything.  You're forced into stupid and
> brittle hardcoding.
> 
> Marc-André's work adds a new optional member @qapi_type that refers to a
> QAPI type in the output of query-qmp-schema.  It's present for a large
> subset of case 3.  When it's present, @type should not be used.
> 
> It also cleans up many crap cases of 3, but without making it robust.  I
> understand this isn't something the series tries to do, it's just
> something that's easier to do than not to do.  If it creates
> compatibility problems, we have to not do it.  I hope it doesn't.
> 
> 
> = Can we do better?
> 
> What information are we trying to convey?  Four cases:
> 
> 1. Child property: the child's QOM type
> 
> 2. Link property: the target's QOM type
> 
> 3. QAPI-backed property: the property's QAPI type
> 
> 4. Other property: we have nothing useful to offer
> 
> Case 4 should go away eventually.
> 
> How would we encode this in QAPI on a green field?  With a union, of
> course:
> 
>     { 'enum': 'ObjectPropertyKind',
>       'data': [ 'child', 'link', 'qapi', 'other'] }
> 
>     { 'struct': 'ObjectPropertyInfoLink',
>       'data': { 'qom-type': 'str' } }
> 
>     { 'struct': 'ObjectPropertyInfoQAPI',
>       'data': { 'qapi-type': 'str' } }
> 
>     { 'union': 'ObjectProperty...',
>       'base': { 'kind': 'ObjectPropertyKind',
>                 ... more ... },
>       'discriminator': 'kind',
>       'data': {
>           'child': 'ObjectPropertyInfoLink',
>           'link': 'ObjectPropertyInfoLink',
>           'qapi': 'ObjectPropertyInfoQAPI' } }
> 
> To make this a compatible evolution of ObjectPropertyInfo, we need
> ... more ... to be
> 
>                 'type': 'str',
>                 '*description': 'str'
>                 '*default-value': 'any',
> 
> Sadly, we need to duplicate the union for ObjectPropertyValue.  There,
> ... more ... needs to be
> 
>                 'type': 'str',
>                 '*value': 'any'
> 
> We should deprecate @type.  I'd also deprecate @description.
> 
> Thoughts?

We currently have

  { 'enum': 'ObjectType', .... }

which provides a name in QMP schema for every QOM type that
implements UserCreatable.

We could relatively easily  extend that to cover *all* QOM
types in existance, with some judicous grepping of TypeInfo
classes.

It would be nice if we could enforce at runtime though that
anything passed to type_register() was listed in 'ObjectType'
enum to catch omissions. Not sure if there are any unexpected
dragons if we make type_register() check the type name
against  'ObjectType_lookup' from qapi-types-qom.h ?

Then your

>     { 'struct': 'ObjectPropertyInfoLink',
>       'data': { 'qom-type': 'str' } }

could at least reference 'ObjectType' instead of 'str' and be
aligned more with query-qmp-schema.


With regards,
Daniel
-- 
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|


Re: ObjectPropertyInfo design
Posted by Markus Armbruster 3 weeks, 4 days ago
Daniel P. Berrangé <berrange@redhat.com> writes:

> On Thu, Oct 22, 2026 at 04:04:44PM +0200, Markus Armbruster wrote:
>> Marc-André's series evolves ObjectPropertyInfo and ObjectPropertyValue:
>> it adds member @qapi-type and changes many values of member @type.
>> 
>> I'd like to take a step back and discuss design.  I trimmed Cc:
>> accordingly.
>> 
>> 
>> = The current interface
>> 
>> qom-list returns information on an object's properties, one
>> ObjectPropertyInfo per property.
>> 
>> qom-list-properties returns information on properties an instance of a
>> type is known to have[*], one ObjectPropertyInfo per property.
>
> This is 

Yes?

>> qom-list-get returns information on the properties of several objects,
>> one ObjectPropertyValue per property.
>
> Since 'qom-list-properties' is really introspecting types, rather
> than instances, I'd add its companion:
>
>   query-qmp-schema  returns information on properties from
>   user creatable QOM objects, via the ObjectOptions union
>   which handles data of arbitary complexity and nesting,
>   with strictly QAPI types only. Obviously missing QDev
>   and other internal only types.

Yes.  Ideally, it would cover everything, but QOM's design and the sheer
amount of QOM types and properties has kept that well out of reach.  QOM
introspection filled the gap, but badly.  Marc-André's work makes it
less bad.

>> * @description is rarely present (I see under 15% in a quick test).  The
>>   description text is commonly misleading for QMP.  For instance, qdev
>>   bool properties have description "on/off".  The possible values are
>>   actually JSON false and true.
>
> With query-qmp-schema  we have a description for 100% of properties,
> enforced by the QAPI schema parser. Only applies to UserCreatable QOM
> objects though.

Yes.

QAPI schema doc comments are mandatory, and they get validated against
the schema code.  They become the "QEMU QMP Reference Manual".

QOM property description strings are optional, and they are not checked
in any way.  They are used in help intended for humans.

> I see descriptions as primarily a documentation thing for humans, and
> perhaps for machines which are trying to generate code frmo QAPI
> schema and want to use descriptions for docs. These are both static
> querying tasks.
>
> I don't see descriptions as useful for mgmt apps at runtime for
> deployed QEMus.

Noted.

>> * @default-value can be useful with qom-list-properties, which operates
>>   on types.  I doubt it is with qom-list, which operates on objects.
>
> Likewise, IMHO this is useful info statically, but not at runtime.

Noted.

>> Let's pretend @description doesn't exist, and @default-value exists only
>> with qom-list-properties.
>> 
>> This makes qom-list-get strictly more powerful than qom-list, so let's
>> further pretend qom-list doesn't exist.
>> 
>> 
>> = Simplified interface for the sake of discussion
>> 
>> qom-list-properties returns information on properties an instance of a
>> type is known to have[*]: @name, @type, and maybe @default-value.
>
> In the ideal world 'qom-list-properties' would not need to exist,
> but it has to for the forseeable future, since none of QDev is
> modelled in QAPI schema currently. 

Yes.

>> qom-list-get returns information on the properties of several objects:
>> @name, @type, and maybe @value.
>> 
>> 
>> = The meaning of @type
>> 
>> Three cases:
>> 
>> 1. For a child property (created with object_property_add_child() etc.),
>>    @type is "child<T>", where T is the child's QOM type.
>> 
>> 2. For a link property (created with object_class_property_add_link()
>>    etc.), @type is "link<T>", where T is the target's QOM type.
>> 
>> 3. For other properties, @type can be anything.  We commonly use QAPI
>>    type names (occasionally misspelled), and also "well-known" (but
>>    undocumented) non-QAPI names for primitive types.  Every now and
>>    then, developers get lazy and use values like "list", or creative and
>>    use values like "guest statistics".  Nobody has gotten sufficiently
>>    masochistic to use values starting with "child<" or "link<" so far,
>>    although nothing would stop that.
>> 
>> Cases 1 and 2 go against the QAPI/QMP design maxim "don't encode stuff
>> in strings".
>
> They're not particular nice internally either as part of QDev/QOM.
> ie this is gross as a design approach:
>
>   static inline bool object_property_is_child(ObjectProperty *prop)
>   {
>     return strstart(prop->type, "child<", NULL);
>   }

I can top that!

    /* Go from link<FOO> to FOO.  */
    type = object_property_get_type(obj, name, NULL);
    target_type = g_strndup(&type[5], strlen(type) - 6);

>> Case 3 is is hard to use for anything.  You're forced into stupid and
>> brittle hardcoding.
>> 
>> Marc-André's work adds a new optional member @qapi_type that refers to a
>> QAPI type in the output of query-qmp-schema.  It's present for a large
>> subset of case 3.  When it's present, @type should not be used.
>> 
>> It also cleans up many crap cases of 3, but without making it robust.  I
>> understand this isn't something the series tries to do, it's just
>> something that's easier to do than not to do.  If it creates
>> compatibility problems, we have to not do it.  I hope it doesn't.
>> 
>> 
>> = Can we do better?
>> 
>> What information are we trying to convey?  Four cases:
>> 
>> 1. Child property: the child's QOM type
>> 
>> 2. Link property: the target's QOM type
>> 
>> 3. QAPI-backed property: the property's QAPI type
>> 
>> 4. Other property: we have nothing useful to offer
>> 
>> Case 4 should go away eventually.
>> 
>> How would we encode this in QAPI on a green field?  With a union, of
>> course:
>> 
>>     { 'enum': 'ObjectPropertyKind',
>>       'data': [ 'child', 'link', 'qapi', 'other'] }
>> 
>>     { 'struct': 'ObjectPropertyInfoLink',
>>       'data': { 'qom-type': 'str' } }
>> 
>>     { 'struct': 'ObjectPropertyInfoQAPI',
>>       'data': { 'qapi-type': 'str' } }
>> 
>>     { 'union': 'ObjectProperty...',
>>       'base': { 'kind': 'ObjectPropertyKind',
>>                 ... more ... },
>>       'discriminator': 'kind',
>>       'data': {
>>           'child': 'ObjectPropertyInfoLink',
>>           'link': 'ObjectPropertyInfoLink',
>>           'qapi': 'ObjectPropertyInfoQAPI' } }
>> 
>> To make this a compatible evolution of ObjectPropertyInfo, we need
>> ... more ... to be
>> 
>>                 'type': 'str',
>>                 '*description': 'str'
>>                 '*default-value': 'any',
>> 
>> Sadly, we need to duplicate the union for ObjectPropertyValue.  There,
>> ... more ... needs to be
>> 
>>                 'type': 'str',
>>                 '*value': 'any'
>> 
>> We should deprecate @type.  I'd also deprecate @description.
>> 
>> Thoughts?
>
> We currently have
>
>   { 'enum': 'ObjectType', .... }
>
> which provides a name in QMP schema for every QOM type that
> implements UserCreatable.
>
> We could relatively easily  extend that to cover *all* QOM
> types in existance, with some judicous grepping of TypeInfo
> classes.
>
> It would be nice if we could enforce at runtime though that
> anything passed to type_register() was listed in 'ObjectType'
> enum to catch omissions. Not sure if there are any unexpected
> dragons if we make type_register() check the type name
> against  'ObjectType_lookup' from qapi-types-qom.h ?

Can't see why that wouldn't work.

We use strings instead of a C enum for type names, because a C enum
would be conflict magnet, and also a "recompile the world" header.

Strings weaken the type checker, and also risk typos.  The #define
TYPE_FOO "foo" reduce that risk.  Since we don't always use them, we
always have to grep both for TYPE_FOO and "foo".

If we enumerate all the type names in a QAPI enum, we generate such a C
enum, but use it only to check the strings.  Still a conflict magnet,
but at least not a "recompile the world" header.

> Then your
>
>>     { 'struct': 'ObjectPropertyInfoLink',
>>       'data': { 'qom-type': 'str' } }
>
> could at least reference 'ObjectType' instead of 'str'

Yes.  There are a few more, e.g. CompatProperty member @qom-type.

>                                                        and be
> aligned more with query-qmp-schema.

What do you mean by that?
Re: ObjectPropertyInfo design (was: [PATCH v7 00/65] Hi)
Posted by Marc-André Lureau 1 month ago
Hi

On Thu, Oct 22, 2026 at 6:04 PM Markus Armbruster <armbru@redhat.com> wrote:
>
> Marc-André's series evolves ObjectPropertyInfo and ObjectPropertyValue:
> it adds member @qapi-type and changes many values of member @type.
>
> I'd like to take a step back and discuss design.  I trimmed Cc:
> accordingly.
>
>
> = The current interface
>
> qom-list returns information on an object's properties, one
> ObjectPropertyInfo per property.
>
> qom-list-properties returns information on properties an instance of a
> type is known to have[*], one ObjectPropertyInfo per property.
>
> qom-list-get returns information on the properties of several objects,
> one ObjectPropertyValue per property.
>
> ObjectPropertyInfo and ObjectPropertyValue provide @name and @type.
>
> ObjectPropertyInfo additionally provides @description and
> @default-value, both optional.
>
> ObjectPropertyValue additionally provides optional @value, absent when
> the property cannot be read.
>
> If ObjectPropertyValue was an extension of ObjectPropertyInfo, then
> qom-list-get would be a strictly more powerful version of qom-list.
> It isn't.  However, I think the information lost when moving from
> qom-list to qom-list-get is not useful:
>
> * @description is rarely present (I see under 15% in a quick test).  The
>   description text is commonly misleading for QMP.  For instance, qdev
>   bool properties have description "on/off".  The possible values are
>   actually JSON false and true.
>
> * @default-value can be useful with qom-list-properties, which operates
>   on types.  I doubt it is with qom-list, which operates on objects.
>
> Let's pretend @description doesn't exist, and @default-value exists only
> with qom-list-properties.
>
> This makes qom-list-get strictly more powerful than qom-list, so let's
> further pretend qom-list doesn't exist.
>
>
> = Simplified interface for the sake of discussion
>
> qom-list-properties returns information on properties an instance of a
> type is known to have[*]: @name, @type, and maybe @default-value.
>
> qom-list-get returns information on the properties of several objects:
> @name, @type, and maybe @value.
>
>
> = The meaning of @type
>
> Three cases:
>
> 1. For a child property (created with object_property_add_child() etc.),
>    @type is "child<T>", where T is the child's QOM type.
>
> 2. For a link property (created with object_class_property_add_link()
>    etc.), @type is "link<T>", where T is the target's QOM type.
>
> 3. For other properties, @type can be anything.  We commonly use QAPI
>    type names (occasionally misspelled), and also "well-known" (but
>    undocumented) non-QAPI names for primitive types.  Every now and
>    then, developers get lazy and use values like "list", or creative and
>    use values like "guest statistics".  Nobody has gotten sufficiently
>    masochistic to use values starting with "child<" or "link<" so far,
>    although nothing would stop that.
>
> Cases 1 and 2 go against the QAPI/QMP design maxim "don't encode stuff
> in strings".
>
> Case 3 is is hard to use for anything.  You're forced into stupid and
> brittle hardcoding.
>
> Marc-André's work adds a new optional member @qapi_type that refers to a
> QAPI type in the output of query-qmp-schema.  It's present for a large
> subset of case 3.  When it's present, @type should not be used.
>
> It also cleans up many crap cases of 3, but without making it robust.  I
> understand this isn't something the series tries to do, it's just
> something that's easier to do than not to do.  If it creates
> compatibility problems, we have to not do it.  I hope it doesn't.
>
>
> = Can we do better?
>
> What information are we trying to convey?  Four cases:
>
> 1. Child property: the child's QOM type
>
> 2. Link property: the target's QOM type
>
> 3. QAPI-backed property: the property's QAPI type
>
> 4. Other property: we have nothing useful to offer
>
> Case 4 should go away eventually.
>
> How would we encode this in QAPI on a green field?  With a union, of
> course:
>
>     { 'enum': 'ObjectPropertyKind',
>       'data': [ 'child', 'link', 'qapi', 'other'] }
>
>     { 'struct': 'ObjectPropertyInfoLink',
>       'data': { 'qom-type': 'str' } }
>
>     { 'struct': 'ObjectPropertyInfoQAPI',
>       'data': { 'qapi-type': 'str' } }
>
>     { 'union': 'ObjectProperty...',
>       'base': { 'kind': 'ObjectPropertyKind',
>                 ... more ... },
>       'discriminator': 'kind',
>       'data': {
>           'child': 'ObjectPropertyInfoLink',
>           'link': 'ObjectPropertyInfoLink',
>           'qapi': 'ObjectPropertyInfoQAPI' } }
>
> To make this a compatible evolution of ObjectPropertyInfo, we need
> ... more ... to be
>
>                 'type': 'str',
>                 '*description': 'str'
>                 '*default-value': 'any',
>
> Sadly, we need to duplicate the union for ObjectPropertyValue.  There,
> ... more ... needs to be
>
>                 'type': 'str',
>                 '*value': 'any'
>
> We should deprecate @type.  I'd also deprecate @description.

It's optional, I don't think that hurts.

> Thoughts?

I like it overall.

But this goes beyond the intended scope of the series.
Blending/merging QOM type & QAPI type would warrant more design
research. So covering child<> & link<> are out of scope of the current
qom-qapi series. I think the addition of qapi-type shouldn't be
incompatible with a future proposal, after all all properties should
have some 'wire' type (link/child are paths). But we can drop it for
now or just rename it x-qapi-type until we agree on the new
introspection.

my2c
Re: ObjectPropertyInfo design
Posted by Markus Armbruster 3 weeks, 4 days ago
Marc-André Lureau <marcandre.lureau@redhat.com> writes:

[Possible improvement to the QAPI/QMP QOM introspection interface...]

>> Thoughts?
>
> I like it overall.
>
> But this goes beyond the intended scope of the series.
> Blending/merging QOM type & QAPI type would warrant more design
> research. So covering child<> & link<> are out of scope of the current
> qom-qapi series. I think the addition of qapi-type shouldn't be
> incompatible with a future proposal, after all all properties should
> have some 'wire' type (link/child are paths). But we can drop it for
> now or just rename it x-qapi-type until we agree on the new
> introspection.
>
> my2c

Adding @qapi-type with feature unstable means we don't have to worry
about the external interface now.  One less hurdle for merging.  I like
it.

Whether changing the @type values is safe remains somewhat unclear.  See

    Subject: Property types changed in this series (was: [PATCH v7 00/65] Hi)
    Date: Wed, 21 Oct 2026 18:29:40 +0200
    Message-ID: <87tsmfkoej.fsf@pond.sub.org>
Re: ObjectPropertyInfo design
Posted by Markus Armbruster 3 weeks, 3 days ago
Markus Armbruster <armbru@redhat.com> writes:

> Marc-André Lureau <marcandre.lureau@redhat.com> writes:
>
> [Possible improvement to the QAPI/QMP QOM introspection interface...]
>
>>> Thoughts?
>>
>> I like it overall.
>>
>> But this goes beyond the intended scope of the series.
>> Blending/merging QOM type & QAPI type would warrant more design
>> research. So covering child<> & link<> are out of scope of the current
>> qom-qapi series. I think the addition of qapi-type shouldn't be
>> incompatible with a future proposal, after all all properties should
>> have some 'wire' type (link/child are paths). But we can drop it for
>> now or just rename it x-qapi-type until we agree on the new
>> introspection.
>>
>> my2c
>
> Adding @qapi-type with feature unstable means we don't have to worry
> about the external interface now.  One less hurdle for merging.  I like
> it.
>
> Whether changing the @type values is safe remains somewhat unclear.  See
>
>     Subject: Property types changed in this series (was: [PATCH v7 00/65] Hi)
>     Date: Wed, 21 Oct 2026 18:29:40 +0200
>     Message-ID: <87tsmfkoej.fsf@pond.sub.org>

We're about to miss the soft freeze.  Not your fault; I've been awfully
slow reviewing this.

The series is quite big.  If we can't get it merged, we'll have to
rebase and update it.  Not good.

Here's a possible way forward:

1. We tweak this series to retain the existing @type values.

   As is, the series changes @type to the QAPI type where applicable.
   This is an improvement, and *probably* safe enough, but I'm reluctant
   to accept the risk this late in the development cycle.

   I can do the tweaking.  It'll be mildly icky, but should go away
   fairly soon.

2. We mark @qapi-type unstable for now.

3. Try hard to get it merged in time for 11.2.

We can then improve on top at our leisure:

* If we convince ourselves that changing @type values is worthwhile and
  safe enough, do so early in a development cycle.

* Hunt down the remaining properties that don't use a QAPI type.

* Explore more comprehensive improvements to QOM introspection.

* Settle on a new QOM introspection interface, deprecate the old crap.

What do you think, Marc-André?
Re: ObjectPropertyInfo design
Posted by Marc-André Lureau 3 weeks, 3 days ago
Hi

On Thu, Oct 29, 2026 at 5:45 PM Markus Armbruster <armbru@redhat.com> wrote:
>
> Markus Armbruster <armbru@redhat.com> writes:
>
> > Marc-André Lureau <marcandre.lureau@redhat.com> writes:
> >
> > [Possible improvement to the QAPI/QMP QOM introspection interface...]
> >
> >>> Thoughts?
> >>
> >> I like it overall.
> >>
> >> But this goes beyond the intended scope of the series.
> >> Blending/merging QOM type & QAPI type would warrant more design
> >> research. So covering child<> & link<> are out of scope of the current
> >> qom-qapi series. I think the addition of qapi-type shouldn't be
> >> incompatible with a future proposal, after all all properties should
> >> have some 'wire' type (link/child are paths). But we can drop it for
> >> now or just rename it x-qapi-type until we agree on the new
> >> introspection.
> >>
> >> my2c
> >
> > Adding @qapi-type with feature unstable means we don't have to worry
> > about the external interface now.  One less hurdle for merging.  I like
> > it.
> >
> > Whether changing the @type values is safe remains somewhat unclear.  See
> >
> >     Subject: Property types changed in this series (was: [PATCH v7 00/65] Hi)
> >     Date: Wed, 21 Oct 2026 18:29:40 +0200
> >     Message-ID: <87tsmfkoej.fsf@pond.sub.org>
>
> We're about to miss the soft freeze.  Not your fault; I've been awfully
> slow reviewing this.
>
> The series is quite big.  If we can't get it merged, we'll have to
> rebase and update it.  Not good.
>
> Here's a possible way forward:
>
> 1. We tweak this series to retain the existing @type values.
>
>    As is, the series changes @type to the QAPI type where applicable.
>    This is an improvement, and *probably* safe enough, but I'm reluctant
>    to accept the risk this late in the development cycle.
>
>    I can do the tweaking.  It'll be mildly icky, but should go away
>    fairly soon.

Tbh, I don't think changing @type is going to hurt, and if it
effectively does, we still have the rc period or backports as
necessary.

>
> 2. We mark @qapi-type unstable for now.

yes

>
> 3. Try hard to get it merged in time for 11.2.
>
> We can then improve on top at our leisure:
>
> * If we convince ourselves that changing @type values is worthwhile and
>   safe enough, do so early in a development cycle.
>
> * Hunt down the remaining properties that don't use a QAPI type.
>
> * Explore more comprehensive improvements to QOM introspection.
>
> * Settle on a new QOM introspection interface, deprecate the old crap.

I think we should flush the queue, because it's natural to stop
working on a "topic" when it reaches >50 pending patches. And it
prevents other people from joining the effort too. If it takes >6
months to get 50 patches accepted, the QOM-QAPI dilemna is going to
stay for a long time :)
Re: ObjectPropertyInfo design
Posted by Markus Armbruster 3 weeks ago
Marc-André Lureau <marcandre.lureau@redhat.com> writes:

> Hi
>
> On Thu, Oct 29, 2026 at 5:45 PM Markus Armbruster <armbru@redhat.com> wrote:
>>
>> Markus Armbruster <armbru@redhat.com> writes:
>>
>> > Marc-André Lureau <marcandre.lureau@redhat.com> writes:
>> >
>> > [Possible improvement to the QAPI/QMP QOM introspection interface...]
>> >
>> >>> Thoughts?
>> >>
>> >> I like it overall.
>> >>
>> >> But this goes beyond the intended scope of the series.
>> >> Blending/merging QOM type & QAPI type would warrant more design
>> >> research. So covering child<> & link<> are out of scope of the current
>> >> qom-qapi series. I think the addition of qapi-type shouldn't be
>> >> incompatible with a future proposal, after all all properties should
>> >> have some 'wire' type (link/child are paths). But we can drop it for
>> >> now or just rename it x-qapi-type until we agree on the new
>> >> introspection.
>> >>
>> >> my2c
>> >
>> > Adding @qapi-type with feature unstable means we don't have to worry
>> > about the external interface now.  One less hurdle for merging.  I like
>> > it.
>> >
>> > Whether changing the @type values is safe remains somewhat unclear.  See
>> >
>> >     Subject: Property types changed in this series (was: [PATCH v7 00/65] Hi)
>> >     Date: Wed, 21 Oct 2026 18:29:40 +0200
>> >     Message-ID: <87tsmfkoej.fsf@pond.sub.org>
>>
>> We're about to miss the soft freeze.  Not your fault; I've been awfully
>> slow reviewing this.
>>
>> The series is quite big.  If we can't get it merged, we'll have to
>> rebase and update it.  Not good.
>>
>> Here's a possible way forward:
>>
>> 1. We tweak this series to retain the existing @type values.
>>
>>    As is, the series changes @type to the QAPI type where applicable.
>>    This is an improvement, and *probably* safe enough, but I'm reluctant
>>    to accept the risk this late in the development cycle.
>>
>>    I can do the tweaking.  It'll be mildly icky, but should go away
>>    fairly soon.
>
> Tbh, I don't think changing @type is going to hurt, and if it
> effectively does, we still have the rc period or backports as
> necessary.

I don't think the changed values are enough of an improvement to be
worth the risk and the churn.

Retaining the existing values turned out to be much less icky than I
thought.

>> 2. We mark @qapi-type unstable for now.
>
> yes

Done.

>> 3. Try hard to get it merged in time for 11.2.
>>
>> We can then improve on top at our leisure:
>>
>> * If we convince ourselves that changing @type values is worthwhile and
>>   safe enough, do so early in a development cycle.
>>
>> * Hunt down the remaining properties that don't use a QAPI type.
>>
>> * Explore more comprehensive improvements to QOM introspection.
>>
>> * Settle on a new QOM introspection interface, deprecate the old crap.
>
> I think we should flush the queue, because it's natural to stop
> working on a "topic" when it reaches >50 pending patches. And it
> prevents other people from joining the effort too. If it takes >6
> months to get 50 patches accepted, the QOM-QAPI dilemna is going to
> stay for a long time :)

Oh yes, we should flush the queue.

This series took me waaaay too long.  Series as big as this one take big
chunks of uninterrupted time to process, and these are hard for me to
come by.  I should've gone "I do this series now whatever it takes, and
screw everything else" much earlier.

My sincere apologies.