diff options
author | Thanos Makatos <thanos.makatos@nutanix.com> | 2021-05-20 17:10:51 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-20 17:10:51 +0100 |
commit | cfe9901919943f14961e1da1c4a823336ff79555 (patch) | |
tree | 2b5d8915bbbea8d239684e3334c9926fb910fc2c /lib/migration_priv.h | |
parent | 947941de95bf2c3f723b37151d67fb129fd01841 (diff) | |
download | libvfio-user-cfe9901919943f14961e1da1c4a823336ff79555.zip libvfio-user-cfe9901919943f14961e1da1c4a823336ff79555.tar.gz libvfio-user-cfe9901919943f14961e1da1c4a823336ff79555.tar.bz2 |
migration: various dirty page tracking fixes (#457)
- document how to use a vfio-user device with libvirt
- document how to use SPDK's nvmf/vfio-user target with libvirt
- replace vfio_bitmap with vfio_user_bitmap and vfio_iommu_type1_dirty_bitmap_get with vfio_user_bitmap_range
- fix bug for calculating number of pages needed for dirty page bitmap
- align number of bytes for dirty page bitmap to QWORD
- add debug messages around dirty page tracking
- only support flags=0 when doing DMA unmap
- set device state to running after reset
- allow region read/write even if device is in stopped state
- allow transitioning from stopped/stop-and-copy state to running state
- fix unit tests
Signed-off-by: Thanos Makatos <thanos.makatos@nutanix.com>
Reviewed-by: John Levon <john.levon@nutanix.com>
Diffstat (limited to 'lib/migration_priv.h')
-rw-r--r-- | lib/migration_priv.h | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/lib/migration_priv.h b/lib/migration_priv.h index bf47621..1a0496f 100644 --- a/lib/migration_priv.h +++ b/lib/migration_priv.h @@ -75,7 +75,9 @@ struct migr_state_data { /* valid migration state transitions */ static const struct migr_state_data migr_states[(VFIO_DEVICE_STATE_MASK + 1)] = { [VFIO_DEVICE_STATE_STOP] = { - .state = 1 << VFIO_DEVICE_STATE_STOP, + .state = + (1 << VFIO_DEVICE_STATE_STOP) | + (1 << VFIO_DEVICE_STATE_RUNNING), .name = "stopped" }, [VFIO_DEVICE_STATE_RUNNING] = { @@ -91,6 +93,7 @@ static const struct migr_state_data migr_states[(VFIO_DEVICE_STATE_MASK + 1)] = [VFIO_DEVICE_STATE_SAVING] = { .state = (1 << VFIO_DEVICE_STATE_STOP) | + (1 << VFIO_DEVICE_STATE_RUNNING) | (1 << VFIO_DEVICE_STATE_SAVING) | (1 << VFIO_DEVICE_STATE_ERROR), .name = "stop-and-copy" @@ -112,6 +115,21 @@ static const struct migr_state_data migr_states[(VFIO_DEVICE_STATE_MASK + 1)] = } }; +MOCK_DECLARE(ssize_t, migration_region_access_registers, vfu_ctx_t *vfu_ctx, + char *buf, size_t count, loff_t pos, bool is_write); + +MOCK_DECLARE(void, migr_state_transition, struct migration *migr, + enum migr_iter_state state); + +MOCK_DECLARE(vfu_migr_state_t, migr_state_vfio_to_vfu, uint32_t device_state); + +MOCK_DECLARE(int, state_trans_notify, vfu_ctx_t *vfu_ctx, + int (*fn)(vfu_ctx_t *, vfu_migr_state_t), + uint32_t vfio_device_state); + +MOCK_DECLARE(ssize_t, migr_trans_to_valid_state, vfu_ctx_t *vfu_ctx, + struct migration *migr, uint32_t device_state, bool notify); + #endif /* ex: set tabstop=4 shiftwidth=4 softtabstop=4 expandtab: */ |