github.com/google/syzkaller@v0.0.0-20240517125934-c0f1611a36d6/sys/linux/dev_iommu.txt (about)

     1  # Copyright 2022 syzkaller project authors. All rights reserved.
     2  # Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
     3  
     4  # https://elixir.bootlin.com/linux/latest/source/include/uapi/linux/iommufd.h
     5  # https://elixir.bootlin.com/linux/latest/source/drivers/iommu/iommufd/main.c
     6  
     7  include <uapi/linux/fcntl.h>
     8  include <uapi/linux/iommufd.h>
     9  include <uapi/linux/vfio.h>
    10  
    11  resource fd_iommufd[fd]
    12  resource ioas_handle[int32]
    13  
    14  openat$iommufd(fd const[AT_FDCWD], file ptr[in, string["/dev/iommu"]], flags flags[open_flags], mode const[0]) fd_iommufd
    15  
    16  ioctl$IOMMU_DESTROY$ioas(fd fd_iommufd, cmd const[IOMMU_DESTROY], arg ptr[in, iommu_destroy$ioas])
    17  
    18  ioctl$IOMMU_IOAS_ALLOC(fd fd_iommufd, cmd const[IOMMU_IOAS_ALLOC], arg ptr[in, iommu_ioas_alloc])
    19  ioctl$IOMMU_IOAS_IOVA_RANGES(fd fd_iommufd, cmd const[IOMMU_IOAS_IOVA_RANGES], arg ptr[in, iommu_ioas_iova_ranges])
    20  ioctl$IOMMU_IOAS_ALLOW_IOVAS(fd fd_iommufd, cmd const[IOMMU_IOAS_ALLOW_IOVAS], arg ptr[in, iommu_ioas_allow_iovas])
    21  ioctl$IOMMU_IOAS_MAP(fd fd_iommufd, cmd const[IOMMU_IOAS_MAP], arg ptr[in, iommu_ioas_map])
    22  ioctl$IOMMU_IOAS_MAP$PAGES(fd fd_iommufd, cmd const[IOMMU_IOAS_MAP], arg ptr[in, iommu_ioas_map$PAGES])
    23  ioctl$IOMMU_IOAS_COPY(fd fd_iommufd, cmd const[IOMMU_IOAS_COPY], arg ptr[in, iommu_ioas_copy])
    24  ioctl$IOMMU_IOAS_COPY$syz(fd fd_iommufd, cmd const[IOMMU_IOAS_COPY], arg ptr[in, iommu_ioas_copy$syz])
    25  ioctl$IOMMU_IOAS_UNMAP(fd fd_iommufd, cmd const[IOMMU_IOAS_UNMAP], arg ptr[in, iommu_ioas_unmap])
    26  ioctl$IOMMU_IOAS_UNMAP$ALL(fd fd_iommufd, cmd const[IOMMU_IOAS_UNMAP], arg ptr[in, iommu_ioas_unmap$ALL])
    27  
    28  ioctl$IOMMU_OPTION$IOMMU_OPTION_RLIMIT_MODE(fd fd_iommufd, cmd const[IOMMU_OPTION], arg ptr[in, iommu_option$IOMMU_OPTION_RLIMIT_MODE])
    29  ioctl$IOMMU_OPTION$IOMMU_OPTION_HUGE_PAGES(fd fd_iommufd, cmd const[IOMMU_OPTION], arg ptr[in, iommu_option$IOMMU_OPTION_HUGE_PAGES])
    30  
    31  ioctl$IOMMU_VFIO_IOAS$GET(fd fd_iommufd, cmd const[IOMMU_VFIO_IOAS], arg ptr[in, iommu_vfio_ioas$GET])
    32  ioctl$IOMMU_VFIO_IOAS$SET(fd fd_iommufd, cmd const[IOMMU_VFIO_IOAS], arg ptr[in, iommu_vfio_ioas$SET])
    33  ioctl$IOMMU_VFIO_IOAS$CLEAR(fd fd_iommufd, cmd const[IOMMU_VFIO_IOAS], arg ptr[in, iommu_vfio_ioas$CLEAR])
    34  
    35  ioctl$IOMMU_HWPT_ALLOC$NONE(fd fd_iommufd, cmd const[IOMMU_HWPT_ALLOC], arg ptr[in, iommu_hwpt_alloc$IOMMU_HWPT_DATA_NONE])
    36  ioctl$IOMMU_HWPT_ALLOC$TEST(fd fd_iommufd, cmd const[IOMMU_HWPT_ALLOC], arg ptr[in, iommu_hwpt_alloc$IOMMU_HWPT_DATA_SELFTEST])
    37  
    38  ioctl$IOMMU_GET_HW_INFO(fd fd_iommufd, cmd const[IOMMU_GET_HW_INFO], arg ptr[in, iommu_hw_info])
    39  ioctl$IOMMU_HWPT_SET_DIRTY_TRACKING(fd fd_iommufd, cmd const[IOMMU_HWPT_SET_DIRTY_TRACKING], arg ptr[in, iommu_hwpt_set_dirty_tracking])
    40  ioctl$IOMMU_HWPT_GET_DIRTY_BITMAP(fd fd_iommufd, cmd const[IOMMU_HWPT_GET_DIRTY_BITMAP], arg ptr[in, iommu_hwpt_get_dirty_bitmap])
    41  ioctl$IOMMU_HWPT_INVALIDATE$TEST(fd fd_iommufd, cmd const[IOMMU_HWPT_INVALIDATE], arg ptr[in, iommu_hwpt_invalidate$IOMMU_HWPT_INVALIDATE_DATA_SELFTEST])
    42  
    43  # VFIO compatibility ioctls
    44  # This shares a few structs with dev_vfio.txt
    45  ioctl$IOMMU_VFIO_GET_API_VERSION(fd fd_iommufd, cmd const[VFIO_GET_API_VERSION])
    46  ioctl$IOMMU_VFIO_SET_IOMMU(fd fd_iommufd, cmd const[VFIO_SET_IOMMU], arg flags[iommu_type])
    47  ioctl$IOMMU_VFIO_CHECK_EXTENSION(fd fd_iommufd, cmd const[VFIO_CHECK_EXTENSION], arg flags[iommu_extension])
    48  ioctl$IOMMU_VFIO_IOMMU_GET_INFO(fd fd_iommufd, cmd const[VFIO_IOMMU_GET_INFO], arg ptr[inout, vfio_iommu_type1_info])
    49  
    50  ioctl$IOMMU_VFIO_IOMMU_MAP_DMA(fd fd_iommufd, cmd const[VFIO_IOMMU_MAP_DMA], arg ptr[in, vfio_iommu_type1_dma_map])
    51  ioctl$IOMMU_VFIO_IOMMU_UNMAP_DMA(fd fd_iommufd, cmd const[VFIO_IOMMU_UNMAP_DMA], arg ptr[in, vfio_iommu_type1_dma_unmap])
    52  
    53  iommu_destroy$ioas {
    54  	size	len[parent, int32]
    55  	id	ioas_handle
    56  }
    57  
    58  iommu_ioas_alloc {
    59  	size		len[parent, int32]
    60  	flags		const[0, int32]
    61  	out_ioas_id	ioas_handle	(out)
    62  }
    63  
    64  iommu_ioas_iova_ranges {
    65  	size			len[parent, int32]
    66  	ioas_id			ioas_handle
    67  	num_iovas		len[allowed_iovas, int32]
    68  	__reserved		const[0x0, int32]
    69  	allowed_iovas		ptr64[out, array[iommu_iova_range]]
    70  	out_iova_alignment	int64	(out)
    71  }
    72  
    73  iommu_ioas_allow_iovas {
    74  	size		len[parent, int32]
    75  	ioas_id		ioas_handle
    76  	num_iovas	len[allowed_iovas, int32]
    77  	__reserved	const[0x0, int32]
    78  	allowed_iovas	ptr64[in, array[iommu_iova_range]]
    79  }
    80  
    81  # user_va/length is a pointer to a chunk of memory
    82  # iova on output is the address that memory was placed at.
    83  # The iova/len pair must be used as an input to unmap
    84  # IOMMU_IOAS_MAP_FIXED_IOVA means iova is an input
    85  iommu_ioas_map {
    86  	size		len[parent, int32]
    87  	flags		flags[iommufd_ioas_map_flags, int32]
    88  	ioas_id		ioas_handle
    89  	__reserved	const[0x0, int32]
    90  	user_va		ptr64[in, array[int8]]
    91  	length		len[user_va, int64]
    92  	iova		int64	(inout)
    93  }
    94  
    95  # Version that guarantees 4k alignment, has a higher chance of success
    96  iommu_ioas_map$PAGES {
    97  	size		len[parent, int32]
    98  	flags		flags[iommufd_ioas_map_flags, int32]
    99  	ioas_id		ioas_handle
   100  	__reserved	const[0x0, int32]
   101  	user_va		vma64
   102  	length		len[user_va, int64]
   103  	iova		int64	(inout)
   104  }
   105  
   106  iommu_ioas_copy {
   107  	size		len[parent, int32]
   108  	flags		flags[iommufd_ioas_map_flags, int32]
   109  	dst_ioas_id	ioas_handle
   110  	src_ioas_id	ioas_handle
   111  	length		int64
   112  	dst_iova	int64	(inout)
   113  	src_iova	int64
   114  }
   115  
   116  iommu_ioas_copy$syz {
   117  	size		len[parent, int32]
   118  	flags		flags[iommufd_ioas_map_flags_syz, int32]
   119  	dst_ioas_id	ioas_handle
   120  	src_ioas_id	ioas_handle
   121  	length		int64[0:4194304]
   122  	dst_iova	int64	(inout)
   123  # See iommufd_test_syz_conv_iova_id()
   124  	nth_area	int32[0:10]
   125  	offset		int32[0:4194304]
   126  }
   127  
   128  iommu_ioas_unmap {
   129  	size	len[parent, int32]
   130  	ioas_id	ioas_handle
   131  	iova	int64
   132  	length	int64
   133  }
   134  
   135  iommu_ioas_unmap$ALL {
   136  	size	len[parent, int32]
   137  	ioas_id	ioas_handle
   138  	iova	const[0x0, int64]
   139  	length	const[-1, int64]
   140  }
   141  
   142  iommu_option$IOMMU_OPTION_RLIMIT_MODE {
   143  	size		len[parent, int32]
   144  	option_id	const[IOMMU_OPTION_RLIMIT_MODE, int32]
   145  	op		flags[iommufd_option_ops, int16]
   146  	__reserved	const[0x0, int16]
   147  	object_id	const[0x0, int32]
   148  	val64		int64	(inout)
   149  }
   150  
   151  iommu_option$IOMMU_OPTION_HUGE_PAGES {
   152  	size		len[parent, int32]
   153  	option_id	const[IOMMU_OPTION_HUGE_PAGES, int32]
   154  	op		flags[iommufd_option_ops, int16]
   155  	__reserved	const[0x0, int16]
   156  	object_id	ioas_handle
   157  	val64		int64	(inout)
   158  }
   159  
   160  iommu_vfio_ioas$GET {
   161  	size		len[parent, int32]
   162  	ioas_id		ioas_handle	(out)
   163  	opt		const[IOMMU_VFIO_IOAS_GET, int16]
   164  	__reserved	const[0x0, int16]
   165  }
   166  
   167  iommu_vfio_ioas$SET {
   168  	size		len[parent, int32]
   169  	ioas_id		ioas_handle
   170  	opt		const[IOMMU_VFIO_IOAS_SET, int16]
   171  	__reserved	const[0x0, int16]
   172  }
   173  
   174  iommu_vfio_ioas$CLEAR {
   175  	size		len[parent, int32]
   176  	ioas_id		const[0x0, int32]
   177  	opt		const[IOMMU_VFIO_IOAS_CLEAR, int16]
   178  	__reserved	const[0x0, int16]
   179  }
   180  
   181  type iommu_hwpt_alloc[DATA_TYPE, DATA] {
   182  	size		len[parent, int32]
   183  	flags		flags[iommufd_hwpt_alloc_flags, int32]
   184  	dev_id		device_handle
   185  	pt_id		ioas_handle
   186  	out_hwpt_id	hwpt_handle	(out)
   187  	__reserved	const[0x0, int32]
   188  	data_type	const[DATA_TYPE, int32]
   189  	data_len	len[uptr, int32]
   190  	uptr		ptr64[in, DATA]
   191  }
   192  
   193  type iommu_hwpt_alloc$IOMMU_HWPT_DATA_NONE iommu_hwpt_alloc[IOMMU_HWPT_DATA_NONE, array[int8]]
   194  
   195  iommu_hwpt_selftest {
   196  	iotlb	const[0xbadbeef, int32]
   197  }
   198  
   199  type iommu_hwpt_alloc$IOMMU_HWPT_DATA_SELFTEST iommu_hwpt_alloc[IOMMU_HWPT_DATA_SELFTEST, iommu_hwpt_selftest]
   200  
   201  iommu_hw_info {
   202  	size			len[parent, int32]
   203  	flags			const[0x0, int32]
   204  	dev_id			device_handle
   205  	data_len		len[data_uptr, int32]
   206  	data_uptr		ptr64[out, array[int8]]
   207  	out_data_type		int32	(out)
   208  	__reserved		const[0x0, int32]
   209  	out_capabilities	int64	(out)
   210  }
   211  
   212  iommu_hwpt_set_dirty_tracking {
   213  	size		len[parent, int32]
   214  	flags		flags[iommufd_hwpt_set_dirty_tracking_flags, int32]
   215  	hwpt_id		hwpt_handle
   216  	__reserved	const[0x0, int32]
   217  }
   218  
   219  iommu_hwpt_get_dirty_bitmap {
   220  	size		len[parent, int32]
   221  	hwpt_id		hwpt_handle
   222  	flags		flags[iommufd_hwpt_get_dirty_bitmap_flags, int32]
   223  	__reserved	const[0x0, int32]
   224  	iova		int64
   225  	length		int64
   226  	page_size	int64
   227  	data		ptr64[out, array[int8]]
   228  }
   229  
   230  iommu_hwpt_invalidate_selftest {
   231  	flags		flags[iommufd_hwpt_invalidate_selftest_flags, int32]
   232  	iotlb_id	int32[0:MOCK_NESTED_DOMAIN_IOTLB_ID_MAX]
   233  }
   234  
   235  iommu_hwpt_invalidate$IOMMU_HWPT_INVALIDATE_DATA_SELFTEST {
   236  	size		len[parent, int32]
   237  	hwpt_id		hwpt_handle
   238  	data_uptr	ptr64[in, array[iommu_hwpt_invalidate_selftest]]
   239  	data_type	const[IOMMU_HWPT_INVALIDATE_DATA_SELFTEST, int32]
   240  	entry_len	const[0x8, int32]
   241  	entry_num	len[data_uptr, int32]
   242  	__reserved	const[0x0, int32]
   243  }
   244  
   245  iommu_iova_range {
   246  	start	int64
   247  	last	int64
   248  }
   249  
   250  iommufd_ioas_map_flags = IOMMU_IOAS_MAP_FIXED_IOVA, IOMMU_IOAS_MAP_WRITEABLE, IOMMU_IOAS_MAP_READABLE
   251  iommufd_ioas_map_flags_syz = MOCK_FLAGS_ACCESS_SYZ, IOMMU_IOAS_MAP_WRITEABLE, IOMMU_IOAS_MAP_READABLE, MOCK_FLAGS_ACCESS_SYZ, IOMMU_IOAS_MAP_READABLE
   252  iommufd_option_ops = IOMMU_OPTION_OP_SET, IOMMU_OPTION_OP_GET
   253  iommufd_hwpt_alloc_flags = IOMMU_HWPT_ALLOC_NEST_PARENT, IOMMU_HWPT_ALLOC_DIRTY_TRACKING
   254  iommufd_hwpt_set_dirty_tracking_flags = IOMMU_HWPT_DIRTY_TRACKING_ENABLE
   255  iommufd_hwpt_get_dirty_bitmap_flags = IOMMU_HWPT_GET_DIRTY_BITMAP_NO_CLEAR
   256  
   257  iommu_type = VFIO_TYPE1_IOMMU, VFIO_TYPE1v2_IOMMU
   258  iommu_extension = VFIO_TYPE1_IOMMU, VFIO_TYPE1v2_IOMMU, VFIO_UNMAP_ALL, VFIO_DMA_CC_IOMMU, VFIO_TYPE1_NESTING_IOMMU, VFIO_UPDATE_VADDR
   259  
   260  # This section requires CONFIG_IOMMUFD_TEST
   261  # It allows the kernel to provide a mock consumer of iommufd which allows greater coverage
   262  
   263  include <../drivers/iommu/iommufd/iommufd_test.h>
   264  
   265  define IOMMU_TEST_CMD_SIZE	sizeof(struct iommu_test_cmd)
   266  
   267  resource device_handle[int32]
   268  resource hwpt_handle[int32]
   269  resource fd_access[fd]
   270  resource access_pages_handle[int32]
   271  resource selftest_device_handle[int32]
   272  
   273  ioctl$IOMMU_TEST_OP_ADD_RESERVED(fd fd_iommufd, cmd const[IOMMU_TEST_CMD], arg ptr[in, iommu_test_cmd$add_reserved])
   274  ioctl$IOMMU_TEST_OP_MOCK_DOMAIN(fd fd_iommufd, cmd const[IOMMU_TEST_CMD], arg ptr[in, iommu_test_cmd$mock_domain])
   275  ioctl$IOMMU_TEST_OP_MOCK_DOMAIN_FLAGS(fd fd_iommufd, cmd const[IOMMU_TEST_CMD], arg ptr[in, iommu_test_cmd$mock_domain_flags])
   276  ioctl$IOMMU_TEST_OP_MD_CHECK_MAP(fd fd_iommufd, cmd const[IOMMU_TEST_CMD], arg ptr[in, iommu_test_cmd$md_check_map])
   277  ioctl$IOMMU_TEST_OP_MD_CHECK_REFS(fd fd_iommufd, cmd const[IOMMU_TEST_CMD], arg ptr[in, iommu_test_cmd$md_check_refs])
   278  ioctl$IOMMU_TEST_OP_CREATE_ACCESS(fd fd_iommufd, cmd const[IOMMU_TEST_CMD], arg ptr[in, iommu_test_cmd$create_access])
   279  ioctl$IOMMU_TEST_OP_DESTROY_ACCESS_PAGES(fd fd_iommufd, cmd const[IOMMU_TEST_CMD], arg ptr[in, iommu_test_cmd$destroy_access_pages])
   280  ioctl$IOMMU_TEST_OP_ACCESS_PAGES(fd fd_iommufd, cmd const[IOMMU_TEST_CMD], arg ptr[in, iommu_test_cmd$access_pages])
   281  ioctl$IOMMU_TEST_OP_ACCESS_PAGES$syz(fd fd_iommufd, cmd const[IOMMU_TEST_CMD], arg ptr[in, iommu_test_cmd$access_pages$syz])
   282  ioctl$IOMMU_TEST_OP_ACCESS_RW(fd fd_iommufd, cmd const[IOMMU_TEST_CMD], arg ptr[in, iommu_test_cmd$access_rw])
   283  ioctl$IOMMU_TEST_OP_ACCESS_RW$syz(fd fd_iommufd, cmd const[IOMMU_TEST_CMD], arg ptr[in, iommu_test_cmd$access_rw$syz])
   284  ioctl$IOMMU_TEST_OP_SET_TEMP_MEMORY_LIMIT(fd fd_iommufd, cmd const[IOMMU_TEST_CMD], arg ptr[in, iommu_test_cmd$memory_limit])
   285  ioctl$IOMMU_TEST_OP_MOCK_DOMAIN_REPLACE(fd fd_iommufd, cmd const[IOMMU_TEST_CMD], arg ptr[in, iommu_test_cmd$mock_domain_replace])
   286  ioctl$IOMMU_TEST_OP_ACCESS_REPLACE_IOAS(fd fd_iommufd, cmd const[IOMMU_TEST_CMD], arg ptr[in, iommu_test_cmd$access_replace_ioas])
   287  
   288  ioctl$IOMMU_DESTROY$stdev(fd fd_iommufd, cmd const[IOMMU_DESTROY], arg ptr[in, iommu_destroy$stdev])
   289  ioctl$IOMMU_DESTROY$hwpt(fd fd_iommufd, cmd const[IOMMU_DESTROY], arg ptr[in, iommu_destroy$hwpt])
   290  
   291  iommu_test_cmd$add_reserved {
   292  	size		len[parent, int32]
   293  	op		const[IOMMU_TEST_OP_ADD_RESERVED, int32]
   294  	id		ioas_handle
   295  	__reserved	const[0x0, int32]
   296  	start		int64
   297  	length		int64
   298  } [size[IOMMU_TEST_CMD_SIZE]]
   299  
   300  iommu_test_cmd$mock_domain {
   301  	size		len[parent, int32]
   302  	op		const[IOMMU_TEST_OP_MOCK_DOMAIN, int32]
   303  	id		ioas_handle
   304  	__reserved	const[0x0, int32]
   305  	out_stdev_id	selftest_device_handle	(out)
   306  	out_hwpt_id	hwpt_handle	(out)
   307  	out_idev_id	device_handle	(out)
   308  } [size[IOMMU_TEST_CMD_SIZE]]
   309  
   310  iommu_test_cmd$mock_domain_flags {
   311  	size		len[parent, int32]
   312  	op		const[IOMMU_TEST_OP_MOCK_DOMAIN, int32]
   313  	id		ioas_handle
   314  	__reserved	const[0x0, int32]
   315  	out_stdev_id	selftest_device_handle	(out)
   316  	out_hwpt_id	hwpt_handle	(out)
   317  	out_idev_id	device_handle	(out)
   318  	dev_flags	flags[iommu_test_cmd_mock_domain_flags, int32]
   319  } [size[IOMMU_TEST_CMD_SIZE]]
   320  
   321  iommu_test_cmd$md_check_map {
   322  	size		len[parent, int32]
   323  	op		const[IOMMU_TEST_OP_MD_CHECK_MAP, int32]
   324  	id		hwpt_handle
   325  	__reserved	const[0x0, int32]
   326  	iova		int64
   327  	length		len[uptr, int64]
   328  	uptr		ptr64[in, array[int8]]
   329  } [size[IOMMU_TEST_CMD_SIZE]]
   330  
   331  iommu_test_cmd$md_check_refs {
   332  	size		len[parent, int32]
   333  	op		const[IOMMU_TEST_OP_MD_CHECK_REFS, int32]
   334  	id		const[0x0, int32]
   335  	__reserved	const[0x0, int32]
   336  	length		len[uptr, int64]
   337  	uptr		ptr64[in, array[int8]]
   338  	refs		int32
   339  } [size[IOMMU_TEST_CMD_SIZE]]
   340  
   341  iommu_test_cmd$create_access {
   342  	size		len[parent, int32]
   343  	op		const[IOMMU_TEST_OP_CREATE_ACCESS, int32]
   344  	id		ioas_handle
   345  	__reserved	const[0x0, int32]
   346  	out_access_fd	fd_access	(out)
   347  	flags		flags[iommu_test_cmd_create_access_flags, int32]
   348  } [size[IOMMU_TEST_CMD_SIZE]]
   349  
   350  iommu_test_cmd$destroy_access_pages {
   351  	size		len[parent, int32]
   352  	op		const[IOMMU_TEST_OP_DESTROY_ACCESS_PAGES, int32]
   353  	id		ioas_handle
   354  	__reserved	const[0x0, int32]
   355  	access_pages_id	access_pages_handle
   356  } [size[IOMMU_TEST_CMD_SIZE]]
   357  
   358  iommu_test_cmd$access_pages {
   359  	size			len[parent, int32]
   360  	op			const[IOMMU_TEST_OP_ACCESS_PAGES, int32]
   361  	id			fd_access
   362  	__reserved		const[0x0, int32]
   363  	flags			flags[iommu_test_cmd_acess_pages_flags, int32]
   364  	out_access_pages_id	access_pages_handle	(out)
   365  	iova			int64
   366  	length			int64
   367  # The test suite uses uptr to confirm the pages are the right pages, 0 will disable the check
   368  	uptr			const[0x0, int64]
   369  } [size[IOMMU_TEST_CMD_SIZE]]
   370  
   371  iommu_test_cmd$access_pages$syz {
   372  	size			len[parent, int32]
   373  	op			const[IOMMU_TEST_OP_ACCESS_PAGES, int32]
   374  	id			fd_access
   375  	__reserved		const[0x0, int32]
   376  	flags			flags[iommu_test_cmd_acess_pages_flags_syz, int32]
   377  	out_access_pages_id	access_pages_handle	(out)
   378  # See iommufd_test_syz_conv_iova_id()
   379  	nth_area		int32[0:10]
   380  	offset			int32[0:4194304]
   381  	length			int64[0:4194304]
   382  # The test suite uses uptr to confirm the pages are the right pages, 0 will disable the check
   383  	uptr			const[0x0, int64]
   384  } [size[IOMMU_TEST_CMD_SIZE]]
   385  
   386  iommu_test_cmd$access_rw {
   387  	size		len[parent, int32]
   388  	op		const[IOMMU_TEST_OP_ACCESS_RW, int32]
   389  	id		fd_access
   390  	__reserved	const[0x0, int32]
   391  	iova		int64
   392  	length		len[uptr, int64]
   393  	uptr		ptr64[in, array[int8]]
   394  	flags		flags[iommu_test_cmd_acess_rw_flags, int32]
   395  } [size[IOMMU_TEST_CMD_SIZE]]
   396  
   397  iommu_test_cmd$access_rw$syz {
   398  	size		len[parent, int32]
   399  	op		const[IOMMU_TEST_OP_ACCESS_RW, int32]
   400  	id		fd_access
   401  	__reserved	const[0x0, int32]
   402  # See iommufd_test_syz_conv_iova_id()
   403  	nth_area	int32[0:10]
   404  	offset		int32[0:4194304]
   405  	length		len[uptr, int64]
   406  	uptr		ptr64[in, array[int8]]
   407  	flags		flags[iommu_test_cmd_acess_rw_flags_syz, int32]
   408  } [size[IOMMU_TEST_CMD_SIZE]]
   409  
   410  iommu_test_cmd$memory_limit {
   411  	size		len[parent, int32]
   412  	op		const[IOMMU_TEST_OP_SET_TEMP_MEMORY_LIMIT, int32]
   413  	id		const[0x0, int32]
   414  	__reserved	const[0x0, int32]
   415  	limit		int32
   416  } [size[IOMMU_TEST_CMD_SIZE]]
   417  
   418  iommu_test_cmd$mock_domain_replace {
   419  	size		len[parent, int32]
   420  	op		const[IOMMU_TEST_OP_MOCK_DOMAIN_REPLACE, int32]
   421  	id		selftest_device_handle
   422  	__reserved	const[0x0, int32]
   423  # or hwpt_handle
   424  	pt_id		ioas_handle
   425  } [size[IOMMU_TEST_CMD_SIZE]]
   426  
   427  iommu_test_cmd$access_replace_ioas {
   428  	size		len[parent, int32]
   429  	op		const[IOMMU_TEST_OP_ACCESS_REPLACE_IOAS, int32]
   430  	id		fd_access
   431  	__reserved	const[0x0, int32]
   432  	ioas_id		ioas_handle
   433  } [size[IOMMU_TEST_CMD_SIZE]]
   434  
   435  iommu_destroy$stdev {
   436  	size	len[parent, int32]
   437  	id	selftest_device_handle
   438  }
   439  
   440  iommu_destroy$hwpt {
   441  	size	len[parent, int32]
   442  	id	hwpt_handle
   443  }
   444  
   445  iommu_test_cmd_create_access_flags = MOCK_FLAGS_ACCESS_CREATE_NEEDS_PIN_PAGES
   446  iommu_test_cmd_acess_pages_flags = MOCK_FLAGS_ACCESS_WRITE
   447  iommu_test_cmd_acess_pages_flags_syz = MOCK_FLAGS_ACCESS_SYZ, MOCK_FLAGS_ACCESS_WRITE
   448  iommu_test_cmd_acess_rw_flags = MOCK_ACCESS_RW_WRITE, MOCK_ACCESS_RW_SLOW_PATH
   449  iommu_test_cmd_acess_rw_flags_syz = MOCK_FLAGS_ACCESS_SYZ, iommu_test_cmd_acess_rw_flags
   450  iommu_test_cmd_mock_domain_flags = MOCK_FLAGS_DEVICE_NO_DIRTY
   451  iommufd_hwpt_invalidate_selftest_flags = IOMMU_TEST_INVALIDATE_FLAG_ALL