vfio: Move vfio_mig_active() into migration.c

vfio_mig_active() is part of the VFIO migration API. Move the
definitions where VFIO migration is implemented.

Reviewed-by: Avihai Horon <avihaih@nvidia.com>
Reviewed-by: John Levon <john.levon@nutanix.com>
Link: https://lore.kernel.org/qemu-devel/20250318095415.670319-2-clg@redhat.com
Link: https://lore.kernel.org/qemu-devel/20250326075122.1299361-2-clg@redhat.com
Signed-off-by: Cédric Le Goater <clg@redhat.com>
This commit is contained in:
Cédric Le Goater 2025-03-26 08:50:46 +01:00
parent d5e8e6195b
commit acea0f0faf
2 changed files with 16 additions and 16 deletions

View file

@ -65,22 +65,6 @@ int vfio_kvm_device_fd = -1;
* Device state interfaces
*/
bool vfio_mig_active(void)
{
VFIODevice *vbasedev;
if (QLIST_EMPTY(&vfio_device_list)) {
return false;
}
QLIST_FOREACH(vbasedev, &vfio_device_list, global_next) {
if (vbasedev->migration_blocker) {
return false;
}
}
return true;
}
static Error *multiple_devices_migration_blocker;
/*

View file

@ -1062,6 +1062,22 @@ void vfio_mig_add_bytes_transferred(unsigned long val)
qatomic_add(&bytes_transferred, val);
}
bool vfio_mig_active(void)
{
VFIODevice *vbasedev;
if (QLIST_EMPTY(&vfio_device_list)) {
return false;
}
QLIST_FOREACH(vbasedev, &vfio_device_list, global_next) {
if (vbasedev->migration_blocker) {
return false;
}
}
return true;
}
/*
* Return true when either migration initialized or blocker registered.
* Currently only return false when adding blocker fails which will