Introduce a GPtrArray in VirtMachineState to keep track of all SMMUv3 devices created on the virt machine.
This will avoid relying on object_child_foreach_recursive() walks of the object tree when accessing SMMUv3 instances. Subsequent patches will use this list during ACPI IORT table generation and for CMDQV-related handling. No functional change. Signed-off-by: Shameer Kolothum <[email protected]> --- include/hw/arm/virt.h | 1 + hw/arm/virt.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h index 8069422769..f9437e6410 100644 --- a/include/hw/arm/virt.h +++ b/include/hw/arm/virt.h @@ -186,6 +186,7 @@ struct VirtMachineState { MemoryRegion *sysmem; MemoryRegion *secure_sysmem; bool pci_preserve_config; + GPtrArray *smmuv3_devices; }; #define VIRT_ECAM_ID(high) (high ? VIRT_HIGH_PCIE_ECAM : VIRT_PCIE_ECAM) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 50865e8115..292e523664 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -3232,6 +3232,7 @@ static void virt_machine_device_plug_cb(HotplugHandler *hotplug_dev, } create_smmuv3_dev_dtb(vms, dev, bus, errp); + g_ptr_array_add(vms->smmuv3_devices, dev); } } @@ -3659,6 +3660,8 @@ static void virt_instance_init(Object *obj) vms->oem_id = g_strndup(ACPI_BUILD_APPNAME6, 6); vms->oem_table_id = g_strndup(ACPI_BUILD_APPNAME8, 8); cxl_machine_init(obj, &vms->cxl_devices_state); + + vms->smmuv3_devices = g_ptr_array_new_with_free_func(NULL); } static const TypeInfo virt_machine_info = { -- 2.43.0
