nvmf/vfio-user: add migration region mmio registers

The miration region data structure is from `vfio_device_migration_info`
defined in `linux/vfio.h`, `vfio_device_migration_info` is in the 0th
offset of the VFIO_REGION_SUBTYPE_MIGRATION region, and in vfio-user,
we reserve first one page of BAR9 for this MMIO accesses.

libvfio-user already helps us to hide some implementation details
based on vfio migration specification, here we just use the two
fields to help the migration process.

Change-Id: I8917ba892bbfdfdf4f135f5d6b4923ab0e4a6250
Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/7628
Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com>
Community-CI: Mellanox Build Bot
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
Changpeng Liu 2021-04-27 22:15:30 +08:00 committed by Keith Lucas
parent 616d7f3b2f
commit 1f6f2ecdbb

View File

@ -251,6 +251,12 @@ enum nvmf_vfio_user_ctrlr_state {
VFIO_USER_CTRLR_MIGRATING VFIO_USER_CTRLR_MIGRATING
}; };
/* Migration region to record NVMe device state data structure */
struct vfio_user_migration_region {
uint64_t last_data_offset;
uint64_t pending_bytes;
};
struct nvmf_vfio_user_sq { struct nvmf_vfio_user_sq {
struct spdk_nvmf_qpair qpair; struct spdk_nvmf_qpair qpair;
struct spdk_nvmf_transport_poll_group *group; struct spdk_nvmf_transport_poll_group *group;
@ -293,6 +299,8 @@ struct nvmf_vfio_user_ctrlr {
TAILQ_HEAD(, nvmf_vfio_user_sq) connected_sqs; TAILQ_HEAD(, nvmf_vfio_user_sq) connected_sqs;
enum nvmf_vfio_user_ctrlr_state state; enum nvmf_vfio_user_ctrlr_state state;
struct vfio_user_migration_region migr_reg;
struct spdk_thread *thread; struct spdk_thread *thread;
struct spdk_poller *vfu_ctx_poller; struct spdk_poller *vfu_ctx_poller;