vfio/migration: Implement VFIO migration protocol v2
commit31bcbbb5be04c7036223ce680a12927f5e51dc77
authorAvihai Horon <avihaih@nvidia.com>
Thu, 16 Feb 2023 14:36:27 +0000 (16 16:36 +0200)
committerAlex Williamson <alex.williamson@redhat.com>
Thu, 16 Feb 2023 19:13:46 +0000 (16 12:13 -0700)
tree10b5bcb45764ce97653c08e85dbd13c3b73d7967
parent6eeb2909104664af4c3488232f3c3cd8471c38c3
vfio/migration: Implement VFIO migration protocol v2

Implement the basic mandatory part of VFIO migration protocol v2.
This includes all functionality that is necessary to support
VFIO_MIGRATION_STOP_COPY part of the v2 protocol.

The two protocols, v1 and v2, will co-exist and in the following patches
v1 protocol code will be removed.

There are several main differences between v1 and v2 protocols:
- VFIO device state is now represented as a finite state machine instead
  of a bitmap.

- Migration interface with kernel is now done using VFIO_DEVICE_FEATURE
  ioctl and normal read() and write() instead of the migration region.

- Pre-copy is made optional in v2 protocol. Support for pre-copy will be
  added later on.

Detailed information about VFIO migration protocol v2 and its difference
compared to v1 protocol can be found here [1].

[1]
https://lore.kernel.org/all/20220224142024.147653-10-yishaih@nvidia.com/

Signed-off-by: Avihai Horon <avihaih@nvidia.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>.
Link: https://lore.kernel.org/r/20230216143630.25610-9-avihaih@nvidia.com
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
hw/vfio/common.c
hw/vfio/migration.c
hw/vfio/trace-events
include/hw/vfio/vfio-common.h