Header file where CONFIG_VFIO is defined is not included in migration.c file.
Moved populate_vfio_info() to hw/vfio/common.c file. Added its stub in stubs/vfio.c file. Updated header files and meson file accordingly. Fixes: 3710586caa5d ("qapi: Add VFIO devices migration stats in Migration stats") Signed-off-by: Kirti Wankhede <kwankh...@nvidia.com> --- hw/vfio/common.c | 12 +++++++++++- include/hw/vfio/vfio-common.h | 1 - include/hw/vfio/vfio.h | 2 ++ migration/migration.c | 16 +--------------- stubs/meson.build | 1 + stubs/vfio.c | 7 +++++++ 6 files changed, 22 insertions(+), 17 deletions(-) create mode 100644 stubs/vfio.c diff --git a/hw/vfio/common.c b/hw/vfio/common.c index 6ff1daa763f8..4868c0fef504 100644 --- a/hw/vfio/common.c +++ b/hw/vfio/common.c @@ -25,6 +25,7 @@ #endif #include <linux/vfio.h> +#include "qapi/qapi-types-migration.h" #include "hw/vfio/vfio-common.h" #include "hw/vfio/vfio.h" #include "exec/address-spaces.h" @@ -292,7 +293,7 @@ const MemoryRegionOps vfio_region_ops = { * Device state interfaces */ -bool vfio_mig_active(void) +static bool vfio_mig_active(void) { VFIOGroup *group; VFIODevice *vbasedev; @@ -311,6 +312,15 @@ bool vfio_mig_active(void) return true; } +void populate_vfio_info(MigrationInfo *info) +{ + if (vfio_mig_active()) { + info->has_vfio = true; + info->vfio = g_malloc0(sizeof(*info->vfio)); + info->vfio->transferred = vfio_mig_bytes_transferred(); + } +} + static bool vfio_devices_all_saving(VFIOContainer *container) { VFIOGroup *group; diff --git a/include/hw/vfio/vfio-common.h b/include/hw/vfio/vfio-common.h index 6141162d7aea..cc47bd7d4456 100644 --- a/include/hw/vfio/vfio-common.h +++ b/include/hw/vfio/vfio-common.h @@ -205,7 +205,6 @@ extern const MemoryRegionOps vfio_region_ops; typedef QLIST_HEAD(VFIOGroupList, VFIOGroup) VFIOGroupList; extern VFIOGroupList vfio_group_list; -bool vfio_mig_active(void); int64_t vfio_mig_bytes_transferred(void); #ifdef CONFIG_LINUX diff --git a/include/hw/vfio/vfio.h b/include/hw/vfio/vfio.h index 86248f54360a..d1e6f4b26f35 100644 --- a/include/hw/vfio/vfio.h +++ b/include/hw/vfio/vfio.h @@ -4,4 +4,6 @@ bool vfio_eeh_as_ok(AddressSpace *as); int vfio_eeh_as_op(AddressSpace *as, uint32_t op); +void populate_vfio_info(MigrationInfo *info); + #endif diff --git a/migration/migration.c b/migration/migration.c index 87a9b59f83f4..c164594c1d8d 100644 --- a/migration/migration.c +++ b/migration/migration.c @@ -56,10 +56,7 @@ #include "net/announce.h" #include "qemu/queue.h" #include "multifd.h" - -#ifdef CONFIG_VFIO -#include "hw/vfio/vfio-common.h" -#endif +#include "hw/vfio/vfio.h" #define MAX_THROTTLE (128 << 20) /* Migration transfer speed throttling */ @@ -1041,17 +1038,6 @@ static void populate_disk_info(MigrationInfo *info) } } -static void populate_vfio_info(MigrationInfo *info) -{ -#ifdef CONFIG_VFIO - if (vfio_mig_active()) { - info->has_vfio = true; - info->vfio = g_malloc0(sizeof(*info->vfio)); - info->vfio->transferred = vfio_mig_bytes_transferred(); - } -#endif -} - static void fill_source_migration_info(MigrationInfo *info) { MigrationState *s = migrate_get_current(); diff --git a/stubs/meson.build b/stubs/meson.build index 82b7ba60abe5..909956674847 100644 --- a/stubs/meson.build +++ b/stubs/meson.build @@ -53,3 +53,4 @@ if have_system stub_ss.add(files('semihost.c')) stub_ss.add(files('xen-hw-stub.c')) endif +stub_ss.add(files('vfio.c')) diff --git a/stubs/vfio.c b/stubs/vfio.c new file mode 100644 index 000000000000..9cc8753cd102 --- /dev/null +++ b/stubs/vfio.c @@ -0,0 +1,7 @@ +#include "qemu/osdep.h" +#include "qapi/qapi-types-migration.h" +#include "hw/vfio/vfio.h" + +void populate_vfio_info(MigrationInfo *info) +{ +} -- 2.7.0