aboutsummaryrefslogtreecommitdiff
path: root/test/py/test_dma_unmap.py
diff options
context:
space:
mode:
authorSwapnil Ingle <swapnil.ingle@nutanix.com>2021-08-27 13:18:53 +0200
committerGitHub <noreply@github.com>2021-08-27 13:18:53 +0200
commit080e664ed5e79dcf5ae5a36521cab0ddb7ebc5f0 (patch)
tree5d920a8a71aa57f088aba9a6f881c71121866f69 /test/py/test_dma_unmap.py
parent2ed612697e8fde14e9995cc1ac4dd5143ae8e0b7 (diff)
downloadlibvfio-user-080e664ed5e79dcf5ae5a36521cab0ddb7ebc5f0.zip
libvfio-user-080e664ed5e79dcf5ae5a36521cab0ddb7ebc5f0.tar.gz
libvfio-user-080e664ed5e79dcf5ae5a36521cab0ddb7ebc5f0.tar.bz2
Add support for VFIO_DMA_UNMAP_FLAG_ALL flag (#600)
* Add support for VFIO_DMA_UNMAP_FLAG_ALL flag Signed-off-by: Swapnil Ingle <swapnil.ingle@nutanix.com> Reviewed-by: John Levon <john.levon@nutanix.com>
Diffstat (limited to 'test/py/test_dma_unmap.py')
-rw-r--r--test/py/test_dma_unmap.py34
1 files changed, 33 insertions, 1 deletions
diff --git a/test/py/test_dma_unmap.py b/test/py/test_dma_unmap.py
index 0200c43..f070ede 100644
--- a/test/py/test_dma_unmap.py
+++ b/test/py/test_dma_unmap.py
@@ -65,7 +65,7 @@ def test_dma_unmap_bad_argsz():
def test_dma_unmap_invalid_flags():
payload = vfio_user_dma_unmap(argsz=len(vfio_user_dma_unmap()),
- flags=0x2323, addr=0x1000, size=4096)
+ flags=0x4, addr=0x1000, size=4096)
msg(ctx, sock, VFIO_USER_DMA_UNMAP, payload, expect=errno.ENOTSUP)
def test_dma_unmap():
@@ -74,6 +74,38 @@ def test_dma_unmap():
flags=0, addr=0x1000, size=4096)
msg(ctx, sock, VFIO_USER_DMA_UNMAP, payload)
+def test_dma_unmap_all():
+
+ for i in range(0, MAX_DMA_REGIONS):
+ payload = vfio_user_dma_map(argsz=len(vfio_user_dma_map()),
+ flags=(VFIO_USER_F_DMA_REGION_READ |
+ VFIO_USER_F_DMA_REGION_WRITE),
+ offset=0, addr=0x1000 * i, size=4096)
+
+ msg(ctx, sock, VFIO_USER_DMA_MAP, payload)
+
+ payload = vfio_user_dma_unmap(argsz=len(vfio_user_dma_unmap()),
+ flags=VFIO_DMA_UNMAP_FLAG_ALL, addr=0, size=0)
+
+ msg(ctx, sock, VFIO_USER_DMA_UNMAP, payload)
+
+def test_dma_unmap_all_invalid_addr():
+
+ payload = vfio_user_dma_unmap(argsz=len(vfio_user_dma_unmap()),
+ flags=VFIO_DMA_UNMAP_FLAG_ALL, addr=0x10000, size=4096)
+
+ msg(ctx, sock, VFIO_USER_DMA_UNMAP, payload, expect=errno.EINVAL)
+
+def test_dma_unmap_all_invalid_flags():
+
+ payload = vfio_user_dma_unmap(argsz=len(vfio_user_dma_unmap()),
+ flags=(VFIO_DMA_UNMAP_FLAG_ALL | VFIO_DMA_UNMAP_FLAG_GET_DIRTY_BITMAP),
+ addr=0, size=0)
+
+ msg(ctx, sock, VFIO_USER_DMA_UNMAP, payload, expect=errno.EINVAL)
+
def test_dma_unmap_cleanup():
disconnect_client(ctx, sock)
vfu_destroy_ctx(ctx)
+
+# ex: set tabstop=4 shiftwidth=4 softtabstop=4 expandtab