Lines Matching full:domain
21 static int intel_nested_attach_dev(struct iommu_domain *domain, in intel_nested_attach_dev() argument
25 struct dmar_domain *dmar_domain = to_dmar_domain(domain); in intel_nested_attach_dev()
30 if (info->domain) in intel_nested_attach_dev()
39 * Stage-1 domain cannot work alone, it is nested on a s2_domain. in intel_nested_attach_dev()
43 ret = prepare_domain_attach_device(&dmar_domain->s2_domain->domain, dev); in intel_nested_attach_dev()
45 dev_err_ratelimited(dev, "s2 domain is not compatible\n"); in intel_nested_attach_dev()
51 dev_err_ratelimited(dev, "Failed to attach domain to iommu\n"); in intel_nested_attach_dev()
63 info->domain = dmar_domain; in intel_nested_attach_dev()
73 static void intel_nested_domain_free(struct iommu_domain *domain) in intel_nested_domain_free() argument
75 struct dmar_domain *dmar_domain = to_dmar_domain(domain); in intel_nested_domain_free()
84 static void nested_flush_dev_iotlb(struct dmar_domain *domain, u64 addr, in nested_flush_dev_iotlb() argument
91 spin_lock_irqsave(&domain->lock, flags); in nested_flush_dev_iotlb()
92 list_for_each_entry(info, &domain->devices, link) { in nested_flush_dev_iotlb()
102 spin_unlock_irqrestore(&domain->lock, flags); in nested_flush_dev_iotlb()
105 static void intel_nested_flush_cache(struct dmar_domain *domain, u64 addr, in intel_nested_flush_cache() argument
112 xa_for_each(&domain->iommu_array, i, info) in intel_nested_flush_cache()
114 domain_id_iommu(domain, info->iommu), in intel_nested_flush_cache()
117 if (!domain->has_iotlb_device) in intel_nested_flush_cache()
125 nested_flush_dev_iotlb(domain, addr, mask); in intel_nested_flush_cache()
128 static int intel_nested_cache_invalidate_user(struct iommu_domain *domain, in intel_nested_cache_invalidate_user() argument
131 struct dmar_domain *dmar_domain = to_dmar_domain(domain); in intel_nested_cache_invalidate_user()
182 struct dmar_domain *domain; in intel_nested_domain_alloc() local
185 /* Must be nested domain */ in intel_nested_domain_alloc()
197 domain = kzalloc(sizeof(*domain), GFP_KERNEL_ACCOUNT); in intel_nested_domain_alloc()
198 if (!domain) in intel_nested_domain_alloc()
201 domain->use_first_level = true; in intel_nested_domain_alloc()
202 domain->s2_domain = s2_domain; in intel_nested_domain_alloc()
203 domain->s1_pgtbl = vtd.pgtbl_addr; in intel_nested_domain_alloc()
204 domain->s1_cfg = vtd; in intel_nested_domain_alloc()
205 domain->domain.ops = &intel_nested_domain_ops; in intel_nested_domain_alloc()
206 domain->domain.type = IOMMU_DOMAIN_NESTED; in intel_nested_domain_alloc()
207 INIT_LIST_HEAD(&domain->devices); in intel_nested_domain_alloc()
208 INIT_LIST_HEAD(&domain->dev_pasids); in intel_nested_domain_alloc()
209 spin_lock_init(&domain->lock); in intel_nested_domain_alloc()
210 xa_init(&domain->iommu_array); in intel_nested_domain_alloc()
213 list_add(&domain->s2_link, &s2_domain->s1_domains); in intel_nested_domain_alloc()
216 return &domain->domain; in intel_nested_domain_alloc()