Lines Matching refs:fd
36 ioctl(self->fd, \
41 static int _test_cmd_mock_domain(int fd, unsigned int ioas_id, __u32 *device_id, in _test_cmd_mock_domain() argument
52 ret = ioctl(fd, IOMMU_TEST_CMD, &cmd); in _test_cmd_mock_domain()
63 ASSERT_EQ(0, _test_cmd_mock_domain(self->fd, ioas_id, device_id, \
66 EXPECT_ERRNO(_errno, _test_cmd_mock_domain(self->fd, ioas_id, \
69 static int _test_cmd_create_access(int fd, unsigned int ioas_id, in _test_cmd_create_access() argument
80 ret = ioctl(fd, IOMMU_TEST_CMD, &cmd); in _test_cmd_create_access()
87 ASSERT_EQ(0, _test_cmd_create_access(self->fd, ioas_id, access_id, \
97 static int _test_cmd_destroy_access_pages(int fd, unsigned int access_id, in _test_cmd_destroy_access_pages() argument
106 return ioctl(fd, IOMMU_TEST_CMD, &cmd); in _test_cmd_destroy_access_pages()
109 ASSERT_EQ(0, _test_cmd_destroy_access_pages(self->fd, access_id, \
113 self->fd, access_id, access_pages_id))
115 static int _test_ioctl_destroy(int fd, unsigned int id) in _test_ioctl_destroy() argument
121 return ioctl(fd, IOMMU_DESTROY, &cmd); in _test_ioctl_destroy()
123 #define test_ioctl_destroy(id) ASSERT_EQ(0, _test_ioctl_destroy(self->fd, id))
125 static int _test_ioctl_ioas_alloc(int fd, __u32 *id) in _test_ioctl_ioas_alloc() argument
132 ret = ioctl(fd, IOMMU_IOAS_ALLOC, &cmd); in _test_ioctl_ioas_alloc()
140 ASSERT_EQ(0, _test_ioctl_ioas_alloc(self->fd, id)); \
144 static int _test_ioctl_ioas_map(int fd, unsigned int ioas_id, void *buffer, in _test_ioctl_ioas_map() argument
159 ret = ioctl(fd, IOMMU_IOAS_MAP, &cmd); in _test_ioctl_ioas_map()
164 ASSERT_EQ(0, _test_ioctl_ioas_map(self->fd, self->ioas_id, buffer, \
171 _test_ioctl_ioas_map(self->fd, self->ioas_id, buffer, \
177 ASSERT_EQ(0, _test_ioctl_ioas_map(self->fd, ioas_id, buffer, length, \
186 self->fd, self->ioas_id, buffer, length, \
198 self->fd, self->ioas_id, buffer, length, \
205 static int _test_ioctl_ioas_unmap(int fd, unsigned int ioas_id, uint64_t iova, in _test_ioctl_ioas_unmap() argument
216 ret = ioctl(fd, IOMMU_IOAS_UNMAP, &cmd); in _test_ioctl_ioas_unmap()
222 ASSERT_EQ(0, _test_ioctl_ioas_unmap(self->fd, self->ioas_id, iova, \
226 ASSERT_EQ(0, _test_ioctl_ioas_unmap(self->fd, ioas_id, iova, length, \
230 EXPECT_ERRNO(_errno, _test_ioctl_ioas_unmap(self->fd, self->ioas_id, \
233 static int _test_ioctl_set_temp_memory_limit(int fd, unsigned int limit) in _test_ioctl_set_temp_memory_limit() argument
241 return ioctl(fd, _IOMMU_TEST_CMD(IOMMU_TEST_OP_SET_TEMP_MEMORY_LIMIT), in _test_ioctl_set_temp_memory_limit()
246 ASSERT_EQ(0, _test_ioctl_set_temp_memory_limit(self->fd, limit))
251 static void teardown_iommufd(int fd, struct __test_metadata *_metadata) in teardown_iommufd() argument
260 if (fd == -1) in teardown_iommufd()
263 EXPECT_EQ(0, close(fd)); in teardown_iommufd()
265 fd = open("/dev/iommu", O_RDWR); in teardown_iommufd()
266 EXPECT_NE(-1, fd); in teardown_iommufd()
267 EXPECT_EQ(0, ioctl(fd, _IOMMU_TEST_CMD(IOMMU_TEST_OP_MD_CHECK_REFS), in teardown_iommufd()
269 EXPECT_EQ(0, close(fd)); in teardown_iommufd()