mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 16:53:55 -06:00
vfio: Make vfio_un/block_multiple_devices_migration() static
Both of these routines are only used in file "migration.c". Move them there. Reviewed-by: Joao Martins <joao.m.martins@oracle.com> Link: https://lore.kernel.org/qemu-devel/20250318095415.670319-5-clg@redhat.com Reviewed-by: John Levon <john.levon@nutanix.com> Link: https://lore.kernel.org/qemu-devel/20250326075122.1299361-5-clg@redhat.com Signed-off-by: Cédric Le Goater <clg@redhat.com>
This commit is contained in:
parent
e1d4ea53d6
commit
0a73045687
3 changed files with 59 additions and 61 deletions
|
@ -1022,6 +1022,65 @@ static int vfio_migration_init(VFIODevice *vbasedev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static Error *multiple_devices_migration_blocker;
|
||||
|
||||
/*
|
||||
* Multiple devices migration is allowed only if all devices support P2P
|
||||
* migration. Single device migration is allowed regardless of P2P migration
|
||||
* support.
|
||||
*/
|
||||
static bool vfio_multiple_devices_migration_is_supported(void)
|
||||
{
|
||||
VFIODevice *vbasedev;
|
||||
unsigned int device_num = 0;
|
||||
bool all_support_p2p = true;
|
||||
|
||||
QLIST_FOREACH(vbasedev, &vfio_device_list, global_next) {
|
||||
if (vbasedev->migration) {
|
||||
device_num++;
|
||||
|
||||
if (!(vbasedev->migration->mig_flags & VFIO_MIGRATION_P2P)) {
|
||||
all_support_p2p = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return all_support_p2p || device_num <= 1;
|
||||
}
|
||||
|
||||
static int vfio_block_multiple_devices_migration(VFIODevice *vbasedev, Error **errp)
|
||||
{
|
||||
if (vfio_multiple_devices_migration_is_supported()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (vbasedev->enable_migration == ON_OFF_AUTO_ON) {
|
||||
error_setg(errp, "Multiple VFIO devices migration is supported only if "
|
||||
"all of them support P2P migration");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (multiple_devices_migration_blocker) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
error_setg(&multiple_devices_migration_blocker,
|
||||
"Multiple VFIO devices migration is supported only if all of "
|
||||
"them support P2P migration");
|
||||
return migrate_add_blocker_normal(&multiple_devices_migration_blocker,
|
||||
errp);
|
||||
}
|
||||
|
||||
static void vfio_unblock_multiple_devices_migration(void)
|
||||
{
|
||||
if (!multiple_devices_migration_blocker ||
|
||||
!vfio_multiple_devices_migration_is_supported()) {
|
||||
return;
|
||||
}
|
||||
|
||||
migrate_del_blocker(&multiple_devices_migration_blocker);
|
||||
}
|
||||
|
||||
static void vfio_migration_deinit(VFIODevice *vbasedev)
|
||||
{
|
||||
VFIOMigration *migration = vbasedev->migration;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue