Lines Matching refs:iova

156 static unsigned int iova_pd_index(unsigned long iova)  in iova_pd_index()  argument
158 return (iova >> SMMU_PDE_SHIFT) & (SMMU_NUM_PDE - 1); in iova_pd_index()
161 static unsigned int iova_pt_index(unsigned long iova) in iova_pt_index() argument
163 return (iova >> SMMU_PTE_SHIFT) & (SMMU_NUM_PTE - 1); in iova_pt_index()
223 unsigned long iova) in smmu_flush_tlb_section() argument
232 value |= SMMU_TLB_FLUSH_ASID_MATCH | SMMU_TLB_FLUSH_VA_SECTION(iova); in smmu_flush_tlb_section()
238 unsigned long iova) in smmu_flush_tlb_group() argument
247 value |= SMMU_TLB_FLUSH_ASID_MATCH | SMMU_TLB_FLUSH_VA_GROUP(iova); in smmu_flush_tlb_group()
531 static void tegra_smmu_set_pde(struct tegra_smmu_as *as, unsigned long iova, in tegra_smmu_set_pde() argument
534 unsigned int pd_index = iova_pd_index(iova); in tegra_smmu_set_pde()
548 smmu_flush_tlb_section(smmu, as->id, iova); in tegra_smmu_set_pde()
552 static u32 *tegra_smmu_pte_offset(struct page *pt_page, unsigned long iova) in tegra_smmu_pte_offset() argument
556 return pt + iova_pt_index(iova); in tegra_smmu_pte_offset()
559 static u32 *tegra_smmu_pte_lookup(struct tegra_smmu_as *as, unsigned long iova, in tegra_smmu_pte_lookup() argument
562 unsigned int pd_index = iova_pd_index(iova); in tegra_smmu_pte_lookup()
574 return tegra_smmu_pte_offset(pt_page, iova); in tegra_smmu_pte_lookup()
577 static u32 *as_get_pte(struct tegra_smmu_as *as, dma_addr_t iova, in as_get_pte() argument
580 unsigned int pde = iova_pd_index(iova); in as_get_pte()
602 tegra_smmu_set_pde(as, iova, SMMU_MK_PDE(dma, SMMU_PDE_ATTR | in as_get_pte()
612 return tegra_smmu_pte_offset(as->pts[pde], iova); in as_get_pte()
615 static void tegra_smmu_pte_get_use(struct tegra_smmu_as *as, unsigned long iova) in tegra_smmu_pte_get_use() argument
617 unsigned int pd_index = iova_pd_index(iova); in tegra_smmu_pte_get_use()
622 static void tegra_smmu_pte_put_use(struct tegra_smmu_as *as, unsigned long iova) in tegra_smmu_pte_put_use() argument
624 unsigned int pde = iova_pd_index(iova); in tegra_smmu_pte_put_use()
636 tegra_smmu_set_pde(as, iova, 0); in tegra_smmu_pte_put_use()
644 static void tegra_smmu_set_pte(struct tegra_smmu_as *as, unsigned long iova, in tegra_smmu_set_pte() argument
655 smmu_flush_tlb_group(smmu, as->id, iova); in tegra_smmu_set_pte()
660 unsigned long iova, gfp_t gfp, in as_get_pde_page() argument
663 unsigned int pde = iova_pd_index(iova); in as_get_pde_page()
699 __tegra_smmu_map(struct iommu_domain *domain, unsigned long iova, in __tegra_smmu_map() argument
709 page = as_get_pde_page(as, iova, gfp, flags); in __tegra_smmu_map()
713 pte = as_get_pte(as, iova, &pte_dma, page); in __tegra_smmu_map()
719 tegra_smmu_pte_get_use(as, iova); in __tegra_smmu_map()
729 tegra_smmu_set_pte(as, iova, pte, pte_dma, in __tegra_smmu_map()
736 __tegra_smmu_unmap(struct iommu_domain *domain, unsigned long iova, in __tegra_smmu_unmap() argument
743 pte = tegra_smmu_pte_lookup(as, iova, &pte_dma); in __tegra_smmu_unmap()
747 tegra_smmu_set_pte(as, iova, pte, pte_dma, 0); in __tegra_smmu_unmap()
748 tegra_smmu_pte_put_use(as, iova); in __tegra_smmu_unmap()
753 static int tegra_smmu_map(struct iommu_domain *domain, unsigned long iova, in tegra_smmu_map() argument
761 ret = __tegra_smmu_map(domain, iova, paddr, size, prot, gfp, &flags); in tegra_smmu_map()
767 static size_t tegra_smmu_unmap(struct iommu_domain *domain, unsigned long iova, in tegra_smmu_unmap() argument
774 size = __tegra_smmu_unmap(domain, iova, size, gather); in tegra_smmu_unmap()
781 dma_addr_t iova) in tegra_smmu_iova_to_phys() argument
788 pte = tegra_smmu_pte_lookup(as, iova, &pte_dma); in tegra_smmu_iova_to_phys()
794 return SMMU_PFN_PHYS(pfn) + SMMU_OFFSET_IN_PAGE(iova); in tegra_smmu_iova_to_phys()