@samitouri / QOSamiQemu / commits / 9c8ac5bbdd

hw/arm/virt: Move MSI controller creation out of create_gic()

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> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-id: 20260327111700.795099-58-peter.maydell@linaro.org

Peter Maydell committed Mar 27, 2026 at 11:16 UTC 9c8ac5bbdd28606b1131260512ff34c6e5280b29
1 file changed +13 -2
hw/arm/virt.c
+13 -2
@@ -1285,11 +1285,21 @@ static void create_gic(VirtMachineState *vms, MemoryRegion *mem)
1285 }
1286
1287 fdt_add_gic_node(vms);
1288 +}
1289
1289 - if (vms->msi_controller == VIRT_MSI_CTRL_ITS) {
1290 +static void create_msi_controller(VirtMachineState *vms)
1291 +{
1292 + switch (vms->msi_controller) {
1293 + case VIRT_MSI_CTRL_ITS:
1294 create_its(vms);
1291 - } else if (vms->msi_controller == VIRT_MSI_CTRL_GICV2M) {
1295 + break;
1296 + case VIRT_MSI_CTRL_GICV2M:
1297 create_v2m(vms);
1298 + break;
1299 + case VIRT_MSI_CTRL_NONE:
1300 + break;
1301 + default:
1302 + g_assert_not_reached();
1303 }
1304 }
1305
@@ -2856,6 +2866,7 @@ static void machvirt_init(MachineState *machine)
2866 virt_flash_fdt(vms, sysmem, secure_sysmem ?: sysmem);
2867
2868 create_gic(vms, sysmem);
2869 + create_msi_controller(vms);
2870
2871 virt_post_cpus_gic_realized(vms, sysmem);
2872