Signed-off-by: Mark Cave-Ayland <[email protected]>
---
include/hw/i386/pc.h | 2 ++
hw/i386/pc.c | 9 ++++++---
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index d4b6d3ed57..843a5a9e1f 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -38,6 +38,8 @@ typedef struct PCMachineState {
DeviceState *iommu;
BusState *idebus[MAX_IDE_BUS];
+ Object *alias_pcspk;
+
/* Configuration options: */
uint64_t max_ram_below_4g;
OnOffAuto vmport;
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 73a625327c..b049c9f880 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -1605,8 +1605,8 @@ static void pc_machine_initfn(Object *obj)
pc_system_flash_create(pcms);
pcms->pcspk = isa_new(TYPE_PC_SPEAKER);
- object_property_add_alias(OBJECT(pcms), "pcspk-audiodev",
- OBJECT(pcms->pcspk), "audiodev");
+ object_property_set_alias(OBJECT(pcms), "pcspk-audiodev",
+ OBJECT(pcms->pcspk));
if (pcmc->pci_enabled) {
cxl_machine_init(obj, &pcms->cxl_devices_state);
}
@@ -1750,7 +1750,10 @@ static void pc_machine_class_init(ObjectClass *oc, const
void *data)
"Set IGVM configuration");
#endif
-
+ object_class_property_add_alias(oc, "pcspk-audiodev",
+ offsetof(PCMachineState, alias_pcspk),
+ TYPE_PC_SPEAKER,
+ "audiodev");
}
static const TypeInfo pc_machine_info = {
--
2.43.0