Skip to content

Commit 4a376d4

Browse files
rmurphy-armjoergroedel
authored andcommitted
iommu/exynos: Drop IOVA cookie management
The core code bakes its own cookies now. Acked-by: Marek Szyprowski <[email protected]> Tested-by: Marek Szyprowski <[email protected]> Signed-off-by: Robin Murphy <[email protected]> Link: https://lore.kernel.org/r/12d88cbf44e57faa4f0512760e7ed3a9cba05ca8.1628682048.git.robin.murphy@arm.com Signed-off-by: Joerg Roedel <[email protected]>
1 parent f297e27 commit 4a376d4

File tree

1 file changed

+4
-15
lines changed

1 file changed

+4
-15
lines changed

drivers/iommu/exynos-iommu.c

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
#include <linux/platform_device.h>
2222
#include <linux/pm_runtime.h>
2323
#include <linux/slab.h>
24-
#include <linux/dma-iommu.h>
2524

2625
typedef u32 sysmmu_iova_t;
2726
typedef u32 sysmmu_pte_t;
@@ -735,20 +734,16 @@ static struct iommu_domain *exynos_iommu_domain_alloc(unsigned type)
735734
/* Check if correct PTE offsets are initialized */
736735
BUG_ON(PG_ENT_SHIFT < 0 || !dma_dev);
737736

737+
if (type != IOMMU_DOMAIN_DMA && type != IOMMU_DOMAIN_UNMANAGED)
738+
return NULL;
739+
738740
domain = kzalloc(sizeof(*domain), GFP_KERNEL);
739741
if (!domain)
740742
return NULL;
741743

742-
if (type == IOMMU_DOMAIN_DMA) {
743-
if (iommu_get_dma_cookie(&domain->domain) != 0)
744-
goto err_pgtable;
745-
} else if (type != IOMMU_DOMAIN_UNMANAGED) {
746-
goto err_pgtable;
747-
}
748-
749744
domain->pgtable = (sysmmu_pte_t *)__get_free_pages(GFP_KERNEL, 2);
750745
if (!domain->pgtable)
751-
goto err_dma_cookie;
746+
goto err_pgtable;
752747

753748
domain->lv2entcnt = (short *)__get_free_pages(GFP_KERNEL | __GFP_ZERO, 1);
754749
if (!domain->lv2entcnt)
@@ -779,9 +774,6 @@ static struct iommu_domain *exynos_iommu_domain_alloc(unsigned type)
779774
free_pages((unsigned long)domain->lv2entcnt, 1);
780775
err_counter:
781776
free_pages((unsigned long)domain->pgtable, 2);
782-
err_dma_cookie:
783-
if (type == IOMMU_DOMAIN_DMA)
784-
iommu_put_dma_cookie(&domain->domain);
785777
err_pgtable:
786778
kfree(domain);
787779
return NULL;
@@ -809,9 +801,6 @@ static void exynos_iommu_domain_free(struct iommu_domain *iommu_domain)
809801

810802
spin_unlock_irqrestore(&domain->lock, flags);
811803

812-
if (iommu_domain->type == IOMMU_DOMAIN_DMA)
813-
iommu_put_dma_cookie(iommu_domain);
814-
815804
dma_unmap_single(dma_dev, virt_to_phys(domain->pgtable), LV1TABLE_SIZE,
816805
DMA_TO_DEVICE);
817806

0 commit comments

Comments
 (0)