@@ -290,13 +290,9 @@ extern VFIODeviceList vfio_device_list;
extern const MemoryListener vfio_memory_listener;
extern int vfio_kvm_device_fd;
-bool vfio_mig_active(void);
int vfio_block_multiple_devices_migration(VFIODevice *vbasedev, Error **errp);
void vfio_unblock_multiple_devices_migration(void);
bool vfio_viommu_preset(VFIODevice *vbasedev);
-int64_t vfio_mig_bytes_transferred(void);
-void vfio_mig_reset_bytes_transferred(void);
-void vfio_mig_add_bytes_transferred(unsigned long val);
bool vfio_device_state_is_running(VFIODevice *vbasedev);
bool vfio_device_state_is_precopy(VFIODevice *vbasedev);
new file mode 100644
@@ -0,0 +1,17 @@
+/*
+ * VFIO migration interface
+ *
+ * Copyright Red Hat, Inc. 2025
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#ifndef HW_VFIO_VFIO_MIGRATION_H
+#define HW_VFIO_VFIO_MIGRATION_H
+
+bool vfio_mig_active(void);
+int64_t vfio_mig_bytes_transferred(void);
+void vfio_mig_reset_bytes_transferred(void);
+void vfio_mig_add_bytes_transferred(unsigned long val);
+
+#endif /* HW_VFIO_VFIO_MIGRATION_H */
@@ -11,6 +11,7 @@
#include "qemu/osdep.h"
#include "hw/vfio/vfio-common.h"
+#include "hw/vfio/vfio-migration.h"
#include "migration/misc.h"
#include "qapi/error.h"
#include "qemu/bswap.h"
@@ -17,6 +17,7 @@
#include "system/runstate.h"
#include "hw/vfio/vfio-common.h"
+#include "hw/vfio/vfio-migration.h"
#include "migration/misc.h"
#include "migration/savevm.h"
#include "migration/vmstate.h"
@@ -11,7 +11,7 @@
#include CONFIG_DEVICES
#ifdef CONFIG_VFIO
-#include "hw/vfio/vfio-common.h"
+#include "hw/vfio/vfio-migration.h"
#endif
#ifdef CONFIG_VFIO
The migration core subsytem makes uses of the VFIO migration API to collect statistics on the number of bytes transferred. These services are declared in "hw/vfio/vfio-common.h" which also contains VFIO internal declarations. Move the migration declarations into a new header file "hw/vfio/vfio-migration.h" to reduce the exposure of VFIO internals. Signed-off-by: Cédric Le Goater <clg@redhat.com> --- include/hw/vfio/vfio-common.h | 4 ---- include/hw/vfio/vfio-migration.h | 17 +++++++++++++++++ hw/vfio/migration-multifd.c | 1 + hw/vfio/migration.c | 1 + migration/target.c | 2 +- 5 files changed, 20 insertions(+), 5 deletions(-) create mode 100644 include/hw/vfio/vfio-migration.h