Lines Matching refs:ndom

98 	struct nested_domain *ndom;  in amd_iommu_alloc_domain_nested()  local
105 ndom = kzalloc_obj(*ndom); in amd_iommu_alloc_domain_nested()
106 if (!ndom) in amd_iommu_alloc_domain_nested()
109 ret = iommu_copy_struct_from_user(&ndom->gdte, user_data, in amd_iommu_alloc_domain_nested()
115 ret = validate_gdte_nested(&ndom->gdte); in amd_iommu_alloc_domain_nested()
119 ndom->gdom_id = FIELD_GET(DTE_DOMID_MASK, ndom->gdte.dte[1]); in amd_iommu_alloc_domain_nested()
120 ndom->domain.ops = &nested_domain_ops; in amd_iommu_alloc_domain_nested()
121 ndom->domain.type = IOMMU_DOMAIN_NESTED; in amd_iommu_alloc_domain_nested()
122 ndom->viommu = aviommu; in amd_iommu_alloc_domain_nested()
141 gdom_info = gdom_info_load_or_alloc_locked(&aviommu->gdomid_array, ndom->gdom_id); in amd_iommu_alloc_domain_nested()
150 ndom->gdom_info = gdom_info; in amd_iommu_alloc_domain_nested()
154 __func__, ndom->gdom_id, gdom_info->hdom_id); in amd_iommu_alloc_domain_nested()
156 return &ndom->domain; in amd_iommu_alloc_domain_nested()
163 ndom->gdom_id, gdom_info, NULL, GFP_ATOMIC); in amd_iommu_alloc_domain_nested()
169 ndom->gdom_info = gdom_info; in amd_iommu_alloc_domain_nested()
175 __func__, ndom->gdom_id, gdom_info->hdom_id); in amd_iommu_alloc_domain_nested()
177 return &ndom->domain; in amd_iommu_alloc_domain_nested()
182 kfree(ndom); in amd_iommu_alloc_domain_nested()
190 struct nested_domain *ndom = to_ndomain(dom); in set_dte_nested() local
191 struct iommu_hwpt_amd_guest *gdte = &ndom->gdte; in set_dte_nested()
199 if (WARN_ON(!ndom->viommu || !ndom->viommu->parent)) in set_dte_nested()
202 parent = ndom->viommu->parent; in set_dte_nested()
212 amd_iommu_set_dte_v1(dev_data, parent, ndom->gdom_info->hdom_id, in set_dte_nested()
261 struct nested_domain *ndom = to_ndomain(dom); in nested_domain_free() local
262 struct amd_iommu_viommu *aviommu = ndom->viommu; in nested_domain_free()
266 if (!refcount_dec_and_test(&ndom->gdom_info->users)) { in nested_domain_free()
275 curr = __xa_cmpxchg(&aviommu->gdomid_array, ndom->gdom_id, in nested_domain_free()
276 ndom->gdom_info, NULL, GFP_ATOMIC); in nested_domain_free()
284 __func__, ndom->gdom_id, curr->hdom_id); in nested_domain_free()
286 amd_iommu_pdom_id_free(ndom->gdom_info->hdom_id); in nested_domain_free()
288 kfree(ndom); in nested_domain_free()