tests: Add iommufd integration tests

Add an `iommufd` flag to existing VFIO integration tests. When false,
tests use the legacy vfio container/group backend (existing behavior).
When true, tests use vfio cdev with iommufd and vfio_p2p_dma=off.

vfio_p2p_dma=off is required because the VFIO test runner uses a stock
Ubuntu 24.04 kernel (v6.8) which does not support mapping device MMIO
pages (VM_PFNMAP) through iommufd, causing IOMMU_IOAS_MAP to fail with
-EFAULT on MMIO BAR regions.

Signed-off-by: Bo Chen <bchen@crusoe.ai>
This commit is contained in:
Bo Chen
2026-04-07 21:22:21 +00:00
parent 87992c77c1
commit 9d47769bc2
2 changed files with 78 additions and 11 deletions

View File

@@ -30,7 +30,14 @@ cargo build --features mshv --all --release --target "$BUILD_TARGET"
export RUST_BACKTRACE=1
export RUSTFLAGS="$RUSTFLAGS"
# Run VFIO tests using legacy vfio interface with container/group
time cargo nextest run --no-tests=pass --test-threads=1 "vfio::test_nvidia" -- ${test_binary_args[*]}
RES=$?
# Run VFIO tests using vfio cdev interface backed by iommufd
if [ $RES -eq 0 ]; then
time cargo nextest run --no-tests=pass --test-threads=1 "vfio::test_iommufd" -- ${test_binary_args[*]}
RES=$?
fi
exit $RES