Commit 9a3dd4c1 authored by Pasha Tatashin's avatar Pasha Tatashin Committed by Joerg Roedel

iommu/io-pgtable-arm: use page allocation function provided by iommu-pages.h

Convert iommu/io-pgtable-arm.c to use the new page allocation functions
provided in iommu-pages.h.
Signed-off-by: default avatarPasha Tatashin <pasha.tatashin@soleen.com>
Acked-by: default avatarDavid Rientjes <rientjes@google.com>
Tested-by: default avatarBagas Sanjaya <bagasdotme@gmail.com>
Link: https://lore.kernel.org/r/20240413002522.1101315-5-pasha.tatashin@soleen.comSigned-off-by: default avatarJoerg Roedel <jroedel@suse.de>
parent 75114cba
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <asm/barrier.h> #include <asm/barrier.h>
#include "io-pgtable-arm.h" #include "io-pgtable-arm.h"
#include "iommu-pages.h"
#define ARM_LPAE_MAX_ADDR_BITS 52 #define ARM_LPAE_MAX_ADDR_BITS 52
#define ARM_LPAE_S2_MAX_CONCAT_PAGES 16 #define ARM_LPAE_S2_MAX_CONCAT_PAGES 16
...@@ -198,14 +199,10 @@ static void *__arm_lpae_alloc_pages(size_t size, gfp_t gfp, ...@@ -198,14 +199,10 @@ static void *__arm_lpae_alloc_pages(size_t size, gfp_t gfp,
VM_BUG_ON((gfp & __GFP_HIGHMEM)); VM_BUG_ON((gfp & __GFP_HIGHMEM));
if (cfg->alloc) { if (cfg->alloc)
pages = cfg->alloc(cookie, size, gfp); pages = cfg->alloc(cookie, size, gfp);
} else { else
struct page *p; pages = iommu_alloc_pages_node(dev_to_node(dev), gfp, order);
p = alloc_pages_node(dev_to_node(dev), gfp | __GFP_ZERO, order);
pages = p ? page_address(p) : NULL;
}
if (!pages) if (!pages)
return NULL; return NULL;
...@@ -233,7 +230,7 @@ static void *__arm_lpae_alloc_pages(size_t size, gfp_t gfp, ...@@ -233,7 +230,7 @@ static void *__arm_lpae_alloc_pages(size_t size, gfp_t gfp,
if (cfg->free) if (cfg->free)
cfg->free(cookie, pages, size); cfg->free(cookie, pages, size);
else else
free_pages((unsigned long)pages, order); iommu_free_pages(pages, order);
return NULL; return NULL;
} }
...@@ -249,7 +246,7 @@ static void __arm_lpae_free_pages(void *pages, size_t size, ...@@ -249,7 +246,7 @@ static void __arm_lpae_free_pages(void *pages, size_t size,
if (cfg->free) if (cfg->free)
cfg->free(cookie, pages, size); cfg->free(cookie, pages, size);
else else
free_pages((unsigned long)pages, get_order(size)); iommu_free_pages(pages, get_order(size));
} }
static void __arm_lpae_sync_pte(arm_lpae_iopte *ptep, int num_entries, static void __arm_lpae_sync_pte(arm_lpae_iopte *ptep, int num_entries,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment