* [PATCH v4 1/5] igvm: move igvm.h file to include/system
2025-10-22 8:44 [PATCH v4 0/5] igvm: add support for igvm memory map parameter in native mode Gerd Hoffmann
@ 2025-10-22 8:44 ` Gerd Hoffmann
2025-10-22 12:09 ` Luigi Leonardi
2025-10-22 8:44 ` [PATCH v4 2/5] igvm: fix off by one bug in memmap entry count checking Gerd Hoffmann
` (3 subsequent siblings)
4 siblings, 1 reply; 13+ messages in thread
From: Gerd Hoffmann @ 2025-10-22 8:44 UTC (permalink / raw)
To: qemu-devel
Cc: Stefano Garzarella, Paolo Bonzini, Ani Sinha, Luigi Leonardi,
Gerd Hoffmann, Zhao Liu, Roy Hopkins
Prepare for arch-specific igvm code being added to the code base.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Ani Sinha <anisinha@redhat.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
---
{backends => include/system}/igvm.h | 0
backends/igvm-cfg.c | 2 +-
backends/igvm.c | 2 +-
3 files changed, 2 insertions(+), 2 deletions(-)
rename {backends => include/system}/igvm.h (100%)
diff --git a/backends/igvm.h b/include/system/igvm.h
similarity index 100%
rename from backends/igvm.h
rename to include/system/igvm.h
diff --git a/backends/igvm-cfg.c b/backends/igvm-cfg.c
index 45df63e06c1a..d00acf351249 100644
--- a/backends/igvm-cfg.c
+++ b/backends/igvm-cfg.c
@@ -12,7 +12,7 @@
#include "qemu/osdep.h"
#include "system/igvm-cfg.h"
-#include "igvm.h"
+#include "system/igvm.h"
#include "qom/object_interfaces.h"
static char *get_igvm(Object *obj, Error **errp)
diff --git a/backends/igvm.c b/backends/igvm.c
index 9ad41582ee5e..723d45b755a0 100644
--- a/backends/igvm.c
+++ b/backends/igvm.c
@@ -11,8 +11,8 @@
#include "qemu/osdep.h"
-#include "igvm.h"
#include "qapi/error.h"
+#include "system/igvm.h"
#include "system/memory.h"
#include "system/address-spaces.h"
#include "hw/core/cpu.h"
--
2.51.0
^ permalink raw reply related [flat|nested] 13+ messages in thread* Re: [PATCH v4 1/5] igvm: move igvm.h file to include/system
2025-10-22 8:44 ` [PATCH v4 1/5] igvm: move igvm.h file to include/system Gerd Hoffmann
@ 2025-10-22 12:09 ` Luigi Leonardi
0 siblings, 0 replies; 13+ messages in thread
From: Luigi Leonardi @ 2025-10-22 12:09 UTC (permalink / raw)
To: Gerd Hoffmann
Cc: qemu-devel, Stefano Garzarella, Paolo Bonzini, Ani Sinha,
Zhao Liu, Roy Hopkins
On Wed, Oct 22, 2025 at 10:44:35AM +0200, Gerd Hoffmann wrote:
>Prepare for arch-specific igvm code being added to the code base.
>
>Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
>Reviewed-by: Ani Sinha <anisinha@redhat.com>
>Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
>---
> {backends => include/system}/igvm.h | 0
> backends/igvm-cfg.c | 2 +-
> backends/igvm.c | 2 +-
> 3 files changed, 2 insertions(+), 2 deletions(-)
> rename {backends => include/system}/igvm.h (100%)
>
>diff --git a/backends/igvm.h b/include/system/igvm.h
>similarity index 100%
>rename from backends/igvm.h
>rename to include/system/igvm.h
>diff --git a/backends/igvm-cfg.c b/backends/igvm-cfg.c
>index 45df63e06c1a..d00acf351249 100644
>--- a/backends/igvm-cfg.c
>+++ b/backends/igvm-cfg.c
>@@ -12,7 +12,7 @@
> #include "qemu/osdep.h"
>
> #include "system/igvm-cfg.h"
>-#include "igvm.h"
>+#include "system/igvm.h"
> #include "qom/object_interfaces.h"
>
> static char *get_igvm(Object *obj, Error **errp)
>diff --git a/backends/igvm.c b/backends/igvm.c
>index 9ad41582ee5e..723d45b755a0 100644
>--- a/backends/igvm.c
>+++ b/backends/igvm.c
>@@ -11,8 +11,8 @@
>
> #include "qemu/osdep.h"
>
>-#include "igvm.h"
> #include "qapi/error.h"
>+#include "system/igvm.h"
> #include "system/memory.h"
> #include "system/address-spaces.h"
> #include "hw/core/cpu.h"
>--
>2.51.0
>
Reviewed-by: Luigi Leonardi <leonardi@redhat.com>
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v4 2/5] igvm: fix off by one bug in memmap entry count checking
2025-10-22 8:44 [PATCH v4 0/5] igvm: add support for igvm memory map parameter in native mode Gerd Hoffmann
2025-10-22 8:44 ` [PATCH v4 1/5] igvm: move igvm.h file to include/system Gerd Hoffmann
@ 2025-10-22 8:44 ` Gerd Hoffmann
2025-10-22 12:10 ` Luigi Leonardi
2025-10-22 12:32 ` Stefano Garzarella
2025-10-22 8:44 ` [PATCH v4 3/5] igvm: add support for igvm memory map parameter in native mode Gerd Hoffmann
` (2 subsequent siblings)
4 siblings, 2 replies; 13+ messages in thread
From: Gerd Hoffmann @ 2025-10-22 8:44 UTC (permalink / raw)
To: qemu-devel
Cc: Stefano Garzarella, Paolo Bonzini, Ani Sinha, Luigi Leonardi,
Gerd Hoffmann, Zhao Liu, Roy Hopkins
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
backends/igvm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/backends/igvm.c b/backends/igvm.c
index 723d45b755a0..055bbba745ad 100644
--- a/backends/igvm.c
+++ b/backends/igvm.c
@@ -567,7 +567,7 @@ static int qigvm_directive_memory_map(QIgvm *ctx, const uint8_t *header_data,
retval = ctx->cgsc->get_mem_map_entry(entry, &cgmm_entry, errp);
while (retval == 0) {
- if (entry > max_entry_count) {
+ if (entry >= max_entry_count) {
error_setg(
errp,
"IGVM: guest memory map size exceeds parameter area defined in IGVM file");
--
2.51.0
^ permalink raw reply related [flat|nested] 13+ messages in thread* Re: [PATCH v4 2/5] igvm: fix off by one bug in memmap entry count checking
2025-10-22 8:44 ` [PATCH v4 2/5] igvm: fix off by one bug in memmap entry count checking Gerd Hoffmann
@ 2025-10-22 12:10 ` Luigi Leonardi
2025-10-22 12:32 ` Stefano Garzarella
1 sibling, 0 replies; 13+ messages in thread
From: Luigi Leonardi @ 2025-10-22 12:10 UTC (permalink / raw)
To: Gerd Hoffmann
Cc: qemu-devel, Stefano Garzarella, Paolo Bonzini, Ani Sinha,
Zhao Liu, Roy Hopkins
On Wed, Oct 22, 2025 at 10:44:36AM +0200, Gerd Hoffmann wrote:
>Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
>---
> backends/igvm.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/backends/igvm.c b/backends/igvm.c
>index 723d45b755a0..055bbba745ad 100644
>--- a/backends/igvm.c
>+++ b/backends/igvm.c
>@@ -567,7 +567,7 @@ static int qigvm_directive_memory_map(QIgvm *ctx, const uint8_t *header_data,
>
> retval = ctx->cgsc->get_mem_map_entry(entry, &cgmm_entry, errp);
> while (retval == 0) {
>- if (entry > max_entry_count) {
>+ if (entry >= max_entry_count) {
> error_setg(
> errp,
> "IGVM: guest memory map size exceeds parameter area defined in IGVM file");
>-- 2.51.0
>
LGTM!
Reviewed-by: Luigi Leonardi <leonardi@redhat.com>
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [PATCH v4 2/5] igvm: fix off by one bug in memmap entry count checking
2025-10-22 8:44 ` [PATCH v4 2/5] igvm: fix off by one bug in memmap entry count checking Gerd Hoffmann
2025-10-22 12:10 ` Luigi Leonardi
@ 2025-10-22 12:32 ` Stefano Garzarella
1 sibling, 0 replies; 13+ messages in thread
From: Stefano Garzarella @ 2025-10-22 12:32 UTC (permalink / raw)
To: Gerd Hoffmann
Cc: qemu-devel, Paolo Bonzini, Ani Sinha, Luigi Leonardi, Zhao Liu,
Roy Hopkins
On Wed, Oct 22, 2025 at 10:44:36AM +0200, Gerd Hoffmann wrote:
Should we CC stable and add fixes tag?
Fixes: c1d466d267 ("backends/igvm: Add IGVM loader and configuration")
>Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
>---
> backends/igvm.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Thanks for fixing it!
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
>
>diff --git a/backends/igvm.c b/backends/igvm.c
>index 723d45b755a0..055bbba745ad 100644
>--- a/backends/igvm.c
>+++ b/backends/igvm.c
>@@ -567,7 +567,7 @@ static int qigvm_directive_memory_map(QIgvm *ctx, const uint8_t *header_data,
>
> retval = ctx->cgsc->get_mem_map_entry(entry, &cgmm_entry, errp);
> while (retval == 0) {
>- if (entry > max_entry_count) {
>+ if (entry >= max_entry_count) {
> error_setg(
> errp,
> "IGVM: guest memory map size exceeds parameter area defined in IGVM file");
>--
>2.51.0
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v4 3/5] igvm: add support for igvm memory map parameter in native mode
2025-10-22 8:44 [PATCH v4 0/5] igvm: add support for igvm memory map parameter in native mode Gerd Hoffmann
2025-10-22 8:44 ` [PATCH v4 1/5] igvm: move igvm.h file to include/system Gerd Hoffmann
2025-10-22 8:44 ` [PATCH v4 2/5] igvm: fix off by one bug in memmap entry count checking Gerd Hoffmann
@ 2025-10-22 8:44 ` Gerd Hoffmann
2025-10-22 12:11 ` Luigi Leonardi
2025-10-22 8:44 ` [PATCH v4 4/5] igvm: add support for initial register state load " Gerd Hoffmann
2025-10-22 8:44 ` [PATCH v4 5/5] igvm: add MAINTAINERS entry Gerd Hoffmann
4 siblings, 1 reply; 13+ messages in thread
From: Gerd Hoffmann @ 2025-10-22 8:44 UTC (permalink / raw)
To: qemu-devel
Cc: Stefano Garzarella, Paolo Bonzini, Ani Sinha, Luigi Leonardi,
Gerd Hoffmann, Zhao Liu, Roy Hopkins
Add and wire up qigvm_x86_get_mem_map_entry function which converts the
e820 table into an igvm memory map parameter. This makes igvm files for
the native (non-confidential) platform with memory map parameter work.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
---
include/system/igvm.h | 5 +++++
backends/igvm.c | 16 ++++++++++----
stubs/igvm.c | 21 +++++++++++++++++++
target/i386/igvm.c | 46 +++++++++++++++++++++++++++++++++++++++++
stubs/meson.build | 1 +
target/i386/meson.build | 3 +++
6 files changed, 88 insertions(+), 4 deletions(-)
create mode 100644 stubs/igvm.c
create mode 100644 target/i386/igvm.c
diff --git a/include/system/igvm.h b/include/system/igvm.h
index a4abab043a1f..3f72a40b8897 100644
--- a/include/system/igvm.h
+++ b/include/system/igvm.h
@@ -19,4 +19,9 @@
int qigvm_process_file(IgvmCfg *igvm, ConfidentialGuestSupport *cgs,
bool onlyVpContext, Error **errp);
+/* x86 native */
+int qigvm_x86_get_mem_map_entry(int index,
+ ConfidentialGuestMemoryMapEntry *entry,
+ Error **errp);
+
#endif
diff --git a/backends/igvm.c b/backends/igvm.c
index 055bbba745ad..2ab7a9d96565 100644
--- a/backends/igvm.c
+++ b/backends/igvm.c
@@ -12,6 +12,7 @@
#include "qemu/osdep.h"
#include "qapi/error.h"
+#include "qemu/target-info-qapi.h"
#include "system/igvm.h"
#include "system/memory.h"
#include "system/address-spaces.h"
@@ -543,6 +544,8 @@ static int qigvm_directive_memory_map(QIgvm *ctx, const uint8_t *header_data,
Error **errp)
{
const IGVM_VHS_PARAMETER *param = (const IGVM_VHS_PARAMETER *)header_data;
+ int (*get_mem_map_entry)(int index, ConfidentialGuestMemoryMapEntry *entry,
+ Error **errp) = NULL;
QIgvmParameterData *param_entry;
int max_entry_count;
int entry = 0;
@@ -550,7 +553,13 @@ static int qigvm_directive_memory_map(QIgvm *ctx, const uint8_t *header_data,
ConfidentialGuestMemoryMapEntry cgmm_entry;
int retval = 0;
- if (!ctx->cgs) {
+ if (ctx->cgs && ctx->cgsc->get_mem_map_entry) {
+ get_mem_map_entry = ctx->cgsc->get_mem_map_entry;
+
+ } else if (target_arch() == SYS_EMU_TARGET_X86_64) {
+ get_mem_map_entry = qigvm_x86_get_mem_map_entry;
+
+ } else {
error_setg(errp,
"IGVM file contains a memory map but this is not supported "
"by the current system.");
@@ -565,7 +574,7 @@ static int qigvm_directive_memory_map(QIgvm *ctx, const uint8_t *header_data,
param_entry->size / sizeof(IGVM_VHS_MEMORY_MAP_ENTRY);
mm_entry = (IGVM_VHS_MEMORY_MAP_ENTRY *)param_entry->data;
- retval = ctx->cgsc->get_mem_map_entry(entry, &cgmm_entry, errp);
+ retval = get_mem_map_entry(entry, &cgmm_entry, errp);
while (retval == 0) {
if (entry >= max_entry_count) {
error_setg(
@@ -598,8 +607,7 @@ static int qigvm_directive_memory_map(QIgvm *ctx, const uint8_t *header_data,
IGVM_MEMORY_MAP_ENTRY_TYPE_PLATFORM_RESERVED;
break;
}
- retval =
- ctx->cgsc->get_mem_map_entry(++entry, &cgmm_entry, errp);
+ retval = get_mem_map_entry(++entry, &cgmm_entry, errp);
}
if (retval < 0) {
return retval;
diff --git a/stubs/igvm.c b/stubs/igvm.c
new file mode 100644
index 000000000000..c32058eb2a6e
--- /dev/null
+++ b/stubs/igvm.c
@@ -0,0 +1,21 @@
+/*
+ * QEMU IGVM, stubs
+ *
+ * Copyright (C) 2026 Red Hat
+ *
+ * Authors:
+ * Gerd Hoffmann <kraxel@redhat.com>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "qemu/osdep.h"
+
+#include "system/igvm.h"
+
+int qigvm_x86_get_mem_map_entry(int index,
+ ConfidentialGuestMemoryMapEntry *entry,
+ Error **errp)
+{
+ return -1;
+}
diff --git a/target/i386/igvm.c b/target/i386/igvm.c
new file mode 100644
index 000000000000..2ed6cd052c79
--- /dev/null
+++ b/target/i386/igvm.c
@@ -0,0 +1,46 @@
+/*
+ * QEMU IGVM, support for native x86 guests
+ *
+ * Copyright (C) 2026 Red Hat
+ *
+ * Authors:
+ * Gerd Hoffmann <kraxel@redhat.com>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include "qemu/osdep.h"
+
+#include "hw/i386/e820_memory_layout.h"
+#include "system/igvm.h"
+
+/*
+ * convert e820 table into igvm memory map
+ */
+int qigvm_x86_get_mem_map_entry(int index,
+ ConfidentialGuestMemoryMapEntry *entry,
+ Error **errp)
+{
+ struct e820_entry *table;
+ int num_entries;
+
+ num_entries = e820_get_table(&table);
+ if ((index < 0) || (index >= num_entries)) {
+ return 1;
+ }
+ entry->gpa = table[index].address;
+ entry->size = table[index].length;
+ switch (table[index].type) {
+ case E820_RAM:
+ entry->type = CGS_MEM_RAM;
+ break;
+ case E820_RESERVED:
+ entry->type = CGS_MEM_RESERVED;
+ break;
+ default:
+ /* should not happen */
+ error_setg(errp, "unknown e820 type");
+ return -1;
+ }
+ return 0;
+}
diff --git a/stubs/meson.build b/stubs/meson.build
index 5d577467bfdd..27be2dec9f9e 100644
--- a/stubs/meson.build
+++ b/stubs/meson.build
@@ -74,6 +74,7 @@ if have_system
stub_ss.add(files('dump.c'))
stub_ss.add(files('cmos.c'))
stub_ss.add(files('fw_cfg.c'))
+ stub_ss.add(files('igvm.c'))
stub_ss.add(files('target-get-monitor-def.c'))
stub_ss.add(files('target-monitor-defs.c'))
stub_ss.add(files('win32-kbd-hook.c'))
diff --git a/target/i386/meson.build b/target/i386/meson.build
index 89ba4912aaeb..d385eafdf7e1 100644
--- a/target/i386/meson.build
+++ b/target/i386/meson.build
@@ -26,6 +26,9 @@ i386_system_ss.add(files(
))
i386_system_ss.add(when: 'CONFIG_SEV', if_true: files('sev.c'),
if_false: files('sev-system-stub.c'))
+if igvm.found()
+ i386_system_ss.add(files('igvm.c'))
+endif
i386_user_ss = ss.source_set()
--
2.51.0
^ permalink raw reply related [flat|nested] 13+ messages in thread* Re: [PATCH v4 3/5] igvm: add support for igvm memory map parameter in native mode
2025-10-22 8:44 ` [PATCH v4 3/5] igvm: add support for igvm memory map parameter in native mode Gerd Hoffmann
@ 2025-10-22 12:11 ` Luigi Leonardi
0 siblings, 0 replies; 13+ messages in thread
From: Luigi Leonardi @ 2025-10-22 12:11 UTC (permalink / raw)
To: Gerd Hoffmann
Cc: qemu-devel, Stefano Garzarella, Paolo Bonzini, Ani Sinha,
Zhao Liu, Roy Hopkins
On Wed, Oct 22, 2025 at 10:44:37AM +0200, Gerd Hoffmann wrote:
>Add and wire up qigvm_x86_get_mem_map_entry function which converts the
>e820 table into an igvm memory map parameter. This makes igvm files for
>the native (non-confidential) platform with memory map parameter work.
>
>Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
>Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
>---
> include/system/igvm.h | 5 +++++
> backends/igvm.c | 16 ++++++++++----
> stubs/igvm.c | 21 +++++++++++++++++++
> target/i386/igvm.c | 46 +++++++++++++++++++++++++++++++++++++++++
> stubs/meson.build | 1 +
> target/i386/meson.build | 3 +++
> 6 files changed, 88 insertions(+), 4 deletions(-)
> create mode 100644 stubs/igvm.c
> create mode 100644 target/i386/igvm.c
>
>diff --git a/include/system/igvm.h b/include/system/igvm.h
>index a4abab043a1f..3f72a40b8897 100644
>--- a/include/system/igvm.h
>+++ b/include/system/igvm.h
>@@ -19,4 +19,9 @@
> int qigvm_process_file(IgvmCfg *igvm, ConfidentialGuestSupport *cgs,
> bool onlyVpContext, Error **errp);
>
>+/* x86 native */
>+int qigvm_x86_get_mem_map_entry(int index,
>+ ConfidentialGuestMemoryMapEntry *entry,
>+ Error **errp);
>+
> #endif
>diff --git a/backends/igvm.c b/backends/igvm.c
>index 055bbba745ad..2ab7a9d96565 100644
>--- a/backends/igvm.c
>+++ b/backends/igvm.c
>@@ -12,6 +12,7 @@
> #include "qemu/osdep.h"
>
> #include "qapi/error.h"
>+#include "qemu/target-info-qapi.h"
> #include "system/igvm.h"
> #include "system/memory.h"
> #include "system/address-spaces.h"
>@@ -543,6 +544,8 @@ static int qigvm_directive_memory_map(QIgvm *ctx, const uint8_t *header_data,
> Error **errp)
> {
> const IGVM_VHS_PARAMETER *param = (const IGVM_VHS_PARAMETER *)header_data;
>+ int (*get_mem_map_entry)(int index, ConfidentialGuestMemoryMapEntry *entry,
>+ Error **errp) = NULL;
> QIgvmParameterData *param_entry;
> int max_entry_count;
> int entry = 0;
>@@ -550,7 +553,13 @@ static int qigvm_directive_memory_map(QIgvm *ctx, const uint8_t *header_data,
> ConfidentialGuestMemoryMapEntry cgmm_entry;
> int retval = 0;
>
>- if (!ctx->cgs) {
>+ if (ctx->cgs && ctx->cgsc->get_mem_map_entry) {
>+ get_mem_map_entry = ctx->cgsc->get_mem_map_entry;
>+
>+ } else if (target_arch() == SYS_EMU_TARGET_X86_64) {
>+ get_mem_map_entry = qigvm_x86_get_mem_map_entry;
>+
>+ } else {
> error_setg(errp,
> "IGVM file contains a memory map but this is not supported "
> "by the current system.");
>@@ -565,7 +574,7 @@ static int qigvm_directive_memory_map(QIgvm *ctx, const uint8_t *header_data,
> param_entry->size / sizeof(IGVM_VHS_MEMORY_MAP_ENTRY);
> mm_entry = (IGVM_VHS_MEMORY_MAP_ENTRY *)param_entry->data;
>
>- retval = ctx->cgsc->get_mem_map_entry(entry, &cgmm_entry, errp);
>+ retval = get_mem_map_entry(entry, &cgmm_entry, errp);
> while (retval == 0) {
> if (entry >= max_entry_count) {
> error_setg(
>@@ -598,8 +607,7 @@ static int qigvm_directive_memory_map(QIgvm *ctx, const uint8_t *header_data,
> IGVM_MEMORY_MAP_ENTRY_TYPE_PLATFORM_RESERVED;
> break;
> }
>- retval =
>- ctx->cgsc->get_mem_map_entry(++entry, &cgmm_entry, errp);
>+ retval = get_mem_map_entry(++entry, &cgmm_entry, errp);
> }
> if (retval < 0) {
> return retval;
>diff --git a/stubs/igvm.c b/stubs/igvm.c
>new file mode 100644
>index 000000000000..c32058eb2a6e
>--- /dev/null
>+++ b/stubs/igvm.c
>@@ -0,0 +1,21 @@
>+/*
>+ * QEMU IGVM, stubs
>+ *
>+ * Copyright (C) 2026 Red Hat
>+ *
>+ * Authors:
>+ * Gerd Hoffmann <kraxel@redhat.com>
>+ *
>+ * SPDX-License-Identifier: GPL-2.0-or-later
>+ */
>+
>+#include "qemu/osdep.h"
>+
>+#include "system/igvm.h"
>+
>+int qigvm_x86_get_mem_map_entry(int index,
>+ ConfidentialGuestMemoryMapEntry *entry,
>+ Error **errp)
>+{
>+ return -1;
>+}
>diff --git a/target/i386/igvm.c b/target/i386/igvm.c
>new file mode 100644
>index 000000000000..2ed6cd052c79
>--- /dev/null
>+++ b/target/i386/igvm.c
>@@ -0,0 +1,46 @@
>+/*
>+ * QEMU IGVM, support for native x86 guests
>+ *
>+ * Copyright (C) 2026 Red Hat
>+ *
>+ * Authors:
>+ * Gerd Hoffmann <kraxel@redhat.com>
>+ *
>+ * SPDX-License-Identifier: GPL-2.0-or-later
>+ */
>+
>+#include "qemu/osdep.h"
>+
>+#include "hw/i386/e820_memory_layout.h"
>+#include "system/igvm.h"
>+
>+/*
>+ * convert e820 table into igvm memory map
>+ */
>+int qigvm_x86_get_mem_map_entry(int index,
>+ ConfidentialGuestMemoryMapEntry *entry,
>+ Error **errp)
>+{
>+ struct e820_entry *table;
>+ int num_entries;
>+
>+ num_entries = e820_get_table(&table);
>+ if ((index < 0) || (index >= num_entries)) {
>+ return 1;
>+ }
>+ entry->gpa = table[index].address;
>+ entry->size = table[index].length;
>+ switch (table[index].type) {
>+ case E820_RAM:
>+ entry->type = CGS_MEM_RAM;
>+ break;
>+ case E820_RESERVED:
>+ entry->type = CGS_MEM_RESERVED;
>+ break;
>+ default:
>+ /* should not happen */
>+ error_setg(errp, "unknown e820 type");
>+ return -1;
>+ }
>+ return 0;
>+}
>diff --git a/stubs/meson.build b/stubs/meson.build
>index 5d577467bfdd..27be2dec9f9e 100644
>--- a/stubs/meson.build
>+++ b/stubs/meson.build
>@@ -74,6 +74,7 @@ if have_system
> stub_ss.add(files('dump.c'))
> stub_ss.add(files('cmos.c'))
> stub_ss.add(files('fw_cfg.c'))
>+ stub_ss.add(files('igvm.c'))
> stub_ss.add(files('target-get-monitor-def.c'))
> stub_ss.add(files('target-monitor-defs.c'))
> stub_ss.add(files('win32-kbd-hook.c'))
>diff --git a/target/i386/meson.build b/target/i386/meson.build
>index 89ba4912aaeb..d385eafdf7e1 100644
>--- a/target/i386/meson.build
>+++ b/target/i386/meson.build
>@@ -26,6 +26,9 @@ i386_system_ss.add(files(
> ))
> i386_system_ss.add(when: 'CONFIG_SEV', if_true: files('sev.c'),
> if_false: files('sev-system-stub.c'))
>+if igvm.found()
>+ i386_system_ss.add(files('igvm.c'))
>+endif
>
> i386_user_ss = ss.source_set()
>
>--
>2.51.0
>
LGTM!
Reviewed-by: Luigi Leonardi <leonardi@redhat.com>
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v4 4/5] igvm: add support for initial register state load in native mode
2025-10-22 8:44 [PATCH v4 0/5] igvm: add support for igvm memory map parameter in native mode Gerd Hoffmann
` (2 preceding siblings ...)
2025-10-22 8:44 ` [PATCH v4 3/5] igvm: add support for igvm memory map parameter in native mode Gerd Hoffmann
@ 2025-10-22 8:44 ` Gerd Hoffmann
2025-10-22 13:22 ` Luigi Leonardi
2025-10-22 8:44 ` [PATCH v4 5/5] igvm: add MAINTAINERS entry Gerd Hoffmann
4 siblings, 1 reply; 13+ messages in thread
From: Gerd Hoffmann @ 2025-10-22 8:44 UTC (permalink / raw)
To: qemu-devel
Cc: Stefano Garzarella, Paolo Bonzini, Ani Sinha, Luigi Leonardi,
Gerd Hoffmann, Zhao Liu, Roy Hopkins
Add IgvmNativeVpContextX64 struct holding the register state (see igvm
spec), and the qigvm_x86_load_context() function to load the register
state.
Wire up using two new functions: qigvm_x86_set_vp_context() is called
from igvm file handling code and stores the boot processor context.
qigvm_x86_bsp_reset() is called from i386 target cpu reset code and
loads the context into the cpu registers.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
---
include/system/igvm.h | 2 +
target/i386/cpu.h | 3 +
backends/igvm.c | 30 +++++-----
stubs/igvm.c | 5 ++
target/i386/cpu.c | 6 ++
target/i386/igvm.c | 134 ++++++++++++++++++++++++++++++++++++++++++
6 files changed, 165 insertions(+), 15 deletions(-)
diff --git a/include/system/igvm.h b/include/system/igvm.h
index 3f72a40b8897..48ce20604259 100644
--- a/include/system/igvm.h
+++ b/include/system/igvm.h
@@ -23,5 +23,7 @@ int qigvm_process_file(IgvmCfg *igvm, ConfidentialGuestSupport *cgs,
int qigvm_x86_get_mem_map_entry(int index,
ConfidentialGuestMemoryMapEntry *entry,
Error **errp);
+int qigvm_x86_set_vp_context(void *data, int index,
+ Error **errp);
#endif
diff --git a/target/i386/cpu.h b/target/i386/cpu.h
index ce948861a765..78d4b427c67a 100644
--- a/target/i386/cpu.h
+++ b/target/i386/cpu.h
@@ -2867,6 +2867,9 @@ void x86_cpu_dump_local_apic_state(CPUState *cs, int flags);
#endif
+/* igvm.c */
+void qigvm_x86_bsp_reset(CPUX86State *env);
+
/* cpu.c */
bool cpu_is_bsp(X86CPU *cpu);
diff --git a/backends/igvm.c b/backends/igvm.c
index 2ab7a9d96565..905bd8d98994 100644
--- a/backends/igvm.c
+++ b/backends/igvm.c
@@ -432,18 +432,6 @@ static int qigvm_directive_vp_context(QIgvm *ctx, const uint8_t *header_data,
return 0;
}
- /*
- * A confidential guest support object must be provided for setting
- * a VP context.
- */
- if (!ctx->cgs) {
- error_setg(
- errp,
- "A VP context is present in the IGVM file but is not supported "
- "by the current system.");
- return -1;
- }
-
data_handle = igvm_get_header_data(ctx->file, IGVM_HEADER_SECTION_DIRECTIVE,
ctx->current_header_index);
if (data_handle < 0) {
@@ -453,9 +441,21 @@ static int qigvm_directive_vp_context(QIgvm *ctx, const uint8_t *header_data,
}
data = (uint8_t *)igvm_get_buffer(ctx->file, data_handle);
- result = ctx->cgsc->set_guest_state(
- vp_context->gpa, data, igvm_get_buffer_size(ctx->file, data_handle),
- CGS_PAGE_TYPE_VMSA, vp_context->vp_index, errp);
+
+ if (ctx->cgs) {
+ result = ctx->cgsc->set_guest_state(
+ vp_context->gpa, data, igvm_get_buffer_size(ctx->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);
+ } else {
+ error_setg(
+ errp,
+ "A VP context is present in the IGVM file but is not supported "
+ "by the current system.");
+ result = -1;
+ }
+
igvm_free_buffer(ctx->file, data_handle);
if (result < 0) {
return result;
diff --git a/stubs/igvm.c b/stubs/igvm.c
index c32058eb2a6e..17cd1e903e35 100644
--- a/stubs/igvm.c
+++ b/stubs/igvm.c
@@ -19,3 +19,8 @@ int qigvm_x86_get_mem_map_entry(int index,
{
return -1;
}
+
+int qigvm_x86_set_vp_context(void *data, int index, Error **errp)
+{
+ return -1;
+}
diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 455caff6b230..e00936e4b542 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -8770,6 +8770,12 @@ static void x86_cpu_reset_hold(Object *obj, ResetType type)
cs->halted = !cpu_is_bsp(cpu);
+#if defined(CONFIG_IGVM)
+ if (cpu_is_bsp(cpu)) {
+ qigvm_x86_bsp_reset(env);
+ }
+#endif
+
if (kvm_enabled()) {
kvm_arch_reset_vcpu(cpu);
}
diff --git a/target/i386/igvm.c b/target/i386/igvm.c
index 2ed6cd052c79..457c253b030c 100644
--- a/target/i386/igvm.c
+++ b/target/i386/igvm.c
@@ -11,9 +11,115 @@
#include "qemu/osdep.h"
+#include "cpu.h"
#include "hw/i386/e820_memory_layout.h"
#include "system/igvm.h"
+struct IgvmNativeVpContextX64 {
+ uint64_t rax;
+ uint64_t rcx;
+ uint64_t rdx;
+ uint64_t rbx;
+ uint64_t rsp;
+ uint64_t rbp;
+ uint64_t rsi;
+ uint64_t rdi;
+ uint64_t r8;
+ uint64_t r9;
+ uint64_t r10;
+ uint64_t r11;
+ uint64_t r12;
+ uint64_t r13;
+ uint64_t r14;
+ uint64_t r15;
+ uint64_t rip;
+ uint64_t rflags;
+ uint64_t idtr_base;
+ uint16_t idtr_limit;
+ uint16_t reserved[2];
+ uint16_t gdtr_limit;
+ uint64_t gdtr_base;
+
+ uint16_t code_selector;
+ uint16_t code_attributes;
+ uint32_t code_base;
+ uint32_t code_limit;
+
+ uint16_t data_selector;
+ uint16_t data_attributes;
+ uint32_t data_base;
+ uint32_t data_limit;
+
+ uint64_t gs_base;
+ uint64_t cr0;
+ uint64_t cr3;
+ uint64_t cr4;
+ uint64_t efer;
+};
+
+#define FLAGS_TO_SEGCACHE(flags) \
+ (((unsigned int)flags) << 8)
+
+static void qigvm_x86_load_context(struct IgvmNativeVpContextX64 *context,
+ CPUX86State *env)
+{
+ cpu_load_efer(env, context->efer);
+ cpu_x86_update_cr4(env, context->cr4);
+ cpu_x86_update_cr0(env, context->cr0);
+ cpu_x86_update_cr3(env, context->cr3);
+
+ cpu_x86_load_seg_cache(
+ env, R_CS, context->code_selector,
+ context->code_base, context->code_limit,
+ FLAGS_TO_SEGCACHE(context->code_attributes));
+ cpu_x86_load_seg_cache(
+ env, R_DS, context->data_selector,
+ context->data_base, context->data_limit,
+ FLAGS_TO_SEGCACHE(context->data_attributes));
+ cpu_x86_load_seg_cache(
+ env, R_ES, context->data_selector,
+ context->data_base, context->data_limit,
+ FLAGS_TO_SEGCACHE(context->data_attributes));
+ cpu_x86_load_seg_cache(
+ env, R_FS, context->data_selector,
+ context->data_base, context->data_limit,
+ FLAGS_TO_SEGCACHE(context->data_attributes));
+ cpu_x86_load_seg_cache(
+ env, R_GS, context->data_selector,
+ context->data_base, context->data_limit,
+ FLAGS_TO_SEGCACHE(context->data_attributes));
+ cpu_x86_load_seg_cache(
+ env, R_SS, context->data_selector,
+ context->data_base, context->data_limit,
+ FLAGS_TO_SEGCACHE(context->data_attributes));
+
+ env->gdt.base = context->gdtr_base;
+ env->gdt.limit = context->gdtr_limit;
+ env->idt.base = context->idtr_base;
+ env->idt.limit = context->idtr_limit;
+
+ env->regs[R_EAX] = context->rax;
+ env->regs[R_ECX] = context->rcx;
+ env->regs[R_EDX] = context->rdx;
+ env->regs[R_EBX] = context->rbx;
+ env->regs[R_ESP] = context->rsp;
+ env->regs[R_EBP] = context->rbp;
+ env->regs[R_ESI] = context->rsi;
+ env->regs[R_EDI] = context->rdi;
+#ifdef TARGET_X86_64
+ env->regs[R_R8] = context->r8;
+ env->regs[R_R9] = context->r9;
+ env->regs[R_R10] = context->r10;
+ env->regs[R_R11] = context->r11;
+ env->regs[R_R12] = context->r12;
+ env->regs[R_R13] = context->r13;
+ env->regs[R_R14] = context->r14;
+ env->regs[R_R15] = context->r15;
+#endif
+ env->eip = context->rip;
+ env->eflags = context->rflags;
+}
+
/*
* convert e820 table into igvm memory map
*/
@@ -44,3 +150,31 @@ int qigvm_x86_get_mem_map_entry(int index,
}
return 0;
}
+
+/*
+ * set initial cpu context
+ */
+static struct IgvmNativeVpContextX64 *bsp_context;
+
+int qigvm_x86_set_vp_context(void *data, int index, Error **errp)
+{
+ if (index != 0) {
+ error_setg(errp, "context can be set for BSP only");
+ return -1;
+ }
+
+ if (bsp_context == NULL) {
+ bsp_context = g_new0(struct IgvmNativeVpContextX64, 1);
+ }
+ memcpy(bsp_context, data, sizeof(struct IgvmNativeVpContextX64));
+ return 0;
+}
+
+void qigvm_x86_bsp_reset(CPUX86State *env)
+{
+ if (bsp_context == NULL) {
+ return;
+ }
+
+ qigvm_x86_load_context(bsp_context, env);
+}
--
2.51.0
^ permalink raw reply related [flat|nested] 13+ messages in thread* Re: [PATCH v4 4/5] igvm: add support for initial register state load in native mode
2025-10-22 8:44 ` [PATCH v4 4/5] igvm: add support for initial register state load " Gerd Hoffmann
@ 2025-10-22 13:22 ` Luigi Leonardi
2025-10-22 14:37 ` Gerd Hoffmann
0 siblings, 1 reply; 13+ messages in thread
From: Luigi Leonardi @ 2025-10-22 13:22 UTC (permalink / raw)
To: Gerd Hoffmann
Cc: qemu-devel, Stefano Garzarella, Paolo Bonzini, Ani Sinha,
Zhao Liu, Roy Hopkins
On Wed, Oct 22, 2025 at 10:44:38AM +0200, Gerd Hoffmann wrote:
>Add IgvmNativeVpContextX64 struct holding the register state (see igvm
>spec), and the qigvm_x86_load_context() function to load the register
>state.
>
>Wire up using two new functions: qigvm_x86_set_vp_context() is called
>from igvm file handling code and stores the boot processor context.
>qigvm_x86_bsp_reset() is called from i386 target cpu reset code and
>loads the context into the cpu registers.
>
>Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
>Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
>---
> include/system/igvm.h | 2 +
> target/i386/cpu.h | 3 +
> backends/igvm.c | 30 +++++-----
> stubs/igvm.c | 5 ++
> target/i386/cpu.c | 6 ++
> target/i386/igvm.c | 134 ++++++++++++++++++++++++++++++++++++++++++
> 6 files changed, 165 insertions(+), 15 deletions(-)
>
>diff --git a/include/system/igvm.h b/include/system/igvm.h
>index 3f72a40b8897..48ce20604259 100644
>--- a/include/system/igvm.h
>+++ b/include/system/igvm.h
>@@ -23,5 +23,7 @@ int qigvm_process_file(IgvmCfg *igvm, ConfidentialGuestSupport *cgs,
> int qigvm_x86_get_mem_map_entry(int index,
> ConfidentialGuestMemoryMapEntry *entry,
> Error **errp);
>+int qigvm_x86_set_vp_context(void *data, int index,
>+ Error **errp);
>
> #endif
>diff --git a/target/i386/cpu.h b/target/i386/cpu.h
>index ce948861a765..78d4b427c67a 100644
>--- a/target/i386/cpu.h
>+++ b/target/i386/cpu.h
>@@ -2867,6 +2867,9 @@ void x86_cpu_dump_local_apic_state(CPUState *cs, int flags);
>
> #endif
>
>+/* igvm.c */
>+void qigvm_x86_bsp_reset(CPUX86State *env);
>+
> /* cpu.c */
> bool cpu_is_bsp(X86CPU *cpu);
>
>diff --git a/backends/igvm.c b/backends/igvm.c
>index 2ab7a9d96565..905bd8d98994 100644
>--- a/backends/igvm.c
>+++ b/backends/igvm.c
>@@ -432,18 +432,6 @@ static int qigvm_directive_vp_context(QIgvm *ctx, const uint8_t *header_data,
> return 0;
> }
>
>- /*
>- * A confidential guest support object must be provided for setting
>- * a VP context.
>- */
>- if (!ctx->cgs) {
>- error_setg(
>- errp,
>- "A VP context is present in the IGVM file but is not supported "
>- "by the current system.");
>- return -1;
>- }
>-
> data_handle = igvm_get_header_data(ctx->file, IGVM_HEADER_SECTION_DIRECTIVE,
> ctx->current_header_index);
> if (data_handle < 0) {
>@@ -453,9 +441,21 @@ static int qigvm_directive_vp_context(QIgvm *ctx, const uint8_t *header_data,
> }
>
> data = (uint8_t *)igvm_get_buffer(ctx->file, data_handle);
>- result = ctx->cgsc->set_guest_state(
>- vp_context->gpa, data, igvm_get_buffer_size(ctx->file, data_handle),
>- CGS_PAGE_TYPE_VMSA, vp_context->vp_index, errp);
>+
>+ if (ctx->cgs) {
>+ result = ctx->cgsc->set_guest_state(
>+ vp_context->gpa, data, igvm_get_buffer_size(ctx->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);
>+ } else {
>+ error_setg(
>+ errp,
>+ "A VP context is present in the IGVM file but is not supported "
>+ "by the current system.");
>+ result = -1;
>+ }
>+
> igvm_free_buffer(ctx->file, data_handle);
> if (result < 0) {
> return result;
>diff --git a/stubs/igvm.c b/stubs/igvm.c
>index c32058eb2a6e..17cd1e903e35 100644
>--- a/stubs/igvm.c
>+++ b/stubs/igvm.c
>@@ -19,3 +19,8 @@ int qigvm_x86_get_mem_map_entry(int index,
> {
> return -1;
> }
>+
>+int qigvm_x86_set_vp_context(void *data, int index, Error **errp)
>+{
>+ return -1;
>+}
>diff --git a/target/i386/cpu.c b/target/i386/cpu.c
>index 455caff6b230..e00936e4b542 100644
>--- a/target/i386/cpu.c
>+++ b/target/i386/cpu.c
>@@ -8770,6 +8770,12 @@ static void x86_cpu_reset_hold(Object *obj, ResetType type)
>
> cs->halted = !cpu_is_bsp(cpu);
>
>+#if defined(CONFIG_IGVM)
>+ if (cpu_is_bsp(cpu)) {
>+ qigvm_x86_bsp_reset(env);
>+ }
>+#endif
>+
> if (kvm_enabled()) {
> kvm_arch_reset_vcpu(cpu);
> }
>diff --git a/target/i386/igvm.c b/target/i386/igvm.c
>index 2ed6cd052c79..457c253b030c 100644
>--- a/target/i386/igvm.c
>+++ b/target/i386/igvm.c
>@@ -11,9 +11,115 @@
>
> #include "qemu/osdep.h"
>
>+#include "cpu.h"
> #include "hw/i386/e820_memory_layout.h"
> #include "system/igvm.h"
>
>+struct IgvmNativeVpContextX64 {
>+ uint64_t rax;
>+ uint64_t rcx;
>+ uint64_t rdx;
>+ uint64_t rbx;
>+ uint64_t rsp;
>+ uint64_t rbp;
>+ uint64_t rsi;
>+ uint64_t rdi;
>+ uint64_t r8;
>+ uint64_t r9;
>+ uint64_t r10;
>+ uint64_t r11;
>+ uint64_t r12;
>+ uint64_t r13;
>+ uint64_t r14;
>+ uint64_t r15;
>+ uint64_t rip;
>+ uint64_t rflags;
>+ uint64_t idtr_base;
>+ uint16_t idtr_limit;
>+ uint16_t reserved[2];
>+ uint16_t gdtr_limit;
>+ uint64_t gdtr_base;
>+
>+ uint16_t code_selector;
>+ uint16_t code_attributes;
>+ uint32_t code_base;
>+ uint32_t code_limit;
>+
>+ uint16_t data_selector;
>+ uint16_t data_attributes;
>+ uint32_t data_base;
>+ uint32_t data_limit;
>+
>+ uint64_t gs_base;
>+ uint64_t cr0;
>+ uint64_t cr3;
>+ uint64_t cr4;
>+ uint64_t efer;
>+};
>+
>+#define FLAGS_TO_SEGCACHE(flags) \
>+ (((unsigned int)flags) << 8)
>+
>+static void qigvm_x86_load_context(struct IgvmNativeVpContextX64 *context,
>+ CPUX86State *env)
>+{
>+ cpu_load_efer(env, context->efer);
>+ cpu_x86_update_cr4(env, context->cr4);
>+ cpu_x86_update_cr0(env, context->cr0);
>+ cpu_x86_update_cr3(env, context->cr3);
>+
>+ cpu_x86_load_seg_cache(
>+ env, R_CS, context->code_selector,
>+ context->code_base, context->code_limit,
>+ FLAGS_TO_SEGCACHE(context->code_attributes));
>+ cpu_x86_load_seg_cache(
>+ env, R_DS, context->data_selector,
>+ context->data_base, context->data_limit,
>+ FLAGS_TO_SEGCACHE(context->data_attributes));
>+ cpu_x86_load_seg_cache(
>+ env, R_ES, context->data_selector,
>+ context->data_base, context->data_limit,
>+ FLAGS_TO_SEGCACHE(context->data_attributes));
>+ cpu_x86_load_seg_cache(
>+ env, R_FS, context->data_selector,
>+ context->data_base, context->data_limit,
>+ FLAGS_TO_SEGCACHE(context->data_attributes));
>+ cpu_x86_load_seg_cache(
>+ env, R_GS, context->data_selector,
>+ context->data_base, context->data_limit,
>+ FLAGS_TO_SEGCACHE(context->data_attributes));
>+ cpu_x86_load_seg_cache(
>+ env, R_SS, context->data_selector,
>+ context->data_base, context->data_limit,
>+ FLAGS_TO_SEGCACHE(context->data_attributes));
IIUC `R_TR` and `R_LDTR` are used by HVF in QEMU. Is there a reason why
you didn't add them here?
Rest LGTM!
Thanks,
Luigi
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [PATCH v4 4/5] igvm: add support for initial register state load in native mode
2025-10-22 13:22 ` Luigi Leonardi
@ 2025-10-22 14:37 ` Gerd Hoffmann
2025-10-22 15:26 ` Luigi Leonardi
0 siblings, 1 reply; 13+ messages in thread
From: Gerd Hoffmann @ 2025-10-22 14:37 UTC (permalink / raw)
To: Luigi Leonardi
Cc: qemu-devel, Stefano Garzarella, Paolo Bonzini, Ani Sinha,
Zhao Liu, Roy Hopkins
Hi,
> > +struct IgvmNativeVpContextX64 {
> > + uint64_t rax;
> > + uint64_t rcx;
> > + uint64_t rdx;
> > + uint64_t rbx;
> > + uint64_t rsp;
> > + uint64_t rbp;
> > + uint64_t rsi;
> > + uint64_t rdi;
> > + uint64_t r8;
> > + uint64_t r9;
> > + uint64_t r10;
> > + uint64_t r11;
> > + uint64_t r12;
> > + uint64_t r13;
> > + uint64_t r14;
> > + uint64_t r15;
> > + uint64_t rip;
> > + uint64_t rflags;
> > + uint64_t idtr_base;
> > + uint16_t idtr_limit;
> > + uint16_t reserved[2];
> > + uint16_t gdtr_limit;
> > + uint64_t gdtr_base;
> > +
> > + uint16_t code_selector;
> > + uint16_t code_attributes;
> > + uint32_t code_base;
> > + uint32_t code_limit;
> > +
> > + uint16_t data_selector;
> > + uint16_t data_attributes;
> > + uint32_t data_base;
> > + uint32_t data_limit;
> > +
> > + uint64_t gs_base;
> > + uint64_t cr0;
> > + uint64_t cr3;
> > + uint64_t cr4;
> > + uint64_t efer;
> > +};
> IIUC `R_TR` and `R_LDTR` are used by HVF in QEMU. Is there a reason why you
> didn't add them here?
They are not present in IgvmNativeVpContextX64, so you can't set them
via igvm for the initial vcpu state. Of course the guest can set them
later on.
take care,
Gerd
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [PATCH v4 4/5] igvm: add support for initial register state load in native mode
2025-10-22 14:37 ` Gerd Hoffmann
@ 2025-10-22 15:26 ` Luigi Leonardi
0 siblings, 0 replies; 13+ messages in thread
From: Luigi Leonardi @ 2025-10-22 15:26 UTC (permalink / raw)
To: Gerd Hoffmann
Cc: qemu-devel, Stefano Garzarella, Paolo Bonzini, Ani Sinha,
Zhao Liu, Roy Hopkins
Hi Gerd,
On Wed, Oct 22, 2025 at 04:37:33PM +0200, Gerd Hoffmann wrote:
> Hi,
>
>> > +struct IgvmNativeVpContextX64 {
>> > + uint64_t rax;
>> > + uint64_t rcx;
>> > + uint64_t rdx;
>> > + uint64_t rbx;
>> > + uint64_t rsp;
>> > + uint64_t rbp;
>> > + uint64_t rsi;
>> > + uint64_t rdi;
>> > + uint64_t r8;
>> > + uint64_t r9;
>> > + uint64_t r10;
>> > + uint64_t r11;
>> > + uint64_t r12;
>> > + uint64_t r13;
>> > + uint64_t r14;
>> > + uint64_t r15;
>> > + uint64_t rip;
>> > + uint64_t rflags;
>> > + uint64_t idtr_base;
>> > + uint16_t idtr_limit;
>> > + uint16_t reserved[2];
>> > + uint16_t gdtr_limit;
>> > + uint64_t gdtr_base;
>> > +
>> > + uint16_t code_selector;
>> > + uint16_t code_attributes;
>> > + uint32_t code_base;
>> > + uint32_t code_limit;
>> > +
>> > + uint16_t data_selector;
>> > + uint16_t data_attributes;
>> > + uint32_t data_base;
>> > + uint32_t data_limit;
>> > +
>> > + uint64_t gs_base;
>> > + uint64_t cr0;
>> > + uint64_t cr3;
>> > + uint64_t cr4;
>> > + uint64_t efer;
>> > +};
>
>> IIUC `R_TR` and `R_LDTR` are used by HVF in QEMU. Is there a reason
>> why you
>> didn't add them here?
>
>They are not present in IgvmNativeVpContextX64, so you can't set them
>via igvm for the initial vcpu state. Of course the guest can set them
>later on.
>
Thanks for the clarification.
Reviewed-by: Luigi Leonardi <leonardi@redhat.com>
>take care,
> Gerd
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v4 5/5] igvm: add MAINTAINERS entry
2025-10-22 8:44 [PATCH v4 0/5] igvm: add support for igvm memory map parameter in native mode Gerd Hoffmann
` (3 preceding siblings ...)
2025-10-22 8:44 ` [PATCH v4 4/5] igvm: add support for initial register state load " Gerd Hoffmann
@ 2025-10-22 8:44 ` Gerd Hoffmann
4 siblings, 0 replies; 13+ messages in thread
From: Gerd Hoffmann @ 2025-10-22 8:44 UTC (permalink / raw)
To: qemu-devel
Cc: Stefano Garzarella, Paolo Bonzini, Ani Sinha, Luigi Leonardi,
Gerd Hoffmann, Zhao Liu, Roy Hopkins
Add Roy (being the original author) as maintainer. Add myself
and Ani as reviewer. Status to be decided.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
MAINTAINERS | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/MAINTAINERS b/MAINTAINERS
index 0c766961f39a..1c4904ad9187 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -3892,6 +3892,16 @@ F: roms/edk2-*
F: tests/data/uefi-boot-images/
F: tests/uefi-test-tools/
+IGVM Firmware
+M: Roy Hopkins <roy.hopkins@randomman.co.uk>
+R: Gerd Hoffmann <kraxel@redhat.com>
+R: Ani Sinha <anisinha@redhat.com>
+S: TBD
+F: backends/igvm*.c
+F: include/system/igvm*.h
+F: stubs/igvm.c
+F: target/i386/igvm.c
+
VT-d Emulation
M: Michael S. Tsirkin <mst@redhat.com>
R: Jason Wang <jasowang@redhat.com>
--
2.51.0
^ permalink raw reply related [flat|nested] 13+ messages in thread