* [PATCH 0/7] hw/acpi: convert object props to class props
@ 2026-06-22 11:22 Mark Cave-Ayland
2026-06-22 11:22 ` [PATCH 1/7] hw/acpi/ich9.c: move initial property values into ich9_reset_properties() Mark Cave-Ayland
` (6 more replies)
0 siblings, 7 replies; 15+ messages in thread
From: Mark Cave-Ayland @ 2026-06-22 11:22 UTC (permalink / raw)
To: mst, imammedo, anisinha, philmd, aurelien, peter.maydell,
pbonzini, richard.henderson, qemu-devel, qemu-arm
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>
Mark Cave-Ayland (7):
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 +
hw/acpi/generic_event_device.c | 30 ++++++
hw/acpi/ich9.c | 192 ++++++++++++++++++++++++++++-----
hw/acpi/pci-bridge.c | 9 +-
hw/acpi/pcihp.c | 37 +++----
hw/acpi/piix4.c | 72 ++++++++++---
hw/arm/virt-acpi-build.c | 7 +-
hw/i386/acpi-build.c | 7 +-
hw/isa/lpc_ich9.c | 68 +++++++++---
hw/pci/pci.c | 32 ++++++
11 files changed, 376 insertions(+), 84 deletions(-)
--
2.43.0
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 1/7] hw/acpi/ich9.c: move initial property values into ich9_reset_properties()
2026-06-22 11:22 [PATCH 0/7] hw/acpi: convert object props to class props Mark Cave-Ayland
@ 2026-06-22 11:22 ` Mark Cave-Ayland
2026-06-25 13:55 ` Daniel P. Berrangé
2026-06-22 11:22 ` [PATCH 2/7] hw/isa/lpc_ich9.c: convert ich9_lpc_initfn() object props to class props Mark Cave-Ayland
` (5 subsequent siblings)
6 siblings, 1 reply; 15+ messages in thread
From: Mark Cave-Ayland @ 2026-06-22 11:22 UTC (permalink / raw)
To: mst, imammedo, anisinha, philmd, aurelien, peter.maydell,
pbonzini, richard.henderson, qemu-devel, qemu-arm
Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
---
include/hw/acpi/ich9.h | 2 ++
hw/acpi/ich9.c | 8 ++++++--
hw/isa/lpc_ich9.c | 1 +
3 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/include/hw/acpi/ich9.h b/include/hw/acpi/ich9.h
index 019f0915c1..30990fcef5 100644
--- a/include/hw/acpi/ich9.h
+++ b/include/hw/acpi/ich9.h
@@ -81,6 +81,8 @@ void ich9_pm_init(PCIDevice *lpc_pci, ICH9LPCPMRegs *pm, qemu_irq sci_irq);
void ich9_pm_iospace_update(ICH9LPCPMRegs *pm, uint32_t pm_io_base);
extern const VMStateDescription vmstate_ich9_pm;
+void ich9_pm_reset_properties(ICH9LPCPMRegs *pm);
+
void ich9_pm_add_properties(Object *obj, ICH9LPCPMRegs *pm);
void ich9_pm_device_pre_plug_cb(HotplugHandler *hotplug_dev, DeviceState *dev,
diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c
index 5c7dfb2c69..5e8f8a7eaf 100644
--- a/hw/acpi/ich9.c
+++ b/hw/acpi/ich9.c
@@ -388,9 +388,8 @@ static void ich9_pm_set_keep_pci_slot_hpc(Object *obj, bool value, Error **errp)
s->pm.keep_pci_slot_hpc = value;
}
-void ich9_pm_add_properties(Object *obj, ICH9LPCPMRegs *pm)
+void ich9_pm_reset_properties(ICH9LPCPMRegs *pm)
{
- static const uint32_t gpe0_len = ICH9_PMIO_GPE0_LEN;
pm->acpi_memory_hotplug.is_enabled = true;
pm->disable_s3 = 0;
pm->disable_s4 = 0;
@@ -398,6 +397,11 @@ void ich9_pm_add_properties(Object *obj, ICH9LPCPMRegs *pm)
pm->acpi_pci_hotplug.use_acpi_hotplug_bridge = true;
pm->keep_pci_slot_hpc = true;
pm->enable_tco = true;
+}
+
+void ich9_pm_add_properties(Object *obj, ICH9LPCPMRegs *pm)
+{
+ static const uint32_t gpe0_len = ICH9_PMIO_GPE0_LEN;
object_property_add_uint32_ptr(obj, ACPI_PM_PROP_PM_IO_BASE,
&pm->pm_io_base, OBJ_PROP_FLAG_READ);
diff --git a/hw/isa/lpc_ich9.c b/hw/isa/lpc_ich9.c
index 9cec18a378..edf9783ec8 100644
--- a/hw/isa/lpc_ich9.c
+++ b/hw/isa/lpc_ich9.c
@@ -701,6 +701,7 @@ static void ich9_lpc_initfn(Object *obj)
&lpc->smi_negotiated_features,
OBJ_PROP_FLAG_READ);
+ ich9_pm_reset_properties(&lpc->pm);
ich9_pm_add_properties(obj, &lpc->pm);
}
--
2.43.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 2/7] hw/isa/lpc_ich9.c: convert ich9_lpc_initfn() object props to class props
2026-06-22 11:22 [PATCH 0/7] hw/acpi: convert object props to class props Mark Cave-Ayland
2026-06-22 11:22 ` [PATCH 1/7] hw/acpi/ich9.c: move initial property values into ich9_reset_properties() Mark Cave-Ayland
@ 2026-06-22 11:22 ` Mark Cave-Ayland
2026-06-25 13:56 ` Daniel P. Berrangé
2026-06-22 11:22 ` [PATCH 3/7] hw/acpi/ich9.c: don't pass ICH9LPCPMRegs via opaque for ACPI_PM_PROP_GPE0_BLK prop Mark Cave-Ayland
` (4 subsequent siblings)
6 siblings, 1 reply; 15+ messages in thread
From: Mark Cave-Ayland @ 2026-06-22 11:22 UTC (permalink / raw)
To: mst, imammedo, anisinha, philmd, aurelien, peter.maydell,
pbonzini, richard.henderson, qemu-devel, qemu-arm
Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
---
hw/isa/lpc_ich9.c | 64 +++++++++++++++++++++++++++++++++++++----------
1 file changed, 51 insertions(+), 13 deletions(-)
diff --git a/hw/isa/lpc_ich9.c b/hw/isa/lpc_ich9.c
index edf9783ec8..c6d31a3957 100644
--- a/hw/isa/lpc_ich9.c
+++ b/hw/isa/lpc_ich9.c
@@ -683,24 +683,11 @@ static void ich9_lpc_initfn(Object *obj)
{
ICH9LPCState *lpc = ICH9_LPC_DEVICE(obj);
- static const uint8_t acpi_enable_cmd = ICH9_APM_ACPI_ENABLE;
- static const uint8_t acpi_disable_cmd = ICH9_APM_ACPI_DISABLE;
-
object_initialize_child(obj, "rtc", &lpc->rtc, TYPE_MC146818_RTC);
qdev_init_gpio_out_named(DEVICE(lpc), lpc->gsi, ICH9_GPIO_GSI,
IOAPIC_NUM_PINS);
- object_property_add_uint8_ptr(obj, ACPI_PM_PROP_SCI_INT,
- &lpc->sci_gsi, OBJ_PROP_FLAG_READ);
- object_property_add_uint8_ptr(OBJECT(lpc), ACPI_PM_PROP_ACPI_ENABLE_CMD,
- &acpi_enable_cmd, OBJ_PROP_FLAG_READ);
- object_property_add_uint8_ptr(OBJECT(lpc), ACPI_PM_PROP_ACPI_DISABLE_CMD,
- &acpi_disable_cmd, OBJ_PROP_FLAG_READ);
- object_property_add_uint64_ptr(obj, ICH9_LPC_SMI_NEGOTIATED_FEAT_PROP,
- &lpc->smi_negotiated_features,
- OBJ_PROP_FLAG_READ);
-
ich9_pm_reset_properties(&lpc->pm);
ich9_pm_add_properties(obj, &lpc->pm);
}
@@ -880,6 +867,40 @@ static void build_ich9_isa_aml(AcpiDevAmlIf *adev, Aml *scope)
qbus_build_aml(bus, scope);
}
+static void ich9_lpc_get_sci_int(Object *obj, Visitor *v,
+ const char *name, void *opaque,
+ Error **errp)
+{
+ ICH9LPCState *lpc = ICH9_LPC_DEVICE(obj);
+ uint8_t sci_gsi = lpc->sci_gsi;
+
+ visit_type_uint8(v, name, &sci_gsi, errp);
+}
+
+static void ich9_lpc_get_smi_negotiated_feat(Object *obj, Visitor *v,
+ const char *name, void *opaque,
+ Error **errp)
+{
+ ICH9LPCState *lpc = ICH9_LPC_DEVICE(obj);
+ uint64_t smi_negotiated_features = lpc->smi_negotiated_features;
+
+ visit_type_uint64(v, name, &smi_negotiated_features, errp);
+}
+
+static void ich9_lpc_set_smi_negotiated_feat(Object *obj, Visitor *v,
+ const char *name, void *opaque,
+ Error **errp)
+{
+ ICH9LPCState *lpc = ICH9_LPC_DEVICE(obj);
+ uint64_t smi_negotiated_features = lpc->smi_negotiated_features;
+
+ if (!visit_type_uint64(v, name, &smi_negotiated_features, errp)) {
+ return;
+ }
+
+ lpc->smi_negotiated_features = smi_negotiated_features;
+}
+
static void ich9_lpc_class_init(ObjectClass *klass, const void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
@@ -888,6 +909,9 @@ static void ich9_lpc_class_init(ObjectClass *klass, const void *data)
AcpiDeviceIfClass *adevc = ACPI_DEVICE_IF_CLASS(klass);
AcpiDevAmlIfClass *amldevc = ACPI_DEV_AML_IF_CLASS(klass);
+ static const uint8_t acpi_enable_cmd = ICH9_APM_ACPI_ENABLE;
+ static const uint8_t acpi_disable_cmd = ICH9_APM_ACPI_DISABLE;
+
set_bit(DEVICE_CATEGORY_BRIDGE, dc->categories);
device_class_set_legacy_reset(dc, ich9_lpc_reset);
k->realize = ich9_lpc_realize;
@@ -912,6 +936,20 @@ static void ich9_lpc_class_init(ObjectClass *klass, const void *data)
adevc->ospm_status = ich9_pm_ospm_status;
adevc->send_event = ich9_send_gpe;
amldevc->build_dev_aml = build_ich9_isa_aml;
+
+ object_class_property_add(klass, ACPI_PM_PROP_SCI_INT, "uint8",
+ ich9_lpc_get_sci_int,
+ NULL,
+ NULL, NULL);
+ object_class_property_add_uint8_ptr(klass, ACPI_PM_PROP_ACPI_ENABLE_CMD,
+ &acpi_enable_cmd, OBJ_PROP_FLAG_READ);
+ object_class_property_add_uint8_ptr(klass, ACPI_PM_PROP_ACPI_DISABLE_CMD,
+ &acpi_disable_cmd, OBJ_PROP_FLAG_READ);
+ object_class_property_add(klass, ICH9_LPC_SMI_NEGOTIATED_FEAT_PROP,
+ "uint64",
+ ich9_lpc_get_smi_negotiated_feat,
+ ich9_lpc_set_smi_negotiated_feat,
+ NULL, NULL);
}
static const TypeInfo ich9_lpc_info = {
--
2.43.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 3/7] hw/acpi/ich9.c: don't pass ICH9LPCPMRegs via opaque for ACPI_PM_PROP_GPE0_BLK prop
2026-06-22 11:22 [PATCH 0/7] hw/acpi: convert object props to class props Mark Cave-Ayland
2026-06-22 11:22 ` [PATCH 1/7] hw/acpi/ich9.c: move initial property values into ich9_reset_properties() Mark Cave-Ayland
2026-06-22 11:22 ` [PATCH 2/7] hw/isa/lpc_ich9.c: convert ich9_lpc_initfn() object props to class props Mark Cave-Ayland
@ 2026-06-22 11:22 ` Mark Cave-Ayland
2026-06-25 13:57 ` Daniel P. Berrangé
2026-06-22 11:22 ` [PATCH 4/7] hw/acpi/ich9.c: convert object props in ICH9_LPC_DEVICE to class props Mark Cave-Ayland
` (3 subsequent siblings)
6 siblings, 1 reply; 15+ messages in thread
From: Mark Cave-Ayland @ 2026-06-22 11:22 UTC (permalink / raw)
To: mst, imammedo, anisinha, philmd, aurelien, peter.maydell,
pbonzini, richard.henderson, qemu-devel, qemu-arm
In order to convert to a class property, the ICH9LPCPMRegs instance must be
resolved by the getter/setter instead of being passed directly as an opaque.
Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
---
hw/acpi/ich9.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c
index 5e8f8a7eaf..ac3f452dc3 100644
--- a/hw/acpi/ich9.c
+++ b/hw/acpi/ich9.c
@@ -342,7 +342,8 @@ void ich9_pm_init(PCIDevice *lpc_pci, ICH9LPCPMRegs *pm, qemu_irq sci_irq)
static void ich9_pm_get_gpe0_blk(Object *obj, Visitor *v, const char *name,
void *opaque, Error **errp)
{
- ICH9LPCPMRegs *pm = opaque;
+ ICH9LPCState *s = ICH9_LPC_DEVICE(obj);
+ ICH9LPCPMRegs *pm = &s->pm;
uint32_t value = pm->pm_io_base + ICH9_PMIO_GPE0_STS;
visit_type_uint32(v, name, &value, errp);
@@ -411,7 +412,7 @@ void ich9_pm_add_properties(Object *obj, ICH9LPCPMRegs *pm)
OBJ_PROP_LINK_STRONG);
object_property_add(obj, ACPI_PM_PROP_GPE0_BLK, "uint32",
ich9_pm_get_gpe0_blk,
- NULL, NULL, pm);
+ NULL, NULL, NULL);
object_property_add_uint32_ptr(obj, ACPI_PM_PROP_GPE0_BLK_LEN,
&gpe0_len, OBJ_PROP_FLAG_READ);
object_property_add_uint8_ptr(obj, ACPI_PM_PROP_S3_DISABLED,
--
2.43.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 4/7] hw/acpi/ich9.c: convert object props in ICH9_LPC_DEVICE to class props
2026-06-22 11:22 [PATCH 0/7] hw/acpi: convert object props to class props Mark Cave-Ayland
` (2 preceding siblings ...)
2026-06-22 11:22 ` [PATCH 3/7] hw/acpi/ich9.c: don't pass ICH9LPCPMRegs via opaque for ACPI_PM_PROP_GPE0_BLK prop Mark Cave-Ayland
@ 2026-06-22 11:22 ` Mark Cave-Ayland
2026-06-25 13:58 ` Daniel P. Berrangé
2026-06-22 11:22 ` [PATCH 5/7] hw/acpi/pcihp.c: convert ACPI_PCIHP_IO_BASE_PROP and ACPI_PCIHP_IO_BASE_PROP " Mark Cave-Ayland
` (2 subsequent siblings)
6 siblings, 1 reply; 15+ messages in thread
From: Mark Cave-Ayland @ 2026-06-22 11:22 UTC (permalink / raw)
To: mst, imammedo, anisinha, philmd, aurelien, peter.maydell,
pbonzini, richard.henderson, qemu-devel, qemu-arm
Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
---
include/hw/acpi/ich9.h | 2 +-
hw/acpi/ich9.c | 153 +++++++++++++++++++++++++++++++++--------
hw/isa/lpc_ich9.c | 3 +-
3 files changed, 129 insertions(+), 29 deletions(-)
diff --git a/include/hw/acpi/ich9.h b/include/hw/acpi/ich9.h
index 30990fcef5..3180e98c93 100644
--- a/include/hw/acpi/ich9.h
+++ b/include/hw/acpi/ich9.h
@@ -83,7 +83,7 @@ extern const VMStateDescription vmstate_ich9_pm;
void ich9_pm_reset_properties(ICH9LPCPMRegs *pm);
-void ich9_pm_add_properties(Object *obj, ICH9LPCPMRegs *pm);
+void ich9_pm_add_class_properties(ObjectClass *oc);
void ich9_pm_device_pre_plug_cb(HotplugHandler *hotplug_dev, DeviceState *dev,
Error **errp);
diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c
index ac3f452dc3..723a87e6f3 100644
--- a/hw/acpi/ich9.c
+++ b/hw/acpi/ich9.c
@@ -339,6 +339,16 @@ void ich9_pm_init(PCIDevice *lpc_pci, ICH9LPCPMRegs *pm, qemu_irq sci_irq)
ACPI_MEMORY_HOTPLUG_BASE);
}
+static void ich9_pm_get_io_base(Object *obj, Visitor *v,
+ const char *name, void *opaque,
+ Error **errp)
+{
+ ICH9LPCState *lpc = ICH9_LPC_DEVICE(obj);
+ uint32_t pm_io_base = lpc->pm.pm_io_base;
+
+ visit_type_uint32(v, name, &pm_io_base, errp);
+}
+
static void ich9_pm_get_gpe0_blk(Object *obj, Visitor *v, const char *name,
void *opaque, Error **errp)
{
@@ -349,6 +359,84 @@ static void ich9_pm_get_gpe0_blk(Object *obj, Visitor *v, const char *name,
visit_type_uint32(v, name, &value, errp);
}
+static void ich9_pm_get_s3_disabled(Object *obj, Visitor *v,
+ const char *name, void *opaque,
+ Error **errp)
+{
+ ICH9LPCState *s = ICH9_LPC_DEVICE(obj);
+ ICH9LPCPMRegs *pm = &s->pm;
+ uint8_t s3_disabled = pm->disable_s3;
+
+ visit_type_uint8(v, name, &s3_disabled, errp);
+}
+
+static void ich9_pm_set_s3_disabled(Object *obj, Visitor *v,
+ const char *name, void *opaque,
+ Error **errp)
+{
+ ICH9LPCState *s = ICH9_LPC_DEVICE(obj);
+ ICH9LPCPMRegs *pm = &s->pm;
+ uint8_t s3_disabled = pm->disable_s3;
+
+ if (!visit_type_uint8(v, name, &s3_disabled, errp)) {
+ return;
+ }
+
+ pm->disable_s3 = s3_disabled;
+}
+
+static void ich9_pm_get_s4_disabled(Object *obj, Visitor *v,
+ const char *name, void *opaque,
+ Error **errp)
+{
+ ICH9LPCState *s = ICH9_LPC_DEVICE(obj);
+ ICH9LPCPMRegs *pm = &s->pm;
+ uint8_t s4_disabled = pm->disable_s4;
+
+ visit_type_uint8(v, name, &s4_disabled, errp);
+}
+
+static void ich9_pm_set_s4_disabled(Object *obj, Visitor *v,
+ const char *name, void *opaque,
+ Error **errp)
+{
+ ICH9LPCState *s = ICH9_LPC_DEVICE(obj);
+ ICH9LPCPMRegs *pm = &s->pm;
+ uint8_t s4_disabled = pm->disable_s4;
+
+ if (!visit_type_uint8(v, name, &s4_disabled, errp)) {
+ return;
+ }
+
+ pm->disable_s4 = s4_disabled;
+}
+
+static void ich9_pm_get_s4_val(Object *obj, Visitor *v,
+ const char *name, void *opaque,
+ Error **errp)
+{
+ ICH9LPCState *s = ICH9_LPC_DEVICE(obj);
+ ICH9LPCPMRegs *pm = &s->pm;
+ uint8_t s4_val = pm->s4_val;
+
+ visit_type_uint8(v, name, &s4_val, errp);
+}
+
+static void ich9_pm_set_s4_val(Object *obj, Visitor *v,
+ const char *name, void *opaque,
+ Error **errp)
+{
+ ICH9LPCState *s = ICH9_LPC_DEVICE(obj);
+ ICH9LPCPMRegs *pm = &s->pm;
+ uint8_t s4_val = pm->s4_val;
+
+ if (!visit_type_uint8(v, name, &s4_val, errp)) {
+ return;
+ }
+
+ pm->s4_val = s4_val;
+}
+
static bool ich9_pm_get_enable_tco(Object *obj, Error **errp)
{
ICH9LPCState *s = ICH9_LPC_DEVICE(obj);
@@ -400,36 +488,47 @@ void ich9_pm_reset_properties(ICH9LPCPMRegs *pm)
pm->enable_tco = true;
}
-void ich9_pm_add_properties(Object *obj, ICH9LPCPMRegs *pm)
+void ich9_pm_add_class_properties(ObjectClass *oc)
{
static const uint32_t gpe0_len = ICH9_PMIO_GPE0_LEN;
- object_property_add_uint32_ptr(obj, ACPI_PM_PROP_PM_IO_BASE,
- &pm->pm_io_base, OBJ_PROP_FLAG_READ);
- object_property_add_link(obj, "bus", TYPE_PCI_BUS,
- (Object **)&pm->acpi_pci_hotplug.root,
- object_property_allow_set_link,
- OBJ_PROP_LINK_STRONG);
- object_property_add(obj, ACPI_PM_PROP_GPE0_BLK, "uint32",
- ich9_pm_get_gpe0_blk,
- NULL, NULL, NULL);
- object_property_add_uint32_ptr(obj, ACPI_PM_PROP_GPE0_BLK_LEN,
- &gpe0_len, OBJ_PROP_FLAG_READ);
- object_property_add_uint8_ptr(obj, ACPI_PM_PROP_S3_DISABLED,
- &pm->disable_s3, OBJ_PROP_FLAG_READWRITE);
- object_property_add_uint8_ptr(obj, ACPI_PM_PROP_S4_DISABLED,
- &pm->disable_s4, OBJ_PROP_FLAG_READWRITE);
- object_property_add_uint8_ptr(obj, ACPI_PM_PROP_S4_VAL,
- &pm->s4_val, OBJ_PROP_FLAG_READWRITE);
- object_property_add_bool(obj, ACPI_PM_PROP_TCO_ENABLED,
- ich9_pm_get_enable_tco,
- ich9_pm_set_enable_tco);
- object_property_add_bool(obj, ACPI_PM_PROP_ACPI_PCIHP_BRIDGE,
- ich9_pm_get_acpi_pci_hotplug,
- ich9_pm_set_acpi_pci_hotplug);
- object_property_add_bool(obj, "x-keep-pci-slot-hpc",
- ich9_pm_get_keep_pci_slot_hpc,
- ich9_pm_set_keep_pci_slot_hpc);
+ object_class_property_add(oc, ACPI_PM_PROP_PM_IO_BASE, "uint32",
+ ich9_pm_get_io_base,
+ NULL,
+ NULL, NULL);
+ object_class_property_add_link(oc, "bus",
+ TYPE_PCI_BUS,
+ offsetof(ICH9LPCState,
+ pm.acpi_pci_hotplug.root),
+ object_property_allow_set_link,
+ OBJ_PROP_LINK_STRONG);
+ object_class_property_add(oc, ACPI_PM_PROP_GPE0_BLK, "uint32",
+ ich9_pm_get_gpe0_blk,
+ NULL,
+ NULL, NULL);
+ object_class_property_add_uint32_ptr(oc, ACPI_PM_PROP_GPE0_BLK_LEN,
+ &gpe0_len, OBJ_PROP_FLAG_READ);
+ object_class_property_add(oc, ACPI_PM_PROP_S3_DISABLED, "uint8",
+ ich9_pm_get_s3_disabled,
+ ich9_pm_set_s3_disabled,
+ NULL, NULL);
+ object_class_property_add(oc, ACPI_PM_PROP_S4_DISABLED, "uint8",
+ ich9_pm_get_s4_disabled,
+ ich9_pm_set_s4_disabled,
+ NULL, NULL);
+ object_class_property_add(oc, ACPI_PM_PROP_S4_VAL, "uint8",
+ ich9_pm_get_s4_val,
+ ich9_pm_set_s4_val,
+ NULL, NULL);
+ object_class_property_add_bool(oc, ACPI_PM_PROP_TCO_ENABLED,
+ ich9_pm_get_enable_tco,
+ ich9_pm_set_enable_tco);
+ object_class_property_add_bool(oc, ACPI_PM_PROP_ACPI_PCIHP_BRIDGE,
+ ich9_pm_get_acpi_pci_hotplug,
+ ich9_pm_set_acpi_pci_hotplug);
+ object_class_property_add_bool(oc, "x-keep-pci-slot-hpc",
+ ich9_pm_get_keep_pci_slot_hpc,
+ ich9_pm_set_keep_pci_slot_hpc);
}
void ich9_pm_device_pre_plug_cb(HotplugHandler *hotplug_dev, DeviceState *dev,
diff --git a/hw/isa/lpc_ich9.c b/hw/isa/lpc_ich9.c
index c6d31a3957..13aa05b221 100644
--- a/hw/isa/lpc_ich9.c
+++ b/hw/isa/lpc_ich9.c
@@ -689,7 +689,6 @@ static void ich9_lpc_initfn(Object *obj)
IOAPIC_NUM_PINS);
ich9_pm_reset_properties(&lpc->pm);
- ich9_pm_add_properties(obj, &lpc->pm);
}
static void ich9_lpc_realize(PCIDevice *d, Error **errp)
@@ -950,6 +949,8 @@ static void ich9_lpc_class_init(ObjectClass *klass, const void *data)
ich9_lpc_get_smi_negotiated_feat,
ich9_lpc_set_smi_negotiated_feat,
NULL, NULL);
+
+ ich9_pm_add_class_properties(klass);
}
static const TypeInfo ich9_lpc_info = {
--
2.43.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 5/7] hw/acpi/pcihp.c: convert ACPI_PCIHP_IO_BASE_PROP and ACPI_PCIHP_IO_BASE_PROP to class props
2026-06-22 11:22 [PATCH 0/7] hw/acpi: convert object props to class props Mark Cave-Ayland
` (3 preceding siblings ...)
2026-06-22 11:22 ` [PATCH 4/7] hw/acpi/ich9.c: convert object props in ICH9_LPC_DEVICE to class props Mark Cave-Ayland
@ 2026-06-22 11:22 ` Mark Cave-Ayland
2026-06-25 13:59 ` Daniel P. Berrangé
2026-06-22 11:22 ` [PATCH 6/7] hw/acpi/pcihp.c: convert ACPI_PCIHP_PROP_BSEL from object prop to class prop Mark Cave-Ayland
2026-06-22 11:22 ` [PATCH 7/7] hw/acpi/piix4.c: convert object props in PIIX4_PM to class props Mark Cave-Ayland
6 siblings, 1 reply; 15+ messages in thread
From: Mark Cave-Ayland @ 2026-06-22 11:22 UTC (permalink / raw)
To: mst, imammedo, anisinha, philmd, aurelien, peter.maydell,
pbonzini, richard.henderson, qemu-devel, qemu-arm
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>
---
hw/acpi/generic_event_device.c | 30 ++++++++++++++++++++++++++++++
hw/acpi/ich9.c | 30 ++++++++++++++++++++++++++++++
hw/acpi/pcihp.c | 5 -----
hw/acpi/piix4.c | 30 ++++++++++++++++++++++++++++++
4 files changed, 90 insertions(+), 5 deletions(-)
diff --git a/hw/acpi/generic_event_device.c b/hw/acpi/generic_event_device.c
index 9e9416d406..1fc2798d53 100644
--- a/hw/acpi/generic_event_device.c
+++ b/hw/acpi/generic_event_device.c
@@ -11,6 +11,7 @@
#include "qemu/osdep.h"
#include "qapi/error.h"
+#include "qapi/visitor.h"
#include "hw/acpi/acpi.h"
#include "hw/acpi/pcihp.h"
#include "hw/acpi/cpu.h"
@@ -357,6 +358,26 @@ static void acpi_ged_send_event(AcpiDeviceIf *adev, AcpiEventStatusBits ev)
qemu_irq_pulse(s->irq);
}
+static void acpi_ged_get_pcihp_io_base(Object *obj, Visitor *v,
+ const char *name, void *opaque,
+ Error **errp)
+{
+ AcpiGedState *s = ACPI_GED(obj);
+ uint16_t io_base = s->pcihp_state.io_base;
+
+ visit_type_uint16(v, name, &io_base, errp);
+}
+
+static void acpi_ged_get_pcihp_io_len(Object *obj, Visitor *v,
+ const char *name, void *opaque,
+ Error **errp)
+{
+ AcpiGedState *s = ACPI_GED(obj);
+ uint16_t io_len = s->pcihp_state.io_len;
+
+ visit_type_uint16(v, name, &io_len, errp);
+}
+
static const Property acpi_ged_properties[] = {
DEFINE_PROP_UINT32("ged-event", AcpiGedState, ged_event_bitmap, 0),
DEFINE_PROP_BOOL(ACPI_PM_PROP_ACPI_PCIHP_BRIDGE, AcpiGedState,
@@ -608,6 +629,15 @@ static void acpi_ged_class_init(ObjectClass *class, const void *data)
adevc->ospm_status = acpi_ged_ospm_status;
adevc->send_event = acpi_ged_send_event;
+
+ object_class_property_add(class, ACPI_PCIHP_IO_BASE_PROP, "uint16",
+ acpi_ged_get_pcihp_io_base,
+ NULL,
+ NULL, NULL);
+ object_class_property_add(class, ACPI_PCIHP_IO_LEN_PROP, "uint16",
+ acpi_ged_get_pcihp_io_len,
+ NULL,
+ NULL, NULL);
}
static const TypeInfo acpi_ged_info = {
diff --git a/hw/acpi/ich9.c b/hw/acpi/ich9.c
index 723a87e6f3..71c3735eec 100644
--- a/hw/acpi/ich9.c
+++ b/hw/acpi/ich9.c
@@ -477,6 +477,28 @@ static void ich9_pm_set_keep_pci_slot_hpc(Object *obj, bool value, Error **errp)
s->pm.keep_pci_slot_hpc = value;
}
+static void ich9_pm_get_pcihp_io_base(Object *obj, Visitor *v,
+ const char *name, void *opaque,
+ Error **errp)
+{
+ ICH9LPCState *s = ICH9_LPC_DEVICE(obj);
+ ICH9LPCPMRegs *pm = &s->pm;
+ uint16_t io_base = pm->acpi_pci_hotplug.io_base;
+
+ visit_type_uint16(v, name, &io_base, errp);
+}
+
+static void ich9_pm_get_pcihp_io_len(Object *obj, Visitor *v,
+ const char *name, void *opaque,
+ Error **errp)
+{
+ ICH9LPCState *s = ICH9_LPC_DEVICE(obj);
+ ICH9LPCPMRegs *pm = &s->pm;
+ uint16_t io_len = pm->acpi_pci_hotplug.io_len;
+
+ visit_type_uint16(v, name, &io_len, errp);
+}
+
void ich9_pm_reset_properties(ICH9LPCPMRegs *pm)
{
pm->acpi_memory_hotplug.is_enabled = true;
@@ -529,6 +551,14 @@ void ich9_pm_add_class_properties(ObjectClass *oc)
object_class_property_add_bool(oc, "x-keep-pci-slot-hpc",
ich9_pm_get_keep_pci_slot_hpc,
ich9_pm_set_keep_pci_slot_hpc);
+ object_class_property_add(oc, ACPI_PCIHP_IO_BASE_PROP, "uint16",
+ ich9_pm_get_pcihp_io_base,
+ NULL,
+ NULL, NULL);
+ object_class_property_add(oc, ACPI_PCIHP_IO_LEN_PROP, "uint16",
+ ich9_pm_get_pcihp_io_len,
+ NULL,
+ NULL, NULL);
}
void ich9_pm_device_pre_plug_cb(HotplugHandler *hotplug_dev, DeviceState *dev,
diff --git a/hw/acpi/pcihp.c b/hw/acpi/pcihp.c
index 87162ff2c0..a91f523c93 100644
--- a/hw/acpi/pcihp.c
+++ b/hw/acpi/pcihp.c
@@ -502,11 +502,6 @@ void acpi_pcihp_init(Object *owner, AcpiPciHpState *s,
memory_region_init_io(&s->io, owner, &acpi_pcihp_io_ops, s,
"acpi-pci-hotplug", s->io_len);
memory_region_add_subregion(io, s->io_base, &s->io);
-
- object_property_add_uint16_ptr(owner, ACPI_PCIHP_IO_BASE_PROP, &s->io_base,
- OBJ_PROP_FLAG_READ);
- object_property_add_uint16_ptr(owner, ACPI_PCIHP_IO_LEN_PROP, &s->io_len,
- OBJ_PROP_FLAG_READ);
}
void build_append_pci_dsm_func0_common(Aml *ctx, Aml *retvar)
diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c
index 9b7f50c7af..4bfe3caa0d 100644
--- a/hw/acpi/piix4.c
+++ b/hw/acpi/piix4.c
@@ -32,6 +32,7 @@
#include "system/system.h"
#include "system/xen.h"
#include "qapi/error.h"
+#include "qapi/visitor.h"
#include "qemu/range.h"
#include "hw/acpi/cpu.h"
#include "hw/core/hotplug.h"
@@ -405,6 +406,26 @@ static void piix4_pm_machine_ready(Notifier *n, void *opaque)
(memory_region_present(io_as, 0x2f8) ? 0x90 : 0);
}
+static void piix4_pm_get_pcihp_io_base(Object *obj, Visitor *v,
+ const char *name, void *opaque,
+ Error **errp)
+{
+ PIIX4PMState *s = PIIX4_PM(obj);
+ uint16_t io_base = s->acpi_pci_hotplug.io_base;
+
+ visit_type_uint16(v, name, &io_base, errp);
+}
+
+static void piix4_pm_get_pcihp_io_len(Object *obj, Visitor *v,
+ const char *name, void *opaque,
+ Error **errp)
+{
+ PIIX4PMState *s = PIIX4_PM(obj);
+ uint16_t io_len = s->acpi_pci_hotplug.io_len;
+
+ visit_type_uint16(v, name, &io_len, errp);
+}
+
static void piix4_pm_add_properties(PIIX4PMState *s)
{
static const uint8_t acpi_enable_cmd = ACPI_ENABLE;
@@ -607,6 +628,15 @@ static void piix4_pm_class_init(ObjectClass *klass, const void *data)
hc->is_hotpluggable_bus = piix4_is_hotpluggable_bus;
adevc->ospm_status = piix4_ospm_status;
adevc->send_event = piix4_send_gpe;
+
+ object_class_property_add(klass, ACPI_PCIHP_IO_BASE_PROP, "uint16",
+ piix4_pm_get_pcihp_io_base,
+ NULL,
+ NULL, NULL);
+ object_class_property_add(klass, ACPI_PCIHP_IO_LEN_PROP, "uint16",
+ piix4_pm_get_pcihp_io_len,
+ NULL,
+ NULL, NULL);
}
static const TypeInfo piix4_pm_info = {
--
2.43.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 6/7] hw/acpi/pcihp.c: convert ACPI_PCIHP_PROP_BSEL from object prop to class prop
2026-06-22 11:22 [PATCH 0/7] hw/acpi: convert object props to class props Mark Cave-Ayland
` (4 preceding siblings ...)
2026-06-22 11:22 ` [PATCH 5/7] hw/acpi/pcihp.c: convert ACPI_PCIHP_IO_BASE_PROP and ACPI_PCIHP_IO_BASE_PROP " Mark Cave-Ayland
@ 2026-06-22 11:22 ` Mark Cave-Ayland
2026-06-25 14:00 ` Daniel P. Berrangé
2026-06-22 11:22 ` [PATCH 7/7] hw/acpi/piix4.c: convert object props in PIIX4_PM to class props Mark Cave-Ayland
6 siblings, 1 reply; 15+ messages in thread
From: Mark Cave-Ayland @ 2026-06-22 11:22 UTC (permalink / raw)
To: mst, imammedo, anisinha, philmd, aurelien, peter.maydell,
pbonzini, richard.henderson, qemu-devel, qemu-arm
Move the ACPI_PCIHP_PROP_BSEL property to the PCIBus object and update all
callers accordingly.
Since the existing logic checks for the existence of the ACPI_PCIHP_PROP_BSEL
property to enable the relevant ACPI changes, set the type of the underlying
variable to int32_t with a default value of -1 indicating that the property
has not been set.
Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
---
include/hw/pci/pci_bus.h | 2 ++
hw/acpi/pci-bridge.c | 9 ++++++++-
hw/acpi/pcihp.c | 32 +++++++++++++++-----------------
hw/arm/virt-acpi-build.c | 7 ++++++-
hw/i386/acpi-build.c | 7 ++++++-
hw/pci/pci.c | 32 ++++++++++++++++++++++++++++++++
6 files changed, 69 insertions(+), 20 deletions(-)
diff --git a/include/hw/pci/pci_bus.h b/include/hw/pci/pci_bus.h
index c738446788..186a157dbc 100644
--- a/include/hw/pci/pci_bus.h
+++ b/include/hw/pci/pci_bus.h
@@ -56,6 +56,8 @@ struct PCIBus {
int *irq_count;
Notifier machine_done;
+
+ int32_t acpi_pcihp_bsel_val;
};
static inline bool pci_bus_is_cxl(PCIBus *bus)
diff --git a/hw/acpi/pci-bridge.c b/hw/acpi/pci-bridge.c
index 394a919479..9af939363c 100644
--- a/hw/acpi/pci-bridge.c
+++ b/hw/acpi/pci-bridge.c
@@ -23,6 +23,8 @@ void build_pci_bridge_aml(AcpiDevAmlIf *adev, Aml *scope)
if (!DEVICE(br)->hotplugged) {
PCIBus *sec_bus = pci_bridge_get_sec_bus(br);
+ Error *local_err = NULL;
+ int32_t bsel;
build_append_pci_bus_devices(scope, sec_bus);
@@ -30,9 +32,14 @@ void build_pci_bridge_aml(AcpiDevAmlIf *adev, Aml *scope)
* generate hotplug slots descriptors if
* bridge has ACPI PCI hotplug attached,
*/
- if (object_property_find(OBJECT(sec_bus), ACPI_PCIHP_PROP_BSEL)) {
+ bsel = object_property_get_int(OBJECT(sec_bus), ACPI_PCIHP_PROP_BSEL,
+ &local_err);
+
+ if (local_err == NULL && bsel >= 0) {
build_append_pcihp_slots(scope, sec_bus);
}
+
+ error_free(local_err);
}
}
diff --git a/hw/acpi/pcihp.c b/hw/acpi/pcihp.c
index a91f523c93..31822f6310 100644
--- a/hw/acpi/pcihp.c
+++ b/hw/acpi/pcihp.c
@@ -58,8 +58,8 @@ typedef struct AcpiPciHpFind {
static int acpi_pcihp_get_bsel(PCIBus *bus)
{
Error *local_err = NULL;
- uint64_t bsel = object_property_get_uint(OBJECT(bus), ACPI_PCIHP_PROP_BSEL,
- &local_err);
+ int32_t bsel = object_property_get_int(OBJECT(bus), ACPI_PCIHP_PROP_BSEL,
+ &local_err);
if (local_err || bsel >= ACPI_PCIHP_MAX_HOTPLUG_BUS) {
error_free(local_err);
@@ -78,18 +78,14 @@ typedef struct {
static void *acpi_set_bsel(PCIBus *bus, void *opaque)
{
BSELInfo *info = opaque;
- unsigned *bus_bsel;
DeviceState *br = bus->qbus.parent;
bool is_bridge = IS_PCI_BRIDGE(br);
/* hotplugged bridges can't be described in ACPI ignore them */
if (qbus_is_hotpluggable(BUS(bus))) {
if (!is_bridge || (!br->hotplugged && info->has_bridge_hotplug)) {
- bus_bsel = g_malloc(sizeof *bus_bsel);
-
- *bus_bsel = info->bsel_alloc++;
- object_property_add_uint32_ptr(OBJECT(bus), ACPI_PCIHP_PROP_BSEL,
- bus_bsel, OBJ_PROP_FLAG_READ);
+ object_property_set_int(OBJECT(bus), ACPI_PCIHP_PROP_BSEL,
+ info->bsel_alloc++, NULL);
}
}
@@ -730,14 +726,16 @@ bool build_append_notification_callback(Aml *parent_scope, const PCIBus *bus)
/* If bus supports hotplug select it and notify about local events */
bsel = object_property_get_qobject(OBJECT(bus), ACPI_PCIHP_PROP_BSEL, NULL);
if (bsel) {
- uint64_t bsel_val = qnum_get_uint(qobject_to(QNum, bsel));
-
- aml_append(method, aml_store(aml_int(bsel_val), aml_name("BNUM")));
- aml_append(method, aml_call2("DVNT", aml_name("PCIU"),
- aml_int(1))); /* Device Check */
- aml_append(method, aml_call2("DVNT", aml_name("PCID"),
- aml_int(3))); /* Eject Request */
- nr_notifiers++;
+ int32_t bsel_val = qnum_get_int(qobject_to(QNum, bsel));
+
+ if (bsel_val >= 0) {
+ aml_append(method, aml_store(aml_int(bsel_val), aml_name("BNUM")));
+ aml_append(method, aml_call2("DVNT", aml_name("PCIU"),
+ aml_int(1))); /* Device Check */
+ aml_append(method, aml_call2("DVNT", aml_name("PCID"),
+ aml_int(3))); /* Eject Request */
+ nr_notifiers++;
+ }
}
/* Notify about child bus events in any case */
@@ -848,7 +846,7 @@ void build_append_pcihp_slots(Aml *parent_scope, PCIBus *bus)
Aml *dev, *notify_method = NULL, *method;
QObject *bsel = object_property_get_qobject(OBJECT(bus),
ACPI_PCIHP_PROP_BSEL, NULL);
- uint64_t bsel_val = qnum_get_uint(qobject_to(QNum, bsel));
+ int32_t bsel_val = qnum_get_int(qobject_to(QNum, bsel));
qobject_unref(bsel);
aml_append(parent_scope, aml_name_decl("BSEL", aml_int(bsel_val)));
diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c
index 3f285ff6c7..926c21324a 100644
--- a/hw/arm/virt-acpi-build.c
+++ b/hw/arm/virt-acpi-build.c
@@ -1138,6 +1138,8 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
AcpiTable table = { .sig = "DSDT", .rev = 2, .oem_id = vms->oem_id,
.oem_table_id = vms->oem_table_id };
Aml *pci0_scope;
+ Error *local_err = NULL;
+ int32_t bsel;
acpi_table_begin(&table, table_data);
dsdt = init_aml_allocator();
@@ -1196,9 +1198,12 @@ build_dsdt(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms)
aml_append(pci0_scope, build_pci_bridge_edsm());
build_append_pci_bus_devices(pci0_scope, vms->bus);
- if (object_property_find(OBJECT(vms->bus), ACPI_PCIHP_PROP_BSEL)) {
+ bsel = object_property_get_int(OBJECT(vms->bus), ACPI_PCIHP_PROP_BSEL,
+ &local_err);
+ if (local_err == NULL && bsel >= 0) {
build_append_pcihp_slots(pci0_scope, vms->bus);
}
+ error_free(local_err);
if (vms->acpi_dev) {
bool acpi_pcihp;
diff --git a/hw/i386/acpi-build.c b/hw/i386/acpi-build.c
index 2ee061558c..de196f2f4a 100644
--- a/hw/i386/acpi-build.c
+++ b/hw/i386/acpi-build.c
@@ -1197,15 +1197,20 @@ build_dsdt(GArray *table_data, BIOSLinker *linker,
sb_scope = aml_scope("\\_SB");
{
Object *pci_host = acpi_get_i386_pci_host();
+ Error *local_err = NULL;
+ int32_t bsel;
if (pci_host) {
PCIBus *pbus = PCI_HOST_BRIDGE(pci_host)->bus;
Aml *ascope = aml_scope("PCI0");
/* Scan all PCI buses. Generate tables to support hotplug. */
build_append_pci_bus_devices(ascope, pbus);
- if (object_property_find(OBJECT(pbus), ACPI_PCIHP_PROP_BSEL)) {
+ bsel = object_property_get_int(OBJECT(pbus), ACPI_PCIHP_PROP_BSEL,
+ &local_err);
+ if (local_err == NULL && bsel >= 0) {
build_append_pcihp_slots(ascope, pbus);
}
+ error_free(local_err);
aml_append(sb_scope, ascope);
}
}
diff --git a/hw/pci/pci.c b/hw/pci/pci.c
index cec065d108..db42b5296a 100644
--- a/hw/pci/pci.c
+++ b/hw/pci/pci.c
@@ -25,6 +25,7 @@
#include "qemu/osdep.h"
#include "qemu/datadir.h"
#include "qemu/units.h"
+#include "hw/acpi/pcihp.h"
#include "hw/core/irq.h"
#include "hw/pci/pci.h"
#include "hw/pci/pci_bridge.h"
@@ -187,6 +188,8 @@ static void pci_bus_realize(BusState *qbus, Error **errp)
bus->machine_done.notify = pcibus_machine_done;
qemu_add_machine_init_done_notifier(&bus->machine_done);
+ bus->acpi_pcihp_bsel_val = -1;
+
vmstate_register_any(NULL, &vmstate_pcibus, bus);
}
@@ -283,6 +286,30 @@ static GByteArray *pci_bus_fw_cfg_gen_data(Object *obj, Error **errp)
return byte_array;
}
+static void pci_bus_get_acpi_pcihp_bsel_val(Object *obj, Visitor *v,
+ const char *name, void *opaque,
+ Error **errp)
+{
+ PCIBus *bus = PCI_BUS(obj);
+ int32_t bsel_val = bus->acpi_pcihp_bsel_val;
+
+ visit_type_int32(v, name, &bsel_val, errp);
+}
+
+static void pci_bus_set_acpi_pcihp_bsel_val(Object *obj, Visitor *v,
+ const char *name, void *opaque,
+ Error **errp)
+{
+ PCIBus *bus = PCI_BUS(obj);
+ int32_t bsel_val = bus->acpi_pcihp_bsel_val;
+
+ if (!visit_type_int32(v, name, &bsel_val, errp)) {
+ return;
+ }
+
+ bus->acpi_pcihp_bsel_val = bsel_val;
+}
+
static void pci_bus_class_init(ObjectClass *klass, const void *data)
{
BusClass *k = BUS_CLASS(klass);
@@ -302,6 +329,11 @@ static void pci_bus_class_init(ObjectClass *klass, const void *data)
pbc->numa_node = pcibus_numa_node;
fwgc->get_data = pci_bus_fw_cfg_gen_data;
+
+ object_class_property_add(klass, ACPI_PCIHP_PROP_BSEL, "int32",
+ pci_bus_get_acpi_pcihp_bsel_val,
+ pci_bus_set_acpi_pcihp_bsel_val,
+ NULL, NULL);
}
static const TypeInfo pci_bus_info = {
--
2.43.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 7/7] hw/acpi/piix4.c: convert object props in PIIX4_PM to class props
2026-06-22 11:22 [PATCH 0/7] hw/acpi: convert object props to class props Mark Cave-Ayland
` (5 preceding siblings ...)
2026-06-22 11:22 ` [PATCH 6/7] hw/acpi/pcihp.c: convert ACPI_PCIHP_PROP_BSEL from object prop to class prop Mark Cave-Ayland
@ 2026-06-22 11:22 ` Mark Cave-Ayland
2026-06-25 14:01 ` Daniel P. Berrangé
6 siblings, 1 reply; 15+ messages in thread
From: Mark Cave-Ayland @ 2026-06-22 11:22 UTC (permalink / raw)
To: mst, imammedo, anisinha, philmd, aurelien, peter.maydell,
pbonzini, richard.henderson, qemu-devel, qemu-arm
Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
---
hw/acpi/piix4.c | 42 +++++++++++++++++++++++++++---------------
1 file changed, 27 insertions(+), 15 deletions(-)
diff --git a/hw/acpi/piix4.c b/hw/acpi/piix4.c
index 4bfe3caa0d..1aaf53e438 100644
--- a/hw/acpi/piix4.c
+++ b/hw/acpi/piix4.c
@@ -406,6 +406,16 @@ static void piix4_pm_machine_ready(Notifier *n, void *opaque)
(memory_region_present(io_as, 0x2f8) ? 0x90 : 0);
}
+static void piix4_pm_get_io_base(Object *obj, Visitor *v,
+ const char *name, void *opaque,
+ Error **errp)
+{
+ PIIX4PMState *s = PIIX4_PM(obj);
+ uint32_t io_base = s->io_base;
+
+ visit_type_uint32(v, name, &io_base, errp);
+}
+
static void piix4_pm_get_pcihp_io_base(Object *obj, Visitor *v,
const char *name, void *opaque,
Error **errp)
@@ -426,7 +436,7 @@ static void piix4_pm_get_pcihp_io_len(Object *obj, Visitor *v,
visit_type_uint16(v, name, &io_len, errp);
}
-static void piix4_pm_add_properties(PIIX4PMState *s)
+static void piix4_pm_add_class_properties(ObjectClass *oc)
{
static const uint8_t acpi_enable_cmd = ACPI_ENABLE;
static const uint8_t acpi_disable_cmd = ACPI_DISABLE;
@@ -434,18 +444,20 @@ static void piix4_pm_add_properties(PIIX4PMState *s)
static const uint32_t gpe0_blk_len = GPE_LEN;
static const uint16_t sci_int = 9;
- object_property_add_uint8_ptr(OBJECT(s), ACPI_PM_PROP_ACPI_ENABLE_CMD,
- &acpi_enable_cmd, OBJ_PROP_FLAG_READ);
- object_property_add_uint8_ptr(OBJECT(s), ACPI_PM_PROP_ACPI_DISABLE_CMD,
- &acpi_disable_cmd, OBJ_PROP_FLAG_READ);
- object_property_add_uint32_ptr(OBJECT(s), ACPI_PM_PROP_GPE0_BLK,
- &gpe0_blk, OBJ_PROP_FLAG_READ);
- object_property_add_uint32_ptr(OBJECT(s), ACPI_PM_PROP_GPE0_BLK_LEN,
- &gpe0_blk_len, OBJ_PROP_FLAG_READ);
- object_property_add_uint16_ptr(OBJECT(s), ACPI_PM_PROP_SCI_INT,
- &sci_int, OBJ_PROP_FLAG_READ);
- object_property_add_uint32_ptr(OBJECT(s), ACPI_PM_PROP_PM_IO_BASE,
- &s->io_base, OBJ_PROP_FLAG_READ);
+ object_class_property_add_uint8_ptr(oc, ACPI_PM_PROP_ACPI_ENABLE_CMD,
+ &acpi_enable_cmd, OBJ_PROP_FLAG_READ);
+ object_class_property_add_uint8_ptr(oc, ACPI_PM_PROP_ACPI_DISABLE_CMD,
+ &acpi_disable_cmd, OBJ_PROP_FLAG_READ);
+ object_class_property_add_uint32_ptr(oc, ACPI_PM_PROP_GPE0_BLK,
+ &gpe0_blk, OBJ_PROP_FLAG_READ);
+ object_class_property_add_uint32_ptr(oc, ACPI_PM_PROP_GPE0_BLK_LEN,
+ &gpe0_blk_len, OBJ_PROP_FLAG_READ);
+ object_class_property_add_uint16_ptr(oc, ACPI_PM_PROP_SCI_INT,
+ &sci_int, OBJ_PROP_FLAG_READ);
+ object_class_property_add(oc, ACPI_PM_PROP_PM_IO_BASE, "uint32",
+ piix4_pm_get_io_base,
+ NULL,
+ NULL, NULL);
}
static void piix4_pm_realize(PCIDevice *dev, Error **errp)
@@ -501,8 +513,6 @@ static void piix4_pm_realize(PCIDevice *dev, Error **errp)
piix4_acpi_system_hot_add_init(pci_address_space_io(dev),
pci_get_bus(dev), s);
-
- piix4_pm_add_properties(s);
}
static void piix4_pm_init(Object *obj)
@@ -637,6 +647,8 @@ static void piix4_pm_class_init(ObjectClass *klass, const void *data)
piix4_pm_get_pcihp_io_len,
NULL,
NULL, NULL);
+
+ piix4_pm_add_class_properties(klass);
}
static const TypeInfo piix4_pm_info = {
--
2.43.0
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH 1/7] hw/acpi/ich9.c: move initial property values into ich9_reset_properties()
2026-06-22 11:22 ` [PATCH 1/7] hw/acpi/ich9.c: move initial property values into ich9_reset_properties() Mark Cave-Ayland
@ 2026-06-25 13:55 ` Daniel P. Berrangé
0 siblings, 0 replies; 15+ messages in thread
From: Daniel P. Berrangé @ 2026-06-25 13:55 UTC (permalink / raw)
To: Mark Cave-Ayland
Cc: mst, imammedo, anisinha, philmd, aurelien, peter.maydell,
pbonzini, richard.henderson, qemu-devel, qemu-arm
On Mon, Jun 22, 2026 at 12:22:33PM +0100, Mark Cave-Ayland wrote:
> Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
> ---
> include/hw/acpi/ich9.h | 2 ++
> hw/acpi/ich9.c | 8 ++++++--
> hw/isa/lpc_ich9.c | 1 +
> 3 files changed, 9 insertions(+), 2 deletions(-)
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
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 :|
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 2/7] hw/isa/lpc_ich9.c: convert ich9_lpc_initfn() object props to class props
2026-06-22 11:22 ` [PATCH 2/7] hw/isa/lpc_ich9.c: convert ich9_lpc_initfn() object props to class props Mark Cave-Ayland
@ 2026-06-25 13:56 ` Daniel P. Berrangé
0 siblings, 0 replies; 15+ messages in thread
From: Daniel P. Berrangé @ 2026-06-25 13:56 UTC (permalink / raw)
To: Mark Cave-Ayland
Cc: mst, imammedo, anisinha, philmd, aurelien, peter.maydell,
pbonzini, richard.henderson, qemu-devel, qemu-arm
On Mon, Jun 22, 2026 at 12:22:34PM +0100, Mark Cave-Ayland wrote:
> Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
> ---
> hw/isa/lpc_ich9.c | 64 +++++++++++++++++++++++++++++++++++++----------
> 1 file changed, 51 insertions(+), 13 deletions(-)
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
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 :|
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 3/7] hw/acpi/ich9.c: don't pass ICH9LPCPMRegs via opaque for ACPI_PM_PROP_GPE0_BLK prop
2026-06-22 11:22 ` [PATCH 3/7] hw/acpi/ich9.c: don't pass ICH9LPCPMRegs via opaque for ACPI_PM_PROP_GPE0_BLK prop Mark Cave-Ayland
@ 2026-06-25 13:57 ` Daniel P. Berrangé
0 siblings, 0 replies; 15+ messages in thread
From: Daniel P. Berrangé @ 2026-06-25 13:57 UTC (permalink / raw)
To: Mark Cave-Ayland
Cc: mst, imammedo, anisinha, philmd, aurelien, peter.maydell,
pbonzini, richard.henderson, qemu-devel, qemu-arm
On Mon, Jun 22, 2026 at 12:22:35PM +0100, Mark Cave-Ayland wrote:
> In order to convert to a class property, the ICH9LPCPMRegs instance must be
> resolved by the getter/setter instead of being passed directly as an opaque.
>
> Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
> ---
> hw/acpi/ich9.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
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 :|
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 4/7] hw/acpi/ich9.c: convert object props in ICH9_LPC_DEVICE to class props
2026-06-22 11:22 ` [PATCH 4/7] hw/acpi/ich9.c: convert object props in ICH9_LPC_DEVICE to class props Mark Cave-Ayland
@ 2026-06-25 13:58 ` Daniel P. Berrangé
0 siblings, 0 replies; 15+ messages in thread
From: Daniel P. Berrangé @ 2026-06-25 13:58 UTC (permalink / raw)
To: Mark Cave-Ayland
Cc: mst, imammedo, anisinha, philmd, aurelien, peter.maydell,
pbonzini, richard.henderson, qemu-devel, qemu-arm
On Mon, Jun 22, 2026 at 12:22:36PM +0100, Mark Cave-Ayland wrote:
> Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
> ---
> include/hw/acpi/ich9.h | 2 +-
> hw/acpi/ich9.c | 153 +++++++++++++++++++++++++++++++++--------
> hw/isa/lpc_ich9.c | 3 +-
> 3 files changed, 129 insertions(+), 29 deletions(-)
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
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 :|
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 5/7] hw/acpi/pcihp.c: convert ACPI_PCIHP_IO_BASE_PROP and ACPI_PCIHP_IO_BASE_PROP to class props
2026-06-22 11:22 ` [PATCH 5/7] hw/acpi/pcihp.c: convert ACPI_PCIHP_IO_BASE_PROP and ACPI_PCIHP_IO_BASE_PROP " Mark Cave-Ayland
@ 2026-06-25 13:59 ` Daniel P. Berrangé
0 siblings, 0 replies; 15+ messages in thread
From: Daniel P. Berrangé @ 2026-06-25 13:59 UTC (permalink / raw)
To: Mark Cave-Ayland
Cc: mst, imammedo, anisinha, philmd, aurelien, peter.maydell,
pbonzini, richard.henderson, qemu-devel, qemu-arm
On Mon, Jun 22, 2026 at 12:22:37PM +0100, Mark Cave-Ayland wrote:
> 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>
> ---
> hw/acpi/generic_event_device.c | 30 ++++++++++++++++++++++++++++++
> hw/acpi/ich9.c | 30 ++++++++++++++++++++++++++++++
> hw/acpi/pcihp.c | 5 -----
> hw/acpi/piix4.c | 30 ++++++++++++++++++++++++++++++
> 4 files changed, 90 insertions(+), 5 deletions(-)
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
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 :|
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 6/7] hw/acpi/pcihp.c: convert ACPI_PCIHP_PROP_BSEL from object prop to class prop
2026-06-22 11:22 ` [PATCH 6/7] hw/acpi/pcihp.c: convert ACPI_PCIHP_PROP_BSEL from object prop to class prop Mark Cave-Ayland
@ 2026-06-25 14:00 ` Daniel P. Berrangé
0 siblings, 0 replies; 15+ messages in thread
From: Daniel P. Berrangé @ 2026-06-25 14:00 UTC (permalink / raw)
To: Mark Cave-Ayland
Cc: mst, imammedo, anisinha, philmd, aurelien, peter.maydell,
pbonzini, richard.henderson, qemu-devel, qemu-arm
On Mon, Jun 22, 2026 at 12:22:38PM +0100, Mark Cave-Ayland wrote:
> Move the ACPI_PCIHP_PROP_BSEL property to the PCIBus object and update all
> callers accordingly.
>
> Since the existing logic checks for the existence of the ACPI_PCIHP_PROP_BSEL
> property to enable the relevant ACPI changes, set the type of the underlying
> variable to int32_t with a default value of -1 indicating that the property
> has not been set.
>
> Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
> ---
> include/hw/pci/pci_bus.h | 2 ++
> hw/acpi/pci-bridge.c | 9 ++++++++-
> hw/acpi/pcihp.c | 32 +++++++++++++++-----------------
> hw/arm/virt-acpi-build.c | 7 ++++++-
> hw/i386/acpi-build.c | 7 ++++++-
> hw/pci/pci.c | 32 ++++++++++++++++++++++++++++++++
> 6 files changed, 69 insertions(+), 20 deletions(-)
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
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 :|
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH 7/7] hw/acpi/piix4.c: convert object props in PIIX4_PM to class props
2026-06-22 11:22 ` [PATCH 7/7] hw/acpi/piix4.c: convert object props in PIIX4_PM to class props Mark Cave-Ayland
@ 2026-06-25 14:01 ` Daniel P. Berrangé
0 siblings, 0 replies; 15+ messages in thread
From: Daniel P. Berrangé @ 2026-06-25 14:01 UTC (permalink / raw)
To: Mark Cave-Ayland
Cc: mst, imammedo, anisinha, philmd, aurelien, peter.maydell,
pbonzini, richard.henderson, qemu-devel, qemu-arm
On Mon, Jun 22, 2026 at 12:22:39PM +0100, Mark Cave-Ayland wrote:
> Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
> ---
> hw/acpi/piix4.c | 42 +++++++++++++++++++++++++++---------------
> 1 file changed, 27 insertions(+), 15 deletions(-)
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
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 :|
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2026-06-25 14:01 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-22 11:22 [PATCH 0/7] hw/acpi: convert object props to class props Mark Cave-Ayland
2026-06-22 11:22 ` [PATCH 1/7] hw/acpi/ich9.c: move initial property values into ich9_reset_properties() Mark Cave-Ayland
2026-06-25 13:55 ` Daniel P. Berrangé
2026-06-22 11:22 ` [PATCH 2/7] hw/isa/lpc_ich9.c: convert ich9_lpc_initfn() object props to class props Mark Cave-Ayland
2026-06-25 13:56 ` Daniel P. Berrangé
2026-06-22 11:22 ` [PATCH 3/7] hw/acpi/ich9.c: don't pass ICH9LPCPMRegs via opaque for ACPI_PM_PROP_GPE0_BLK prop Mark Cave-Ayland
2026-06-25 13:57 ` Daniel P. Berrangé
2026-06-22 11:22 ` [PATCH 4/7] hw/acpi/ich9.c: convert object props in ICH9_LPC_DEVICE to class props Mark Cave-Ayland
2026-06-25 13:58 ` Daniel P. Berrangé
2026-06-22 11:22 ` [PATCH 5/7] hw/acpi/pcihp.c: convert ACPI_PCIHP_IO_BASE_PROP and ACPI_PCIHP_IO_BASE_PROP " Mark Cave-Ayland
2026-06-25 13:59 ` Daniel P. Berrangé
2026-06-22 11:22 ` [PATCH 6/7] hw/acpi/pcihp.c: convert ACPI_PCIHP_PROP_BSEL from object prop to class prop Mark Cave-Ayland
2026-06-25 14:00 ` Daniel P. Berrangé
2026-06-22 11:22 ` [PATCH 7/7] hw/acpi/piix4.c: convert object props in PIIX4_PM to class props Mark Cave-Ayland
2026-06-25 14:01 ` Daniel P. Berrangé
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.