@samitouri / QOSamiQemu / commits / 5c45204e34

igvm: fix build when igvm is not installed in a well known path

`stubs/igvm.c` includes `igvm-internal.h`, that in turn includes the igvm library. This is required just for the QIgvm declaration and creates an unnecessary dependency on the library. Since igvm is not listed as a dependency of stubs, this results in build failing when the library is not installed in a "well known" path of the system. Add a forward declaration for QIgvm and move the definition of `qigvm_directive_madt` to `igvm.h` so that we can drop `igvm-internal.h` from `stubs/igvm.c`. Fixes: dea1f68a5c ("igvm: Fill MADT IGVM parameter field on x86_64") Suggested-by: Stefano Garzarella <sgarzare@redhat.com> Signed-off-by: Luigi Leonardi <leonardi@redhat.com> Message-ID: <20260309-master-v2-1-7e02f07a1096@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>

Luigi Leonardi committed Mar 9, 2026 at 09:55 UTC 5c45204e34bd5179c30958aa47bb3eee150973e1
4 files changed +8 -8
include/qemu/typedefs.h
+1
@@ -102,6 +102,7 @@ typedef struct QEMUSGList QEMUSGList;
102 typedef struct QemuSpin QemuSpin;
103 typedef struct QEMUTimer QEMUTimer;
104 typedef struct QEMUTimerListGroup QEMUTimerListGroup;
105 +typedef struct QIgvm QIgvm;
106 typedef struct QList QList;
107 typedef struct QNull QNull;
108 typedef struct QNum QNum;
include/system/igvm-internal.h
+2 -7
@@ -42,7 +42,7 @@ typedef struct QIgvmParameterData {
42 * QIgvm contains the information required during processing of a single IGVM
43 * file.
44 */
45 -typedef struct QIgvm {
45 +struct QIgvm {
46 IgvmHandle file;
47 MachineState *machine_state;
48 ConfidentialGuestSupportClass *cgsc;
@@ -67,16 +67,11 @@ typedef struct QIgvm {
67 unsigned region_start_index;
68 unsigned region_last_index;
69 unsigned region_page_count;
70 -} QIgvm;
70 +};
71
72 IgvmHandle qigvm_file_init(char *filename, Error **errp);
73
74 QIgvmParameterData*
75 qigvm_find_param_entry(QIgvm *igvm, uint32_t parameter_area_index);
76
77 -/*
78 - * IGVM parameter handlers
79 - */
80 -int qigvm_directive_madt(QIgvm *ctx, const uint8_t *header_data, Error **errp);
81 -
77 #endif
include/system/igvm.h
+5
@@ -27,4 +27,9 @@ int qigvm_x86_get_mem_map_entry(int index,
27 int qigvm_x86_set_vp_context(void *data, int index,
28 Error **errp);
29
30 +/*
31 + * IGVM parameter handlers
32 + */
33 +int qigvm_directive_madt(QIgvm *ctx, const uint8_t *header_data, Error **errp);
34 +
35 #endif
stubs/igvm.c
-1
@@ -12,7 +12,6 @@
12 #include "qemu/osdep.h"
13
14 #include "system/igvm.h"
15 -#include "system/igvm-internal.h"
15
16 int qigvm_x86_get_mem_map_entry(int index,
17 ConfidentialGuestMemoryMapEntry *entry,