Lines Matching refs:s390_domain

24 struct s390_domain {  struct
37 static struct s390_domain *to_s390_domain(struct iommu_domain *dom) in to_s390_domain() argument
39 return container_of(dom, struct s390_domain, domain); in to_s390_domain()
56 struct s390_domain *s390_domain; in s390_domain_alloc() local
61 s390_domain = kzalloc(sizeof(*s390_domain), GFP_KERNEL); in s390_domain_alloc()
62 if (!s390_domain) in s390_domain_alloc()
65 s390_domain->dma_table = dma_alloc_cpu_table(); in s390_domain_alloc()
66 if (!s390_domain->dma_table) { in s390_domain_alloc()
67 kfree(s390_domain); in s390_domain_alloc()
71 spin_lock_init(&s390_domain->dma_table_lock); in s390_domain_alloc()
72 spin_lock_init(&s390_domain->list_lock); in s390_domain_alloc()
73 INIT_LIST_HEAD(&s390_domain->devices); in s390_domain_alloc()
75 return &s390_domain->domain; in s390_domain_alloc()
80 struct s390_domain *s390_domain = to_s390_domain(domain); in s390_domain_free() local
82 WARN_ON(!list_empty(&s390_domain->devices)); in s390_domain_free()
83 dma_cleanup_tables(s390_domain->dma_table); in s390_domain_free()
84 kfree(s390_domain); in s390_domain_free()
89 struct s390_domain *s390_domain = zdev->s390_domain; in __s390_iommu_detach_device() local
93 if (!s390_domain) in __s390_iommu_detach_device()
96 spin_lock_irqsave(&s390_domain->list_lock, flags); in __s390_iommu_detach_device()
97 list_for_each_entry_safe(domain_device, tmp, &s390_domain->devices, in __s390_iommu_detach_device()
105 spin_unlock_irqrestore(&s390_domain->list_lock, flags); in __s390_iommu_detach_device()
108 zdev->s390_domain = NULL; in __s390_iommu_detach_device()
115 struct s390_domain *s390_domain = to_s390_domain(domain); in s390_iommu_attach_device() local
128 if (zdev->s390_domain) in s390_iommu_attach_device()
134 virt_to_phys(s390_domain->dma_table)); in s390_iommu_attach_device()
139 zdev->dma_table = s390_domain->dma_table; in s390_iommu_attach_device()
141 spin_lock_irqsave(&s390_domain->list_lock, flags); in s390_iommu_attach_device()
143 if (list_empty(&s390_domain->devices)) { in s390_iommu_attach_device()
150 spin_unlock_irqrestore(&s390_domain->list_lock, flags); in s390_iommu_attach_device()
155 zdev->s390_domain = s390_domain; in s390_iommu_attach_device()
156 list_add(&domain_device->list, &s390_domain->devices); in s390_iommu_attach_device()
157 spin_unlock_irqrestore(&s390_domain->list_lock, flags); in s390_iommu_attach_device()
175 WARN_ON(zdev->s390_domain != to_s390_domain(domain)); in s390_iommu_detach_device()
205 static int s390_iommu_update_trans(struct s390_domain *s390_domain, in s390_iommu_update_trans() argument
216 if (dma_addr < s390_domain->domain.geometry.aperture_start || in s390_iommu_update_trans()
217 dma_addr + size > s390_domain->domain.geometry.aperture_end) in s390_iommu_update_trans()
224 spin_lock_irqsave(&s390_domain->dma_table_lock, irq_flags); in s390_iommu_update_trans()
226 entry = dma_walk_cpu_trans(s390_domain->dma_table, dma_addr); in s390_iommu_update_trans()
236 spin_lock(&s390_domain->list_lock); in s390_iommu_update_trans()
237 list_for_each_entry(domain_device, &s390_domain->devices, list) { in s390_iommu_update_trans()
243 spin_unlock(&s390_domain->list_lock); in s390_iommu_update_trans()
251 entry = dma_walk_cpu_trans(s390_domain->dma_table, in s390_iommu_update_trans()
258 spin_unlock_irqrestore(&s390_domain->dma_table_lock, irq_flags); in s390_iommu_update_trans()
266 struct s390_domain *s390_domain = to_s390_domain(domain); in s390_iommu_map() local
275 rc = s390_iommu_update_trans(s390_domain, paddr, iova, in s390_iommu_map()
284 struct s390_domain *s390_domain = to_s390_domain(domain); in s390_iommu_iova_to_phys() local
296 rto = s390_domain->dma_table; in s390_iommu_iova_to_phys()
298 spin_lock_irqsave(&s390_domain->dma_table_lock, flags); in s390_iommu_iova_to_phys()
307 spin_unlock_irqrestore(&s390_domain->dma_table_lock, flags); in s390_iommu_iova_to_phys()
316 struct s390_domain *s390_domain = to_s390_domain(domain); in s390_iommu_unmap() local
325 rc = s390_iommu_update_trans(s390_domain, paddr, iova, in s390_iommu_unmap()