Skip to contentSkip to conversation

swiotlb: Use the calculated number of areas

PATCH Applied Ross Lagerwall 2 participants 2 messages Sep 11, 2023 – Sep 13, 2023 DMA mapping helpers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 swiotlb: Use the calculated number of areas

Commit 8ac04063354a ("swiotlb: reduce the number of areas to match actual memory pool size") calculated the reduced number of areas in swiotlb_init_remap() but didn't actually use the value. Replace usage of default_nareas accordingly.

Fixes 8ac04063354a ("swiotlb: reduce the number of areas to match actual memory pool size")

---

Compile-tested only since I saw this just from code inspection.

 kernel/dma/swiotlb.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
kernel/dma/swiotlb.c +2 -3
index 394494a6b1f3..85dd94323b98 100644
@@ -399,14 +399,13 @@ void __init swiotlb_init_remap(bool addressing_limit, unsigned int flags,
 	}
 
 	mem->areas = memblock_alloc(array_size(sizeof(struct io_tlb_area),
-		default_nareas), SMP_CACHE_BYTES);
+		nareas), SMP_CACHE_BYTES);
 	if (!mem->areas) {
 		pr_warn("%s: Failed to allocate mem->areas.\n", __func__);
 		return;
 	}
 
-	swiotlb_init_io_tlb_pool(mem, __pa(tlb), nslabs, false,
-				 default_nareas);
+	swiotlb_init_io_tlb_pool(mem, __pa(tlb), nslabs, false, nareas);
 	add_mem_pool(&io_tlb_default_mem, mem);
 
 	if (flags & SWIOTLB_VERBOSE)
Signature · 1 line
2.41.0