[PATCH v7 4/5] dma: contiguous: Reserve default CMA heap
Maxime Ripard
mripard at kernel.org
Mon Jul 21 11:17:33 UTC 2025
The CMA code, in addition to the reserved-memory regions in the device
tree, will also register a default CMA region if the device tree doesn't
provide any, with its size and position coming from either the kernel
command-line or configuration.
Let's register that one for use to create a heap for it.
Signed-off-by: Maxime Ripard <mripard at kernel.org>
---
kernel/dma/contiguous.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/kernel/dma/contiguous.c b/kernel/dma/contiguous.c
index e81982c0ee8f5c0654731adb611df4bcc4637c7c..7aec2a559607b86e4d9df33ae2c004f7fb30fff1 100644
--- a/kernel/dma/contiguous.c
+++ b/kernel/dma/contiguous.c
@@ -237,17 +237,23 @@ void __init dma_contiguous_reserve(phys_addr_t limit)
selected_size = max(size_bytes, cma_early_percent_memory());
#endif
}
if (selected_size && !dma_contiguous_default_area) {
+ int ret;
+
pr_debug("%s: reserving %ld MiB for global area\n", __func__,
(unsigned long)selected_size / SZ_1M);
dma_contiguous_reserve_area(selected_size, selected_base,
selected_limit,
&dma_contiguous_default_area,
fixed);
+
+ ret = dma_heap_cma_register_heap(dma_contiguous_default_area);
+ if (ret)
+ pr_warn("Couldn't register default CMA heap.");
}
}
void __weak
dma_contiguous_early_fixup(phys_addr_t base, unsigned long size)
--
2.50.1
More information about the dri-devel
mailing list