Lines Matching refs:iova
155 static unsigned int iova_pd_index(unsigned long iova) in iova_pd_index() argument
157 return (iova >> SMMU_PDE_SHIFT) & (SMMU_NUM_PDE - 1); in iova_pd_index()
160 static unsigned int iova_pt_index(unsigned long iova) in iova_pt_index() argument
162 return (iova >> SMMU_PTE_SHIFT) & (SMMU_NUM_PTE - 1); in iova_pt_index()
222 unsigned long iova) in smmu_flush_tlb_section() argument
231 value |= SMMU_TLB_FLUSH_ASID_MATCH | SMMU_TLB_FLUSH_VA_SECTION(iova); in smmu_flush_tlb_section()
237 unsigned long iova) in smmu_flush_tlb_group() argument
246 value |= SMMU_TLB_FLUSH_ASID_MATCH | SMMU_TLB_FLUSH_VA_GROUP(iova); in smmu_flush_tlb_group()
536 static void tegra_smmu_set_pde(struct tegra_smmu_as *as, unsigned long iova, in tegra_smmu_set_pde() argument
539 unsigned int pd_index = iova_pd_index(iova); in tegra_smmu_set_pde()
553 smmu_flush_tlb_section(smmu, as->id, iova); in tegra_smmu_set_pde()
557 static u32 *tegra_smmu_pte_offset(struct page *pt_page, unsigned long iova) in tegra_smmu_pte_offset() argument
561 return pt + iova_pt_index(iova); in tegra_smmu_pte_offset()
564 static u32 *tegra_smmu_pte_lookup(struct tegra_smmu_as *as, unsigned long iova, in tegra_smmu_pte_lookup() argument
567 unsigned int pd_index = iova_pd_index(iova); in tegra_smmu_pte_lookup()
579 return tegra_smmu_pte_offset(pt_page, iova); in tegra_smmu_pte_lookup()
582 static u32 *as_get_pte(struct tegra_smmu_as *as, dma_addr_t iova, in as_get_pte() argument
585 unsigned int pde = iova_pd_index(iova); in as_get_pte()
607 tegra_smmu_set_pde(as, iova, SMMU_MK_PDE(dma, SMMU_PDE_ATTR | in as_get_pte()
617 return tegra_smmu_pte_offset(as->pts[pde], iova); in as_get_pte()
620 static void tegra_smmu_pte_get_use(struct tegra_smmu_as *as, unsigned long iova) in tegra_smmu_pte_get_use() argument
622 unsigned int pd_index = iova_pd_index(iova); in tegra_smmu_pte_get_use()
627 static void tegra_smmu_pte_put_use(struct tegra_smmu_as *as, unsigned long iova) in tegra_smmu_pte_put_use() argument
629 unsigned int pde = iova_pd_index(iova); in tegra_smmu_pte_put_use()
641 tegra_smmu_set_pde(as, iova, 0); in tegra_smmu_pte_put_use()
649 static void tegra_smmu_set_pte(struct tegra_smmu_as *as, unsigned long iova, in tegra_smmu_set_pte() argument
660 smmu_flush_tlb_group(smmu, as->id, iova); in tegra_smmu_set_pte()
665 unsigned long iova, gfp_t gfp, in as_get_pde_page() argument
668 unsigned int pde = iova_pd_index(iova); in as_get_pde_page()
704 __tegra_smmu_map(struct iommu_domain *domain, unsigned long iova, in __tegra_smmu_map() argument
714 page = as_get_pde_page(as, iova, gfp, flags); in __tegra_smmu_map()
718 pte = as_get_pte(as, iova, &pte_dma, page); in __tegra_smmu_map()
724 tegra_smmu_pte_get_use(as, iova); in __tegra_smmu_map()
734 tegra_smmu_set_pte(as, iova, pte, pte_dma, in __tegra_smmu_map()
741 __tegra_smmu_unmap(struct iommu_domain *domain, unsigned long iova, in __tegra_smmu_unmap() argument
748 pte = tegra_smmu_pte_lookup(as, iova, &pte_dma); in __tegra_smmu_unmap()
752 tegra_smmu_set_pte(as, iova, pte, pte_dma, 0); in __tegra_smmu_unmap()
753 tegra_smmu_pte_put_use(as, iova); in __tegra_smmu_unmap()
758 static int tegra_smmu_map(struct iommu_domain *domain, unsigned long iova, in tegra_smmu_map() argument
766 ret = __tegra_smmu_map(domain, iova, paddr, size, prot, gfp, &flags); in tegra_smmu_map()
772 static size_t tegra_smmu_unmap(struct iommu_domain *domain, unsigned long iova, in tegra_smmu_unmap() argument
779 size = __tegra_smmu_unmap(domain, iova, size, gather); in tegra_smmu_unmap()
786 dma_addr_t iova) in tegra_smmu_iova_to_phys() argument
793 pte = tegra_smmu_pte_lookup(as, iova, &pte_dma); in tegra_smmu_iova_to_phys()
799 return SMMU_PFN_PHYS(pfn) + SMMU_OFFSET_IN_PAGE(iova); in tegra_smmu_iova_to_phys()