Lines Matching refs:sun50i_domain

288 static void sun50i_table_flush(struct sun50i_iommu_domain *sun50i_domain,  in sun50i_table_flush()  argument
291 struct sun50i_iommu *iommu = sun50i_domain->iommu; in sun50i_table_flush()
327 struct sun50i_iommu_domain *sun50i_domain = to_sun50i_domain(domain); in sun50i_iommu_flush_iotlb_all() local
328 struct sun50i_iommu *iommu = sun50i_domain->iommu; in sun50i_iommu_flush_iotlb_all()
355 struct sun50i_iommu_domain *sun50i_domain; in sun50i_iommu_enable() local
362 sun50i_domain = to_sun50i_domain(iommu->domain); in sun50i_iommu_enable()
374 iommu_write(iommu, IOMMU_TTB_REG, sun50i_domain->dt_dma); in sun50i_iommu_enable()
482 static u32 *sun50i_dte_get_page_table(struct sun50i_iommu_domain *sun50i_domain, in sun50i_dte_get_page_table() argument
485 struct sun50i_iommu *iommu = sun50i_domain->iommu; in sun50i_dte_get_page_table()
491 dte_addr = &sun50i_domain->dt[sun50i_iova_get_dte_index(iova)]; in sun50i_dte_get_page_table()
515 sun50i_table_flush(sun50i_domain, page_table, PT_SIZE); in sun50i_dte_get_page_table()
516 sun50i_table_flush(sun50i_domain, dte_addr, 1); in sun50i_dte_get_page_table()
524 struct sun50i_iommu_domain *sun50i_domain = to_sun50i_domain(domain); in sun50i_iommu_map() local
525 struct sun50i_iommu *iommu = sun50i_domain->iommu; in sun50i_iommu_map()
530 page_table = sun50i_dte_get_page_table(sun50i_domain, iova, gfp); in sun50i_iommu_map()
548 sun50i_table_flush(sun50i_domain, pte_addr, 1); in sun50i_iommu_map()
557 struct sun50i_iommu_domain *sun50i_domain = to_sun50i_domain(domain); in sun50i_iommu_unmap() local
562 dte = sun50i_domain->dt[sun50i_iova_get_dte_index(iova)]; in sun50i_iommu_unmap()
573 sun50i_table_flush(sun50i_domain, pte_addr, 1); in sun50i_iommu_unmap()
581 struct sun50i_iommu_domain *sun50i_domain = to_sun50i_domain(domain); in sun50i_iommu_iova_to_phys() local
586 dte = sun50i_domain->dt[sun50i_iova_get_dte_index(iova)]; in sun50i_iommu_iova_to_phys()
602 struct sun50i_iommu_domain *sun50i_domain; in sun50i_iommu_domain_alloc() local
609 sun50i_domain = kzalloc(sizeof(*sun50i_domain), GFP_KERNEL); in sun50i_iommu_domain_alloc()
610 if (!sun50i_domain) in sun50i_iommu_domain_alloc()
614 iommu_get_dma_cookie(&sun50i_domain->domain)) in sun50i_iommu_domain_alloc()
617 sun50i_domain->dt = (u32 *)__get_free_pages(GFP_KERNEL | __GFP_ZERO, in sun50i_iommu_domain_alloc()
619 if (!sun50i_domain->dt) in sun50i_iommu_domain_alloc()
622 refcount_set(&sun50i_domain->refcnt, 1); in sun50i_iommu_domain_alloc()
624 sun50i_domain->domain.geometry.aperture_start = 0; in sun50i_iommu_domain_alloc()
625 sun50i_domain->domain.geometry.aperture_end = DMA_BIT_MASK(32); in sun50i_iommu_domain_alloc()
626 sun50i_domain->domain.geometry.force_aperture = true; in sun50i_iommu_domain_alloc()
628 return &sun50i_domain->domain; in sun50i_iommu_domain_alloc()
632 iommu_put_dma_cookie(&sun50i_domain->domain); in sun50i_iommu_domain_alloc()
635 kfree(sun50i_domain); in sun50i_iommu_domain_alloc()
642 struct sun50i_iommu_domain *sun50i_domain = to_sun50i_domain(domain); in sun50i_iommu_domain_free() local
644 free_pages((unsigned long)sun50i_domain->dt, get_order(DT_SIZE)); in sun50i_iommu_domain_free()
645 sun50i_domain->dt = NULL; in sun50i_iommu_domain_free()
649 kfree(sun50i_domain); in sun50i_iommu_domain_free()
653 struct sun50i_iommu_domain *sun50i_domain) in sun50i_iommu_attach_domain() argument
655 iommu->domain = &sun50i_domain->domain; in sun50i_iommu_attach_domain()
656 sun50i_domain->iommu = iommu; in sun50i_iommu_attach_domain()
658 sun50i_domain->dt_dma = dma_map_single(iommu->dev, sun50i_domain->dt, in sun50i_iommu_attach_domain()
660 if (dma_mapping_error(iommu->dev, sun50i_domain->dt_dma)) { in sun50i_iommu_attach_domain()
669 struct sun50i_iommu_domain *sun50i_domain) in sun50i_iommu_detach_domain() argument
679 dte_addr = &sun50i_domain->dt[i]; in sun50i_iommu_detach_domain()
685 sun50i_table_flush(sun50i_domain, dte_addr, 1); in sun50i_iommu_detach_domain()
695 dma_unmap_single(iommu->dev, virt_to_phys(sun50i_domain->dt), in sun50i_iommu_detach_domain()
704 struct sun50i_iommu_domain *sun50i_domain = to_sun50i_domain(domain); in sun50i_iommu_detach_device() local
712 if (refcount_dec_and_test(&sun50i_domain->refcnt)) in sun50i_iommu_detach_device()
713 sun50i_iommu_detach_domain(iommu, sun50i_domain); in sun50i_iommu_detach_device()
719 struct sun50i_iommu_domain *sun50i_domain = to_sun50i_domain(domain); in sun50i_iommu_attach_device() local
728 refcount_inc(&sun50i_domain->refcnt); in sun50i_iommu_attach_device()
736 sun50i_iommu_attach_domain(iommu, sun50i_domain); in sun50i_iommu_attach_device()