aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWilliam Henderson <william.henderson@nutanix.com>2023-08-09 15:57:37 +0000
committerJohn Levon <john.levon@nutanix.com>2023-09-15 13:06:15 +0100
commitecf1d0efaa998e0eb1ba3dde988b40f6bef1b880 (patch)
tree3f4e36a3b012866da71fc6560bec5e1317aac437
parent8266a29b9c5446c04458baa6b6c898ebdf0b89a3 (diff)
downloadlibvfio-user-ecf1d0efaa998e0eb1ba3dde988b40f6bef1b880.zip
libvfio-user-ecf1d0efaa998e0eb1ba3dde988b40f6bef1b880.tar.gz
libvfio-user-ecf1d0efaa998e0eb1ba3dde988b40f6bef1b880.tar.bz2
fix: fixes for changes from John's core review
Signed-off-by: William Henderson <william.henderson@nutanix.com>
-rw-r--r--test/py/libvfio_user.py15
-rw-r--r--test/py/test_dirty_pages.py40
-rw-r--r--test/py/test_migration.py2
-rw-r--r--test/unit-tests.c3
4 files changed, 5 insertions, 55 deletions
diff --git a/test/py/libvfio_user.py b/test/py/libvfio_user.py
index e879255..4e414cd 100644
--- a/test/py/libvfio_user.py
+++ b/test/py/libvfio_user.py
@@ -163,7 +163,6 @@ VFIO_USER_REGION_WRITE = 10
VFIO_USER_DMA_READ = 11
VFIO_USER_DMA_WRITE = 12
VFIO_USER_DEVICE_RESET = 13
-VFIO_USER_DIRTY_PAGES = 14
VFIO_USER_REGION_WRITE_MULTI = 15
VFIO_USER_DEVICE_FEATURE = 16
VFIO_USER_MIG_DATA_READ = 17
@@ -527,14 +526,6 @@ class vfu_dma_info_t(Structure):
return result
-class vfio_user_dirty_pages(Structure):
- _pack_ = 1
- _fields_ = [
- ("argsz", c.c_uint32),
- ("flags", c.c_uint32)
- ]
-
-
class vfio_user_bitmap(Structure):
_pack_ = 1
_fields_ = [
@@ -665,7 +656,7 @@ vfu_dma_unregister_cb_t = c.CFUNCTYPE(None, c.c_void_p,
use_errno=True)
lib.vfu_setup_device_dma.argtypes = (c.c_void_p, vfu_dma_register_cb_t,
vfu_dma_unregister_cb_t)
-lib.vfu_setup_device_migration_callbacks.argtypes = (c.c_void_p, c.c_uint64,
+lib.vfu_setup_device_migration_callbacks.argtypes = (c.c_void_p,
c.POINTER(vfu_migration_callbacks_t))
lib.dma_sg_size.restype = (c.c_size_t)
lib.vfu_addr_to_sgl.argtypes = (c.c_void_p, c.c_void_p, c.c_size_t,
@@ -1184,7 +1175,7 @@ def __migr_write_data_cb(ctx, buf, count, offset):
return migr_write_data_cb(ctx, buf, count, offset)
-def vfu_setup_device_migration_callbacks(ctx, flags=0, cbs=None):
+def vfu_setup_device_migration_callbacks(ctx, cbs=None):
assert ctx is not None
if not cbs:
@@ -1194,7 +1185,7 @@ def vfu_setup_device_migration_callbacks(ctx, flags=0, cbs=None):
cbs.read_data = __migr_read_data_cb
cbs.write_data = __migr_write_data_cb
- return lib.vfu_setup_device_migration_callbacks(ctx, flags, cbs)
+ return lib.vfu_setup_device_migration_callbacks(ctx, cbs)
def dma_sg_size():
diff --git a/test/py/test_dirty_pages.py b/test/py/test_dirty_pages.py
index 7875033..7710ed0 100644
--- a/test/py/test_dirty_pages.py
+++ b/test/py/test_dirty_pages.py
@@ -351,46 +351,6 @@ def test_dirty_pages_stop():
stop_logging()
-def test_dirty_pages_start_specific():
- start_logging(addr=0x60 << PAGE_SHIFT, length=0x20 << PAGE_SHIFT)
- # should be idempotent
- start_logging(addr=0x60 << PAGE_SHIFT, length=0x20 << PAGE_SHIFT)
-
-
-def test_dirty_pages_get_modified_specific():
- ret, sg1 = vfu_addr_to_sgl(ctx, dma_addr=0x60 << PAGE_SHIFT,
- length=PAGE_SIZE)
- assert ret == 1
- iovec1 = iovec_t()
- ret = vfu_sgl_get(ctx, sg1, iovec1)
- assert ret == 0
-
- # not put yet, dirty bitmap should be zero
- bitmap = get_dirty_page_bitmap(addr=0x60 << PAGE_SHIFT, length=PAGE_SIZE)
- assert bitmap == 0b0000000000000000
-
- # put SGLs, dirty bitmap should be updated
- vfu_sgl_put(ctx, sg1, iovec1)
- bitmap = get_dirty_page_bitmap(addr=0x60 << PAGE_SHIFT, length=PAGE_SIZE)
- assert bitmap == 0b0000000000000001
-
-
-def test_dirty_pages_get_modified_specific_not_logged():
- ret, sg1 = vfu_addr_to_sgl(ctx, dma_addr=0x10 << PAGE_SHIFT,
- length=PAGE_SIZE)
- assert ret == 1
- iovec1 = iovec_t()
- ret = vfu_sgl_get(ctx, sg1, iovec1)
- assert ret == 0
- vfu_sgl_put(ctx, sg1, iovec1)
-
- get_dirty_page_bitmap(addr=0x10 << PAGE_SHIFT, length=PAGE_SIZE, expect=22)
-
-
-def test_dirty_pages_stop_specific():
- stop_logging(addr=0x60 << PAGE_SHIFT, length=0x20 << PAGE_SHIFT)
-
-
def test_dirty_pages_cleanup():
disconnect_client(ctx, sock)
vfu_destroy_ctx(ctx)
diff --git a/test/py/test_migration.py b/test/py/test_migration.py
index 6afc993..83c941c 100644
--- a/test/py/test_migration.py
+++ b/test/py/test_migration.py
@@ -89,7 +89,7 @@ def test_migration_setup():
cbs.read_data = migr_read_data_cb
cbs.write_data = migr_write_data_cb
- ret = vfu_setup_device_migration_callbacks(ctx, 0, cbs)
+ ret = vfu_setup_device_migration_callbacks(ctx, cbs)
assert ret == 0
vfu_setup_device_quiesce_cb(ctx)
diff --git a/test/unit-tests.c b/test/unit-tests.c
index 2e6bca7..580eb29 100644
--- a/test/unit-tests.c
+++ b/test/unit-tests.c
@@ -531,7 +531,7 @@ static void
test_setup_migration_callbacks(void **state)
{
struct test_setup_migr_reg_dat *p = *state;
- int r = vfu_setup_device_migration_callbacks(p->v, 0, &p->c);
+ int r = vfu_setup_device_migration_callbacks(p->v, &p->c);
assert_int_equal(0, r);
assert_non_null(p->v->migration);
assert_int_equal(p->v->migration->state, VFIO_USER_DEVICE_STATE_RUNNING);
@@ -747,7 +747,6 @@ test_cmd_allowed_when_stopped_and_copying(UNUSED void **state)
bool r = cmd_allowed_when_stopped_and_copying(i);
if (i == VFIO_USER_REGION_READ ||
i == VFIO_USER_REGION_WRITE ||
- i == VFIO_USER_DIRTY_PAGES ||
i == VFIO_USER_DEVICE_FEATURE ||
i == VFIO_USER_MIG_DATA_READ) {
assert_true(r);