aboutsummaryrefslogtreecommitdiff
path: root/test/py/test_vfu_realize_ctx.py
diff options
context:
space:
mode:
authorjfgd <4610889+jfgd@users.noreply.github.com>2024-03-29 11:37:10 +0100
committerGitHub <noreply@github.com>2024-03-29 10:37:10 +0000
commit143b4f840b07990a759d0e7328475bdf90d7d6ba (patch)
treef1f8c906c3e2495639baaf0f5cf6bfd95b3d305c /test/py/test_vfu_realize_ctx.py
parentb646559cc90f1a1f475fc47048bbbd955e20f4a2 (diff)
downloadlibvfio-user-143b4f840b07990a759d0e7328475bdf90d7d6ba.zip
libvfio-user-143b4f840b07990a759d0e7328475bdf90d7d6ba.tar.gz
libvfio-user-143b4f840b07990a759d0e7328475bdf90d7d6ba.tar.bz2
Support 64 bits and prefetchable BARs (#792)
* Support 64 bits and prefetchable BARs Add two new flags for lib user to request 64bits and/or prefetchable BARs. Tested with a vfio-user client patched QEMU. Signed-off-by: Jérémy Fanguède <jfanguede@kalrayinc.com>
Diffstat (limited to 'test/py/test_vfu_realize_ctx.py')
-rw-r--r--test/py/test_vfu_realize_ctx.py20
1 files changed, 18 insertions, 2 deletions
diff --git a/test/py/test_vfu_realize_ctx.py b/test/py/test_vfu_realize_ctx.py
index ab0b86a..4b001a4 100644
--- a/test/py/test_vfu_realize_ctx.py
+++ b/test/py/test_vfu_realize_ctx.py
@@ -73,14 +73,30 @@ def test_vfu_realize_ctx_pci_bars():
ret = vfu_setup_region(ctx, index=VFU_PCI_DEV_BAR1_REGION_IDX, size=4096,
flags=(VFU_REGION_FLAG_RW | VFU_REGION_FLAG_MEM))
assert ret == 0
+ ret = vfu_setup_region(ctx, index=VFU_PCI_DEV_BAR2_REGION_IDX,
+ size=1048576,
+ flags=(VFU_REGION_FLAG_RW | VFU_REGION_FLAG_MEM
+ | VFU_REGION_FLAG_64_BITS))
+ assert ret == 0
+ ret = vfu_setup_region(ctx, index=VFU_PCI_DEV_BAR4_REGION_IDX,
+ size=1073741824,
+ flags=(VFU_REGION_FLAG_RW | VFU_REGION_FLAG_MEM
+ | VFU_REGION_FLAG_64_BITS
+ | VFU_REGION_FLAG_PREFETCH))
+ assert ret == 0
ret = vfu_realize_ctx(ctx)
assert ret == 0
# region_type should be set non-MEM BAR, unset otherwise
hdr = get_pci_header(ctx)
- assert hdr.bars[0].io == 0x1
- assert hdr.bars[1].io == 0
+ assert hdr.bars[0].io == PCI_BASE_ADDRESS_SPACE_IO
+ assert hdr.bars[1].mem == PCI_BASE_ADDRESS_SPACE_MEMORY
+ assert hdr.bars[2].mem == (PCI_BASE_ADDRESS_SPACE_MEMORY
+ | PCI_BASE_ADDRESS_MEM_TYPE_64)
+ assert hdr.bars[4].mem == (PCI_BASE_ADDRESS_SPACE_MEMORY
+ | PCI_BASE_ADDRESS_MEM_TYPE_64
+ | PCI_BASE_ADDRESS_MEM_PREFETCH)
vfu_destroy_ctx(ctx)