Skip to contentSkip to conversation

Igvm 20260821 patches

GIT PULL Applied Gerd Hoffmann 2 participants 14 messages Aug 21 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

The following changes since commit ae4f3443209ab154b48b706a146e5f557ab147cb:

Merge tag 'qtest-20260819-pull-request' of https://gitlab.com/farosas/qemu into staging (2026-08-19 08:21:57 -0700)

are available in the Git repository at:

https://gitlab.com/kraxel/qemu.git tags/igvm-20260821-pull-request

for you to fetch changes up to e27a2b5f36a0fc913ab9a55a00f77a33ec6cc4f0:

Update MAINTAINERS (2026-08-20 16:40:33 +0200)

----------------------------------------------------------------
igvm + vmlaunchupdate: allow guests supply their own igvm firmware images.

----------------------------------------------------------------

Ani Sinha (9):
MAINTAINERS: elevating myself to be a maintainer for igvm system/memory: add a tracepoint for memory_region_finalize backends/igvm: add a tracepoint for qigvm_cleanup_memory hw/misc/vmlaunchupdate: add api header hw/misc/vmlaunchupdate: Introduce hypervisor fw-cfg interface support docs/spec: Add a specification document for vm-launch-update device tests/qtest: Add small igvm files for testing purpose
Add functional and unit tests for the vm-launch-update device Update MAINTAINERS

Gerd Hoffmann (3):
igvm: store IgvmCfg pointer in QIgvm
igvm: track memory regions
igvm: cleanup memory regions

 .../aarch64/test_vm_launch_update_aarch.py    |  33 +
 .../x86_64/test_vm_launch_update.py           |  48 ++
 include/hw/misc/vmlaunchupdate.h              |  38 ++
 .../standard-headers/misc/vmlaunchupdate.h    | 102 +++
 include/system/igvm-internal.h                |   8 +-
 include/system/igvm.h                         |   1 +
 backends/igvm-cfg.c                           |   3 +
 backends/igvm.c                               |  97 ++-
 hw/misc/vmlaunchupdate.c                      | 333 ++++++++++
 system/memory.c                               |   1 +
 tests/qtest/launchupdate-test.c               | 625 ++++++++++++++++++
 MAINTAINERS                                   |  15 +-
 backends/trace-events                         |   1 +
 docs/specs/index.rst                          |   1 +
 docs/specs/vmlaunchupdate.rst                 | 198 ++++++
 hw/misc/meson.build                           |   3 +
 hw/misc/trace-events                          |   6 +
 system/trace-events                           |   1 +
 tests/data/igvm/README                        |  45 ++
 tests/data/igvm/hello.igvm                    | Bin 0 -> 137112 bytes
 tests/data/igvm/qemuinit.igvm                 | Bin 0 -> 137112 bytes
 tests/functional/aarch64/meson.build          |   4 +
 tests/functional/x86_64/meson.build           |   4 +
 tests/qtest/meson.build                       |   2 +
 24 files changed, 1535 insertions(+), 34 deletions(-)
 create mode 100755 tests/functional/aarch64/test_vm_launch_update_aarch.py
 create mode 100755 tests/functional/x86_64/test_vm_launch_update.py
 create mode 100644 include/hw/misc/vmlaunchupdate.h
 create mode 100644 include/standard-headers/misc/vmlaunchupdate.h
 create mode 100644 hw/misc/vmlaunchupdate.c
 create mode 100644 tests/qtest/launchupdate-test.c
 create mode 100644 docs/specs/vmlaunchupdate.rst
 create mode 100644 tests/data/igvm/README
 create mode 100644 tests/data/igvm/hello.igvm
 create mode 100644 tests/data/igvm/qemuinit.igvm
Signature · 1 line
2.55.0
#1 lore raw

[PULL 09/12] docs/spec: Add a specification document for vm-launch-update device

From: Ani Sinha <[email protected]>

This change adds a specification document and expanation for the vm-launch-update device.

CC Alex Graf <[email protected]>
CC Gerd Hoffman <[email protected]>

Message-ID: <[email protected]>

---
 docs/specs/index.rst          |   1 +
 docs/specs/vmlaunchupdate.rst | 198 ++++++++++++++++++++++++++++++++++
 2 files changed, 199 insertions(+)
 create mode 100644 docs/specs/vmlaunchupdate.rst
docs/specs/index.rst +1 -0
index b7909a108ab9..3cdf242661b4 100644
@@ -34,6 +34,7 @@ guest hardware that is specific to QEMU.
    virt-ctlr
    vmcoreinfo
    vmgenid
+   vmlaunchupdate
    rapl-msr
    rocker
    riscv-iommu
docs/specs/vmlaunchupdate.rst new file +198 -0

198 lines not on this page · raw message

Signature · 1 line
2.55.0
#2 lore raw

[PULL 10/12] tests/qtest: Add small igvm files for testing purpose

In reply to Gerd Hoffmann

From: Ani Sinha <[email protected]>

Needed by launchupdate-test.c. README file is added with explanation on how to build these IGVM files.

CC Alex Graf <[email protected]>
CC Gerd Hoffman <[email protected]>

Message-ID: <[email protected]>

---
 tests/data/igvm/README        |  45 ++++++++++++++++++++++++++++++++++
 tests/data/igvm/hello.igvm    | Bin 0 -> 137112 bytes
 tests/data/igvm/qemuinit.igvm | Bin 0 -> 137112 bytes
 3 files changed, 45 insertions(+)
 create mode 100644 tests/data/igvm/README
 create mode 100644 tests/data/igvm/hello.igvm
 create mode 100644 tests/data/igvm/qemuinit.igvm
tests/data/igvm/README new file +45 -0
new file mode 100644
index 000000000000..d4d26478eeb9
@@ -0,0 +1,45 @@
+
+=== This is the readme file for all IGVM file bundles provided ===
+=== All IGVM files are covered by GPL v2 or later ===
+SPDX-License-Identifier: GPL-2.0-or-later
+
+Small IGVM file bundles required for tesing vm-launch-update device
+===================================================================
+
+This directory contains IGVM files required for launchupdate-test.c.
+These IGVM bundles can be built from the following repository:
+
+https://gitlab.com/anisinha/virt-firmware-rs
+
+Just type "make" in the top of the repository. The built IGVM files
+can be found in the target/x86_64-unknown-none/debug directory.
+
+$ ls -l ./target/x86_64-unknown-none/debug/*.igvm
+-rw-r--r--. 1 anisinha anisinha 153624 Jun  8 10:05 ./target/x86_64-unknown-none/debug/hello.igvm
+-rw-r--r--. 1 anisinha anisinha 157848 Jun  8 10:05 ./target/x86_64-unknown-none/debug/igvmtest.igvm
+-rw-r--r--. 1 anisinha anisinha 987384 Jun  8 10:05 ./target/x86_64-unknown-none/debug/mefisto.igvm
+-rw-r--r--. 1 anisinha anisinha 368312 Jun  8 10:05 ./target/x86_64-unknown-none/debug/qemuinit.igvm
+-rw-r--r--. 1 anisinha anisinha 223944 Jun  8 10:05 ./target/x86_64-unknown-none/debug/snptest.igvm
+
+The IGVM bundles for sev-snp testing are also kept in a seperate directory /snp_igvm_bundles in the
+above repository for use without requiring to build from source:
+
+$ virtfirmware-rs/snp_igvm_bundles$ ls -l
+total 388
+-rw-r--r-- 1 anisinha anisinha 199176 Aug  7 00:58 snptest.igvm
+-rw-r--r-- 1 anisinha anisinha 195048 Aug  6 06:10 snptest-nohello.igvm
+
+Following files are used by the tests/qtest/launchupdate-test.c for non-coco case:
+
+hello.igvm
+qemuinit.igvm
+
+For confidential case (that is when COCO=1 is passed in the environment), the following
+IGVM bundles are used:
+
+snptest-nohello.igvm
+snptest.igvm
+
+The IGVM bundles used by the confidential case are not checked into the QEMU
+repository. Users who wish to test the confidential case can use the IGVM
+bundles from https://gitlab.com/anisinha/virt-firmware-rs as mentioned above.
tests/data/igvm/hello.igvm new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..2d3ffda5b157c13d109ef965d1c0f41e9a34caf5
GIT binary patch
tests/data/igvm/qemuinit.igvm new file binary +0 -0
new file mode 100644
index 0000000000000000000000000000000000000000..08e605ae0d8164b115bd2ac8b65530ecc7d78eaf
GIT binary patch
Signature · 1 line
2.55.0
#3 lore raw

[PULL 03/12] igvm: track memory regions

In reply to Gerd Hoffmann

Memory regions added by the current IGVM needs to be tracked so that they can be freed when a new IGVM is loaded.

Message-ID: <[email protected]>

---
 include/system/igvm-internal.h |  6 ++++++
 backends/igvm-cfg.c            |  1 +
 backends/igvm.c                | 20 ++++++++++++--------
 3 files changed, 19 insertions(+), 8 deletions(-)
include/system/igvm-internal.h +6 -0
index b5720fae0c00..9e9fa1d9afdb 100644
@@ -18,6 +18,11 @@
 #include "system/confidential-guest-support.h"
 #include <igvm/igvm.h>
 
+typedef struct IgvmMemoryRegion {
+    QTAILQ_ENTRY(IgvmMemoryRegion) next;
+    MemoryRegion *mr;
+} IgvmMemoryRegion;
+
 struct IgvmCfg {
     Object parent_obj;
 
@@ -29,6 +34,7 @@ struct IgvmCfg {
     char *filename;
     IgvmHandle file;
     ResettableState reset_state;
+    QTAILQ_HEAD(, IgvmMemoryRegion) memory_regions;
 };
 
 typedef struct QIgvmParameterData {
backends/igvm-cfg.c +1 -0
index e1f09855f66d..38438a7b1e2c 100644
@@ -65,6 +65,7 @@ static void igvm_complete(UserCreatable *uc, Error **errp)
     IgvmCfg *igvm = IGVM_CFG(uc);
 
     igvm->file = qigvm_file_init(igvm->filename, errp);
+    QTAILQ_INIT(&igvm->memory_regions);
 }
 
 OBJECT_DEFINE_TYPE_WITH_INTERFACES(IgvmCfg, igvm_cfg, IGVM_CFG, OBJECT,
backends/igvm.c +12 -8
index 534032fed812..9e7c90d386d1 100644
@@ -220,7 +220,7 @@ static void *qigvm_prepare_memory(QIgvm *ctx, uint64_t addr, uint64_t size,
                                   int region_identifier, Error **errp)
 {
     ERRP_GUARD();
-    MemoryRegion *igvm_pages = NULL;
+    IgvmMemoryRegion *imr = NULL;
     Int128 gpa_region_size;
     MemoryRegionSection mrs =
         memory_region_find(get_system_memory(), addr, size);
@@ -254,23 +254,27 @@ static void *qigvm_prepare_memory(QIgvm *ctx, uint64_t addr, uint64_t size,
          */
         g_autofree char *region_name =
             g_strdup_printf("igvm.%X", region_identifier);
-        igvm_pages = g_new0(MemoryRegion, 1);
+        imr = g_new0(IgvmMemoryRegion, 1);
+        imr->mr = g_new0(MemoryRegion, 1);
         if (ctx->machine_state->cgs &&
             ctx->machine_state->cgs->require_guest_memfd) {
-            if (!memory_region_init_ram_guest_memfd(igvm_pages, NULL,
+            if (!memory_region_init_ram_guest_memfd(imr->mr, NULL,
                                                     region_name, size, errp)) {
-                g_free(igvm_pages);
+                g_free(imr->mr);
+                g_free(imr);
                 return NULL;
             }
         } else {
-            if (!memory_region_init_ram(igvm_pages, NULL, region_name, size,
+            if (!memory_region_init_ram(imr->mr, NULL, region_name, size,
                                         errp)) {
-                g_free(igvm_pages);
+                g_free(imr->mr);
+                g_free(imr);
                 return NULL;
             }
         }
-        memory_region_add_subregion(get_system_memory(), addr, igvm_pages);
-        return memory_region_get_ram_ptr(igvm_pages);
+        memory_region_add_subregion(get_system_memory(), addr, imr->mr);
+        QTAILQ_INSERT_TAIL(&ctx->cfg->memory_regions, imr, next);
+        return memory_region_get_ram_ptr(imr->mr);
     }
 }
 
Signature · 1 line
2.55.0
#4 lore raw

[PULL 11/12] Add functional and unit tests for the vm-launch-update device

In reply to Gerd Hoffmann

From: Ani Sinha <[email protected]>

This patchset adds functional and unit tests that exercize various functions and behaviors of vm-launch-update device. It uses the IGVM files that were introduced in the previous patch for exercizing the hypervisor interface.

Message-ID: <[email protected]>

---
 .../aarch64/test_vm_launch_update_aarch.py    |  33 +
 .../x86_64/test_vm_launch_update.py           |  48 ++
 tests/qtest/launchupdate-test.c               | 625 ++++++++++++++++++
 tests/functional/aarch64/meson.build          |   4 +
 tests/functional/x86_64/meson.build           |   4 +
 tests/qtest/meson.build                       |   2 +
 6 files changed, 716 insertions(+)
 create mode 100755 tests/functional/aarch64/test_vm_launch_update_aarch.py
 create mode 100755 tests/functional/x86_64/test_vm_launch_update.py
 create mode 100644 tests/qtest/launchupdate-test.c
tests/functional/aarch64/test_vm_launch_update_aarch.py new file +33 -0
new file mode 100755
index 000000000000..2b3d7cf4a309
@@ -0,0 +1,33 @@
+#!/usr/bin/env python3
+#
+# Check for vm-launch-update device.
+#
+# Copyright (c) 2026 Red Hat, Inc.
+#
+# Author:
+#  Ani Sinha <[email protected]>
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+from qemu_test import QemuSystemTest
+
+class VmLaunchUpdateDeviceCheck(QemuSystemTest):
+
+    def aarch64_fail_test(self):
+        """
+        Currently the device is only supported for pc platforms.
+        """
+        self.vm.add_args('-machine', 'virt', '-device',
+                         'vm-launch-update,id=fwupd1')
+        self.vm.set_qmp_monitor(enabled=False)
+        self.vm.launch()
+        self.vm.wait()
+        self.assertEqual(self.vm.exitcode(), 1, "QEMU exit code should be 1")
+        self.assertRegex(self.vm.get_log(),
+                    r'This machine does not support vm-launch-update device')
+
+    def test_vm_launch_update(self):
+        self.aarch64_fail_test()
+
+if __name__ == '__main__':
+    QemuSystemTest.main()
tests/functional/x86_64/test_vm_launch_update.py new file +48 -0

48 lines not on this page · raw message

tests/qtest/launchupdate-test.c new file +625 -0

625 lines not on this page · raw message

tests/functional/aarch64/meson.build +4 -0
index e81afd6c39fc..f0881bed1671 100644
@@ -25,6 +25,10 @@ tests_aarch64_system_quick = [
   'vmstate',
 ]
 
+if igvm.found()
+  tests_aarch64_system_quick += [ 'vm_launch_update_aarch' ]
+endif
+
 tests_aarch64_system_thorough = [
   'aspeed_ast2700a1',
   'aspeed_ast2700a2',
tests/functional/x86_64/meson.build +4 -0
index 27b31f2e966f..0353b2af8e1d 100644
@@ -28,6 +28,10 @@ if not get_option('asan')
   tests_x86_64_system_quick += [ 'memlock' ]
 endif
 
+if igvm.found()
+  tests_x86_64_system_quick += [ 'vm_launch_update' ]
+endif
+
 tests_x86_64_system_thorough = [
   'acpi_bits',
   'hotplug_blk',
tests/qtest/meson.build +2 -0
index f7c7d06620ea..12ed368997b6 100644
@@ -61,6 +61,8 @@ qtests_i386 = \
   (config_all_devices.has_key('CONFIG_Q35') ? ['e820-test'] : []) +                          \
   (config_all_devices.has_key('CONFIG_FW_CFG_DMA') ? ['vmcoreinfo-test'] : []) +            \
   (config_all_devices.has_key('CONFIG_Q35') ? ['dump-test'] : []) +                         \
+  (igvm.found() and
+   config_all_devices.has_key('CONFIG_FW_CFG_DMA') ? ['launchupdate-test'] : []) +          \
   (config_all_devices.has_key('CONFIG_I440FX') ? ['i440fx-test'] : []) +                    \
   (config_all_devices.has_key('CONFIG_I440FX') ? ['ide-test'] : []) +                       \
   (config_all_devices.has_key('CONFIG_I440FX') ? ['numa-test'] : []) +                      \
Signature · 1 line
2.55.0
#5 lore raw

[PULL 04/12] igvm: cleanup memory regions

In reply to Gerd Hoffmann

This change cleans up existing memory regions that were created by the current IGVM. The cleanup would be necessary when a new IGVM is loaded. This cleanup function is called in a subsequent patch.

Message-ID: <[email protected]>

---
 include/system/igvm.h |  1 +
 backends/igvm-cfg.c   |  2 ++
 backends/igvm.c       | 19 +++++++++++++++++++
 3 files changed, 22 insertions(+)
include/system/igvm.h +1 -0
index 64d3542311ae..e219f1a4edb4 100644
@@ -20,6 +20,7 @@ typedef struct QIgvm QIgvm;
 
 int qigvm_process_file(IgvmCfg *igvm, MachineState *machine_state,
                        bool onlyVpContext, Error **errp);
+void qigvm_cleanup_memory(IgvmCfg *igvm);
 
 /* x86 native */
 int qigvm_x86_get_mem_map_entry(int index,
backends/igvm-cfg.c +2 -0
index 38438a7b1e2c..935ba54f54f3 100644
@@ -52,6 +52,8 @@ static void igvm_reset_hold(Object *obj, ResetType type)
 
     trace_igvm_reset_hold(type);
 
+    /* cleanup existing memory regions first */
+    qigvm_cleanup_memory(igvm);
     qigvm_process_file(igvm, ms, false, &error_fatal);
 }
 
backends/igvm.c +19 -0
index 9e7c90d386d1..9b101c81824e 100644
@@ -14,6 +14,7 @@
 #include "qapi/error.h"
 #include "qemu/error-report.h"
 #include "qemu/target-info-qapi.h"
+#include "migration/vmstate.h"
 #include "system/igvm.h"
 #include "system/igvm-cfg.h"
 #include "system/igvm-internal.h"
@@ -1109,3 +1110,21 @@ cleanup_parameters:
 cleanup:
     return retval;
 }
+
+/*
+ * cleanup any memory regions created by qigvm_prepare_memory()
+ */
+void qigvm_cleanup_memory(IgvmCfg *cfg)
+{
+    IgvmMemoryRegion *imr, *tmp;
+
+    QTAILQ_FOREACH_SAFE(imr, &cfg->memory_regions, next, tmp)
+    {
+        memory_region_del_subregion(get_system_memory(), imr->mr);
+        vmstate_unregister_ram(imr->mr, NULL);
+        QTAILQ_REMOVE(&cfg->memory_regions, imr, next);
+        /* this triggers MemoryRegion cleanup */
+        object_unparent(OBJECT(imr->mr));
+        g_free(imr);
+    }
+}
Signature · 1 line
2.55.0
#6 lore raw

[PULL 01/12] MAINTAINERS: elevating myself to be a maintainer for igvm

In reply to Gerd Hoffmann

From: Ani Sinha <[email protected]>

I have worked enough on the igvm to be confident to elevate myself to a maintainer role.

Message-ID: <[email protected]>

---
 MAINTAINERS | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
MAINTAINERS +1 -1
index b51f5c3e6022..9e0a2a656f4c 100644
@@ -4118,7 +4118,7 @@ F: tests/uefi-test-tools/
 IGVM Firmware
 M: Gerd Hoffmann <[email protected]>
 M: Stefano Garzarella <[email protected]>
-R: Ani Sinha <[email protected]>
+M: Ani Sinha <[email protected]>
 S: Maintained
 F: backends/igvm*.c
 F: docs/system/igvm.rst
Signature · 1 line
2.55.0
#7 lore raw

[PULL 06/12] backends/igvm: add a tracepoint for qigvm_cleanup_memory

In reply to Gerd Hoffmann

From: Ani Sinha <[email protected]>

Useful for debugging memory region cleanups.

Message-ID: <[email protected]>

---
 backends/igvm.c       | 1 +
 backends/trace-events | 1 +
 2 files changed, 2 insertions(+)
backends/igvm.c +1 -0
index 9b101c81824e..7b7bdc72b75b 100644
@@ -1120,6 +1120,7 @@ void qigvm_cleanup_memory(IgvmCfg *cfg)
 
     QTAILQ_FOREACH_SAFE(imr, &cfg->memory_regions, next, tmp)
     {
+        trace_qigvm_cleanup_memory(imr->mr->name);
         memory_region_del_subregion(get_system_memory(), imr->mr);
         vmstate_unregister_ram(imr->mr, NULL);
         QTAILQ_REMOVE(&cfg->memory_regions, imr, next);
backends/trace-events +1 -0
index 009a25b0be96..9b7b9b7d6801 100644
@@ -33,3 +33,4 @@ igvm_reset_hold(int type) "type=%u"
 igvm_reset_exit(int type) "type=%u"
 igvm_file_loaded(const char *fn, int32_t handle) "fn=%s, handle=0x%x"
 igvm_process_file(int32_t handle, bool context_only) "handle=0x%x context-only=%d"
+qigvm_cleanup_memory(const char* name) "freeing mr %s"
Signature · 1 line
2.55.0
#8 lore raw

[PULL 05/12] system/memory: add a tracepoint for memory_region_finalize

In reply to Gerd Hoffmann

From: Ani Sinha <[email protected]>

cosmetic: add a tracepoint to track when memory regions are getting freed. Useful for debugging and tracking all freed memory regions.

Message-ID: <[email protected]>

---
 system/memory.c     | 1 +
 system/trace-events | 1 +
 2 files changed, 2 insertions(+)
system/memory.c +1 -0
index da710bbade1b..9760721e4550 100644
@@ -1691,6 +1691,7 @@ static void memory_region_finalize(Object *obj)
 {
     MemoryRegion *mr = MEMORY_REGION(obj);
 
+    trace_memory_region_finalize(mr->name);
     /*
      * Each memory region (that can be freed) must have an owner, and it
      * always has the same lifecycle of its owner.  It means when reaching
system/trace-events +1 -0
index d483b31419bc..38ad0be8a998 100644
@@ -25,6 +25,7 @@ flatview_new(void *view, void *root) "%p (root %p)"
 flatview_destroy(void *view, void *root) "%p (root %p)"
 flatview_destroy_rcu(void *view, void *root) "%p (root %p)"
 global_dirty_changed(unsigned int bitmask) "bitmask 0x%"PRIx32
+memory_region_finalize(const char* name) "mr %s"
 
 # physmem.c
 address_space_map(void *as, uint64_t addr, uint64_t len, bool is_write, uint32_t attrs) "as:%p addr 0x%"PRIx64":%"PRIx64" write:%d attrs:0x%x"
Signature · 1 line
2.55.0
#9 lore raw

[PULL 02/12] igvm: store IgvmCfg pointer in QIgvm

In reply to Gerd Hoffmann

Store a pointer to IgvmCfg instead of only IgvmFile in QIgvm. Allows to store additional state in the (persistent) IgvmCfg struct.

Message-ID: <[email protected]>

---
 include/system/igvm-internal.h |  2 +-
 backends/igvm.c                | 57 ++++++++++++++++++++--------------
 2 files changed, 34 insertions(+), 25 deletions(-)
include/system/igvm-internal.h +1 -1
index 7eb3792ed8c5..b5720fae0c00 100644
@@ -43,7 +43,7 @@ typedef struct QIgvmParameterData {
  * file.
  */
 struct QIgvm {
-    IgvmHandle file;
+    IgvmCfg *cfg;
     MachineState *machine_state;
     ConfidentialGuestSupportClass *cgsc;
     uint32_t compatibility_mask;
backends/igvm.c +33 -24

188 lines not on this page · raw message

Signature · 1 line
2.55.0
#10 lore raw

[PULL 08/12] hw/misc/vmlaunchupdate: Introduce hypervisor fw-cfg interface support

In reply to Gerd Hoffmann

From: Ani Sinha <[email protected]>

VM launch update is a mechanism where the virtual machines can use IGVM file bundle to boot into a trusted execution environment without having to depend on a untrusted party to provide the IGVM bundle or firmware image. This is particularly useful for confidential virtual machines that are deployed in the cloud where the tenant and the cloud provider are two different entities. In this scenario, virtual machines can bring their own trusted IGVM file containing a trusted firmware image
bundled as a part of their filesystem and then use this hypervisor interface to update to a trusted and deterministic boot state.
This also allows the guests to have a consistent measurements on the firmware image.

Currently, this mechanism only works if the VM was started with IGVM in the first place.

This change introduces support for the fw-cfg based hypervisor interface and the corresponding device. The interface is made generic enough so that guests are free to use their own ABI to pass required information between initial and trusted execution contexts (where they are running their own trusted boot state) without the hypervisor getting involved in between.

Currently, this device is only supported for x86_64 machines. Presence of IGVM host libraries is also required for parsing IGVM files. Hence, the device cannot be initialized for other machine types or hosts where IGVM support is not present. Trying to initialize it for arm for example will lead to failure:

$ ./qemu-system-arm -device vm-launch-update -machine virt
qemu-system-arm: -device vm-launch-update: This machine does not support vm-launch-update device

A document detailing the specification is added in a subsequent patch. Please see docs/specs/vmlaunchupdate.rst.
Functional and qtests are added in a subsequent patch.

CC Alex Graf <[email protected]>
CC Gerd Hoffman <[email protected]>

Message-ID: <[email protected]>

---
 include/hw/misc/vmlaunchupdate.h |  38 ++++
 hw/misc/vmlaunchupdate.c         | 333 +++++++++++++++++++++++++++++++
 hw/misc/meson.build              |   3 +
 hw/misc/trace-events             |   6 +
 4 files changed, 380 insertions(+)
 create mode 100644 include/hw/misc/vmlaunchupdate.h
 create mode 100644 hw/misc/vmlaunchupdate.c
include/hw/misc/vmlaunchupdate.h new file +38 -0
new file mode 100644
index 000000000000..02f96cebdc17
@@ -0,0 +1,38 @@
+/*
+ * Guest driven VM launch state update device via IGVM.
+ * For details and specification, please look at docs/specs/vmlaunchupdate.rst.
+ *
+ * Copyright (C) 2026 Red Hat, Inc.
+ *
+ * Authors: Ani Sinha <[email protected]>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ *
+ */
+#ifndef VMLAUNCHUPDATE_H
+#define VMLAUNCHUPDATE_H
+
+#include "hw/core/qdev.h"
+#include "qom/object.h"
+#include "qemu/units.h"
+#include "system/igvm-cfg.h"
+#include "standard-headers/misc/vmlaunchupdate.h"
+
+#define TYPE_VMLAUNCHUPDATE "vm-launch-update"
+
+typedef struct VMLaunchUpdateState {
+    DeviceState parent_obj;
+    VMLaunchUpdate launch_update;
+    bool disabled;
+    bool host_igvm_on_reset;
+    ResettableState reset_state;
+} VMLaunchUpdateState;
+
+
+typedef struct VMLaunchUpdateStateClass {
+    ObjectClass parent_class;
+} VMLaunchUpdateStateClass;
+
+OBJECT_DECLARE_SIMPLE_TYPE(VMLaunchUpdateState, VMLAUNCHUPDATE);
+
+#endif
hw/misc/vmlaunchupdate.c new file +333 -0

333 lines not on this page · raw message

hw/misc/meson.build +3 -0
index e86d9ad6b39b..858ca845a2d3 100644
@@ -164,6 +164,9 @@ specific_ss.add(when: 'CONFIG_MIPS_ITU', if_true: files('mips_itu.c'))
 
 specific_ss.add(when: 'CONFIG_RISCV_MIPS_CMGCR', if_true: files('riscv_cmgcr.c'))
 specific_ss.add(when: 'CONFIG_RISCV_MIPS_CPC', if_true: files('riscv_cpc.c'))
+if igvm.found()
+   specific_ss.add(when: 'CONFIG_FW_CFG_DMA', if_true: files('vmlaunchupdate.c'))
+endif
 
 system_ss.add(when: 'CONFIG_SBSA_REF', if_true: files('sbsa_ec.c'))
 
hw/misc/trace-events +6 -0
index c9a868b3efb9..2d6d2238c57b 100644
@@ -442,3 +442,9 @@ iommu_testdev_dma_read(uint64_t gva, uint32_t len) "gva=0x%" PRIx64 " len=%u"
 iommu_testdev_dma_verify(uint32_t expected, uint32_t actual) "expected=0x%x actual=0x%x"
 iommu_testdev_dma_result(uint32_t result) "DMA completed result=0x%x"
 iommu_testdev_dma_armed(bool armed) "armed=%d"
+
+# vmlaunchupdate.c
+launch_update_write(void) ""
+vmlaunch_reset_enter(void) ""
+vm_launchupdate_finalize(void) ""
+restore_host_x86_igvm(void) ""
Signature · 1 line
2.55.0
#11 lore raw

[PULL 07/12] hw/misc/vmlaunchupdate: add api header

In reply to Gerd Hoffmann

From: Ani Sinha <[email protected]>

Add a separate header file for guest usable api definitions.

Message-ID: <[email protected]>

---
 .../standard-headers/misc/vmlaunchupdate.h    | 102 ++++++++++++++++++
 1 file changed, 102 insertions(+)
 create mode 100644 include/standard-headers/misc/vmlaunchupdate.h
include/standard-headers/misc/vmlaunchupdate.h new file +102 -0
new file mode 100644
index 000000000000..7f8382a765d1
@@ -0,0 +1,102 @@
+/*
+ * Guest driven VM launch state update device via IGVM.
+ * The definitions in this header defines the API for the hypervisor interface.
+ * For details and specification, please look at docs/specs/vmlaunchupdate.rst.
+ *
+ * Copyright (C) 2026 Red Hat, Inc.
+ *
+ * Authors: Ani Sinha <[email protected]>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ *
+ */
+#ifndef VMLAUNCHUPDATE_API_H
+#define VMLAUNCHUPDATE_API_H
+
+/* fw-cfg file definition */
+#define FILE_VMLAUNCHUPDATE "etc/vmlaunchupdate"
+
+/* version */
+#define VM_LAUNCHUPDATE_VERSION 0x01
+
+/* format bits, used by both 'capabilities' and 'control'  */
+
+/* igvm */
+#define VM_LAUNCHUPDATE_FORMAT_IGVM           (1ULL << 32)
+
+/* 'control' field bits  */
+
+/* disable vmlaunchupdate interface */
+#define VM_LAUNCHUPDATE_CTL_DISABLE            (1 << 0)
+/* revert to the original host provided igvm */
+#define VM_LAUNCHUPDATE_CTL_HOST_IGVM          (1 << 1)
+
+/* The combination of the above two ctl interfaces work as
+ * follows:
+ *
+ * A) CTL_HOST_IGVM=off CTL_DISABLE=off
+ *
+ * Supplied IGVM file replaces the firmware permanently.  Updating the
+ * firmware again is possible.
+ *
+ * B) CTL_HOST_IGVM=off CTL_DISABLE=on
+ *
+ * Supplied IGVM file replaces the firmware permanently.  Updating the
+ * firmware again is not possible.
+ *
+ * C) CTL_HOST_IGVM=on CTL_DISABLE=off
+ *
+ * Supplied IGVM file replaces the firmware for one reset.  Resetting
+ * again will switch back to the original firmware.  Updating the
+ * firmware again is possible.
+ *
+ * D) CTL_HOST_IGVM=on CTL_DISABLE=on
+ *
+ * Supplied IGVM file replaces the firmware for one reset.  Resetting
+ * again will switch back to the original firmware.  Updating the
+ * firmware again is NOT possible.
+ *
+ */
+
+/* status code */
+enum VMLaunchUpdateStatus {
+    VM_LAUNCHUPDATE_SUCCESS = 0,
+    VM_LAUNCHUPDATE_LOAD_FAIL = 1,
+    VM_LAUNCHUPDATE_NOT_IGVM_INIT = 2,
+};
+
+typedef struct QEMU_PACKED {
+    /* api version */
+    uint16_t version;
+
+    /*
+     * The guest can read this in order to determine if loading new IGVM
+     * succeeded.
+     */
+    uint16_t status;
+
+    uint32_t _padding;
+
+    /* VMM capabilities, read-only. */
+    uint64_t capabilities;
+    /* control bits, see VMFWUPDATE_CTL_* */
+    uint64_t control;
+
+    /*
+     * address and size of the IGVM image.  Will be cleared when
+     * the write completes successfully and IGVM file is correctly parsed.
+     */
+    uint64_t fw_image_addr;
+    uint64_t fw_image_size;
+
+    /*
+     * address + size of opaque blob.  The guest can use this to pass on
+     * information, for example which memory region the linux kernel has been
+     * loaded to.  writable, will be kept intact on firmware update.
+     */
+    uint64_t opaque_addr;
+    uint64_t opaque_size;
+
+} VMLaunchUpdate;
+
+#endif
Signature · 1 line
2.55.0
#12 lore raw

[PULL 12/12] Update MAINTAINERS

In reply to Gerd Hoffmann

From: Ani Sinha <[email protected]>

Add maintainers for vm-launch-update device and associated documentation and test code.

Message-ID: <[email protected]>

---
 MAINTAINERS | 13 +++++++++++++
 1 file changed, 13 insertions(+)
MAINTAINERS +13 -0
index 9e0a2a656f4c..1f9c08d76601 100644
@@ -2851,6 +2851,19 @@ F: include/hw/acpi/vmgenid.h
 F: docs/specs/vmgenid.rst
 F: tests/qtest/vmgenid-test.c
 
+VM Launch Update
+M: Ani Sinha <[email protected]>
+M: Gerd Hoffman <[email protected]>
+S: Maintained
+F: hw/misc/vmlaunchupdate.c
+F: include/hw/misc/vmlaunchupdate.h
+F: include/standard-headers/misc/vmlaunchupdate.h
+F: docs/specs/vmlaunchupdate.rst
+F: tests/functional/aarch64/test_vm_launch_update_aarch.py
+F: tests/functional/x86_64/test_vm_launch_update.py
+F: tests/qtest/launchupdate-test.c
+F: tests/data/igvm/*
+
 LED
 M: Philippe Mathieu-Daudé <[email protected]>
 S: Maintained
Signature · 1 line
2.55.0
#13 lore raw
In reply to Gerd Hoffmann
Quoted 6 lines · Gerd Hoffmann

The following changes since commit ae4f3443209ab154b48b706a146e5f557ab147cb:

   Merge tag 'qtest-20260819-pull-request' ofhttps://gitlab.com/farosas/qemu into staging (2026-08-19 08:21:57 -0700)

are available in the Git repository at:

Quoted 8 lines
   https://gitlab.com/kraxel/qemu.git tags/igvm-20260821-pull-request

for you to fetch changes up to e27a2b5f36a0fc913ab9a55a00f77a33ec6cc4f0:

   Update MAINTAINERS (2026-08-20 16:40:33 +0200)

----------------------------------------------------------------
igvm + vmlaunchupdate: allow guests supply their own igvm firmware images.

Applied, thanks. Please update https://wiki.qemu.org/ChangeLog/11.2 as appropriate.

r~