Lines Matching defs:hwpt
12 struct iommufd_hw_pagetable *hwpt =
15 if (!list_empty(&hwpt->hwpt_item)) {
16 mutex_lock(&hwpt->ioas->mutex);
17 list_del(&hwpt->hwpt_item);
18 mutex_unlock(&hwpt->ioas->mutex);
20 iopt_table_remove_domain(&hwpt->ioas->iopt, hwpt->domain);
23 if (hwpt->domain)
24 iommu_domain_free(hwpt->domain);
26 refcount_dec(&hwpt->ioas->obj.users);
31 struct iommufd_hw_pagetable *hwpt =
35 lockdep_assert_held(&hwpt->ioas->mutex);
37 if (!list_empty(&hwpt->hwpt_item)) {
38 list_del_init(&hwpt->hwpt_item);
39 iopt_table_remove_domain(&hwpt->ioas->iopt, hwpt->domain);
44 int iommufd_hw_pagetable_enforce_cc(struct iommufd_hw_pagetable *hwpt)
46 if (hwpt->enforce_cache_coherency)
49 if (hwpt->domain->ops->enforce_cache_coherency)
50 hwpt->enforce_cache_coherency =
51 hwpt->domain->ops->enforce_cache_coherency(
52 hwpt->domain);
53 if (!hwpt->enforce_cache_coherency)
63 * @immediate_attach: True if idev should be attached to the hwpt
71 * the returned hwpt.
77 struct iommufd_hw_pagetable *hwpt;
82 hwpt = iommufd_object_alloc(ictx, hwpt, IOMMUFD_OBJ_HW_PAGETABLE);
83 if (IS_ERR(hwpt))
84 return hwpt;
86 INIT_LIST_HEAD(&hwpt->hwpt_item);
89 hwpt->ioas = ioas;
91 hwpt->domain = iommu_domain_alloc(idev->dev->bus);
92 if (!hwpt->domain) {
105 rc = iommufd_hw_pagetable_enforce_cc(hwpt);
117 rc = iommufd_hw_pagetable_attach(hwpt, idev);
122 rc = iopt_table_add_domain(&hwpt->ioas->iopt, hwpt->domain);
125 list_add_tail(&hwpt->hwpt_item, &hwpt->ioas->hwpt_list);
126 return hwpt;
132 iommufd_object_abort_and_destroy(ictx, &hwpt->obj);
139 struct iommufd_hw_pagetable *hwpt;
158 hwpt = iommufd_hw_pagetable_alloc(ucmd->ictx, ioas, idev, false);
159 if (IS_ERR(hwpt)) {
160 rc = PTR_ERR(hwpt);
164 cmd->out_hwpt_id = hwpt->obj.id;
168 iommufd_object_finalize(ucmd->ictx, &hwpt->obj);
172 iommufd_object_abort_and_destroy(ucmd->ictx, &hwpt->obj);