@samitouri / QOSamiQemu / commits / e1eb4f6779

hw/acpi/pcihp.c: convert ACPI_PCIHP_IO_BASE_PROP and ACPI_PCIHP_IO_BASE_PROP to class props

Since the objects referenced by acpi_pcihp_init() do not inherit from a common class, add ACPI_PCIHP_IO_BASE_PROP and ACPI_PCIHP_IO_BASE_PROP class properties to each referenced object and remove the object properties manually added in acpi_pcihp_init(). Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com> Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20260825134320.1039012-14-mark.caveayland@nutanix.com>

Mark Cave-Ayland committed Aug 25, 2026 at 14:41 UTC e1eb4f67797c71d412d37e822fb543a8beb799af
4 files changed +25 -5
hw/acpi/generic_event_device.c
+10
@@ -11,6 +11,7 @@
11
12 #include "qemu/osdep.h"
13 #include "qapi/error.h"
14 +#include "qapi/visitor.h"
15 #include "hw/acpi/acpi.h"
16 #include "hw/acpi/pcihp.h"
17 #include "hw/acpi/cpu.h"
@@ -608,6 +609,15 @@ static void acpi_ged_class_init(ObjectClass *class, const void *data)
609
610 adevc->ospm_status = acpi_ged_ospm_status;
611 adevc->send_event = acpi_ged_send_event;
612 +
613 + object_class_property_add_uint16_ptr(class, ACPI_PCIHP_IO_BASE_PROP,
614 + offsetof(AcpiGedState,
615 + pcihp_state.io_base),
616 + OBJ_PROP_FLAG_READ);
617 + object_class_property_add_uint16_ptr(class, ACPI_PCIHP_IO_LEN_PROP,
618 + offsetof(AcpiGedState,
619 + pcihp_state.io_len),
620 + OBJ_PROP_FLAG_READ);
621 }
622
623 static const TypeInfo acpi_ged_info = {
hw/acpi/ich9.c
+6
@@ -400,6 +400,12 @@ void ich9_pm_add_class_properties(ObjectClass *oc, ptrdiff_t pm_offset)
400 object_class_property_add_bool_ptr(oc, "x-keep-pci-slot-hpc",
401 PM_REG_FIELD(keep_pci_slot_hpc),
402 OBJ_PROP_FLAG_READWRITE);
403 + object_class_property_add_uint16_ptr(oc, ACPI_PCIHP_IO_BASE_PROP,
404 + PM_REG_FIELD(acpi_pci_hotplug.io_base),
405 + OBJ_PROP_FLAG_READ);
406 + object_class_property_add_uint16_ptr(oc, ACPI_PCIHP_IO_LEN_PROP,
407 + PM_REG_FIELD(acpi_pci_hotplug.io_len),
408 + OBJ_PROP_FLAG_READ);
409 }
410
411 #undef PM_REG_FIELD
hw/acpi/pcihp.c
-5
@@ -502,11 +502,6 @@ void acpi_pcihp_init(Object *owner, AcpiPciHpState *s,
502 memory_region_init_io(&s->io, owner, &acpi_pcihp_io_ops, s,
503 "acpi-pci-hotplug", s->io_len);
504 memory_region_add_subregion(io, s->io_base, &s->io);
505 -
506 - object_property_add_uint16_ptr(owner, ACPI_PCIHP_IO_BASE_PROP, &s->io_base,
507 - OBJ_PROP_FLAG_READ);
508 - object_property_add_uint16_ptr(owner, ACPI_PCIHP_IO_LEN_PROP, &s->io_len,
509 - OBJ_PROP_FLAG_READ);
505 }
506
507 void build_append_pci_dsm_func0_common(Aml *ctx, Aml *retvar)
hw/acpi/piix4.c
+9
@@ -607,6 +607,15 @@ static void piix4_pm_class_init(ObjectClass *klass, const void *data)
607 hc->is_hotpluggable_bus = piix4_is_hotpluggable_bus;
608 adevc->ospm_status = piix4_ospm_status;
609 adevc->send_event = piix4_send_gpe;
610 +
611 + object_class_property_add_uint16_ptr(klass, ACPI_PCIHP_IO_BASE_PROP,
612 + offsetof(PIIX4PMState,
613 + acpi_pci_hotplug.io_base),
614 + OBJ_PROP_FLAG_READ);
615 + object_class_property_add_uint16_ptr(klass, ACPI_PCIHP_IO_LEN_PROP,
616 + offsetof(PIIX4PMState,
617 + acpi_pci_hotplug.io_len),
618 + OBJ_PROP_FLAG_READ);
619 }
620
621 static const TypeInfo piix4_pm_info = {