On 2023-11-28 8:49 pm, Pasha Tatashin wrote:
Convert iommu/dma-iommu.c to use the new page allocation functions
provided in iommu-pages.h.
These have nothing to do with IOMMU pagetables, they are DMA buffers and
they belong to whoever called the corresponding dma_alloc_* function.
Thanks,
Robin.
Signed-off-by: Pasha Tatashin <pasha.tatashin@xxxxxxxxxx>
---
drivers/iommu/dma-iommu.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c
index 85163a83df2f..822adad464c2 100644
--- a/drivers/iommu/dma-iommu.c
+++ b/drivers/iommu/dma-iommu.c
@@ -31,6 +31,7 @@
#include <linux/vmalloc.h>
#include "dma-iommu.h"
+#include "iommu-pages.h"
struct iommu_dma_msi_page {
struct list_head list;
@@ -874,7 +875,7 @@ static dma_addr_t __iommu_dma_map(struct device *dev, phys_addr_t phys,
static void __iommu_dma_free_pages(struct page **pages, int count)
{
while (count--)
- __free_page(pages[count]);
+ __iommu_free_page(pages[count]);
kvfree(pages);
}
@@ -912,7 +913,8 @@ static struct page **__iommu_dma_alloc_pages(struct device *dev,
order_size = 1U << order;
if (order_mask > order_size)
alloc_flags |= __GFP_NORETRY;
- page = alloc_pages_node(nid, alloc_flags, order);
+ page = __iommu_alloc_pages_node(nid, alloc_flags,
+ order);
if (!page)
continue;
if (order)
@@ -1572,7 +1574,7 @@ static void *iommu_dma_alloc_pages(struct device *dev, size_t size,
page = dma_alloc_contiguous(dev, alloc_size, gfp);
if (!page)
- page = alloc_pages_node(node, gfp, get_order(alloc_size));
+ page = __iommu_alloc_pages_node(node, gfp, get_order(alloc_size));
if (!page)
return NULL;