Searched refs:rk_domain (Results 1 - 1 of 1) sorted by relevance

/linux-4.1.27/drivers/iommu/
H A Drockchip-iommu.c513 struct rk_iommu_domain *rk_domain = to_rk_domain(domain); rk_iommu_iova_to_phys() local
519 spin_lock_irqsave(&rk_domain->dt_lock, flags); rk_iommu_iova_to_phys()
521 dte = rk_domain->dt[rk_iova_dte_index(iova)]; rk_iommu_iova_to_phys()
533 spin_unlock_irqrestore(&rk_domain->dt_lock, flags); rk_iommu_iova_to_phys()
538 static void rk_iommu_zap_iova(struct rk_iommu_domain *rk_domain, rk_iommu_zap_iova() argument
545 spin_lock_irqsave(&rk_domain->iommus_lock, flags); rk_iommu_zap_iova()
546 list_for_each(pos, &rk_domain->iommus) { rk_iommu_zap_iova()
551 spin_unlock_irqrestore(&rk_domain->iommus_lock, flags); rk_iommu_zap_iova()
554 static u32 *rk_dte_get_page_table(struct rk_iommu_domain *rk_domain, rk_dte_get_page_table() argument
561 assert_spin_locked(&rk_domain->dt_lock); rk_dte_get_page_table()
563 dte_addr = &rk_domain->dt[rk_iova_dte_index(iova)]; rk_dte_get_page_table()
582 rk_iommu_zap_iova(rk_domain, iova, SPAGE_SIZE); rk_dte_get_page_table()
589 static size_t rk_iommu_unmap_iova(struct rk_iommu_domain *rk_domain, rk_iommu_unmap_iova() argument
595 assert_spin_locked(&rk_domain->dt_lock); rk_iommu_unmap_iova()
610 static int rk_iommu_map_iova(struct rk_iommu_domain *rk_domain, u32 *pte_addr, rk_iommu_map_iova() argument
618 assert_spin_locked(&rk_domain->dt_lock); rk_iommu_map_iova()
636 rk_iommu_unmap_iova(rk_domain, pte_addr, iova, pte_count * SPAGE_SIZE); rk_iommu_map_iova()
649 struct rk_iommu_domain *rk_domain = to_rk_domain(domain); rk_iommu_map() local
655 spin_lock_irqsave(&rk_domain->dt_lock, flags); rk_iommu_map()
664 page_table = rk_dte_get_page_table(rk_domain, iova); rk_iommu_map()
666 spin_unlock_irqrestore(&rk_domain->dt_lock, flags); rk_iommu_map()
671 ret = rk_iommu_map_iova(rk_domain, pte_addr, iova, paddr, size, prot); rk_iommu_map()
672 spin_unlock_irqrestore(&rk_domain->dt_lock, flags); rk_iommu_map()
680 struct rk_iommu_domain *rk_domain = to_rk_domain(domain); rk_iommu_unmap() local
688 spin_lock_irqsave(&rk_domain->dt_lock, flags); rk_iommu_unmap()
697 dte = rk_domain->dt[rk_iova_dte_index(iova)]; rk_iommu_unmap()
700 spin_unlock_irqrestore(&rk_domain->dt_lock, flags); rk_iommu_unmap()
706 unmap_size = rk_iommu_unmap_iova(rk_domain, pte_addr, iova, size); rk_iommu_unmap()
708 spin_unlock_irqrestore(&rk_domain->dt_lock, flags); rk_iommu_unmap()
711 rk_iommu_zap_iova(rk_domain, iova, unmap_size); rk_iommu_unmap()
736 struct rk_iommu_domain *rk_domain = to_rk_domain(domain); rk_iommu_attach_device() local
764 dte_addr = virt_to_phys(rk_domain->dt); rk_iommu_attach_device()
773 spin_lock_irqsave(&rk_domain->iommus_lock, flags); rk_iommu_attach_device()
774 list_add_tail(&iommu->node, &rk_domain->iommus); rk_iommu_attach_device()
775 spin_unlock_irqrestore(&rk_domain->iommus_lock, flags); rk_iommu_attach_device()
788 struct rk_iommu_domain *rk_domain = to_rk_domain(domain); rk_iommu_detach_device() local
796 spin_lock_irqsave(&rk_domain->iommus_lock, flags); rk_iommu_detach_device()
798 spin_unlock_irqrestore(&rk_domain->iommus_lock, flags); rk_iommu_detach_device()
816 struct rk_iommu_domain *rk_domain; rk_iommu_domain_alloc() local
821 rk_domain = kzalloc(sizeof(*rk_domain), GFP_KERNEL); rk_iommu_domain_alloc()
822 if (!rk_domain) rk_iommu_domain_alloc()
830 rk_domain->dt = (u32 *)get_zeroed_page(GFP_KERNEL | GFP_DMA32); rk_iommu_domain_alloc()
831 if (!rk_domain->dt) rk_iommu_domain_alloc()
834 rk_table_flush(rk_domain->dt, NUM_DT_ENTRIES); rk_iommu_domain_alloc()
836 spin_lock_init(&rk_domain->iommus_lock); rk_iommu_domain_alloc()
837 spin_lock_init(&rk_domain->dt_lock); rk_iommu_domain_alloc()
838 INIT_LIST_HEAD(&rk_domain->iommus); rk_iommu_domain_alloc()
840 return &rk_domain->domain; rk_iommu_domain_alloc()
843 kfree(rk_domain); rk_iommu_domain_alloc()
849 struct rk_iommu_domain *rk_domain = to_rk_domain(domain); rk_iommu_domain_free() local
852 WARN_ON(!list_empty(&rk_domain->iommus)); rk_iommu_domain_free()
855 u32 dte = rk_domain->dt[i]; rk_iommu_domain_free()
863 free_page((unsigned long)rk_domain->dt); rk_iommu_domain_free()
864 kfree(rk_domain); rk_iommu_domain_free()

Completed in 33 milliseconds