From e3d0b70923ed1e01d3b0339b21910fa4f0e975ae Mon Sep 17 00:00:00 2001 From: Jason Gunthorpe Date: Wed, 7 Feb 2024 12:45:05 -0400 Subject: sys/linux: make tets/dev_iommu work again This should run without any errno returns. A number of problems have crept in: The kernel changed the size of the test ioctl from 0x38 to 0x48. The generated description picked this up but the hardwired constant in the test did not. Update all cases. Fix TEST_OP_MOCK_DOMAIN to use the kernel changed ID layout and new destruction sequence. Move TEST_OP_MD_CHECK_* up into a region with a MOCK_DOMAIN and fix their arguments so they work properly. The test now passes on v6.8-rc3 with no error failures. --- sys/linux/dev_iommu.txt | 6 +++--- sys/linux/test/dev_iommu | 28 +++++++++++++--------------- 2 files changed, 16 insertions(+), 18 deletions(-) (limited to 'sys/linux') diff --git a/sys/linux/dev_iommu.txt b/sys/linux/dev_iommu.txt index fa70d3a15..e31be76a3 100644 --- a/sys/linux/dev_iommu.txt +++ b/sys/linux/dev_iommu.txt @@ -209,7 +209,7 @@ ioctl$IOMMU_TEST_OP_SET_TEMP_MEMORY_LIMIT(fd fd_iommufd, cmd const[IOMMU_TEST_CM ioctl$IOMMU_TEST_OP_MOCK_DOMAIN_REPLACE(fd fd_iommufd, cmd const[IOMMU_TEST_CMD], arg ptr[in, iommu_test_cmd$mock_domain_replace]) ioctl$IOMMU_TEST_OP_ACCESS_REPLACE_IOAS(fd fd_iommufd, cmd const[IOMMU_TEST_CMD], arg ptr[in, iommu_test_cmd$access_replace_ioas]) -ioctl$IOMMU_DESTROY$device(fd fd_iommufd, cmd const[IOMMU_DESTROY], arg ptr[in, iommu_destroy$device]) +ioctl$IOMMU_DESTROY$stdev(fd fd_iommufd, cmd const[IOMMU_DESTROY], arg ptr[in, iommu_destroy$stdev]) ioctl$IOMMU_DESTROY$hwpt(fd fd_iommufd, cmd const[IOMMU_DESTROY], arg ptr[in, iommu_destroy$hwpt]) iommu_test_cmd$add_reserved { @@ -345,9 +345,9 @@ iommu_test_cmd$access_replace_ioas { ioas_id ioas_handle } [size[IOMMU_TEST_CMD_SIZE]] -iommu_destroy$device { +iommu_destroy$stdev { size len[parent, int32] - id device_handle + id selftest_device_handle } iommu_destroy$hwpt { diff --git a/sys/linux/test/dev_iommu b/sys/linux/test/dev_iommu index 354b0abaa..4038a77e6 100644 --- a/sys/linux/test/dev_iommu +++ b/sys/linux/test/dev_iommu @@ -39,26 +39,24 @@ ioctl$IOMMU_VFIO_IOMMU_MAP_DMA(r0, 0x3b71, &AUTO={0x20, 0x0, &AUTO='LLLLLLLLLLLL ioctl$IOMMU_VFIO_IOMMU_UNMAP_DMA(r0, 0x3b72, &AUTO={0x18, 0x0, 0x1c, 0x1c, ''}) ioctl$IOMMU_IOAS_UNMAP$ALL(r0, 0x3b86, &AUTO={0x18, r1, 0, 0xFFFFFFFFFFFFFFFF}) -ioctl$IOMMU_TEST_OP_ADD_RESERVED(r0, 0x3ba0, &AUTO={0x38, 0x1, r1, 0x0, 0x1000, 0x2000}) +ioctl$IOMMU_TEST_OP_ADD_RESERVED(r0, 0x3ba0, &AUTO={0x48, 0x1, r1, 0x0, 0x1000, 0x2000}) -ioctl$IOMMU_TEST_OP_MOCK_DOMAIN(r0, 0x3ba0, &AUTO={0x38, 0x2, r1, 0x0, 0x0, 0x0}) -ioctl$IOMMU_DESTROY$device(r0, 0x3b80, &AUTO={0x8, r2}) -ioctl$IOMMU_DESTROY$hwpt(r0, 0x3b80, &AUTO={0x8, r3}) - -ioctl$IOMMU_TEST_OP_CREATE_ACCESS(r0, 0x3ba0, &AUTO={0x38, 0x5, r1, 0x0, 0x0, 0x1}) +ioctl$IOMMU_TEST_OP_MOCK_DOMAIN(r0, 0x3ba0, &AUTO={0x48, 0x2, r1, 0x0, 0x0, 0x0, 0x0}) +ioctl$IOMMU_IOAS_MAP$PAGES(r0, 0x3b85, &AUTO={0x28, 0x7, r1, 0x0, &(0x7f0000ffc000/0x1000)=nil, 0x1000, 0x1004000}) +ioctl$IOMMU_TEST_OP_MD_CHECK_MAP(r0, 0x3ba0, &AUTO={0x48, 0x3, r3, 0x0, 0x1004000, 0x1000, &(0x7f0000ffc000/0x1000)}) +ioctl$IOMMU_TEST_OP_MD_CHECK_REFS(r0, 0x3ba0, &AUTO={0x48, 0x4, 0x0, 0x0, 0x1000, &(0x7f0000ffc000/0x1000), 0x1}) +ioctl$IOMMU_IOAS_UNMAP(r0, 0x3b86, &AUTO={0x18, r1, 0x1000, 0x1004000}) +ioctl$IOMMU_DESTROY$stdev(r0, 0x3b80, &AUTO={0x8, r4}) +ioctl$IOMMU_TEST_OP_CREATE_ACCESS(r0, 0x3ba0, &AUTO={0x48, 0x5, r1, 0x0, 0x0, 0x1}) ioctl$IOMMU_IOAS_MAP(r0, 0x3b85, &AUTO={0x28, 0x7, r1, 0x0, &(0x7f00000a0000)='LLLLLLLLLLLLLLLLLLLLLLLLLLLL', 0x1000, 0x0}) -ioctl$IOMMU_TEST_OP_ACCESS_PAGES(r0, 0x3ba0, &AUTO={0x38, 0x7, r2, 0x0, 0x0, 0x0, 0x0, 0x1000, 0x0}) -ioctl$IOMMU_TEST_OP_ACCESS_RW(r0, 0x3ba0, &AUTO={0x38, 0x8, r2, 0x0, 0x0, 0x10, &AUTO='LLLLLLLLLLLLLLLLLLLLLLLLLLLL', 0x0}) -ioctl$IOMMU_TEST_OP_DESTROY_ACCESS_PAGES(r0, 0x3ba0, &AUTO={0x38, 0x6, r2, 0x0, r3}) - -ioctl$IOMMU_IOAS_MAP(r0, 0x3b85, &AUTO={0x28, 0x7, r1, 0x0, &(0x7f00000a0000)='LLLLLLLLLLLLLLLLLLLLLLLLLLLL', 0x1000, 0x1c}) -ioctl$IOMMU_TEST_OP_MD_CHECK_MAP(r0, 0x3ba0, &AUTO={0x38, 0x3, r2, 0x0, 0x1c, 0x1000, &AUTO='LLLLLLLLLLLLLLLLLLLLLLLLLLLL'}) -ioctl$IOMMU_TEST_OP_MD_CHECK_REFS(r0, 0x3ba0, &AUTO={0x38, 0x4, r2, 0x0, 0x800, &AUTO='LLLLLLLLLLLLLLLLLLLLLLLLLLLL', 0x1}) -ioctl$IOMMU_IOAS_UNMAP(r0, 0x3b86, &AUTO={0x18, r1, 0x1c, 0x800}) +ioctl$IOMMU_TEST_OP_ACCESS_PAGES(r0, 0x3ba0, &AUTO={0x48, 0x7, r2, 0x0, 0x0, 0x0, 0x0, 0x1000, 0x0}) +ioctl$IOMMU_TEST_OP_ACCESS_RW(r0, 0x3ba0, &AUTO={0x48, 0x8, r2, 0x0, 0x0, 0x10, &AUTO='LLLLLLLLLLLLLLLLLLLLLLLLLLLL', 0x0}) +ioctl$IOMMU_TEST_OP_DESTROY_ACCESS_PAGES(r0, 0x3ba0, &AUTO={0x48, 0x6, r2, 0x0, r3}) +ioctl$IOMMU_IOAS_UNMAP$ALL(r0, 0x3b86, &AUTO={0x18, r1, 0, 0xFFFFFFFFFFFFFFFF}) close(r2) -ioctl$IOMMU_TEST_OP_SET_TEMP_MEMORY_LIMIT(r0, 0x3ba0, &AUTO={0x38, 0x9, 0x0, 0x0, 0x10}) +ioctl$IOMMU_TEST_OP_SET_TEMP_MEMORY_LIMIT(r0, 0x3ba0, &AUTO={0x48, 0x9, 0x0, 0x0, 0x10}) ioctl$IOMMU_DESTROY$ioas(r0, 0x3b80, &AUTO={0x8, r1}) -- cgit mrf-deployment