Lines Matching full:fd
63 ioctl(self->fd, \
68 static int _test_cmd_mock_domain(int fd, unsigned int ioas_id, __u32 *stdev_id, in _test_cmd_mock_domain() argument
79 ret = ioctl(fd, IOMMU_TEST_CMD, &cmd); in _test_cmd_mock_domain()
92 ASSERT_EQ(0, _test_cmd_mock_domain(self->fd, ioas_id, stdev_id, \
95 EXPECT_ERRNO(_errno, _test_cmd_mock_domain(self->fd, ioas_id, \
98 static int _test_cmd_mock_domain_flags(int fd, unsigned int ioas_id, in _test_cmd_mock_domain_flags() argument
110 ret = ioctl(fd, IOMMU_TEST_CMD, &cmd); in _test_cmd_mock_domain_flags()
123 ASSERT_EQ(0, _test_cmd_mock_domain_flags(self->fd, ioas_id, flags, \
127 _test_cmd_mock_domain_flags(self->fd, ioas_id, flags, \
130 static int _test_cmd_mock_domain_replace(int fd, __u32 stdev_id, __u32 pt_id, in _test_cmd_mock_domain_replace() argument
143 ret = ioctl(fd, IOMMU_TEST_CMD, &cmd); in _test_cmd_mock_domain_replace()
152 ASSERT_EQ(0, _test_cmd_mock_domain_replace(self->fd, stdev_id, pt_id, \
155 EXPECT_ERRNO(_errno, _test_cmd_mock_domain_replace(self->fd, stdev_id, \
158 static int _test_cmd_hwpt_alloc(int fd, __u32 device_id, __u32 pt_id, __u32 ft_id, in _test_cmd_hwpt_alloc() argument
174 ret = ioctl(fd, IOMMU_HWPT_ALLOC, &cmd); in _test_cmd_hwpt_alloc()
183 ASSERT_EQ(0, _test_cmd_hwpt_alloc(self->fd, device_id, pt_id, 0, flags, \
188 self->fd, device_id, pt_id, 0, flags, \
193 ASSERT_EQ(0, _test_cmd_hwpt_alloc(self->fd, device_id, pt_id, 0, flags, \
198 _test_cmd_hwpt_alloc(self->fd, device_id, pt_id, 0, flags, \
203 ASSERT_EQ(0, _test_cmd_hwpt_alloc(self->fd, device_id, pt_id, fault_id, \
209 _test_cmd_hwpt_alloc(self->fd, device_id, pt_id, fault_id, \
225 ioctl(self->fd, \
237 static int _test_cmd_hwpt_invalidate(int fd, __u32 hwpt_id, void *reqs, in _test_cmd_hwpt_invalidate() argument
249 int rc = ioctl(fd, IOMMU_HWPT_INVALIDATE, &cmd); in _test_cmd_hwpt_invalidate()
257 _test_cmd_hwpt_invalidate(self->fd, hwpt_id, reqs, \
264 self->fd, hwpt_id, reqs, \
268 static int _test_cmd_access_replace_ioas(int fd, __u32 access_id, in _test_cmd_access_replace_ioas() argument
279 ret = ioctl(fd, IOMMU_TEST_CMD, &cmd); in _test_cmd_access_replace_ioas()
285 ASSERT_EQ(0, _test_cmd_access_replace_ioas(self->fd, access_id, ioas_id))
287 static int _test_cmd_set_dirty_tracking(int fd, __u32 hwpt_id, bool enabled) in _test_cmd_set_dirty_tracking() argument
296 ret = ioctl(fd, IOMMU_HWPT_SET_DIRTY_TRACKING, &cmd); in _test_cmd_set_dirty_tracking()
302 ASSERT_EQ(0, _test_cmd_set_dirty_tracking(self->fd, hwpt_id, enabled))
304 static int _test_cmd_get_dirty_bitmap(int fd, __u32 hwpt_id, size_t length, in _test_cmd_get_dirty_bitmap() argument
319 ret = ioctl(fd, IOMMU_HWPT_GET_DIRTY_BITMAP, &cmd); in _test_cmd_get_dirty_bitmap()
325 #define test_cmd_get_dirty_bitmap(fd, hwpt_id, length, iova, page_size, \ argument
327 ASSERT_EQ(0, _test_cmd_get_dirty_bitmap(fd, hwpt_id, length, iova, \
330 static int _test_cmd_mock_domain_set_dirty(int fd, __u32 hwpt_id, size_t length, in _test_cmd_mock_domain_set_dirty() argument
347 ret = ioctl(fd, _IOMMU_TEST_CMD(IOMMU_TEST_OP_DIRTY), &cmd); in _test_cmd_mock_domain_set_dirty()
355 #define test_cmd_mock_domain_set_dirty(fd, hwpt_id, length, iova, page_size, \ argument
358 _test_cmd_mock_domain_set_dirty(fd, hwpt_id, length, iova, \
361 static int _test_mock_dirty_bitmaps(int fd, __u32 hwpt_id, size_t length, in _test_mock_dirty_bitmaps() argument
377 test_cmd_mock_domain_set_dirty(fd, hwpt_id, length, iova, page_size, in _test_mock_dirty_bitmaps()
383 test_cmd_get_dirty_bitmap(fd, hwpt_id, length, iova, page_size, bitmap, in _test_mock_dirty_bitmaps()
395 test_cmd_get_dirty_bitmap(fd, hwpt_id, length, iova, page_size, bitmap, in _test_mock_dirty_bitmaps()
413 ASSERT_EQ(0, _test_mock_dirty_bitmaps(self->fd, hwpt_id, length, iova, \
417 static int _test_cmd_create_access(int fd, unsigned int ioas_id, in _test_cmd_create_access() argument
428 ret = ioctl(fd, IOMMU_TEST_CMD, &cmd); in _test_cmd_create_access()
435 ASSERT_EQ(0, _test_cmd_create_access(self->fd, ioas_id, access_id, \
445 static int _test_cmd_destroy_access_pages(int fd, unsigned int access_id, in _test_cmd_destroy_access_pages() argument
454 return ioctl(fd, IOMMU_TEST_CMD, &cmd); in _test_cmd_destroy_access_pages()
457 ASSERT_EQ(0, _test_cmd_destroy_access_pages(self->fd, access_id, \
461 self->fd, access_id, access_pages_id))
463 static int _test_ioctl_destroy(int fd, unsigned int id) in _test_ioctl_destroy() argument
469 return ioctl(fd, IOMMU_DESTROY, &cmd); in _test_ioctl_destroy()
471 #define test_ioctl_destroy(id) ASSERT_EQ(0, _test_ioctl_destroy(self->fd, id))
473 static int _test_ioctl_ioas_alloc(int fd, __u32 *id) in _test_ioctl_ioas_alloc() argument
480 ret = ioctl(fd, IOMMU_IOAS_ALLOC, &cmd); in _test_ioctl_ioas_alloc()
488 ASSERT_EQ(0, _test_ioctl_ioas_alloc(self->fd, id)); \
492 static int _test_ioctl_ioas_map(int fd, unsigned int ioas_id, void *buffer, in _test_ioctl_ioas_map() argument
507 ret = ioctl(fd, IOMMU_IOAS_MAP, &cmd); in _test_ioctl_ioas_map()
512 ASSERT_EQ(0, _test_ioctl_ioas_map(self->fd, self->ioas_id, buffer, \
519 _test_ioctl_ioas_map(self->fd, self->ioas_id, buffer, \
525 ASSERT_EQ(0, _test_ioctl_ioas_map(self->fd, ioas_id, buffer, length, \
534 self->fd, self->ioas_id, buffer, length, \
546 self->fd, ioas_id, buffer, length, &__iova, \
557 self->fd, self->ioas_id, buffer, length, \
564 static int _test_ioctl_ioas_unmap(int fd, unsigned int ioas_id, uint64_t iova, in _test_ioctl_ioas_unmap() argument
575 ret = ioctl(fd, IOMMU_IOAS_UNMAP, &cmd); in _test_ioctl_ioas_unmap()
581 ASSERT_EQ(0, _test_ioctl_ioas_unmap(self->fd, self->ioas_id, iova, \
585 ASSERT_EQ(0, _test_ioctl_ioas_unmap(self->fd, ioas_id, iova, length, \
589 EXPECT_ERRNO(_errno, _test_ioctl_ioas_unmap(self->fd, self->ioas_id, \
592 static int _test_ioctl_set_temp_memory_limit(int fd, unsigned int limit) in _test_ioctl_set_temp_memory_limit() argument
600 return ioctl(fd, _IOMMU_TEST_CMD(IOMMU_TEST_OP_SET_TEMP_MEMORY_LIMIT), in _test_ioctl_set_temp_memory_limit()
605 ASSERT_EQ(0, _test_ioctl_set_temp_memory_limit(self->fd, limit))
610 static void teardown_iommufd(int fd, struct __test_metadata *_metadata) in teardown_iommufd() argument
619 if (fd == -1) in teardown_iommufd()
622 EXPECT_EQ(0, close(fd)); in teardown_iommufd()
624 fd = open("/dev/iommu", O_RDWR); in teardown_iommufd()
625 EXPECT_NE(-1, fd); in teardown_iommufd()
626 EXPECT_EQ(0, ioctl(fd, _IOMMU_TEST_CMD(IOMMU_TEST_OP_MD_CHECK_REFS), in teardown_iommufd()
628 EXPECT_EQ(0, close(fd)); in teardown_iommufd()
640 static int _test_cmd_get_hw_info(int fd, __u32 device_id, void *data, in _test_cmd_get_hw_info() argument
653 ret = ioctl(fd, IOMMU_GET_HW_INFO, &cmd); in _test_cmd_get_hw_info()
693 ASSERT_EQ(0, _test_cmd_get_hw_info(self->fd, device_id, data, \
697 EXPECT_ERRNO(_errno, _test_cmd_get_hw_info(self->fd, device_id, data, \
701 ASSERT_EQ(0, _test_cmd_get_hw_info(self->fd, device_id, NULL, 0, &caps))
703 static int _test_ioctl_fault_alloc(int fd, __u32 *fault_id, __u32 *fault_fd) in _test_ioctl_fault_alloc() argument
710 ret = ioctl(fd, IOMMU_FAULT_QUEUE_ALLOC, &cmd); in _test_ioctl_fault_alloc()
720 ASSERT_EQ(0, _test_ioctl_fault_alloc(self->fd, fault_id, \
726 static int _test_cmd_trigger_iopf(int fd, __u32 device_id, __u32 fault_fd) in _test_cmd_trigger_iopf() argument
746 ret = ioctl(fd, _IOMMU_TEST_CMD(IOMMU_TEST_OP_TRIGGER_IOPF), &trigger_iopf_cmd); in _test_cmd_trigger_iopf()
764 ASSERT_EQ(0, _test_cmd_trigger_iopf(self->fd, device_id, fault_fd))