qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v2 00/44] Make qdev static property API usable by any QOM type


From: Eduardo Habkost
Subject: [PATCH v2 00/44] Make qdev static property API usable by any QOM type
Date: Wed, 4 Nov 2020 10:59:37 -0500

This series refactor the qdev property code so the static
property system can be used by any QOM type.  As an example, at
the end of the series some properties in TYPE_MACHINE are
converted to static properties to demonstrate the new API.

Changes v1 -> v2
----------------

* Rename functions and source files to call the new feature
  "field property" instead of "static property"

* Change the API signature from an array-based interface similar
  to device_class_set_props() to a object_property_add()-like
  interface.

  This means instead of doing this:

    object_class_property_add_static_props(oc, my_array_of_props);

  properties are registered like this:

    object_class_property_add_field(oc, "property-name"
                                    PROP_XXX(MyState, my_field),
                                    prop_allow_set_always);

  where PROP_XXX is a PROP_* macro like PROP_STRING, PROP_BOOL,
  etc.

* Make Property.name optional.  Rename it to qdev_prop_name,
  and restrict its usage to qdev property tracking code.

* Make allow_set callback mandatory, to avoid ambiguity

* Big cleanup of array property code.  We don't need a custom
  release function for array elements anymore, because we don't
  need to save the property name in the Property struct anymore.

* Moved UUID property to qdev-properties-system, because
  it still has dependencies on qdev code

Eduardo Habkost (44):
  cs4231: Get rid of empty property array
  cpu: Move cpu_common_props to hw/core/cpu.c
  qdev: Move property code to qdev-properties.[ch]
  qdev: Check dev->realized at set_size()
  sparc: Check dev->realized at sparc_set_nwindows()
  qdev: Don't use dev->id on set_size32() error message
  qdev: Make PropertyInfo.print method get Object* argument
  qdev: Make bit_prop_set() get Object* argument
  qdev: Make qdev_get_prop_ptr() get Object* arg
  qdev: Make qdev_find_global_prop() get Object* argument
  qdev: Make check_prop_still_unset() get Object* argument
  qdev: Make error_set_from_qdev_prop_error() get Object* argument
  qdev: Move UUID property to qdev-properties-system.c
  qdev: Move softmmu properties to qdev-properties-system.h
  qdev: Reuse DEFINE_PROP in all DEFINE_PROP_* macros
  sparc: Use DEFINE_PROP for nwindows property
  qdev: Get just property name at error_set_from_qdev_prop_error()
  qdev: Avoid using prop->name unnecessarily
  qdev: Add name parameter to qdev_class_add_property()
  qdev: Add name argument to PropertyInfo.create method
  qdev: Wrap getters and setters in separate helpers
  qdev: Move dev->realized check to qdev_property_set()
  qdev: Make PropertyInfo.create return ObjectProperty*
  qdev: Make qdev_class_add_property() more flexible
  qdev: Separate generic and device-specific property registration
  qdev: Rename Property.name to Property.qdev_prop_name
  qdev: Don't set qdev_prop_name for array elements
  qdev: Avoid unnecessary DeviceState* variable at set_prop_arraylen()
  qdev: Remove ArrayElementProperty.propname field
  qdev: Get rid of ArrayElementProperty struct
  qdev: Reuse object_property_add_field() when adding array elements
  qom: Add allow_set callback to ObjectProperty
  qdev: Make qdev_prop_allow_set() a ObjectProperty.allow_set callback
  qdev: Make qdev_propinfo_get_uint16() static
  qdev: Rename qdev_propinfo_* to field_prop_*
  qdev: Rename qdev_get_prop_ptr() to object_field_prop_ptr()
  qdev: Move qdev_prop_tpm declaration to tpm_prop.h
  qdev: Rename qdev_prop_* to prop_info_*
  qdev: PROP_* macros
  qdev: Move core field property code to QOM
  qdev: Move base property types to qom/property-types.c
  qom: Include static property API reference in documentation
  tests: Use field properties at check-qom-proplist test case
  machine: Register most properties as field properties

 docs/devel/qom.rst                    |  17 +-
 audio/audio.h                         |   1 +
 hw/core/qdev-prop-internal.h          |  30 -
 hw/tpm/tpm_prop.h                     |   2 +
 include/hw/block/block.h              |   1 +
 include/hw/core/cpu.h                 |   1 -
 include/hw/qdev-core.h                |  37 --
 include/hw/qdev-properties-system.h   |  77 +++
 include/hw/qdev-properties.h          | 244 +-------
 include/net/net.h                     |   1 +
 include/qom/field-property-internal.h |  43 ++
 include/qom/field-property.h          | 112 ++++
 include/qom/object.h                  |  38 ++
 include/qom/property-types.h          | 292 ++++++++++
 backends/tpm/tpm_util.c               |  16 +-
 cpu.c                                 |  15 -
 hw/acpi/vmgenid.c                     |   1 +
 hw/arm/pxa2xx.c                       |   1 +
 hw/arm/strongarm.c                    |   1 +
 hw/audio/cs4231.c                     |   5 -
 hw/block/fdc.c                        |   1 +
 hw/block/m25p80.c                     |   1 +
 hw/block/nand.c                       |   1 +
 hw/block/onenand.c                    |   1 +
 hw/block/pflash_cfi01.c               |   1 +
 hw/block/pflash_cfi02.c               |   1 +
 hw/block/vhost-user-blk.c             |   1 +
 hw/block/xen-block.c                  |  11 +-
 hw/char/avr_usart.c                   |   1 +
 hw/char/bcm2835_aux.c                 |   1 +
 hw/char/cadence_uart.c                |   1 +
 hw/char/cmsdk-apb-uart.c              |   1 +
 hw/char/debugcon.c                    |   1 +
 hw/char/digic-uart.c                  |   1 +
 hw/char/escc.c                        |   1 +
 hw/char/etraxfs_ser.c                 |   1 +
 hw/char/exynos4210_uart.c             |   1 +
 hw/char/grlib_apbuart.c               |   1 +
 hw/char/ibex_uart.c                   |   1 +
 hw/char/imx_serial.c                  |   1 +
 hw/char/ipoctal232.c                  |   1 +
 hw/char/lm32_juart.c                  |   1 +
 hw/char/lm32_uart.c                   |   1 +
 hw/char/mcf_uart.c                    |   1 +
 hw/char/milkymist-uart.c              |   1 +
 hw/char/nrf51_uart.c                  |   1 +
 hw/char/parallel.c                    |   1 +
 hw/char/pl011.c                       |   1 +
 hw/char/renesas_sci.c                 |   1 +
 hw/char/sclpconsole-lm.c              |   1 +
 hw/char/sclpconsole.c                 |   1 +
 hw/char/serial-pci-multi.c            |   1 +
 hw/char/serial.c                      |   1 +
 hw/char/spapr_vty.c                   |   1 +
 hw/char/stm32f2xx_usart.c             |   1 +
 hw/char/terminal3270.c                |   1 +
 hw/char/virtio-console.c              |   1 +
 hw/char/xilinx_uartlite.c             |   1 +
 hw/core/cpu.c                         |  15 +
 hw/core/machine.c                     | 256 ++------
 hw/core/qdev-properties-system.c      | 258 ++++-----
 hw/core/qdev-properties.c             | 806 +++-----------------------
 hw/core/qdev.c                        | 120 ----
 hw/hyperv/vmbus.c                     |   1 +
 hw/i386/kvm/i8254.c                   |   1 +
 hw/ide/qdev.c                         |   1 +
 hw/intc/arm_gicv3_common.c            |   2 +-
 hw/intc/rx_icu.c                      |   4 +-
 hw/ipmi/ipmi_bmc_extern.c             |   1 +
 hw/ipmi/ipmi_bmc_sim.c                |   1 +
 hw/misc/allwinner-sid.c               |   1 +
 hw/misc/arm_sysctl.c                  |   4 +-
 hw/misc/ivshmem.c                     |   1 +
 hw/misc/mac_via.c                     |   1 +
 hw/misc/sifive_u_otp.c                |   1 +
 hw/net/e1000e.c                       |   6 +-
 hw/net/rocker/rocker.c                |   1 +
 hw/nvram/eeprom_at24c.c               |   1 +
 hw/nvram/spapr_nvram.c                |   1 +
 hw/pci-bridge/gen_pcie_root_port.c    |   1 +
 hw/pci/pci.c                          |   1 +
 hw/ppc/pnv_pnor.c                     |   1 +
 hw/rdma/vmw/pvrdma_main.c             |   1 +
 hw/rtc/mc146818rtc.c                  |   1 +
 hw/s390x/css.c                        |  13 +-
 hw/s390x/s390-pci-bus.c               |  10 +-
 hw/scsi/scsi-disk.c                   |   1 +
 hw/scsi/scsi-generic.c                |   1 +
 hw/scsi/vhost-user-scsi.c             |   1 +
 hw/sd/sd.c                            |   1 +
 hw/usb/ccid-card-passthru.c           |   1 +
 hw/usb/dev-serial.c                   |   1 +
 hw/usb/redirect.c                     |   1 +
 hw/vfio/pci-quirks.c                  |  11 +-
 hw/vfio/pci.c                         |   1 +
 hw/virtio/vhost-user-fs.c             |   1 +
 hw/virtio/vhost-user-vsock.c          |   1 +
 hw/virtio/virtio-iommu-pci.c          |   1 +
 hw/xen/xen_pt.c                       |   1 +
 migration/migration.c                 |   1 +
 qom/field-property.c                  | 108 ++++
 qom/object.c                          |  16 +
 qom/property-types.c                  | 545 +++++++++++++++++
 softmmu/qdev-monitor.c                |   9 +-
 target/arm/cpu.c                      |   2 +-
 target/sparc/cpu.c                    |   5 +-
 tests/check-qom-proplist.c            |  64 +-
 qom/meson.build                       |   2 +
 108 files changed, 1630 insertions(+), 1639 deletions(-)
 delete mode 100644 hw/core/qdev-prop-internal.h
 create mode 100644 include/hw/qdev-properties-system.h
 create mode 100644 include/qom/field-property-internal.h
 create mode 100644 include/qom/field-property.h
 create mode 100644 include/qom/property-types.h
 create mode 100644 qom/field-property.c
 create mode 100644 qom/property-types.c

-- 
2.28.0





reply via email to

[Prev in Thread] Current Thread [Next in Thread]