Skip to contentSkip to conversation

Introducing guest driven VM launch update mechanism (BYOF interface)

PATCH Superseded Ani Sinha 3 participants 19 messages Jul 30 – Aug 6 Arm/Amlogic Meson SoC support

v3 of 6 Superseded Latest is v6 →

lore
Share & tools
lore

Ani Sinha

author
#0 lore raw

v3 cover Introducing guest driven VM launch update mechanism (BYOF interface)

This is the resurrection of the work that was previously discussed here:
https://lists.endsoftwarepatents.org/archive/html/qemu-devel/2025-03/msg05872.html

This relates to the 'bring your own firmware' work that we are driving at Red Hat, now with IGVM support.

The patchset includes a spec doc that has more details.

This patchset implements the hypervisor interface using fw-cfg. Using this interface, the guest can pass its own IGVM file to the hypervisor. Upon reset, the hypervisor re-initializes the guest using the IGVM file the guest provided. This is useful in order to have deterministic and trustworthy launch measurements, mostly for the cloud confidential guest deployments.

This patchset has added functional and unit tests that exercize the hypervisor interface. It has been tested for both confidential guests and non-confidential guests. Gerd has also independently tested the patchset.

Changelog:
v3:
- Gerd's suggestions incorporated.
- Rebased.
- tags added.
v2:
- API definitions moved to a separate userland header file.
- A new ctrl flag is added that will restore original host provided IGVM. Tests for the same are added as well.
- doc updates that describe how the interface works with the new ctrl flag set.
- A memory corruption issue is fixed.
- total size of test IGVM files reduced to 270 KB.
- other review comments addressed.
- tags added.

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

Ani Sinha (6):
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

 MAINTAINERS                                   |  13 +
 backends/igvm-cfg.c                           |   3 +
 backends/igvm.c                               |  99 +++--
 docs/specs/index.rst                          |   1 +
 docs/specs/vmlaunchupdate.rst                 | 172 ++++++++
 hw/misc/meson.build                           |   3 +
 hw/misc/trace-events                          |   6 +
 hw/misc/vmlaunchupdate.c                      | 309 +++++++++++++
 include/hw/misc/vmlaunchupdate.h              |  38 ++
 .../standard-headers/misc/vmlaunchupdate.h    | 102 +++++
 include/system/igvm-internal.h                |   8 +-
 include/system/igvm.h                         |   1 +
 tests/data/igvm/README                        |  24 ++
 tests/data/igvm/hello.igvm                    | Bin 0 -> 137112 bytes
 tests/data/igvm/qemuinit.igvm                 | Bin 0 -> 137112 bytes
 tests/functional/aarch64/meson.build          |   1 +
 .../aarch64/test_vm_launch_update_aarch.py    |  33 ++
 tests/functional/x86_64/meson.build           |   1 +
 .../x86_64/test_vm_launch_update.py           |  48 +++
 tests/qtest/launchupdate-test.c               | 408 ++++++++++++++++++
 tests/qtest/meson.build                       |   2 +
 21 files changed, 1239 insertions(+), 33 deletions(-)
 create mode 100644 docs/specs/vmlaunchupdate.rst
 create mode 100644 hw/misc/vmlaunchupdate.c
 create mode 100644 include/hw/misc/vmlaunchupdate.h
 create mode 100644 include/standard-headers/misc/vmlaunchupdate.h
 create mode 100644 tests/data/igvm/README
 create mode 100644 tests/data/igvm/hello.igvm
 create mode 100644 tests/data/igvm/qemuinit.igvm
 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
Signature · 1 line
2.42.0
author
#1 lore raw

PATCH v3 1/9 igvm: store IgvmCfg pointer in QIgvm

From: Gerd Hoffmann <[email protected]>

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

---
 backends/igvm.c                | 57 ++++++++++++++++++++--------------
 include/system/igvm-internal.h |  2 +-
 2 files changed, 34 insertions(+), 25 deletions(-)
backends/igvm.c +33 -24
index 80e87fe602..534032fed8 100644
@@ -178,7 +178,8 @@ static int qigvm_handler(QIgvm *ctx, IgvmVariableHeaderType raw_type,
         if (handlers[handler].type != type) {
             continue;
         }
-        header_handle = igvm_get_header(ctx->file, handlers[handler].section,
+        header_handle = igvm_get_header(ctx->cfg->file,
+                                        handlers[handler].section,
                                         ctx->current_header_index);
         if (header_handle < 0) {
             error_setg(
@@ -187,7 +188,7 @@ static int qigvm_handler(QIgvm *ctx, IgvmVariableHeaderType raw_type,
                 (int)header_handle);
             return -1;
         }
-        header_data = igvm_get_buffer(ctx->file, header_handle);
+        header_data = igvm_get_buffer(ctx->cfg->file, header_handle);
         if (header_data != NULL) {
             header_data += sizeof(IGVM_VHS_VARIABLE_HEADER);
             result = handlers[handler].handler(ctx, header_data, errp);
@@ -198,7 +199,7 @@ static int qigvm_handler(QIgvm *ctx, IgvmVariableHeaderType raw_type,
                     header_handle, type);
             result = -1;
         }
-        igvm_free_buffer(ctx->file, header_handle);
+        igvm_free_buffer(ctx->cfg->file, header_handle);
         return result;
     }
 
@@ -344,7 +345,8 @@ static int qigvm_process_mem_region(QIgvm *ctx, unsigned start_index,
 
     for (page_index = 0; page_index < page_count; page_index++) {
         data_handle = igvm_get_header_data(
-            ctx->file, IGVM_HEADER_SECTION_DIRECTIVE, page_index + start_index);
+            ctx->cfg->file, IGVM_HEADER_SECTION_DIRECTIVE,
+            page_index + start_index);
         if (data_handle == IGVMAPI_NO_DATA) {
             /* No data indicates a zero page */
             memset(&region[page_index * page_size], 0, page_size);
@@ -357,7 +359,7 @@ static int qigvm_process_mem_region(QIgvm *ctx, unsigned start_index,
             return -1;
         } else {
             zero = false;
-            data_size = igvm_get_buffer_size(ctx->file, data_handle);
+            data_size = igvm_get_buffer_size(ctx->cfg->file, data_handle);
             if (data_size < page_size) {
                 memset(&region[page_index * page_size], 0, page_size);
             } else if (data_size > page_size) {
@@ -367,14 +369,14 @@ static int qigvm_process_mem_region(QIgvm *ctx, unsigned start_index,
                            page_index + start_index);
                 return -1;
             }
-            data = igvm_get_buffer(ctx->file, data_handle);
+            data = igvm_get_buffer(ctx->cfg->file, data_handle);
             if (data == NULL) {
                 error_setg(errp, "IGVM: No buffer for handle %d", data_handle);
-                igvm_free_buffer(ctx->file, data_handle);
+                igvm_free_buffer(ctx->cfg->file, data_handle);
                 return -1;
             }
             memcpy(&region[page_index * page_size], data, data_size);
-            igvm_free_buffer(ctx->file, data_handle);
+            igvm_free_buffer(ctx->cfg->file, data_handle);
         }
     }
 
@@ -411,7 +413,8 @@ static int qigvm_process_mem_page(QIgvm *ctx,
             ctx->region_start = page_data->gpa;
             ctx->region_start_index = ctx->current_header_index;
         } else {
-            if (!qigvm_page_attrs_equal(ctx->file, ctx->current_header_index,
+            if (!qigvm_page_attrs_equal(ctx->cfg->file,
+                                        ctx->current_header_index,
                                         page_data,
                                         &ctx->region_prev_page_data) ||
                 ((ctx->region_prev_page_data.gpa +
@@ -474,7 +477,8 @@ static int qigvm_directive_vp_context(QIgvm *ctx, const uint8_t *header_data,
         return 0;
     }
 
-    data_handle = igvm_get_header_data(ctx->file, IGVM_HEADER_SECTION_DIRECTIVE,
+    data_handle = igvm_get_header_data(ctx->cfg->file,
+                                       IGVM_HEADER_SECTION_DIRECTIVE,
                                        ctx->current_header_index);
     if (data_handle < 0) {
         error_setg(errp, "Invalid VP context in IGVM file. Error code: %X",
@@ -482,7 +486,7 @@ static int qigvm_directive_vp_context(QIgvm *ctx, const uint8_t *header_data,
         return -1;
     }
 
-    data = (uint8_t *)igvm_get_buffer(ctx->file, data_handle);
+    data = (uint8_t *)igvm_get_buffer(ctx->cfg->file, data_handle);
     if (data == NULL) {
         error_setg(errp, "IGVM: No buffer for handle %d", data_handle);
         result = -1;
@@ -491,7 +495,8 @@ static int qigvm_directive_vp_context(QIgvm *ctx, const uint8_t *header_data,
 
     if (ctx->machine_state->cgs) {
         result = ctx->cgsc->set_guest_state(
-            vp_context->gpa, data, igvm_get_buffer_size(ctx->file, data_handle),
+            vp_context->gpa, data,
+            igvm_get_buffer_size(ctx->cfg->file, data_handle),
             CGS_PAGE_TYPE_VMSA, vp_context->vp_index, errp);
     } else if (target_arch() == SYS_EMU_TARGET_X86_64) {
         result = qigvm_x86_set_vp_context(data, vp_context->vp_index, errp);
@@ -504,7 +509,7 @@ static int qigvm_directive_vp_context(QIgvm *ctx, const uint8_t *header_data,
     }
 
 exit:
-    igvm_free_buffer(ctx->file, data_handle);
+    igvm_free_buffer(ctx->cfg->file, data_handle);
     if (result < 0) {
         return result;
     }
@@ -863,7 +868,8 @@ static int qigvm_supported_platform_compat_mask(QIgvm *ctx, Error **errp)
     uint32_t compatibility_mask_sev_snp = 0;
     uint32_t compatibility_mask = 0;
 
-    header_count = igvm_header_count(ctx->file, IGVM_HEADER_SECTION_PLATFORM);
+    header_count = igvm_header_count(ctx->cfg->file,
+                                     IGVM_HEADER_SECTION_PLATFORM);
     if (header_count < 0) {
         error_setg(errp,
                    "Invalid platform header count in IGVM file. Error code: %X",
@@ -874,11 +880,11 @@ static int qigvm_supported_platform_compat_mask(QIgvm *ctx, Error **errp)
     for (header_index = 0; header_index < (unsigned)header_count;
          header_index++) {
         IgvmVariableHeaderType typ = igvm_get_header_type(
-            ctx->file, IGVM_HEADER_SECTION_PLATFORM, header_index);
+            ctx->cfg->file, IGVM_HEADER_SECTION_PLATFORM, header_index);
         typ = igvm_vht_type(typ);
         if (typ == IGVM_VHT_SUPPORTED_PLATFORM) {
             header_handle = igvm_get_header(
-                ctx->file, IGVM_HEADER_SECTION_PLATFORM, header_index);
+                ctx->cfg->file, IGVM_HEADER_SECTION_PLATFORM, header_index);
             if (header_handle < 0) {
                 error_setg(errp,
                            "Invalid platform header in IGVM file. "
@@ -887,11 +893,11 @@ static int qigvm_supported_platform_compat_mask(QIgvm *ctx, Error **errp)
                 return -1;
             }
             platform =
-                (IGVM_VHS_SUPPORTED_PLATFORM *)(igvm_get_buffer(ctx->file,
+                (IGVM_VHS_SUPPORTED_PLATFORM *)(igvm_get_buffer(ctx->cfg->file,
                                                                 header_handle));
             if (platform == NULL) {
                 error_setg(errp, "IGVM: No buffer for handle %d", header_handle);
-                igvm_free_buffer(ctx->file, header_handle);
+                igvm_free_buffer(ctx->cfg->file, header_handle);
                 return -1;
             }
 
@@ -922,7 +928,7 @@ static int qigvm_supported_platform_compat_mask(QIgvm *ctx, Error **errp)
             } else if (platform->platform_type == IGVM_PLATFORM_TYPE_NATIVE) {
                 compatibility_mask = platform->compatibility_mask;
             }
-            igvm_free_buffer(ctx->file, header_handle);
+            igvm_free_buffer(ctx->cfg->file, header_handle);
         }
     }
     /* Choose the strongest supported isolation technology */
@@ -999,7 +1005,7 @@ int qigvm_process_file(IgvmCfg *cfg, MachineState *machine_state,
         error_setg(errp, "No IGVM file loaded.");
         return -1;
     }
-    ctx.file = cfg->file;
+    ctx.cfg = cfg;
     trace_igvm_process_file(cfg->file, onlyVpContext);
 
     ctx.machine_state = machine_state;
@@ -1021,7 +1027,8 @@ int qigvm_process_file(IgvmCfg *cfg, MachineState *machine_state,
         goto cleanup;
     }
 
-    header_count = igvm_header_count(ctx.file, IGVM_HEADER_SECTION_DIRECTIVE);
+    header_count = igvm_header_count(ctx.cfg->file,
+                                     IGVM_HEADER_SECTION_DIRECTIVE);
     if (header_count <= 0) {
         error_setg(
             errp, "Invalid directive header count in IGVM file. Error code: %X",
@@ -1035,7 +1042,8 @@ int qigvm_process_file(IgvmCfg *cfg, MachineState *machine_state,
          ctx.current_header_index < (unsigned)header_count;
          ctx.current_header_index++) {
         IgvmVariableHeaderType raw_type = igvm_get_header_type(
-            ctx.file, IGVM_HEADER_SECTION_DIRECTIVE, ctx.current_header_index);
+            ctx.cfg->file, IGVM_HEADER_SECTION_DIRECTIVE,
+            ctx.current_header_index);
         if (!onlyVpContext || igvm_vht_type(raw_type) == IGVM_VHT_VP_CONTEXT) {
             if (qigvm_handler(&ctx, raw_type, errp) < 0) {
                 goto cleanup_parameters;
@@ -1053,7 +1061,7 @@ int qigvm_process_file(IgvmCfg *cfg, MachineState *machine_state,
     }
 
     header_count =
-        igvm_header_count(ctx.file, IGVM_HEADER_SECTION_INITIALIZATION);
+        igvm_header_count(ctx.cfg->file, IGVM_HEADER_SECTION_INITIALIZATION);
     if (header_count < 0) {
         error_setg(
             errp,
@@ -1066,7 +1074,8 @@ int qigvm_process_file(IgvmCfg *cfg, MachineState *machine_state,
          ctx.current_header_index < (unsigned)header_count;
          ctx.current_header_index++) {
         IgvmVariableHeaderType type =
-            igvm_get_header_type(ctx.file, IGVM_HEADER_SECTION_INITIALIZATION,
+            igvm_get_header_type(ctx.cfg->file,
+                                 IGVM_HEADER_SECTION_INITIALIZATION,
                                  ctx.current_header_index);
         if (qigvm_handler(&ctx, type, errp) < 0) {
             goto cleanup_parameters;
include/system/igvm-internal.h +1 -1
index 7eb3792ed8..b5720fae0c 100644
@@ -43,7 +43,7 @@ typedef struct QIgvmParameterData {
  * file.
  */
 struct QIgvm {
-    IgvmHandle file;
+    IgvmCfg *cfg;
     MachineState *machine_state;
     ConfidentialGuestSupportClass *cgsc;
     uint32_t compatibility_mask;
Signature · 1 line
2.42.0
author
#2 lore raw

PATCH v3 2/9 igvm: track memory regions

In reply to Ani Sinha

From: Gerd Hoffmann <[email protected]>

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

---
 backends/igvm-cfg.c            |  1 +
 backends/igvm.c                | 20 ++++++++++++--------
 include/system/igvm-internal.h |  6 ++++++
 3 files changed, 19 insertions(+), 8 deletions(-)
backends/igvm-cfg.c +1 -0
index e1f09855f6..38438a7b1e 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 534032fed8..9e7c90d386 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);
     }
 }
 
include/system/igvm-internal.h +6 -0
index b5720fae0c..9e9fa1d9af 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 {
Signature · 1 line
2.42.0
#3 lore raw

Re: [PATCH v3 2/9] igvm: track memory regions

Quoted 39 lines · Ani Sinha

From: Gerd Hoffmann <[email protected]>

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

---
  backends/igvm-cfg.c            |  1 +
  backends/igvm.c                | 20 ++++++++++++--------
  include/system/igvm-internal.h |  6 ++++++
  3 files changed, 19 insertions(+), 8 deletions(-)
backends/igvm-cfg.c +1 -0
index e1f09855f6..38438a7b1e 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 +1 -1
index 534032fed8..9e7c90d386 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);

backends/igvm.c static void *qigvm_prepare_memory(QIgvm *ctx, uint64_t addr, uint64_t size, · line 261

Quoted 10 lines
backends/igvm.c +3 -2
@@ -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,

Please make sure to track them with owner set to OBJECT(ctx->machine_state). Without owner, reference counting is disabled and we end up leaking memory regions on cleanup you introduce in patch 3 later.

Alex

author
#4 lore raw

Re: [PATCH v3 2/9] igvm: track memory regions

Quoted 48 lines · Alexander Graf
Quoted 42 lines · Ani Sinha

From: Gerd Hoffmann <[email protected]>

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

---
 backends/igvm-cfg.c            |  1 +
 backends/igvm.c                | 20 ++++++++++++--------
 include/system/igvm-internal.h |  6 ++++++
 3 files changed, 19 insertions(+), 8 deletions(-)
backends/igvm-cfg.c +1 -0
index e1f09855f6..38438a7b1e 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 +2 -2
index 534032fed8..9e7c90d386 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);
Quoted 8 lines

backends/igvm.c static void *qigvm_prepare_memory(QIgvm *ctx, uint64_t addr, uint64_t size, · line 261

Quoted 5 lines
backends/igvm.c +2 -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,

Please make sure to track them with owner set to OBJECT(ctx->machine_state).

This will not work as the owner will have to be of TYPE_DEVICE not of TYPE_MACHINE.

Quoted 4 lines

Without owner, reference counting is disabled and we end up leaking memory regions on cleanup you introduce in patch 3 later.

Alex

author
#5 lore raw

Re: [PATCH v3 2/9] igvm: track memory regions

Quoted 58 lines · Ani Sinha
Quoted 49 lines · Alexander Graf
Quoted 42 lines · Ani Sinha

From: Gerd Hoffmann <[email protected]>

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

---
 backends/igvm-cfg.c            |  1 +
 backends/igvm.c                | 20 ++++++++++++--------
 include/system/igvm-internal.h |  6 ++++++
 3 files changed, 19 insertions(+), 8 deletions(-)
backends/igvm-cfg.c +1 -0
index e1f09855f6..38438a7b1e 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 +2 -2
index 534032fed8..9e7c90d386 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);
Quoted 8 lines

backends/igvm.c static void *qigvm_prepare_memory(QIgvm *ctx, uint64_t addr, uint64_t size, · line 261

Quoted 5 lines
backends/igvm.c +2 -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,

Please make sure to track them with owner set to OBJECT(ctx->machine_state).

Quoted 1 line

This will not work as the owner will have to be of TYPE_DEVICE not of TYPE_MACHINE.

Looking closer, these memory regions are subregions of system_mmeory. system_memory is initialized with owner as NULL in memory_map_init().

memory_region_finalize() says .,,

Here it is possible that the MR has:
mr->container set, which means this MR is a subregion of a
container MR. In this case they must share the same owner as the container (otherwise the container should have kept a refcount of this MR's owner).

And then there is this assertion:

/* Must share the owner; see above comments */

        assert(mr->container->owner == mr->owner);

So i think the owner should be NULL.

I think that means we should garbage collect system_memory and its sub-regions?

Quoted 6 lines
Quoted 4 lines

Without owner, reference counting is disabled and we end up leaking memory regions on cleanup you introduce in patch 3 later.

Alex

author
#6 lore raw

Re: [PATCH v3 2/9] igvm: track memory regions

Quoted 76 lines · Ani Sinha
Quoted 58 lines · Ani Sinha
Quoted 49 lines · Alexander Graf
Quoted 42 lines · Ani Sinha

From: Gerd Hoffmann <[email protected]>

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

---

backends/igvm-cfg.c            |  1 +
backends/igvm.c                | 20 ++++++++++++--------
include/system/igvm-internal.h |  6 ++++++
3 files changed, 19 insertions(+), 8 deletions(-)
backends/igvm-cfg.c +1 -0
index e1f09855f6..38438a7b1e 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 +2 -2
index 534032fed8..9e7c90d386 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);
Quoted 8 lines

backends/igvm.c static void *qigvm_prepare_memory(QIgvm *ctx, uint64_t addr, uint64_t size, · line 261

Quoted 5 lines
backends/igvm.c +2 -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,

Please make sure to track them with owner set to OBJECT(ctx->machine_state).

Quoted 1 line

This will not work as the owner will have to be of TYPE_DEVICE not of TYPE_MACHINE.

Looking closer, these memory regions are subregions of system_mmeory. system_memory is initialized with owner as NULL in memory_map_init().

memory_region_finalize() says .,,

Here it is possible that the MR has:
mr->container set, which means this MR is a subregion of a
container MR. In this case they must share the same owner as the container (otherwise the container should have kept a refcount of this MR's owner).

Quoted 8 lines

And then there is this assertion:

/* Must share the owner; see above comments */

       assert(mr->container->owner == mr->owner);

So i think the owner should be NULL.

I think that means we should garbage collect system_memory and its sub-regions?

I looked at this deeply and I believe this change triggers the mr cleanup:

backends/igvm.c +3 -5
index da09e6195c..44cf74dfc6 100644
@@ -1124,11 +1124,9 @@ void qigvm_cleanup_memory(IgvmCfg *cfg)
         memory_region_del_subregion(get_system_memory(), imr->mr);
         vmstate_unregister_ram(imr->mr, NULL);
         QTAILQ_REMOVE(&cfg->memory_regions, imr, next);
-        /*
-         * imr->mr will be freed when all references to the memory
-         * region are dropped. Freeing it here will cause memory
-         * corruption.
-         */
+        /* this triggers MemoryRegion cleanup */
+        object_unparent(OBJECT(imr->mr));
+        imr->mr = NULL;
         g_free(imr);
     }
 }

Using added tracing, I see the following in the log:

$ grep igvm /tmp/qemu-debug.log 
qigvm_cleanup_memory freeing mr igvm.23B
memory_region_finalize mr name igvm.23B
qigvm_cleanup_memory freeing mr igvm.23B
memory_region_finalize mr name igvm.23B

So the mr which is cleaned up in qigvm_cleanup_memory() is actually freed and there is no memory leak.

The cleanup triggered by object_unparent() has the following call chain as seen in debugger:

#0  memory_region_finalize (obj=0x55ef77ebbc30) at /workspace/qemu-ani/include/system/memory.h:41
#1  0x000055ef6b195261 in object_deinit (obj=<optimized out>, type=<optimized out>) at ../qom/object.c:655
#2  object_finalize (data=0x55ef77ebbc30) at ../qom/object.c:669
#3  object_unref (objptr=0x55ef77ebbc30) at ../qom/object.c:1324
#4  0x000055ef6b19385a in object_property_del_child (obj=0x55ef774fb900, child=0x55ef77ebbc30) at ../qom/object.c:629
#5  0x000055ef6b1944d1 in object_unparent (obj=<optimized out>) at ../qom/object.c:648
#6  0x000055ef6ad46c0e in qigvm_cleanup_memory (cfg=cfg@entry=0x55ef77506d80) at ../backends/igvm.c:1128
#7  0x000055ef6ad44c2b in igvm_reset_hold (obj=<optimized out>, type=RESET_TYPE_COLD) at ../backends/igvm-cfg.c:56

(gdb) n
memory_region_finalize (obj=<optimized out>) at ../system/memory.c:1733
1733 trace_memory_region_finalize(mr->name);
(gdb) p mr->name
$1 = 0x55ef7766dfa0 "igvm.23B"
(gdb)

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

Without owner, reference counting is disabled and we end up leaking memory regions on cleanup you introduce in patch 3 later.

Alex

author
#7 lore raw

Re: [PATCH v3 2/9] igvm: track memory regions

Quoted 97 lines · Ani Sinha
Quoted 77 lines · Ani Sinha
Quoted 58 lines · Ani Sinha
Quoted 49 lines · Alexander Graf
Quoted 42 lines · Ani Sinha

From: Gerd Hoffmann <[email protected]>

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

---

backends/igvm-cfg.c            |  1 +
backends/igvm.c                | 20 ++++++++++++--------
include/system/igvm-internal.h |  6 ++++++
3 files changed, 19 insertions(+), 8 deletions(-)
backends/igvm-cfg.c +1 -0
index e1f09855f6..38438a7b1e 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 +2 -2
index 534032fed8..9e7c90d386 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);
Quoted 8 lines

backends/igvm.c static void *qigvm_prepare_memory(QIgvm *ctx, uint64_t addr, uint64_t size, · line 261

Quoted 5 lines
backends/igvm.c +2 -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,

Please make sure to track them with owner set to OBJECT(ctx->machine_state).

Quoted 1 line

This will not work as the owner will have to be of TYPE_DEVICE not of TYPE_MACHINE.

Looking closer, these memory regions are subregions of system_mmeory. system_memory is initialized with owner as NULL in memory_map_init().

memory_region_finalize() says .,,

Here it is possible that the MR has:
mr->container set, which means this MR is a subregion of a
container MR. In this case they must share the same owner as the container (otherwise the container should have kept a refcount of this MR's owner).

Quoted 8 lines

And then there is this assertion:

/* Must share the owner; see above comments */

      assert(mr->container->owner == mr->owner);

So i think the owner should be NULL.

I think that means we should garbage collect system_memory and its sub-regions?

I looked at this deeply and I believe this change triggers the mr cleanup:

backends/igvm.c +0 -0
index da09e6195c..44cf74dfc6 100644
@@ -1124,11 +1124,9 @@ void qigvm_cleanup_memory(IgvmCfg *cfg)
        memory_region_del_subregion(get_system_memory(), imr->mr);

backends/igvm.c void qigvm_cleanup_memory(IgvmCfg *cfg) · line 1129

Quoted 10 lines
backends/igvm.c +3 -5
        vmstate_unregister_ram(imr->mr, NULL);
        QTAILQ_REMOVE(&cfg->memory_regions, imr, next);
-        /*
-         * imr->mr will be freed when all references to the memory
-         * region are dropped. Freeing it here will cause memory
-         * corruption.
-         */
+        /* this triggers MemoryRegion cleanup */
+        object_unparent(OBJECT(imr->mr));
+        imr->mr = NULL;
          ^^^^^^^^^^^^^^^^

I suppose that is unnecessary as imr is getting freed right away.

Quoted 3 lines
backends/igvm.c +0 -0
        g_free(imr);
    }
 }
author
#8 lore raw

PATCH v3 3/9 igvm: cleanup memory regions

In reply to Ani Sinha

From: Gerd Hoffmann <[email protected]>

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.

---
 backends/igvm-cfg.c   |  2 ++
 backends/igvm.c       | 22 ++++++++++++++++++++++
 include/system/igvm.h |  1 +
 3 files changed, 25 insertions(+)
backends/igvm-cfg.c +2 -0
index 38438a7b1e..935ba54f54 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 +22 -0
index 9e7c90d386..c7520d58b7 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,24 @@ 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);
+        /*
+         * imr->mr will be freed when all references to the memory
+         * region are dropped. Freeing it here will cause memory
+         * corruption.
+         */
+        g_free(imr);
+    }
+}
include/system/igvm.h +1 -0
index 64d3542311..e219f1a4ed 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,
Signature · 1 line
2.42.0
author
#9 lore raw

PATCH v3 4/9 hw/misc/vmlaunchupdate: add api header

In reply to Ani Sinha

Add a separate header file for guest usable api definitions.

CC Alex Graf <[email protected]>
CC Gerd Hoffman <[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 0000000000..fc18f8faf7
@@ -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,
+    VM_LAUNCHUPDATE_LOAD_FAIL,
+    VM_LAUNCHUPDATE_NOT_IGVM_INIT,
+};
+
+typedef struct {
+    /* 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.42.0
#10 lore raw

Re: [PATCH v3 4/9] hw/misc/vmlaunchupdate: add api header

include/standard-headers/misc/vmlaunchupdate.h

Quoted 15 lines · Ani Sinha

Add a separate header file for guest usable api definitions.

CC Alex Graf <[email protected]>
CC Gerd Hoffman <[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 +0 -0
new file mode 100644
index 0000000000..fc18f8faf7

Didn't standard-headers usually get imported from somewhere, like Linux? Where does this one originate? If it's self written, why not put it into include/hw/misc?

Quoted 91 lines
include/standard-headers/misc/vmlaunchupdate.h new file +90 -0
@@ -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,
+    VM_LAUNCHUPDATE_LOAD_FAIL,
+    VM_LAUNCHUPDATE_NOT_IGVM_INIT,
+};
+
+typedef struct {
+    /* 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;

include/standard-headers/misc/vmlaunchupdate.h line 100

Quoted 10 lines
include/standard-headers/misc/vmlaunchupdate.h new file +10 -0
+
+    /*
+     * 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;

In theory, we may want to allow all of this logic with TCG eventually. At that point, we need to watch out for different struct layout constraints implied by the compiler. It's probably best to mark this struct QEMU_PACKED right away to not run into accidental padding on obscure platforms later.

Alex

author
#11 lore raw

Re: [PATCH v3 4/9] hw/misc/vmlaunchupdate: add api header

Quoted 16 lines · Alexander Graf
Quoted 10 lines · Ani Sinha

Add a separate header file for guest usable api definitions.

CC Alex Graf <[email protected]>
CC Gerd Hoffman <[email protected]>
---
 .../standard-headers/misc/vmlaunchupdate.h    | 102 ++++++++++++++++++
 1 file changed, 102 insertions(+)
 create mode 100644 include/standard-headers/misc/vmlaunchupdate.h
Quoted 8 lines

include/standard-headers/misc/vmlaunchupdate.h

Quoted 5 lines
include/standard-headers/misc/vmlaunchupdate.h new file +0 -0
new file mode 100644
index 0000000000..fc18f8faf7

Didn't standard-headers usually get imported from somewhere, like Linux? Where does this one originate? If it's self written, why not put it into include/hw/misc?

See https://lists.gnu.org/archive/html/qemu-devel/2026-06/msg06362.html

author
#12 lore raw

PATCH v3 5/9 hw/misc/vmlaunchupdate: Introduce hypervisor fw-cfg interface support

In reply to Ani Sinha

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 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 vmfwupdate: This machine does not support vm-launch-update device

Functional and qtests will be added in a subsequent patch.

CC Alex Graf <[email protected]>
CC Gerd Hoffman <[email protected]>
---
 hw/misc/meson.build              |   3 +
 hw/misc/trace-events             |   6 +
 hw/misc/vmlaunchupdate.c         | 309 +++++++++++++++++++++++++++++++
 include/hw/misc/vmlaunchupdate.h |  38 ++++
 4 files changed, 356 insertions(+)
 create mode 100644 hw/misc/vmlaunchupdate.c
 create mode 100644 include/hw/misc/vmlaunchupdate.h
hw/misc/meson.build +3 -0
index 23265f6035..b8c7de295e 100644
@@ -163,6 +163,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 c9a868b3ef..2d6d2238c5 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) ""
hw/misc/vmlaunchupdate.c new file +309 -0

309 lines not on this page · raw message

include/hw/misc/vmlaunchupdate.h new file +38 -0
new file mode 100644
index 0000000000..02f96cebdc
@@ -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
Signature · 1 line
2.42.0
#13 lore raw

Re: [PATCH v3 5/9] hw/misc/vmlaunchupdate: Introduce hypervisor fw-cfg interface support

Quoted 156 lines · Ani Sinha

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 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 vmfwupdate: This machine does not support vm-launch-update device

Functional and qtests will be added in a subsequent patch.

CC Alex Graf <[email protected]>
CC Gerd Hoffman <[email protected]>
---
  hw/misc/meson.build              |   3 +
  hw/misc/trace-events             |   6 +
  hw/misc/vmlaunchupdate.c         | 309 +++++++++++++++++++++++++++++++
  include/hw/misc/vmlaunchupdate.h |  38 ++++
  4 files changed, 356 insertions(+)

create mode 100644 hw/misc/vmlaunchupdate.c create mode 100644 include/hw/misc/vmlaunchupdate.h

hw/misc/meson.build +3 -0
index 23265f6035..b8c7de295e 100644
@@ -163,6 +163,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 c9a868b3ef..2d6d2238c5 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) ""
hw/misc/vmlaunchupdate.c new file +76 -0
new file mode 100644
index 0000000000..5b0222310b
@@ -0,0 +1,309 @@
+/*
+ * Guest driven VM launch component update (using IGVM) device
+ * 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
+ */
+
+#include "qemu/osdep.h"
+#include "qapi/error.h"
+#include "qemu/module.h"
+#include "system/physmem.h"
+#include "system/reset.h"
+#include "qemu/target-info-qapi.h"
+#include "hw/nvram/fw_cfg.h"
+#include "hw/core/qdev-properties.h"
+#include "hw/i386/pc.h"
+#include "exec/cpu-common.h"
+#include "hw/misc/vmlaunchupdate.h"
+#include "system/igvm.h"
+#include "system/igvm-internal.h"
+#include "qemu/error-report.h"
+#include "trace.h"
+
+/* returns NULL unless there is exactly one device */
+static VMLaunchUpdateState *vm_launchupdate_find(void)
+{
+    Object *o = object_resolve_path_type("", TYPE_VMLAUNCHUPDATE, NULL);
+
+    return o ? VMLAUNCHUPDATE(o) : NULL;
+}
+
+static bool vmlaunchupdate_supported(void)
+{
+    return target_arch() == SYS_EMU_TARGET_X86_64;
+}
+
+static void init_vm_launch_update(VMLaunchUpdateState *s)
+{
+    s->launch_update.capabilities = VM_LAUNCHUPDATE_FORMAT_IGVM;
+    s->launch_update.control = 0;
+
+    if (s->disabled) {
+        s->launch_update.control |= VM_LAUNCHUPDATE_CTL_DISABLE;
+    }
+
+    s->launch_update.version = VM_LAUNCHUPDATE_VERSION;
+    return;
+}
+
+static void clear_init_vm_launch_update(VMLaunchUpdateState *s)
+{
+    memset(&s->launch_update, 0, sizeof(s->launch_update));
+    init_vm_launch_update(s);
+}
+
+static int process_x86_igvm(VMLaunchUpdateState *s,
+                            uint64_t fw_image_addr, uint64_t fw_image_size)
+{
+    X86MachineState *x86machine = X86_MACHINE(qdev_get_machine());
+    IgvmCfg *igvmc = x86machine->igvm;
+    IgvmHandle igvm;
+    void *image_addr_ptr;
+    hwaddr len;
+
+    if (!igvmc) {
+        /* The VM was not started with an IGVM, bail */
+        info_report("guest was not initially started with IGVM, "
+                    "not changing launch state.");
+        return -2;
+    }
+
+    if (!fw_image_addr || !fw_image_size) {

hw/misc/vmlaunchupdate.c line 86

Quoted 10 lines
hw/misc/vmlaunchupdate.c new file +10 -0
+        return -1;
+    }
+
+    len = (hwaddr) fw_image_size;
+    image_addr_ptr = physical_memory_map((hwaddr) fw_image_addr,
+                                         (hwaddr *) &len, 0);
+
+    if (!image_addr_ptr || (len < fw_image_size)) {
+        warn_report("vmlaunchupdate: Invalid guest addresses.");
+        physical_memory_unmap(image_addr_ptr, len, 0, 0);

On !image_addr_ptr, wouldn't this invoke unmap(NULL)?

hw/misc/vmlaunchupdate.c line 93

Quoted 7 lines
hw/misc/vmlaunchupdate.c new file +7 -0
+        return -1;
+    }
+
+    igvm = igvm_new_from_binary(image_addr_ptr, fw_image_size);
+    if (igvm < 0) {
+        warn_report("vmlaunchupdate: Unable to parse IGVM file %"
+                    PRIx64 ": %" PRIx64, fw_image_addr, fw_image_size);

Don't we need to unmap here as well, like above?

I think the best way to make this code pretty is a goto err with conditional unmap.

Quoted 10 lines
hw/misc/vmlaunchupdate.c new file +10 -0
+        return -1;
+    }
+
+    /* free previous file context */
+    if (igvmc->file >= 0) {
+        igvm_free(igvmc->file);
+    }
+    /* set new context */
+    igvmc->file = igvm;
+

hw/misc/vmlaunchupdate.c line 113

Quoted 10 lines
hw/misc/vmlaunchupdate.c new file +10 -0
+    physical_memory_unmap(image_addr_ptr, len, 0, 0);
+    info_report("vmlaunchupdate: new IGVM context set.");
+
+    return 0;
+}
+
+static void restore_host_x86_igvm(void)
+{
+    X86MachineState *x86machine = X86_MACHINE(qdev_get_machine());
+    IgvmCfg *igvmc = x86machine->igvm;

The igvm property can be NULL, if nobody set igvm-cfg. So if you launch QEMU with just "-device vm-launch-update", it will crash here. You check it above in process_x86_igvm(), but not here. Maybe create a generic function that does the info_report and bails out?

hw/misc/vmlaunchupdate.c line 114

Quoted 1 line
hw/misc/vmlaunchupdate.c new file +1 -0
+    Error *errp;

Please always preinitialize errp with NULL. Typically callers expects that it's NULL, so they can choose not to touch it on error.

Alex

author
#14 lore raw

PATCH v3 6/9 docs/spec: Add a specification document for vm-launch-update device

In reply to Ani Sinha

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

CC Alex Graf <[email protected]>
CC Gerd Hoffman <[email protected]>
---
 docs/specs/index.rst          |   1 +
 docs/specs/vmlaunchupdate.rst | 172 ++++++++++++++++++++++++++++++++++
 2 files changed, 173 insertions(+)
 create mode 100644 docs/specs/vmlaunchupdate.rst
docs/specs/index.rst +1 -0
index b7909a108a..3cdf242661 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 +172 -0

172 lines not on this page · raw message

Signature · 1 line
2.42.0
author
#15 lore raw

PATCH v3 7/9 tests/qtest: Add small igvm files for testing purpose

In reply to Ani Sinha

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]>
---
 tests/data/igvm/README        |  24 ++++++++++++++++++++++++
 tests/data/igvm/hello.igvm    | Bin 0 -> 137112 bytes
 tests/data/igvm/qemuinit.igvm | Bin 0 -> 137112 bytes
 3 files changed, 24 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 +24 -0
new file mode 100644
index 0000000000..e785099579
@@ -0,0 +1,24 @@
+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
+
+
+Following files are used by the tests/qtest/launchupdate-test.c:
+
+hello.igvm
+qemuinit.igvm
+
+
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.42.0
author
#16 lore raw

PATCH v3 8/9 Add functional and unit tests for the vm-launch-update device

In reply to Ani Sinha

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.

CC Alex Graf <[email protected]>
CC Gerd Hoffman <[email protected]>
---
 tests/functional/aarch64/meson.build          |   1 +
 .../aarch64/test_vm_launch_update_aarch.py    |  33 ++
 tests/functional/x86_64/meson.build           |   1 +
 .../x86_64/test_vm_launch_update.py           |  48 +++
 tests/qtest/launchupdate-test.c               | 408 ++++++++++++++++++
 tests/qtest/meson.build                       |   2 +
 6 files changed, 493 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/meson.build +1 -0
index e81afd6c39..b07373189e 100644
@@ -23,6 +23,7 @@ test_aarch64_timeouts = {
 tests_aarch64_system_quick = [
   'migration',
   'vmstate',
+  'vm_launch_update_aarch',
 ]
 
 tests_aarch64_system_thorough = [
tests/functional/aarch64/test_vm_launch_update_aarch.py new file +33 -0
new file mode 100755
index 0000000000..2b3d7cf4a3
@@ -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/meson.build +1 -0
index 27b31f2e96..079861ed77 100644
@@ -18,6 +18,7 @@ tests_x86_64_system_quick = [
   'pc_cpu_hotplug_props',
   'virtio_version',
   'vmstate',
+  'vm_launch_update',
 ]
 
 # The address-sanitizer makes mlock() a no-op because it
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 +408 -0

408 lines not on this page · raw message

tests/qtest/meson.build +2 -0
index 56ff860e21..5c7883b48a 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.42.0
author
#17 lore raw

PATCH v3 9/9 Update MAINTAINERS

In reply to Ani Sinha

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

---
 MAINTAINERS | 13 +++++++++++++
 1 file changed, 13 insertions(+)
MAINTAINERS +13 -0
index 902db77218..b8523d4cc9 100644
@@ -2833,6 +2833,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.42.0
Reviewed-by Alexander Graf on the v3 series
#18 lore raw
In reply to Ani Sinha
Quoted 8 lines · Ani Sinha

This is the resurrection of the work that was previously discussed here:
https://lists.endsoftwarepatents.org/archive/html/qemu-devel/2025-03/msg05872.html

This relates to the 'bring your own firmware' work that we are driving at Red Hat, now with IGVM support.

The patchset includes a spec doc that has more details.

Quoted 8 lines

This patchset implements the hypervisor interface using fw-cfg. Using this interface, the guest can pass its own IGVM file to the hypervisor. Upon reset, the hypervisor re-initializes the guest using the IGVM file the guest provided. This is useful in order to have deterministic and trustworthy launch measurements, mostly for the cloud confidential guest deployments.

This patchset has added functional and unit tests that exercize the hypervisor interface. It has been tested for both confidential guests and non-confidential guests. Gerd has also independently tested the patchset.

Very nice, thanks a bunch for pushing this through!

Alex