From c2683c598598d0c54b7de4f1d172a3e4cec9d87f Mon Sep 17 00:00:00 2001 From: Jason Gunthorpe Date: Tue, 13 Feb 2024 11:19:26 -0400 Subject: sys/linux: add IOMMU_HWPT_GET_DIRTY_BITMAP --- sys/linux/dev_iommu.txt | 26 ++++++++++++++++++++++++++ sys/linux/dev_iommu.txt.const | 3 +++ sys/linux/test/dev_iommu | 2 ++ 3 files changed, 31 insertions(+) (limited to 'sys/linux') diff --git a/sys/linux/dev_iommu.txt b/sys/linux/dev_iommu.txt index b2671a0d9..31462b0ee 100644 --- a/sys/linux/dev_iommu.txt +++ b/sys/linux/dev_iommu.txt @@ -37,6 +37,7 @@ ioctl$IOMMU_HWPT_ALLOC$TEST(fd fd_iommufd, cmd const[IOMMU_HWPT_ALLOC], arg ptr[ ioctl$IOMMU_GET_HW_INFO(fd fd_iommufd, cmd const[IOMMU_GET_HW_INFO], arg ptr[in, iommu_hw_info]) ioctl$IOMMU_HWPT_SET_DIRTY_TRACKING(fd fd_iommufd, cmd const[IOMMU_HWPT_SET_DIRTY_TRACKING], arg ptr[in, iommu_hwpt_set_dirty_tracking]) +ioctl$IOMMU_HWPT_GET_DIRTY_BITMAP(fd fd_iommufd, cmd const[IOMMU_HWPT_GET_DIRTY_BITMAP], arg ptr[in, iommu_hwpt_get_dirty_bitmap]) # VFIO compatibility ioctls # This shares a few structs with dev_vfio.txt @@ -214,6 +215,17 @@ iommu_hwpt_set_dirty_tracking { __reserved const[0x0, int32] } +iommu_hwpt_get_dirty_bitmap { + size len[parent, int32] + hwpt_id hwpt_handle + flags flags[iommufd_hwpt_get_dirty_bitmap_flags, int32] + __reserved const[0x0, int32] + iova int64 + length int64 + page_size int64 + data ptr64[out, array[int8]] +} + iommu_iova_range { start int64 last int64 @@ -224,6 +236,7 @@ iommufd_ioas_map_flags_syz = MOCK_FLAGS_ACCESS_SYZ, IOMMU_IOAS_MAP_WRITEABLE, IO iommufd_option_ops = IOMMU_OPTION_OP_SET, IOMMU_OPTION_OP_GET iommufd_hwpt_alloc_flags = IOMMU_HWPT_ALLOC_NEST_PARENT, IOMMU_HWPT_ALLOC_DIRTY_TRACKING iommufd_hwpt_set_dirty_tracking_flags = IOMMU_HWPT_DIRTY_TRACKING_ENABLE +iommufd_hwpt_get_dirty_bitmap_flags = IOMMU_HWPT_GET_DIRTY_BITMAP_NO_CLEAR iommu_type = VFIO_TYPE1_IOMMU, VFIO_TYPE1v2_IOMMU iommu_extension = VFIO_TYPE1_IOMMU, VFIO_TYPE1v2_IOMMU, VFIO_UNMAP_ALL, VFIO_DMA_CC_IOMMU, VFIO_TYPE1_NESTING_IOMMU, VFIO_UPDATE_VADDR @@ -243,6 +256,7 @@ resource selftest_device_handle[int32] ioctl$IOMMU_TEST_OP_ADD_RESERVED(fd fd_iommufd, cmd const[IOMMU_TEST_CMD], arg ptr[in, iommu_test_cmd$add_reserved]) ioctl$IOMMU_TEST_OP_MOCK_DOMAIN(fd fd_iommufd, cmd const[IOMMU_TEST_CMD], arg ptr[in, iommu_test_cmd$mock_domain]) +ioctl$IOMMU_TEST_OP_MOCK_DOMAIN_FLAGS(fd fd_iommufd, cmd const[IOMMU_TEST_CMD], arg ptr[in, iommu_test_cmd$mock_domain_flags]) ioctl$IOMMU_TEST_OP_MD_CHECK_MAP(fd fd_iommufd, cmd const[IOMMU_TEST_CMD], arg ptr[in, iommu_test_cmd$md_check_map]) ioctl$IOMMU_TEST_OP_MD_CHECK_REFS(fd fd_iommufd, cmd const[IOMMU_TEST_CMD], arg ptr[in, iommu_test_cmd$md_check_refs]) ioctl$IOMMU_TEST_OP_CREATE_ACCESS(fd fd_iommufd, cmd const[IOMMU_TEST_CMD], arg ptr[in, iommu_test_cmd$create_access]) @@ -277,6 +291,17 @@ iommu_test_cmd$mock_domain { out_idev_id device_handle (out) } [size[IOMMU_TEST_CMD_SIZE]] +iommu_test_cmd$mock_domain_flags { + size len[parent, int32] + op const[IOMMU_TEST_OP_MOCK_DOMAIN, int32] + id ioas_handle + __reserved const[0x0, int32] + out_stdev_id selftest_device_handle (out) + out_hwpt_id hwpt_handle (out) + out_idev_id device_handle (out) + dev_flags flags[iommu_test_cmd_mock_domain_flags, int32] +} [size[IOMMU_TEST_CMD_SIZE]] + iommu_test_cmd$md_check_map { size len[parent, int32] op const[IOMMU_TEST_OP_MD_CHECK_MAP, int32] @@ -406,3 +431,4 @@ iommu_test_cmd_acess_pages_flags = MOCK_FLAGS_ACCESS_WRITE iommu_test_cmd_acess_pages_flags_syz = MOCK_FLAGS_ACCESS_SYZ, MOCK_FLAGS_ACCESS_WRITE iommu_test_cmd_acess_rw_flags = MOCK_ACCESS_RW_WRITE, MOCK_ACCESS_RW_SLOW_PATH iommu_test_cmd_acess_rw_flags_syz = MOCK_FLAGS_ACCESS_SYZ, iommu_test_cmd_acess_rw_flags +iommu_test_cmd_mock_domain_flags = MOCK_FLAGS_DEVICE_NO_DIRTY diff --git a/sys/linux/dev_iommu.txt.const b/sys/linux/dev_iommu.txt.const index 259d06db8..f98b10561 100644 --- a/sys/linux/dev_iommu.txt.const +++ b/sys/linux/dev_iommu.txt.const @@ -9,6 +9,8 @@ IOMMU_HWPT_ALLOC_NEST_PARENT = 1 IOMMU_HWPT_DATA_NONE = 0 IOMMU_HWPT_DATA_SELFTEST = 57005 IOMMU_HWPT_DIRTY_TRACKING_ENABLE = 1 +IOMMU_HWPT_GET_DIRTY_BITMAP = 15244, mips64le:ppc64le:536886156 +IOMMU_HWPT_GET_DIRTY_BITMAP_NO_CLEAR = 1 IOMMU_HWPT_SET_DIRTY_TRACKING = 15243, mips64le:ppc64le:536886155 IOMMU_IOAS_ALLOC = 15233, mips64le:ppc64le:536886145 IOMMU_IOAS_ALLOW_IOVAS = 15234, mips64le:ppc64le:536886146 @@ -46,6 +48,7 @@ MOCK_ACCESS_RW_WRITE = 1 MOCK_FLAGS_ACCESS_CREATE_NEEDS_PIN_PAGES = 1 MOCK_FLAGS_ACCESS_SYZ = 65536 MOCK_FLAGS_ACCESS_WRITE = 1 +MOCK_FLAGS_DEVICE_NO_DIRTY = 1 VFIO_CHECK_EXTENSION = 15205, mips64le:ppc64le:536886117 VFIO_DMA_CC_IOMMU = 4 VFIO_GET_API_VERSION = 15204, mips64le:ppc64le:536886116 diff --git a/sys/linux/test/dev_iommu b/sys/linux/test/dev_iommu index 1dfc573a0..a1d1a1acc 100644 --- a/sys/linux/test/dev_iommu +++ b/sys/linux/test/dev_iommu @@ -67,8 +67,10 @@ ioctl$IOMMU_DESTROY$stdev(r0, 0x3b80, &AUTO={0x8, r4}) ioctl$IOMMU_TEST_OP_MOCK_DOMAIN(r0, 0x3ba0, &AUTO={0x48, 0x2, r1, 0x0, 0x0, 0x0, 0x0}) ioctl$IOMMU_HWPT_ALLOC$NONE(r0, 0x3b89, &AUTO={0x28, 0x2, r2, r1, 0x0, 0x0, 0x0, 0x0, &AUTO=''}) ioctl$IOMMU_HWPT_SET_DIRTY_TRACKING(r0, 0x3b8b, &AUTO={0x16, 0x1, r3, 0x0}) +ioctl$IOMMU_HWPT_GET_DIRTY_BITMAP(r0, 0x3b8c, &AUTO={0x30, r3, 0x0, 0x0, 0x0, 0x1000, 0x1000, &AUTO='LLLLLLLLLLLLLLLLLLLLLLLLLLLL'}) ioctl$IOMMU_DESTROY$hwpt(r0, 0x3b80, &AUTO={0x8, r3}) ioctl$IOMMU_DESTROY$stdev(r0, 0x3b80, &AUTO={0x8, r4}) +ioctl$IOMMU_IOAS_UNMAP$ALL(r0, 0x3b86, &AUTO={0x18, r1, 0, 0xFFFFFFFFFFFFFFFF}) ioctl$IOMMU_TEST_OP_SET_TEMP_MEMORY_LIMIT(r0, 0x3ba0, &AUTO={0x48, 0x9, 0x0, 0x0, 0x10}) -- cgit mrf-deployment