[PATCH v2 00/12] hw/acpi: convert object props to class props

Mark Cave-Ayland posted 12 patches 3 weeks, 1 day ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20260703135512.3213964-1-mark.caveayland@nutanix.com
Maintainers: "Michael S. Tsirkin" <mst@redhat.com>, Igor Mammedov <imammedo@redhat.com>, Ani Sinha <anisinha@redhat.com>, "Philippe Mathieu-Daudé" <philmd@mailo.com>, Aurelien Jarno <aurelien@aurel32.net>, Peter Maydell <peter.maydell@linaro.org>, Paolo Bonzini <pbonzini@redhat.com>, Richard Henderson <richard.henderson@linaro.org>, Palmer Dabbelt <palmer@dabbelt.com>, Alistair Francis <alistair.francis@wdc.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.zevorn@gmail.com>, "Daniel P. Berrangé" <berrange@redhat.com>
include/hw/acpi/ich9.h         |   4 +-
include/hw/pci/pci_bus.h       |   2 +
include/qom/object.h           |  20 ++++
hw/acpi/generic_event_device.c |  10 ++
hw/acpi/ich9.c                 |  79 ++++++++-----
hw/acpi/pci-bridge.c           |   9 +-
hw/acpi/pcihp.c                |  37 +++----
hw/acpi/piix4.c                |  51 ++++++---
hw/arm/virt-acpi-build.c       |   7 +-
hw/i386/acpi-build.c           |   7 +-
hw/isa/lpc_ich9.c              |  71 +++++++++---
hw/pci/pci.c                   |  32 ++++++
hw/riscv/spike.c               |   5 +-
qom/object.c                   | 196 ++++++++++++++++++++++++++++++++-
14 files changed, 440 insertions(+), 90 deletions(-)
[PATCH v2 00/12] hw/acpi: convert object props to class props
Posted by Mark Cave-Ayland 3 weeks, 1 day ago
[Background: based upon Peter's feedback at
 https://lists.gnu.org/archive/html/qemu-devel/2026-06/msg07717.html I realised
 that what we really need are object_class_property_add_*_ptr() equivalents to
 the existing object_property_add_*_ptr() functions to make it easier to
 convert existing properties.

 There are actually existing functions with these names that are already in use
 but after observation these are really static properties, so these are renamed
 to aid porting object props to class props, as well as making the difference
 clearer.]

Since the use of object props is effectively deprecated, here is an attempt
to convert all use of object props in hw/acpi to class props. The eventual
aim is to continue working through the codebase, removing all remaining uses
of object props.

The series is lightly tested: it passes "make check", GitLab CI and some
simple local tests. I'm mostly interested for feedback on the conversion
strategy, and to get a feel for the best way to merge this series since once
the basic conversion patterns are in place, the same patterns can be applied
elsewhere and it would be good to minimise the merge window for such changes.

Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>

v2:
- Add object_class_property_add_*_ptr() functions matching the existing
  object_property_add_*_ptr() functions for class functions

- Rework patch to use new functions instead of manually adding get/set
  functions as part of the conversion

- Ignore existing R-Bs since this approach is quite different to v1

- Rebase onto master


Mark Cave-Ayland (12):
  qom/object.c: rename object_class_property_uint*_ptr() to
    object_class_static_property_uint*_ptr()
  qom/object.c: add object_class_property_add_uint8_ptr()
  qom/object.c: add object_class_property_add_uint16_ptr()
  qom/object.c: add object_class_property_add_uint32_ptr()
  qom/object.c: add object_class_property_add_uint64_ptr()
  hw/acpi/ich9.c: move initial property values into
    ich9_reset_properties()
  hw/isa/lpc_ich9.c: convert ich9_lpc_initfn() object props to class
    props
  hw/acpi/ich9.c: don't pass ICH9LPCPMRegs via opaque for
    ACPI_PM_PROP_GPE0_BLK prop
  hw/acpi/ich9.c: convert object props in ICH9_LPC_DEVICE to class props
  hw/acpi/pcihp.c: convert ACPI_PCIHP_IO_BASE_PROP and
    ACPI_PCIHP_IO_BASE_PROP to class props
  hw/acpi/pcihp.c: convert ACPI_PCIHP_PROP_BSEL from object prop to
    class prop
  hw/acpi/piix4.c: convert object props in PIIX4_PM to class props

 include/hw/acpi/ich9.h         |   4 +-
 include/hw/pci/pci_bus.h       |   2 +
 include/qom/object.h           |  20 ++++
 hw/acpi/generic_event_device.c |  10 ++
 hw/acpi/ich9.c                 |  79 ++++++++-----
 hw/acpi/pci-bridge.c           |   9 +-
 hw/acpi/pcihp.c                |  37 +++----
 hw/acpi/piix4.c                |  51 ++++++---
 hw/arm/virt-acpi-build.c       |   7 +-
 hw/i386/acpi-build.c           |   7 +-
 hw/isa/lpc_ich9.c              |  71 +++++++++---
 hw/pci/pci.c                   |  32 ++++++
 hw/riscv/spike.c               |   5 +-
 qom/object.c                   | 196 ++++++++++++++++++++++++++++++++-
 14 files changed, 440 insertions(+), 90 deletions(-)

-- 
2.43.0