From b52bff72d4eb646a453d19e19ddbd13ed6111a09 Mon Sep 17 00:00:00 2001 From: Jag Raman Date: Mon, 23 May 2022 08:15:47 -0400 Subject: libvfio-user.h: sync VFIO_DEVICE_STATE_XXXX definitions with upstream (#690) Rename VFIO_DEVICE_STATE_XXXX defines as VFIO_DEVICE_STATE_V1_XXXX. Upstream renamed these variable to be of the XXXX_V1_XXXX format and switched an enum for VFIO_DEVICE_STATE_XXXX. Signed-off-by: Jagannathan Raman Reviewed-by: John Levon Reviewed-by: Thanos Makatos --- docs/vfio-user.rst | 50 +++++++++++++++++++++++------------------------ include/libvfio-user.h | 32 +++++++++++++++++++++++------- lib/libvfio-user.c | 2 +- lib/migration.c | 28 +++++++++++++------------- lib/migration_priv.h | 50 +++++++++++++++++++++++------------------------ samples/client.c | 10 +++++----- test/py/libvfio_user.py | 8 ++++---- test/py/test_migration.py | 10 +++++----- test/py/test_quiesce.py | 8 ++++---- test/unit-tests.c | 4 ++-- 10 files changed, 110 insertions(+), 92 deletions(-) diff --git a/docs/vfio-user.rst b/docs/vfio-user.rst index 9d03f4d..9e1314e 100644 --- a/docs/vfio-user.rst +++ b/docs/vfio-user.rst @@ -1598,29 +1598,29 @@ A device may contain a migration region (of type subregion is accessed like any other part of a standard vfio-user region using ``VFIO_USER_REGION_READ``/``VFIO_USER_REGION_WRITE``. -+---------------+--------+-----------------------------+ -| Name | Offset | Size | -+===============+========+=============================+ -| device_state | 0 | 4 | -+---------------+--------+-----------------------------+ -| | +-----+----------------------------+ | -| | | Bit | Definition | | -| | +=====+============================+ | -| | | 0 | VFIO_DEVICE_STATE_RUNNING | | -| | +-----+----------------------------+ | -| | | 1 | VFIO_DEVICE_STATE_SAVING | | -| | +-----+----------------------------+ | -| | | 2 | VFIO_DEVICE_STATE_RESUMING | | -| | +-----+----------------------------+ | -+---------------+--------+-----------------------------+ -| reserved | 4 | 4 | -+---------------+--------+-----------------------------+ -| pending_bytes | 8 | 8 | -+---------------+--------+-----------------------------+ -| data_offset | 16 | 8 | -+---------------+--------+-----------------------------+ -| data_size | 24 | 8 | -+---------------+--------+-----------------------------+ ++---------------+--------+--------------------------------+ +| Name | Offset | Size | ++===============+========+================================+ +| device_state | 0 | 4 | ++---------------+--------+--------------------------------+ +| | +-----+-------------------------------+ | +| | | Bit | Definition | | +| | +=====+===============================+ | +| | | 0 | VFIO_DEVICE_STATE_V1_RUNNING | | +| | +-----+-------------------------------+ | +| | | 1 | VFIO_DEVICE_STATE_V1_SAVING | | +| | +-----+-------------------------------+ | +| | | 2 | VFIO_DEVICE_STATE_V1_RESUMING | | +| | +-----+-------------------------------+ | ++---------------+--------+--------------------------------+ +| reserved | 4 | 4 | ++---------------+--------+--------------------------------+ +| pending_bytes | 8 | 8 | ++---------------+--------+--------------------------------+ +| data_offset | 16 | 8 | ++---------------+--------+--------------------------------+ +| data_size | 24 | 8 | ++---------------+--------+--------------------------------+ * *device_state* defines the state of the device: @@ -1630,8 +1630,8 @@ using ``VFIO_USER_REGION_READ``/``VFIO_USER_REGION_WRITE``. ``VFIO_USER_REGION_WRITE`` operation with the Error field set accordingly and must remain at the previous state, or in case of internal error it must transition to the error state, defined as - ``VFIO_DEVICE_STATE_RESUMING | VFIO_DEVICE_STATE_SAVING``. The client must - re-read the device state in order to determine it afresh. + ``VFIO_DEVICE_STATE_V1_RESUMING | VFIO_DEVICE_STATE_V1_SAVING``. The client + must re-read the device state in order to determine it afresh. The following device states are defined: diff --git a/include/libvfio-user.h b/include/libvfio-user.h index e95c26a..629727f 100644 --- a/include/libvfio-user.h +++ b/include/libvfio-user.h @@ -671,15 +671,33 @@ typedef struct { } vfu_migration_callbacks_t; -#ifndef VFIO_DEVICE_STATE_STOP +/** + * The definition for VFIO_DEVICE_STATE_XXX differs with the version of vfio + * header file used. Some old systems wouldn't have these definitions. Some + * other newer systems would be using region based migration, and not + * have VFIO_DEVICE_STATE_V1_XXXX defined. The latest ones have + * VFIO_DEVICE_STATE_V1_XXXX defined. The following addresses all + * these scenarios. + */ +#if defined(VFIO_DEVICE_STATE_STOP) + +_Static_assert(VFIO_DEVICE_STATE_STOP == 0, + "incompatible VFIO_DEVICE_STATE_STOP definition"); + +#define VFIO_DEVICE_STATE_V1_STOP VFIO_DEVICE_STATE_STOP +#define VFIO_DEVICE_STATE_V1_RUNNING VFIO_DEVICE_STATE_RUNNING +#define VFIO_DEVICE_STATE_V1_SAVING VFIO_DEVICE_STATE_SAVING +#define VFIO_DEVICE_STATE_V1_RESUMING VFIO_DEVICE_STATE_RESUMING + +#elif !defined(VFIO_REGION_TYPE_MIGRATION_DEPRECATED) /* VFIO_DEVICE_STATE_STOP */ -#define VFIO_DEVICE_STATE_STOP (0) -#define VFIO_DEVICE_STATE_RUNNING (1 << 0) -#define VFIO_DEVICE_STATE_SAVING (1 << 1) -#define VFIO_DEVICE_STATE_RESUMING (1 << 2) -#define VFIO_DEVICE_STATE_MASK ((1 << 3) - 1) +#define VFIO_DEVICE_STATE_V1_STOP (0) +#define VFIO_DEVICE_STATE_V1_RUNNING (1 << 0) +#define VFIO_DEVICE_STATE_V1_SAVING (1 << 1) +#define VFIO_DEVICE_STATE_V1_RESUMING (1 << 2) +#define VFIO_DEVICE_STATE_MASK ((1 << 3) - 1) -#endif /* VFIO_DEVICE_STATE_STOP */ +#endif /* VFIO_REGION_TYPE_MIGRATION_DEPRECATED */ /* * The currently defined migration registers; if using migration callbacks, diff --git a/lib/libvfio-user.c b/lib/libvfio-user.c index fd2465d..a666316 100644 --- a/lib/libvfio-user.c +++ b/lib/libvfio-user.c @@ -861,7 +861,7 @@ do_device_reset(vfu_ctx_t *vfu_ctx, vfu_reset_type_t reason) } if (vfu_ctx->migration != NULL) { return handle_device_state(vfu_ctx, vfu_ctx->migration, - VFIO_DEVICE_STATE_RUNNING, false); + VFIO_DEVICE_STATE_V1_RUNNING, false); } return 0; } diff --git a/lib/migration.c b/lib/migration.c index fc5bb39..2936768 100644 --- a/lib/migration.c +++ b/lib/migration.c @@ -81,7 +81,7 @@ init_migration(const vfu_migration_callbacks_t * callbacks, migr->pgsize = sysconf(_SC_PAGESIZE); /* FIXME this should be done in vfu_ctx_realize */ - migr->info.device_state = VFIO_DEVICE_STATE_RUNNING; + migr->info.device_state = VFIO_DEVICE_STATE_V1_RUNNING; migr->data_offset = data_offset; migr->callbacks = *callbacks; @@ -111,11 +111,11 @@ vfu_migr_state_t MOCK_DEFINE(migr_state_vfio_to_vfu)(uint32_t device_state) { switch (device_state) { - case VFIO_DEVICE_STATE_STOP: + case VFIO_DEVICE_STATE_V1_STOP: return VFU_MIGR_STATE_STOP; - case VFIO_DEVICE_STATE_RUNNING: + case VFIO_DEVICE_STATE_V1_RUNNING: return VFU_MIGR_STATE_RUNNING; - case VFIO_DEVICE_STATE_SAVING: + case VFIO_DEVICE_STATE_V1_SAVING: /* * FIXME How should the device operate during the stop-and-copy * phase? Should we only allow the migration data to be read from @@ -123,9 +123,9 @@ MOCK_DEFINE(migr_state_vfio_to_vfu)(uint32_t device_state) * failed? This might be a good question to send to LKML. */ return VFU_MIGR_STATE_STOP_AND_COPY; - case VFIO_DEVICE_STATE_RUNNING | VFIO_DEVICE_STATE_SAVING: + case VFIO_DEVICE_STATE_V1_RUNNING | VFIO_DEVICE_STATE_V1_SAVING: return VFU_MIGR_STATE_PRE_COPY; - case VFIO_DEVICE_STATE_RESUMING: + case VFIO_DEVICE_STATE_V1_RESUMING: return VFU_MIGR_STATE_RESUME; } return -1; @@ -301,14 +301,14 @@ handle_data_offset(vfu_ctx_t *vfu_ctx, struct migration *migr, assert(offset != NULL); switch (migr->info.device_state) { - case VFIO_DEVICE_STATE_SAVING: - case VFIO_DEVICE_STATE_RUNNING | VFIO_DEVICE_STATE_SAVING: + case VFIO_DEVICE_STATE_V1_SAVING: + case VFIO_DEVICE_STATE_V1_RUNNING | VFIO_DEVICE_STATE_V1_SAVING: ret = handle_data_offset_when_saving(vfu_ctx, migr, is_write); if (ret == 0 && !is_write) { *offset = migr->iter.offset + migr->data_offset; } return ret; - case VFIO_DEVICE_STATE_RESUMING: + case VFIO_DEVICE_STATE_V1_RESUMING: if (is_write) { /* TODO writing to read-only registers should be simply ignored */ vfu_log(vfu_ctx, LOG_ERR, "bad write to migration data_offset"); @@ -380,14 +380,14 @@ handle_data_size(vfu_ctx_t *vfu_ctx, struct migration *migr, assert(size != NULL); switch (migr->info.device_state){ - case VFIO_DEVICE_STATE_SAVING: - case VFIO_DEVICE_STATE_RUNNING | VFIO_DEVICE_STATE_SAVING: + case VFIO_DEVICE_STATE_V1_SAVING: + case VFIO_DEVICE_STATE_V1_RUNNING | VFIO_DEVICE_STATE_V1_SAVING: ret = handle_data_size_when_saving(vfu_ctx, migr, is_write); if (ret == 0 && !is_write) { *size = migr->iter.size; } return ret; - case VFIO_DEVICE_STATE_RESUMING: + case VFIO_DEVICE_STATE_V1_RESUMING: return handle_data_size_when_resuming(vfu_ctx, migr, *size, is_write); } /* TODO improve error message */ @@ -535,13 +535,13 @@ migration_region_access(vfu_ctx_t *vfu_ctx, char *buf, size_t count, bool MOCK_DEFINE(device_is_stopped_and_copying)(struct migration *migr) { - return migr != NULL && migr->info.device_state == VFIO_DEVICE_STATE_SAVING; + return migr != NULL && migr->info.device_state == VFIO_DEVICE_STATE_V1_SAVING; } bool MOCK_DEFINE(device_is_stopped)(struct migration *migr) { - return migr != NULL && migr->info.device_state == VFIO_DEVICE_STATE_STOP; + return migr != NULL && migr->info.device_state == VFIO_DEVICE_STATE_V1_STOP; } size_t diff --git a/lib/migration_priv.h b/lib/migration_priv.h index bf7c7b0..d5643af 100644 --- a/lib/migration_priv.h +++ b/lib/migration_priv.h @@ -70,47 +70,47 @@ struct migr_state_data { const char *name; }; -#define VFIO_DEVICE_STATE_ERROR (VFIO_DEVICE_STATE_SAVING | VFIO_DEVICE_STATE_RESUMING) +#define VFIO_DEVICE_STATE_V1_ERROR (VFIO_DEVICE_STATE_V1_SAVING | VFIO_DEVICE_STATE_V1_RESUMING) /* valid migration state transitions */ static const struct migr_state_data migr_states[(VFIO_DEVICE_STATE_MASK + 1)] = { - [VFIO_DEVICE_STATE_STOP] = { + [VFIO_DEVICE_STATE_V1_STOP] = { .state = - (1 << VFIO_DEVICE_STATE_STOP) | - (1 << VFIO_DEVICE_STATE_RUNNING), + (1 << VFIO_DEVICE_STATE_V1_STOP) | + (1 << VFIO_DEVICE_STATE_V1_RUNNING), .name = "stopped" }, - [VFIO_DEVICE_STATE_RUNNING] = { + [VFIO_DEVICE_STATE_V1_RUNNING] = { .state = - (1 << VFIO_DEVICE_STATE_STOP) | - (1 << VFIO_DEVICE_STATE_RUNNING) | - (1 << VFIO_DEVICE_STATE_SAVING) | - (1 << (VFIO_DEVICE_STATE_RUNNING | VFIO_DEVICE_STATE_SAVING)) | - (1 << VFIO_DEVICE_STATE_RESUMING) | - (1 << VFIO_DEVICE_STATE_ERROR), + (1 << VFIO_DEVICE_STATE_V1_STOP) | + (1 << VFIO_DEVICE_STATE_V1_RUNNING) | + (1 << VFIO_DEVICE_STATE_V1_SAVING) | + (1 << (VFIO_DEVICE_STATE_V1_RUNNING | VFIO_DEVICE_STATE_V1_SAVING)) | + (1 << VFIO_DEVICE_STATE_V1_RESUMING) | + (1 << VFIO_DEVICE_STATE_V1_ERROR), .name = "running" }, - [VFIO_DEVICE_STATE_SAVING] = { + [VFIO_DEVICE_STATE_V1_SAVING] = { .state = - (1 << VFIO_DEVICE_STATE_STOP) | - (1 << VFIO_DEVICE_STATE_RUNNING) | - (1 << VFIO_DEVICE_STATE_SAVING) | - (1 << VFIO_DEVICE_STATE_ERROR), + (1 << VFIO_DEVICE_STATE_V1_STOP) | + (1 << VFIO_DEVICE_STATE_V1_RUNNING) | + (1 << VFIO_DEVICE_STATE_V1_SAVING) | + (1 << VFIO_DEVICE_STATE_V1_ERROR), .name = "stop-and-copy" }, - [VFIO_DEVICE_STATE_RUNNING | VFIO_DEVICE_STATE_SAVING] = { + [VFIO_DEVICE_STATE_V1_RUNNING | VFIO_DEVICE_STATE_V1_SAVING] = { .state = - (1 << VFIO_DEVICE_STATE_STOP) | - (1 << VFIO_DEVICE_STATE_SAVING) | - (1 << VFIO_DEVICE_STATE_RUNNING | VFIO_DEVICE_STATE_SAVING) | - (1 << VFIO_DEVICE_STATE_ERROR), + (1 << VFIO_DEVICE_STATE_V1_STOP) | + (1 << VFIO_DEVICE_STATE_V1_SAVING) | + (1 << VFIO_DEVICE_STATE_V1_RUNNING | VFIO_DEVICE_STATE_V1_SAVING) | + (1 << VFIO_DEVICE_STATE_V1_ERROR), .name = "pre-copy" }, - [VFIO_DEVICE_STATE_RESUMING] = { + [VFIO_DEVICE_STATE_V1_RESUMING] = { .state = - (1 << VFIO_DEVICE_STATE_RUNNING) | - (1 << VFIO_DEVICE_STATE_RESUMING) | - (1 << VFIO_DEVICE_STATE_ERROR), + (1 << VFIO_DEVICE_STATE_V1_RUNNING) | + (1 << VFIO_DEVICE_STATE_V1_RESUMING) | + (1 << VFIO_DEVICE_STATE_V1_ERROR), .name = "resuming" } }; diff --git a/samples/client.c b/samples/client.c index d1c699d..38da81d 100644 --- a/samples/client.c +++ b/samples/client.c @@ -868,7 +868,7 @@ migrate_from(int sock, size_t *nr_iters, struct iovec **migr_iters, * XXX set device state to pre-copy. This is technically optional but any * VMM that cares about performance needs this. */ - device_state = VFIO_DEVICE_STATE_SAVING | VFIO_DEVICE_STATE_RUNNING; + device_state = VFIO_DEVICE_STATE_V1_SAVING | VFIO_DEVICE_STATE_V1_RUNNING; ret = access_region(sock, VFU_PCI_DEV_MIGR_REGION_IDX, true, offsetof(struct vfio_user_migration_info, device_state), &device_state, sizeof(device_state)); @@ -889,7 +889,7 @@ migrate_from(int sock, size_t *nr_iters, struct iovec **migr_iters, printf("client: setting device state to stop-and-copy\n"); - device_state = VFIO_DEVICE_STATE_SAVING; + device_state = VFIO_DEVICE_STATE_V1_SAVING; ret = access_region(sock, VFU_PCI_DEV_MIGR_REGION_IDX, true, offsetof(struct vfio_user_migration_info, device_state), &device_state, sizeof(device_state)); @@ -905,7 +905,7 @@ migrate_from(int sock, size_t *nr_iters, struct iovec **migr_iters, } /* XXX read device state, migration must have finished now */ - device_state = VFIO_DEVICE_STATE_STOP; + device_state = VFIO_DEVICE_STATE_V1_STOP; ret = access_region(sock, VFU_PCI_DEV_MIGR_REGION_IDX, true, offsetof(struct vfio_user_migration_info, device_state), &device_state, sizeof(device_state)); @@ -925,7 +925,7 @@ migrate_to(char *old_sock_path, int *server_max_fds, int ret, sock; char *sock_path; struct stat sb; - uint32_t device_state = VFIO_DEVICE_STATE_RESUMING; + uint32_t device_state = VFIO_DEVICE_STATE_V1_RESUMING; uint64_t data_offset, data_len; size_t i; uint32_t dst_crc; @@ -1020,7 +1020,7 @@ migrate_to(char *old_sock_path, int *server_max_fds, } /* XXX set device state to running */ - device_state = VFIO_DEVICE_STATE_RUNNING; + device_state = VFIO_DEVICE_STATE_V1_RUNNING; ret = access_region(sock, VFU_PCI_DEV_MIGR_REGION_IDX, true, offsetof(struct vfio_user_migration_info, device_state), &device_state, sizeof(device_state)); diff --git a/test/py/libvfio_user.py b/test/py/libvfio_user.py index 246a4f1..ec9da7b 100644 --- a/test/py/libvfio_user.py +++ b/test/py/libvfio_user.py @@ -111,10 +111,10 @@ VFIO_IRQ_SET_ACTION_TRIGGER = (1 << 5) VFIO_DMA_UNMAP_FLAG_ALL = (1 << 1) -VFIO_DEVICE_STATE_STOP = (0) -VFIO_DEVICE_STATE_RUNNING = (1 << 0) -VFIO_DEVICE_STATE_SAVING = (1 << 1) -VFIO_DEVICE_STATE_RESUMING = (1 << 2) +VFIO_DEVICE_STATE_V1_STOP = (0) +VFIO_DEVICE_STATE_V1_RUNNING = (1 << 0) +VFIO_DEVICE_STATE_V1_SAVING = (1 << 1) +VFIO_DEVICE_STATE_V1_RESUMING = (1 << 2) VFIO_DEVICE_STATE_MASK = ((1 << 3) - 1) diff --git a/test/py/test_migration.py b/test/py/test_migration.py index a4da41f..c5da94f 100644 --- a/test/py/test_migration.py +++ b/test/py/test_migration.py @@ -75,7 +75,7 @@ def test_migration_bad_access(mock_trans, mock_quiesce): """ global ctx, sock - data = VFIO_DEVICE_STATE_SAVING.to_bytes(c.sizeof(c.c_int), 'little') + data = VFIO_DEVICE_STATE_V1_SAVING.to_bytes(c.sizeof(c.c_int), 'little') write_region(ctx, sock, VFU_PCI_DEV_MIGR_REGION_IDX, offset=0, count=len(data)-1, data=data, expect=errno.EINVAL) @@ -91,7 +91,7 @@ def test_migration_trans_sync(mock_trans, mock_quiesce): global ctx, sock - data = VFIO_DEVICE_STATE_SAVING.to_bytes(c.sizeof(c.c_int), 'little') + data = VFIO_DEVICE_STATE_V1_SAVING.to_bytes(c.sizeof(c.c_int), 'little') write_region(ctx, sock, VFU_PCI_DEV_MIGR_REGION_IDX, offset=0, count=len(data), data=data) @@ -107,7 +107,7 @@ def test_migration_trans_sync_err(mock_trans): global ctx, sock - data = VFIO_DEVICE_STATE_SAVING.to_bytes(c.sizeof(c.c_int), 'little') + data = VFIO_DEVICE_STATE_V1_SAVING.to_bytes(c.sizeof(c.c_int), 'little') write_region(ctx, sock, VFU_PCI_DEV_MIGR_REGION_IDX, offset=0, count=len(data), data=data, expect=errno.EPERM) @@ -126,7 +126,7 @@ def test_migration_trans_async(mock_trans, mock_quiesce): global ctx, sock mock_quiesce - data = VFIO_DEVICE_STATE_SAVING.to_bytes(c.sizeof(c.c_int), 'little') + data = VFIO_DEVICE_STATE_V1_SAVING.to_bytes(c.sizeof(c.c_int), 'little') write_region(ctx, sock, VFU_PCI_DEV_MIGR_REGION_IDX, offset=0, count=len(data), data=data, rsp=False, busy=True) @@ -151,7 +151,7 @@ def test_migration_trans_async_err(mock_trans, mock_quiesce): global ctx, sock - data = VFIO_DEVICE_STATE_RUNNING.to_bytes(c.sizeof(c.c_int), 'little') + data = VFIO_DEVICE_STATE_V1_RUNNING.to_bytes(c.sizeof(c.c_int), 'little') write_region(ctx, sock, VFU_PCI_DEV_MIGR_REGION_IDX, offset=0, count=len(data), data=data, rsp=False, busy=True) diff --git a/test/py/test_quiesce.py b/test/py/test_quiesce.py index e74eeed..f283ccc 100644 --- a/test/py/test_quiesce.py +++ b/test/py/test_quiesce.py @@ -202,10 +202,10 @@ def test_allowed_funcs_in_quiesed_migration(mock_quiesce, global ctx, sock _map_dma_region(ctx, sock) - data = VFIO_DEVICE_STATE_SAVING.to_bytes(c.sizeof(c.c_int), 'little') + data = VFIO_DEVICE_STATE_V1_SAVING.to_bytes(c.sizeof(c.c_int), 'little') write_region(ctx, sock, VFU_PCI_DEV_MIGR_REGION_IDX, offset=0, count=len(data), data=data) - mock_trans.assert_called_once_with(ctx, VFIO_DEVICE_STATE_SAVING) + mock_trans.assert_called_once_with(ctx, VFIO_DEVICE_STATE_V1_SAVING) @patch('libvfio_user.migr_trans_cb', side_effect=_side_effect) @@ -216,13 +216,13 @@ def test_allowed_funcs_in_quiesed_migration_busy(mock_quiesce, global ctx, sock _map_dma_region(ctx, sock) mock_quiesce.side_effect = fail_with_errno(errno.EBUSY) - data = VFIO_DEVICE_STATE_STOP.to_bytes(c.sizeof(c.c_int), 'little') + data = VFIO_DEVICE_STATE_V1_STOP.to_bytes(c.sizeof(c.c_int), 'little') write_region(ctx, sock, VFU_PCI_DEV_MIGR_REGION_IDX, offset=0, count=len(data), data=data, rsp=False, busy=True) ret = vfu_device_quiesced(ctx, 0) assert ret == 0 - mock_trans.assert_called_once_with(ctx, VFIO_DEVICE_STATE_STOP) + mock_trans.assert_called_once_with(ctx, VFIO_DEVICE_STATE_V1_STOP) @patch('libvfio_user.reset_cb', side_effect=_side_effect) diff --git a/test/unit-tests.c b/test/unit-tests.c index 7d5297e..6b16fe6 100644 --- a/test/unit-tests.c +++ b/test/unit-tests.c @@ -590,13 +590,13 @@ test_device_is_stopped_and_copying(UNUSED void **state) } migration.info.device_state = i; bool r = device_is_stopped_and_copying(vfu_ctx.migration); - if (i == VFIO_DEVICE_STATE_SAVING) { + if (i == VFIO_DEVICE_STATE_V1_SAVING) { assert_true(r); } else { assert_false(r); } r = device_is_stopped(vfu_ctx.migration); - if (i == VFIO_DEVICE_STATE_STOP) { + if (i == VFIO_DEVICE_STATE_V1_STOP) { assert_true(r); } else { assert_false(r); -- cgit v1.1