Skip to content

Commit 95b18ef

Browse files
soleenjoergroedel
authored andcommitted
iommu/dma: use iommu_put_pages_list() to releae freelist
Free the IOMMU page tables via iommu_put_pages_list(). The page tables were allocated via iommu_alloc_* functions in architecture specific places, but are released in dma-iommu if the freelist is gathered during map/unmap operations into iommu_iotlb_gather data structure. Currently, only iommu/intel that does that. Signed-off-by: Pasha Tatashin <pasha.tatashin@soleen.com> Acked-by: David Rientjes <rientjes@google.com> Link: https://lore.kernel.org/r/20240413002522.1101315-3-pasha.tatashin@soleen.com Signed-off-by: Joerg Roedel <jroedel@suse.de>
1 parent 06c3750 commit 95b18ef

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

drivers/iommu/dma-iommu.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include <trace/events/swiotlb.h>
3333

3434
#include "dma-iommu.h"
35+
#include "iommu-pages.h"
3536

3637
struct iommu_dma_msi_page {
3738
struct list_head list;
@@ -156,7 +157,7 @@ static void fq_ring_free_locked(struct iommu_dma_cookie *cookie, struct iova_fq
156157
if (fq->entries[idx].counter >= counter)
157158
break;
158159

159-
put_pages_list(&fq->entries[idx].freelist);
160+
iommu_put_pages_list(&fq->entries[idx].freelist);
160161
free_iova_fast(&cookie->iovad,
161162
fq->entries[idx].iova_pfn,
162163
fq->entries[idx].pages);
@@ -254,7 +255,7 @@ static void iommu_dma_free_fq_single(struct iova_fq *fq)
254255
int idx;
255256

256257
fq_ring_for_each(idx, fq)
257-
put_pages_list(&fq->entries[idx].freelist);
258+
iommu_put_pages_list(&fq->entries[idx].freelist);
258259
vfree(fq);
259260
}
260261

@@ -267,7 +268,7 @@ static void iommu_dma_free_fq_percpu(struct iova_fq __percpu *percpu_fq)
267268
struct iova_fq *fq = per_cpu_ptr(percpu_fq, cpu);
268269

269270
fq_ring_for_each(idx, fq)
270-
put_pages_list(&fq->entries[idx].freelist);
271+
iommu_put_pages_list(&fq->entries[idx].freelist);
271272
}
272273

273274
free_percpu(percpu_fq);

0 commit comments

Comments
 (0)