@samitouri / QOSamiQemu / commits / b25c602ec2

hw/i386/microvm: Add IGVM support

The IGVM infrastructure operates on X86MachineState and is already machine-type-agnostic, but the "igvm-cfg" QOM property is only registered on the PC machine type. Register it on microvm as well. When an IGVM file is configured, the firmware image is provided as a payload of the IGVM file so skip loading the default BIOS. Signed-off-by: Luigi Leonardi <leonardi@redhat.com> Message-ID: <20260512-microvm_igvm-v1-1-8b1fd8861235@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>

Luigi Leonardi committed May 12, 2026 at 17:14 UTC b25c602ec22ca472f98e6154bc60571902011618
1 file changed +16 -5
hw/i386/microvm.c
+16 -5
@@ -159,7 +159,6 @@ static int microvm_ioapics(MicrovmMachineState *mms)
159
160 static void microvm_devices_init(MicrovmMachineState *mms)
161 {
162 - const char *default_firmware;
162 X86MachineState *x86ms = X86_MACHINE(mms);
163 ISABus *isa_bus;
164 GSIState *gsi_state;
@@ -276,10 +275,12 @@ static void microvm_devices_init(MicrovmMachineState *mms)
275 serial_hds_isa_init(isa_bus, 0, 1);
276 }
277
279 - default_firmware = x86_machine_is_acpi_enabled(x86ms)
280 - ? MICROVM_BIOS_FILENAME
281 - : MICROVM_QBOOT_FILENAME;
282 - x86_bios_rom_init(x86ms, default_firmware, get_system_memory(), true);
278 + if (!x86ms->igvm) {
279 + const char *default_firmware = x86_machine_is_acpi_enabled(x86ms)
280 + ? MICROVM_BIOS_FILENAME
281 + : MICROVM_QBOOT_FILENAME;
282 + x86_bios_rom_init(x86ms, default_firmware, get_system_memory(), true);
283 + }
284 }
285
286 static void microvm_memory_init(MicrovmMachineState *mms)
@@ -717,6 +718,16 @@ static void microvm_class_init(ObjectClass *oc, const void *data)
718
719 compat_props_add(mc->compat_props, microvm_properties,
720 G_N_ELEMENTS(microvm_properties));
721 +
722 +#if defined(CONFIG_IGVM)
723 + object_class_property_add_link(oc, "igvm-cfg",
724 + TYPE_IGVM_CFG,
725 + offsetof(X86MachineState, igvm),
726 + object_property_allow_set_link,
727 + OBJ_PROP_LINK_STRONG);
728 + object_class_property_set_description(oc, "igvm-cfg",
729 + "Set IGVM configuration");
730 +#endif
731 }
732
733 static const TypeInfo microvm_machine_info = {