]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
iommu/exynos: use page allocation function provided by iommu-pages.h
authorPasha Tatashin <pasha.tatashin@soleen.com>
Sat, 13 Apr 2024 00:25:17 +0000 (00:25 +0000)
committerJoerg Roedel <jroedel@suse.de>
Mon, 15 Apr 2024 12:31:45 +0000 (14:31 +0200)
Convert iommu/exynos-iommu.c to use the new page allocation functions
provided in iommu-pages.h.

Signed-off-by: Pasha Tatashin <pasha.tatashin@soleen.com>
Acked-by: David Rientjes <rientjes@google.com>
Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
Tested-by: Bagas Sanjaya <bagasdotme@gmail.com>
Link: https://lore.kernel.org/r/20240413002522.1101315-7-pasha.tatashin@soleen.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
drivers/iommu/exynos-iommu.c

index d98c9161948a256597e4cabeda892e503c935c26..c666ecab955d210087abeb81af6b9ca3341dc2cf 100644 (file)
@@ -22,6 +22,8 @@
 #include <linux/pm_runtime.h>
 #include <linux/slab.h>
 
+#include "iommu-pages.h"
+
 typedef u32 sysmmu_iova_t;
 typedef u32 sysmmu_pte_t;
 static struct iommu_domain exynos_identity_domain;
@@ -900,11 +902,11 @@ static struct iommu_domain *exynos_iommu_domain_alloc_paging(struct device *dev)
        if (!domain)
                return NULL;
 
-       domain->pgtable = (sysmmu_pte_t *)__get_free_pages(GFP_KERNEL, 2);
+       domain->pgtable = iommu_alloc_pages(GFP_KERNEL, 2);
        if (!domain->pgtable)
                goto err_pgtable;
 
-       domain->lv2entcnt = (short *)__get_free_pages(GFP_KERNEL | __GFP_ZERO, 1);
+       domain->lv2entcnt = iommu_alloc_pages(GFP_KERNEL, 1);
        if (!domain->lv2entcnt)
                goto err_counter;
 
@@ -930,9 +932,9 @@ static struct iommu_domain *exynos_iommu_domain_alloc_paging(struct device *dev)
        return &domain->domain;
 
 err_lv2ent:
-       free_pages((unsigned long)domain->lv2entcnt, 1);
+       iommu_free_pages(domain->lv2entcnt, 1);
 err_counter:
-       free_pages((unsigned long)domain->pgtable, 2);
+       iommu_free_pages(domain->pgtable, 2);
 err_pgtable:
        kfree(domain);
        return NULL;
@@ -973,8 +975,8 @@ static void exynos_iommu_domain_free(struct iommu_domain *iommu_domain)
                                        phys_to_virt(base));
                }
 
-       free_pages((unsigned long)domain->pgtable, 2);
-       free_pages((unsigned long)domain->lv2entcnt, 1);
+       iommu_free_pages(domain->pgtable, 2);
+       iommu_free_pages(domain->lv2entcnt, 1);
        kfree(domain);
 }