The create_gic() function also creates the MSI controller; however there isn't really a strong linkage here, and for the GICv5 it will be more convenient to separate it out. Move it to a new create_msi_controller() function.
Signed-off-by: Peter Maydell <[email protected]> --- hw/arm/virt.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/hw/arm/virt.c b/hw/arm/virt.c index 0d1032967c..3c318680f8 100644 --- a/hw/arm/virt.c +++ b/hw/arm/virt.c @@ -959,11 +959,21 @@ static void create_gic(VirtMachineState *vms, MemoryRegion *mem) } fdt_add_gic_node(vms); +} - if (vms->msi_controller == VIRT_MSI_CTRL_ITS) { +static void create_msi_controller(VirtMachineState *vms) +{ + switch (vms->msi_controller) { + case VIRT_MSI_CTRL_ITS: create_its(vms); - } else if (vms->msi_controller == VIRT_MSI_CTRL_GICV2M) { + break; + case VIRT_MSI_CTRL_GICV2M: create_v2m(vms); + break; + case VIRT_MSI_CTRL_NONE: + break; + default: + g_assert_not_reached(); } } @@ -2515,6 +2525,7 @@ static void machvirt_init(MachineState *machine) virt_flash_fdt(vms, sysmem, secure_sysmem ?: sysmem); create_gic(vms, sysmem); + create_msi_controller(vms); virt_post_cpus_gic_realized(vms, sysmem); -- 2.43.0
