vfio: Introduce a new header file for external migration services

The migration core subsystem makes use 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.

While at it, use a 'vfio_migration_' prefix for these services.

To be noted, vfio_migration_add_bytes_transferred() is a VFIO
migration internal service which we will be moved in the subsequent
patches.

Cc: Kirti Wankhede <kwankhede@nvidia.com>
Cc: Avihai Horon <avihaih@nvidia.com>
Reviewed-by: Prasad Pandit <pjp@fedoraproject.org>
Reviewed-by: John Levon <john.levon@nutanix.com>
Reviewed-by: Avihai Horon <avihaih@nvidia.com>
Link: https://lore.kernel.org/qemu-devel/20250326075122.1299361-4-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:48 +01:00
parent 426ffab477
commit e1d4ea53d6
5 changed files with 30 additions and 15 deletions

View file

@ -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"
@ -575,7 +576,7 @@ vfio_save_complete_precopy_thread_config_state(VFIODevice *vbasedev,
return false;
}
vfio_mig_add_bytes_transferred(packet_len);
vfio_migration_add_bytes_transferred(packet_len);
return true;
}
@ -645,7 +646,7 @@ vfio_multifd_save_complete_precopy_thread(SaveLiveCompletePrecopyThreadData *d,
goto thread_exit;
}
vfio_mig_add_bytes_transferred(packet_size);
vfio_migration_add_bytes_transferred(packet_size);
}
if (!vfio_save_complete_precopy_thread_config_state(vbasedev,