iommu/exynos: use page allocation function provided by iommu-pages.h

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>
This commit is contained in:
Pasha Tatashin 2024-04-13 00:25:17 +00:00 committed by Joerg Roedel
parent 4a0b77e7c8
commit fe046f1bf8

View File

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