From: Maxime Ripard Date: Mon, 13 Oct 2025 08:35:19 +0000 (+0200) Subject: dma: contiguous: Reserve default CMA heap X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8f1fc1bf1a3d5a61f7465435591a439c1e4671f2;p=thirdparty%2Fkernel%2Flinux.git dma: contiguous: Reserve default CMA heap 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. Reviewed-by: T.J. Mercier Signed-off-by: Maxime Ripard Acked-by: Marek Szyprowski Signed-off-by: Sumit Semwal Link: https://lore.kernel.org/r/20251013-dma-buf-ecc-heap-v8-4-04ce150ea3d9@kernel.org --- diff --git a/kernel/dma/contiguous.c b/kernel/dma/contiguous.c index d67e95094749d..d8fd6f779f797 100644 --- a/kernel/dma/contiguous.c +++ b/kernel/dma/contiguous.c @@ -242,6 +242,8 @@ void __init dma_contiguous_reserve(phys_addr_t limit) } 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); @@ -249,6 +251,10 @@ void __init dma_contiguous_reserve(phys_addr_t limit) 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."); } }