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 <peter.maydell@linaro.org>
Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
---
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 91097e25ec..544605244b 100644
--- a/hw/arm/virt.c
+++ b/hw/arm/virt.c
@@ -958,11 +958,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();
}
}
@@ -2514,6 +2524,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