mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-05 08:43:55 -06:00
vfio/migration: Setup and cleanup multifd transfer in these general methods
Wire VFIO multifd transfer specific setup and cleanup functions into general VFIO load/save setup and cleanup methods. Signed-off-by: Maciej S. Szmigiero <maciej.szmigiero@oracle.com> Reviewed-by: Cédric Le Goater <clg@redhat.com> Link: https://lore.kernel.org/qemu-devel/b1f864a65fafd4fdab1f89230df52e46ae41f2ac.1741124640.git.maciej.szmigiero@oracle.com Signed-off-by: Cédric Le Goater <clg@redhat.com>
This commit is contained in:
parent
ff2fd1f7e2
commit
6bcffb1cad
1 changed files with 22 additions and 2 deletions
|
@ -453,6 +453,10 @@ static int vfio_save_setup(QEMUFile *f, void *opaque, Error **errp)
|
||||||
uint64_t stop_copy_size = VFIO_MIG_DEFAULT_DATA_BUFFER_SIZE;
|
uint64_t stop_copy_size = VFIO_MIG_DEFAULT_DATA_BUFFER_SIZE;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
if (!vfio_multifd_setup(vbasedev, false, errp)) {
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
qemu_put_be64(f, VFIO_MIG_FLAG_DEV_SETUP_STATE);
|
qemu_put_be64(f, VFIO_MIG_FLAG_DEV_SETUP_STATE);
|
||||||
|
|
||||||
vfio_query_stop_copy_size(vbasedev, &stop_copy_size);
|
vfio_query_stop_copy_size(vbasedev, &stop_copy_size);
|
||||||
|
@ -509,6 +513,9 @@ static void vfio_save_cleanup(void *opaque)
|
||||||
Error *local_err = NULL;
|
Error *local_err = NULL;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
/* Currently a NOP, done for symmetry with load_cleanup() */
|
||||||
|
vfio_multifd_cleanup(vbasedev);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Changing device state from STOP_COPY to STOP can take time. Do it here,
|
* Changing device state from STOP_COPY to STOP can take time. Do it here,
|
||||||
* after migration has completed, so it won't increase downtime.
|
* after migration has completed, so it won't increase downtime.
|
||||||
|
@ -674,15 +681,28 @@ static void vfio_save_state(QEMUFile *f, void *opaque)
|
||||||
static int vfio_load_setup(QEMUFile *f, void *opaque, Error **errp)
|
static int vfio_load_setup(QEMUFile *f, void *opaque, Error **errp)
|
||||||
{
|
{
|
||||||
VFIODevice *vbasedev = opaque;
|
VFIODevice *vbasedev = opaque;
|
||||||
|
VFIOMigration *migration = vbasedev->migration;
|
||||||
|
int ret;
|
||||||
|
|
||||||
return vfio_migration_set_state(vbasedev, VFIO_DEVICE_STATE_RESUMING,
|
if (!vfio_multifd_setup(vbasedev, true, errp)) {
|
||||||
vbasedev->migration->device_state, errp);
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = vfio_migration_set_state(vbasedev, VFIO_DEVICE_STATE_RESUMING,
|
||||||
|
migration->device_state, errp);
|
||||||
|
if (ret) {
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int vfio_load_cleanup(void *opaque)
|
static int vfio_load_cleanup(void *opaque)
|
||||||
{
|
{
|
||||||
VFIODevice *vbasedev = opaque;
|
VFIODevice *vbasedev = opaque;
|
||||||
|
|
||||||
|
vfio_multifd_cleanup(vbasedev);
|
||||||
|
|
||||||
vfio_migration_cleanup(vbasedev);
|
vfio_migration_cleanup(vbasedev);
|
||||||
trace_vfio_load_cleanup(vbasedev->name);
|
trace_vfio_load_cleanup(vbasedev->name);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue