mirror of
https://github.com/torvalds/linux.git
synced 2025-12-07 20:06:24 +00:00
dma: contiguous: Register reusable CMA regions at boot
In order to create a CMA dma-buf heap instance for each CMA heap region in the system, we need to collect all of them during boot. They are created from two main sources: the reserved-memory regions in the device tree, and the default CMA region created from the configuration or command line parameters, if no default region is provided in the device tree. Let's collect all the device-tree defined CMA regions flagged as reusable. 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-3-04ce150ea3d9@kernel.org
This commit is contained in:
committed by
Sumit Semwal
parent
8b5690d5c9
commit
84a593066a
@@ -42,6 +42,7 @@
|
||||
#include <linux/memblock.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/sizes.h>
|
||||
#include <linux/dma-buf/heaps/cma.h>
|
||||
#include <linux/dma-map-ops.h>
|
||||
#include <linux/cma.h>
|
||||
#include <linux/nospec.h>
|
||||
@@ -493,6 +494,10 @@ static int __init rmem_cma_setup(struct reserved_mem *rmem)
|
||||
pr_info("Reserved memory: created CMA memory pool at %pa, size %ld MiB\n",
|
||||
&rmem->base, (unsigned long)rmem->size / SZ_1M);
|
||||
|
||||
err = dma_heap_cma_register_heap(cma);
|
||||
if (err)
|
||||
pr_warn("Couldn't register CMA heap.");
|
||||
|
||||
return 0;
|
||||
}
|
||||
RESERVEDMEM_OF_DECLARE(cma, "shared-dma-pool", rmem_cma_setup);
|
||||
|
||||
Reference in New Issue
Block a user