Hi Gerd,

On Thu, Dec 11, 2025 at 11:54:15AM +0100, Gerd Hoffmann wrote:
Add a new igvm-internal.h header file.  Structs and declarations which
depend on the igvm library header go into that file.

Also declare IgvmCfg in typedefs.h, so the type can be used without
including igvm header files.

Signed-off-by: Gerd Hoffmann <[email protected]>
---
include/qemu/typedefs.h        |  1 +
include/system/igvm-cfg.h      | 12 +-----------
include/system/igvm-internal.h | 26 ++++++++++++++++++++++++++
include/system/igvm.h          |  2 +-
backends/igvm-cfg.c            |  4 +++-
backends/igvm.c                |  2 ++
6 files changed, 34 insertions(+), 13 deletions(-)
create mode 100644 include/system/igvm-internal.h

diff --git a/include/qemu/typedefs.h b/include/qemu/typedefs.h
index 4a94af9665a5..416a8c9acead 100644
--- a/include/qemu/typedefs.h
+++ b/include/qemu/typedefs.h
@@ -55,6 +55,7 @@ typedef struct FWCfgState FWCfgState;
typedef struct HostMemoryBackend HostMemoryBackend;
typedef struct I2CBus I2CBus;
typedef struct I2SCodec I2SCodec;
+typedef struct IgvmCfg IgvmCfg;
typedef struct IOMMUMemoryRegion IOMMUMemoryRegion;
typedef struct ISABus ISABus;
typedef struct ISADevice ISADevice;
diff --git a/include/system/igvm-cfg.h b/include/system/igvm-cfg.h
index 944f23a814dd..6c07f3084082 100644
--- a/include/system/igvm-cfg.h
+++ b/include/system/igvm-cfg.h
@@ -12,19 +12,9 @@
#ifndef QEMU_IGVM_CFG_H
#define QEMU_IGVM_CFG_H

+#include "qemu/typedefs.h"
#include "qom/object.h"

-typedef struct IgvmCfg {
-    ObjectClass parent_class;
-
-    /*
-     * filename: Filename that specifies a file that contains the configuration
-     *           of the guest in Independent Guest Virtual Machine (IGVM)
-     *           format.
-     */
-    char *filename;
-} IgvmCfg;
-
typedef struct IgvmCfgClass {
    ObjectClass parent_class;

diff --git a/include/system/igvm-internal.h b/include/system/igvm-internal.h
new file mode 100644
index 000000000000..475a29bbf3d7
--- /dev/null
+++ b/include/system/igvm-internal.h
@@ -0,0 +1,26 @@
+/*
+ * QEMU IGVM private data structures
+ *
+ * Everything which depends on igvm library headers goes here.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#ifndef QEMU_IGVM_INTERNAL_H
+#define QEMU_IGVM_INTERNAL_H
+
+#include "qemu/typedefs.h"
+#include "qom/object.h"
+
+struct IgvmCfg {
+    ObjectClass parent_class;
+
+    /*
+     * filename: Filename that specifies a file that contains the configuration
+     *           of the guest in Independent Guest Virtual Machine (IGVM)
+     *           format.
+     */
+    char *filename;
+};
+
+#endif
diff --git a/include/system/igvm.h b/include/system/igvm.h
index 48ce20604259..8355e54e95fc 100644
--- a/include/system/igvm.h
+++ b/include/system/igvm.h
@@ -12,8 +12,8 @@
#ifndef BACKENDS_IGVM_H
#define BACKENDS_IGVM_H

+#include "qemu/typedefs.h"
#include "system/confidential-guest-support.h"
-#include "system/igvm-cfg.h"
#include "qapi/error.h"

int qigvm_process_file(IgvmCfg *igvm, ConfidentialGuestSupport *cgs,
diff --git a/backends/igvm-cfg.c b/backends/igvm-cfg.c
index d00acf351249..001c4dc93346 100644
--- a/backends/igvm-cfg.c
+++ b/backends/igvm-cfg.c
@@ -11,8 +11,10 @@

#include "qemu/osdep.h"

-#include "system/igvm-cfg.h"
#include "system/igvm.h"
+#include "system/igvm-cfg.h"
+#include "system/igvm-internal.h"
+#include "system/reset.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 905bd8d98994..fbb8300b6d01 100644
--- a/backends/igvm.c
+++ b/backends/igvm.c
@@ -14,6 +14,8 @@
#include "qapi/error.h"
#include "qemu/target-info-qapi.h"
#include "system/igvm.h"
+#include "system/igvm-cfg.h"
+#include "system/igvm-internal.h"
#include "system/memory.h"
#include "system/address-spaces.h"
#include "hw/core/cpu.h"
--
2.52.0


Should we add `igvm-internal.h` to the MAINTAINERS file?

Thanks,
Luigi


Reply via email to