Lines Matching refs:dom
99 static struct mtk_iommu_domain *to_mtk_domain(struct iommu_domain *dom) in to_mtk_domain() argument
101 return container_of(dom, struct mtk_iommu_domain, domain); in to_mtk_domain()
163 struct mtk_iommu_domain *dom = data->m4u_dom; in mtk_iommu_isr() local
181 if (report_iommu_fault(&dom->domain, data->dev, fault_iova, in mtk_iommu_isr()
223 struct mtk_iommu_domain *dom = data->m4u_dom; in mtk_iommu_domain_finalise() local
225 spin_lock_init(&dom->pgtlock); in mtk_iommu_domain_finalise()
227 dom->pgt_va = dma_alloc_coherent(data->dev, M2701_IOMMU_PGT_SIZE, in mtk_iommu_domain_finalise()
228 &dom->pgt_pa, GFP_KERNEL); in mtk_iommu_domain_finalise()
229 if (!dom->pgt_va) in mtk_iommu_domain_finalise()
232 writel(dom->pgt_pa, data->base + REG_MMU_PT_BASE_ADDR); in mtk_iommu_domain_finalise()
234 dom->data = data; in mtk_iommu_domain_finalise()
241 struct mtk_iommu_domain *dom; in mtk_iommu_domain_alloc() local
246 dom = kzalloc(sizeof(*dom), GFP_KERNEL); in mtk_iommu_domain_alloc()
247 if (!dom) in mtk_iommu_domain_alloc()
250 return &dom->domain; in mtk_iommu_domain_alloc()
255 struct mtk_iommu_domain *dom = to_mtk_domain(domain); in mtk_iommu_domain_free() local
256 struct mtk_iommu_data *data = dom->data; in mtk_iommu_domain_free()
259 dom->pgt_va, dom->pgt_pa); in mtk_iommu_domain_free()
267 struct mtk_iommu_domain *dom = to_mtk_domain(domain); in mtk_iommu_attach_device() local
277 data->m4u_dom = dom; in mtk_iommu_attach_device()
300 struct mtk_iommu_domain *dom = to_mtk_domain(domain); in mtk_iommu_map() local
304 u32 *pgt_base_iova = dom->pgt_va + (iova >> MT2701_IOMMU_PAGE_SHIFT); in mtk_iommu_map()
308 spin_lock_irqsave(&dom->pgtlock, flags); in mtk_iommu_map()
319 spin_unlock_irqrestore(&dom->pgtlock, flags); in mtk_iommu_map()
321 mtk_iommu_tlb_flush_range(dom->data, iova, size); in mtk_iommu_map()
330 struct mtk_iommu_domain *dom = to_mtk_domain(domain); in mtk_iommu_unmap() local
332 u32 *pgt_base_iova = dom->pgt_va + (iova >> MT2701_IOMMU_PAGE_SHIFT); in mtk_iommu_unmap()
335 spin_lock_irqsave(&dom->pgtlock, flags); in mtk_iommu_unmap()
337 spin_unlock_irqrestore(&dom->pgtlock, flags); in mtk_iommu_unmap()
339 mtk_iommu_tlb_flush_range(dom->data, iova, size); in mtk_iommu_unmap()
347 struct mtk_iommu_domain *dom = to_mtk_domain(domain); in mtk_iommu_iova_to_phys() local
351 spin_lock_irqsave(&dom->pgtlock, flags); in mtk_iommu_iova_to_phys()
352 pa = *(dom->pgt_va + (iova >> MT2701_IOMMU_PAGE_SHIFT)); in mtk_iommu_iova_to_phys()
354 spin_unlock_irqrestore(&dom->pgtlock, flags); in mtk_iommu_iova_to_phys()