summary refs log tree commit diff stats
path: root/hw/i386/pc_piix.c
diff options
context:
space:
mode:
authorRoy Hopkins <roy.hopkins@randomman.co.uk>2025-07-03 16:11:02 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2025-07-12 15:28:21 +0200
commit28e5ef4a6574cbaf6a5706d582b5b463b7f8d162 (patch)
tree27f8ee0c4258cf1d49cf3e1a16786a6f3111bc54 /hw/i386/pc_piix.c
parentc1d466d267cf40093c9489075906b385459a195f (diff)
downloadfocaccia-qemu-28e5ef4a6574cbaf6a5706d582b5b463b7f8d162.tar.gz
focaccia-qemu-28e5ef4a6574cbaf6a5706d582b5b463b7f8d162.zip
hw/i386: Add igvm-cfg object and processing for IGVM files
An IGVM file contains configuration of guest state that should be
applied during configuration of the guest, before the guest is started.

This patch allows the user to add an igvm-cfg object to an X86 machine
configuration that allows an IGVM file to be configured that will be
applied to the guest before it is started.

If an IGVM configuration is provided then the IGVM file is processed at
the end of the board initialization, before the state transition to
PHASE_MACHINE_INITIALIZED.

Signed-off-by: Roy Hopkins <roy.hopkins@randomman.co.uk>
Acked-by: Gerd Hoffman <kraxel@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Reviewed-by: Ani Sinha <anisinha@redhat.com>
Link: https://lore.kernel.org/r/23bc66ae4504ba5cf2134826e055b25df3fc9cd9.1751554099.git.roy.hopkins@randomman.co.uk
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw/i386/pc_piix.c')
-rw-r--r--hw/i386/pc_piix.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index ea7572e783..3184ea1b37 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -366,6 +366,16 @@ static void pc_init1(MachineState *machine, const char *pci_type)
                                x86_nvdimm_acpi_dsmio,
                                x86ms->fw_cfg, OBJECT(pcms));
     }
+
+#if defined(CONFIG_IGVM)
+    /* Apply guest state from IGVM if supplied */
+    if (x86ms->igvm) {
+        if (IGVM_CFG_GET_CLASS(x86ms->igvm)
+                ->process(x86ms->igvm, machine->cgs, &error_fatal) < 0) {
+            g_assert_not_reached();
+        }
+    }
+#endif
 }
 
 typedef enum PCSouthBridgeOption {