Thread (50 messages) flat view 50 messages, 6 authors, 2023-12-26

Re: [PATCH 06/16] iommu/dma: use page allocation function provided by iommu-pages.h

From: Robin Murphy <robin.murphy@arm.com>
Date: 2023-11-28 22:34:01
Also in: asahi, cgroups, kvm, linux-doc, linux-fsdevel, linux-iommu, linux-mm, linux-rockchip, linux-samsung-soc, linux-sunxi, linux-tegra, lkml, virtualization

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.
quoted hunk ↗ jump to hunk
Signed-off-by: Pasha Tatashin <pasha.tatashin@soleen.com>
---
  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;
  
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help