Lines Matching refs:dom
328 static struct mtk_iommu_domain *to_mtk_domain(struct iommu_domain *dom) in to_mtk_domain() argument
330 return container_of(dom, struct mtk_iommu_domain, domain); in to_mtk_domain()
417 struct mtk_iommu_domain *dom = bank->m4u_dom; in mtk_iommu_isr() local
465 if (!dom || report_iommu_fault(&dom->domain, bank->parent_dev, fault_iova, in mtk_iommu_isr()
584 static int mtk_iommu_domain_finalise(struct mtk_iommu_domain *dom, in mtk_iommu_domain_finalise() argument
594 dom->iop = m4u_dom->iop; in mtk_iommu_domain_finalise()
595 dom->cfg = m4u_dom->cfg; in mtk_iommu_domain_finalise()
596 dom->domain.pgsize_bitmap = m4u_dom->cfg.pgsize_bitmap; in mtk_iommu_domain_finalise()
600 dom->cfg = (struct io_pgtable_cfg) { in mtk_iommu_domain_finalise()
610 dom->cfg.quirks |= IO_PGTABLE_QUIRK_ARM_MTK_TTBR_EXT; in mtk_iommu_domain_finalise()
613 dom->cfg.oas = data->enable_4GB ? 33 : 32; in mtk_iommu_domain_finalise()
615 dom->cfg.oas = 35; in mtk_iommu_domain_finalise()
617 dom->iop = alloc_io_pgtable_ops(ARM_V7S, &dom->cfg, data); in mtk_iommu_domain_finalise()
618 if (!dom->iop) { in mtk_iommu_domain_finalise()
624 dom->domain.pgsize_bitmap = dom->cfg.pgsize_bitmap; in mtk_iommu_domain_finalise()
629 dom->domain.geometry.aperture_start = region->iova_base; in mtk_iommu_domain_finalise()
630 dom->domain.geometry.aperture_end = region->iova_base + region->size - 1; in mtk_iommu_domain_finalise()
631 dom->domain.geometry.force_aperture = true; in mtk_iommu_domain_finalise()
637 struct mtk_iommu_domain *dom; in mtk_iommu_domain_alloc() local
642 dom = kzalloc(sizeof(*dom), GFP_KERNEL); in mtk_iommu_domain_alloc()
643 if (!dom) in mtk_iommu_domain_alloc()
645 mutex_init(&dom->mutex); in mtk_iommu_domain_alloc()
647 return &dom->domain; in mtk_iommu_domain_alloc()
659 struct mtk_iommu_domain *dom = to_mtk_domain(domain); in mtk_iommu_attach_device() local
671 mutex_lock(&dom->mutex); in mtk_iommu_attach_device()
672 if (!dom->bank) { in mtk_iommu_attach_device()
676 ret = mtk_iommu_domain_finalise(dom, frstdata, region_id); in mtk_iommu_attach_device()
678 mutex_unlock(&dom->mutex); in mtk_iommu_attach_device()
681 dom->bank = &data->bank[bankid]; in mtk_iommu_attach_device()
683 mutex_unlock(&dom->mutex); in mtk_iommu_attach_device()
699 bank->m4u_dom = dom; in mtk_iommu_attach_device()
700 writel(dom->cfg.arm_v7s_cfg.ttbr, bank->base + REG_MMU_PT_BASE_ADDR); in mtk_iommu_attach_device()
717 struct mtk_iommu_domain *dom = to_mtk_domain(domain); in mtk_iommu_map() local
720 if (dom->bank->parent_data->enable_4GB) in mtk_iommu_map()
724 return dom->iop->map_pages(dom->iop, iova, paddr, pgsize, pgcount, prot, gfp, mapped); in mtk_iommu_map()
731 struct mtk_iommu_domain *dom = to_mtk_domain(domain); in mtk_iommu_unmap() local
734 return dom->iop->unmap_pages(dom->iop, iova, pgsize, pgcount, gather); in mtk_iommu_unmap()
739 struct mtk_iommu_domain *dom = to_mtk_domain(domain); in mtk_iommu_flush_iotlb_all() local
741 mtk_iommu_tlb_flush_all(dom->bank->parent_data); in mtk_iommu_flush_iotlb_all()
747 struct mtk_iommu_domain *dom = to_mtk_domain(domain); in mtk_iommu_iotlb_sync() local
750 mtk_iommu_tlb_flush_range_sync(gather->start, length, dom->bank); in mtk_iommu_iotlb_sync()
756 struct mtk_iommu_domain *dom = to_mtk_domain(domain); in mtk_iommu_sync_map() local
758 mtk_iommu_tlb_flush_range_sync(iova, size, dom->bank); in mtk_iommu_sync_map()
764 struct mtk_iommu_domain *dom = to_mtk_domain(domain); in mtk_iommu_iova_to_phys() local
767 pa = dom->iop->iova_to_phys(dom->iop, iova); in mtk_iommu_iova_to_phys()
769 dom->bank->parent_data->enable_4GB && in mtk_iommu_iova_to_phys()