Lines Matching refs:ioas
15 struct iommufd_ioas *ioas = container_of(obj, struct iommufd_ioas, obj); in iommufd_ioas_destroy() local
18 rc = iopt_unmap_all(&ioas->iopt, NULL); in iommufd_ioas_destroy()
20 iopt_destroy_table(&ioas->iopt); in iommufd_ioas_destroy()
21 mutex_destroy(&ioas->mutex); in iommufd_ioas_destroy()
26 struct iommufd_ioas *ioas; in iommufd_ioas_alloc() local
28 ioas = iommufd_object_alloc(ictx, ioas, IOMMUFD_OBJ_IOAS); in iommufd_ioas_alloc()
29 if (IS_ERR(ioas)) in iommufd_ioas_alloc()
30 return ioas; in iommufd_ioas_alloc()
32 iopt_init_table(&ioas->iopt); in iommufd_ioas_alloc()
33 INIT_LIST_HEAD(&ioas->hwpt_list); in iommufd_ioas_alloc()
34 mutex_init(&ioas->mutex); in iommufd_ioas_alloc()
35 return ioas; in iommufd_ioas_alloc()
41 struct iommufd_ioas *ioas; in iommufd_ioas_alloc_ioctl() local
47 ioas = iommufd_ioas_alloc(ucmd->ictx); in iommufd_ioas_alloc_ioctl()
48 if (IS_ERR(ioas)) in iommufd_ioas_alloc_ioctl()
49 return PTR_ERR(ioas); in iommufd_ioas_alloc_ioctl()
51 cmd->out_ioas_id = ioas->obj.id; in iommufd_ioas_alloc_ioctl()
57 iommufd_object_finalize(ucmd->ictx, &ioas->obj); in iommufd_ioas_alloc_ioctl()
62 iommufd_object_abort_and_destroy(ucmd->ictx, &ioas->obj); in iommufd_ioas_alloc_ioctl()
70 struct iommufd_ioas *ioas; in iommufd_ioas_iova_ranges() local
78 ioas = iommufd_get_ioas(ucmd->ictx, cmd->ioas_id); in iommufd_ioas_iova_ranges()
79 if (IS_ERR(ioas)) in iommufd_ioas_iova_ranges()
80 return PTR_ERR(ioas); in iommufd_ioas_iova_ranges()
82 down_read(&ioas->iopt.iova_rwsem); in iommufd_ioas_iova_ranges()
86 cmd->out_iova_alignment = ioas->iopt.iova_alignment; in iommufd_ioas_iova_ranges()
87 interval_tree_for_each_span(&span, &ioas->iopt.reserved_itree, 0, in iommufd_ioas_iova_ranges()
111 up_read(&ioas->iopt.iova_rwsem); in iommufd_ioas_iova_ranges()
112 iommufd_put_object(ucmd->ictx, &ioas->obj); in iommufd_ioas_iova_ranges()
151 struct iommufd_ioas *ioas; in iommufd_ioas_allow_iovas() local
158 ioas = iommufd_get_ioas(ucmd->ictx, cmd->ioas_id); in iommufd_ioas_allow_iovas()
159 if (IS_ERR(ioas)) in iommufd_ioas_allow_iovas()
160 return PTR_ERR(ioas); in iommufd_ioas_allow_iovas()
161 iopt = &ioas->iopt; in iommufd_ioas_allow_iovas()
182 iommufd_put_object(ucmd->ictx, &ioas->obj); in iommufd_ioas_allow_iovas()
208 struct iommufd_ioas *ioas; in iommufd_ioas_map_file() local
225 ioas = iommufd_get_ioas(ucmd->ictx, cmd->ioas_id); in iommufd_ioas_map_file()
226 if (IS_ERR(ioas)) in iommufd_ioas_map_file()
227 return PTR_ERR(ioas); in iommufd_ioas_map_file()
236 rc = iopt_map_file_pages(ucmd->ictx, &ioas->iopt, &iova, file, in iommufd_ioas_map_file()
245 iommufd_put_object(ucmd->ictx, &ioas->obj); in iommufd_ioas_map_file()
254 struct iommufd_ioas *ioas; in iommufd_ioas_map() local
270 ioas = iommufd_get_ioas(ucmd->ictx, cmd->ioas_id); in iommufd_ioas_map()
271 if (IS_ERR(ioas)) in iommufd_ioas_map()
272 return PTR_ERR(ioas); in iommufd_ioas_map()
276 rc = iopt_map_user_pages(ucmd->ictx, &ioas->iopt, &iova, in iommufd_ioas_map()
285 iommufd_put_object(ucmd->ictx, &ioas->obj); in iommufd_ioas_map()
349 struct iommufd_ioas *ioas; in iommufd_ioas_unmap() local
353 ioas = iommufd_get_ioas(ucmd->ictx, cmd->ioas_id); in iommufd_ioas_unmap()
354 if (IS_ERR(ioas)) in iommufd_ioas_unmap()
355 return PTR_ERR(ioas); in iommufd_ioas_unmap()
358 rc = iopt_unmap_all(&ioas->iopt, &unmapped); in iommufd_ioas_unmap()
366 rc = iopt_unmap_iova(&ioas->iopt, cmd->iova, cmd->length, in iommufd_ioas_unmap()
376 iommufd_put_object(ucmd->ictx, &ioas->obj); in iommufd_ioas_unmap()
383 struct iommufd_ioas *ioas; in iommufd_release_all_iova_rwsem() local
386 xa_for_each(ioas_list, index, ioas) { in iommufd_release_all_iova_rwsem()
387 up_write(&ioas->iopt.iova_rwsem); in iommufd_release_all_iova_rwsem()
388 refcount_dec(&ioas->obj.users); in iommufd_release_all_iova_rwsem()
416 struct iommufd_ioas *ioas; in iommufd_take_all_iova_rwsem() local
426 ioas = container_of(obj, struct iommufd_ioas, obj); in iommufd_take_all_iova_rwsem()
427 down_write_nest_lock(&ioas->iopt.iova_rwsem, in iommufd_take_all_iova_rwsem()
430 rc = xa_err(xa_store(ioas_list, index, ioas, GFP_KERNEL)); in iommufd_take_all_iova_rwsem()
524 struct iommufd_ioas *ioas; in iommufd_ioas_change_process() local
539 for_each_ioas_area(&ioas_list, index, ioas, area) { in iommufd_ioas_change_process()
552 for_each_ioas_area(&ioas_list, index, ioas, area) { in iommufd_ioas_change_process()
565 for_each_ioas_area(&ioas_list, index, ioas, area) in iommufd_ioas_change_process()
570 for_each_ioas_area(&ioas_list, index, ioas, area) { in iommufd_ioas_change_process()
624 struct iommufd_ioas *ioas) in iommufd_ioas_option_huge_pages() argument
627 cmd->val64 = !ioas->iopt.disable_large_pages; in iommufd_ioas_option_huge_pages()
632 return iopt_disable_large_pages(&ioas->iopt); in iommufd_ioas_option_huge_pages()
634 iopt_enable_large_pages(&ioas->iopt); in iommufd_ioas_option_huge_pages()
645 struct iommufd_ioas *ioas; in iommufd_ioas_option() local
651 ioas = iommufd_get_ioas(ucmd->ictx, cmd->object_id); in iommufd_ioas_option()
652 if (IS_ERR(ioas)) in iommufd_ioas_option()
653 return PTR_ERR(ioas); in iommufd_ioas_option()
657 rc = iommufd_ioas_option_huge_pages(cmd, ioas); in iommufd_ioas_option()
663 iommufd_put_object(ucmd->ictx, &ioas->obj); in iommufd_ioas_option()