mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 15:53:54 -06:00
vfio/migration: Multifd setup/cleanup functions and associated VFIOMultifd
Add multifd setup/cleanup functions and an associated VFIOMultifd data structure that will contain most of the receive-side data together with its init/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/c0520523053b1087787152ddf2163257d3030be0.1741124640.git.maciej.szmigiero@oracle.com Signed-off-by: Cédric Le Goater <clg@redhat.com>
This commit is contained in:
parent
2efa35d34e
commit
ff2fd1f7e2
3 changed files with 51 additions and 0 deletions
|
@ -32,8 +32,52 @@ typedef struct VFIODeviceStatePacket {
|
||||||
uint8_t data[0];
|
uint8_t data[0];
|
||||||
} QEMU_PACKED VFIODeviceStatePacket;
|
} QEMU_PACKED VFIODeviceStatePacket;
|
||||||
|
|
||||||
|
typedef struct VFIOMultifd {
|
||||||
|
} VFIOMultifd;
|
||||||
|
|
||||||
|
static VFIOMultifd *vfio_multifd_new(void)
|
||||||
|
{
|
||||||
|
VFIOMultifd *multifd = g_new(VFIOMultifd, 1);
|
||||||
|
|
||||||
|
return multifd;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void vfio_multifd_free(VFIOMultifd *multifd)
|
||||||
|
{
|
||||||
|
g_free(multifd);
|
||||||
|
}
|
||||||
|
|
||||||
|
void vfio_multifd_cleanup(VFIODevice *vbasedev)
|
||||||
|
{
|
||||||
|
VFIOMigration *migration = vbasedev->migration;
|
||||||
|
|
||||||
|
g_clear_pointer(&migration->multifd, vfio_multifd_free);
|
||||||
|
}
|
||||||
|
|
||||||
bool vfio_multifd_transfer_supported(void)
|
bool vfio_multifd_transfer_supported(void)
|
||||||
{
|
{
|
||||||
return multifd_device_state_supported() &&
|
return multifd_device_state_supported() &&
|
||||||
migrate_send_switchover_start();
|
migrate_send_switchover_start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool vfio_multifd_transfer_enabled(VFIODevice *vbasedev)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool vfio_multifd_setup(VFIODevice *vbasedev, bool alloc_multifd, Error **errp)
|
||||||
|
{
|
||||||
|
VFIOMigration *migration = vbasedev->migration;
|
||||||
|
|
||||||
|
if (!vfio_multifd_transfer_enabled(vbasedev)) {
|
||||||
|
/* Nothing further to check or do */
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (alloc_multifd) {
|
||||||
|
assert(!migration->multifd);
|
||||||
|
migration->multifd = vfio_multifd_new();
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
|
@ -14,6 +14,10 @@
|
||||||
|
|
||||||
#include "hw/vfio/vfio-common.h"
|
#include "hw/vfio/vfio-common.h"
|
||||||
|
|
||||||
|
bool vfio_multifd_setup(VFIODevice *vbasedev, bool alloc_multifd, Error **errp);
|
||||||
|
void vfio_multifd_cleanup(VFIODevice *vbasedev);
|
||||||
|
|
||||||
bool vfio_multifd_transfer_supported(void);
|
bool vfio_multifd_transfer_supported(void);
|
||||||
|
bool vfio_multifd_transfer_enabled(VFIODevice *vbasedev);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -78,6 +78,8 @@ typedef struct VFIORegion {
|
||||||
uint8_t nr; /* cache the region number for debug */
|
uint8_t nr; /* cache the region number for debug */
|
||||||
} VFIORegion;
|
} VFIORegion;
|
||||||
|
|
||||||
|
typedef struct VFIOMultifd VFIOMultifd;
|
||||||
|
|
||||||
typedef struct VFIOMigration {
|
typedef struct VFIOMigration {
|
||||||
struct VFIODevice *vbasedev;
|
struct VFIODevice *vbasedev;
|
||||||
VMChangeStateEntry *vm_state;
|
VMChangeStateEntry *vm_state;
|
||||||
|
@ -89,6 +91,7 @@ typedef struct VFIOMigration {
|
||||||
uint64_t mig_flags;
|
uint64_t mig_flags;
|
||||||
uint64_t precopy_init_size;
|
uint64_t precopy_init_size;
|
||||||
uint64_t precopy_dirty_size;
|
uint64_t precopy_dirty_size;
|
||||||
|
VFIOMultifd *multifd;
|
||||||
bool initial_data_sent;
|
bool initial_data_sent;
|
||||||
|
|
||||||
bool event_save_iterate_started;
|
bool event_save_iterate_started;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue