]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
dma: contiguous: Reserve default CMA heap
authorMaxime Ripard <mripard@kernel.org>
Mon, 13 Oct 2025 08:35:19 +0000 (10:35 +0200)
committerSumit Semwal <sumit.semwal@linaro.org>
Sat, 18 Oct 2025 16:01:21 +0000 (21:31 +0530)
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 <tjmercier@google.com>
Signed-off-by: Maxime Ripard <mripard@kernel.org>
Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Sumit Semwal <sumit.semwal@linaro.org>
Link: https://lore.kernel.org/r/20251013-dma-buf-ecc-heap-v8-4-04ce150ea3d9@kernel.org
kernel/dma/contiguous.c

index d67e95094749d45f43c1809c175e491a3f55b2e1..d8fd6f779f797f711b8e0fd628f868d644b8f784 100644 (file)
@@ -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.");
        }
 }