Lines Matching full:cma

11  *   The Contiguous Memory Allocator (CMA) makes it possible to
32 * CMA tries to solve this issue by operating on memory regions
38 #define pr_fmt(fmt) "cma: " fmt
52 #include <linux/cma.h>
61 struct cma *dma_contiguous_default_area;
64 * Default global CMA area size can be defined in kernel's .config.
70 * Users, who want to set the size of global CMA area for their system
71 * should use cma= kernel parameter.
98 early_param("cma", early_cma);
102 static struct cma *dma_contiguous_numa_area[MAX_NUMNODES];
104 static struct cma *dma_contiguous_pernuma_area[MAX_NUMNODES];
172 struct cma **cma; in dma_numa_cma_reserve() local
182 cma = &dma_contiguous_pernuma_area[nid]; in dma_numa_cma_reserve()
185 0, false, name, cma, nid); in dma_numa_cma_reserve()
193 cma = &dma_contiguous_numa_area[nid]; in dma_numa_cma_reserve()
196 name, cma, nid); in dma_numa_cma_reserve()
268 * @res_cma: Pointer to store the created cma region.
281 phys_addr_t limit, struct cma **res_cma, in dma_contiguous_reserve_area()
335 static struct page *cma_alloc_aligned(struct cma *cma, size_t size, gfp_t gfp) in cma_alloc_aligned() argument
339 return cma_alloc(cma, size >> PAGE_SHIFT, align, gfp & __GFP_NOWARN); in cma_alloc_aligned()
349 * tries to use per-numa cma, if the allocation fails, it will fallback to
354 * there is no need to waste CMA pages for that kind; it also helps reduce
363 /* CMA can be used only in the context which permits sleeping */ in dma_alloc_contiguous()
373 struct cma *cma = dma_contiguous_pernuma_area[nid]; in dma_alloc_contiguous() local
376 if (cma) { in dma_alloc_contiguous()
377 page = cma_alloc_aligned(cma, size, gfp); in dma_alloc_contiguous()
382 cma = dma_contiguous_numa_area[nid]; in dma_alloc_contiguous()
383 if (cma) { in dma_alloc_contiguous()
384 page = cma_alloc_aligned(cma, size, gfp); in dma_alloc_contiguous()
411 /* if dev has its own cma, free page from there */ in dma_free_contiguous()
417 * otherwise, page is from either per-numa cma or default cma in dma_free_contiguous()
431 /* not in any cma, free from buddy */ in dma_free_contiguous()
466 bool default_cma = of_get_flat_dt_prop(node, "linux,cma-default", NULL); in rmem_cma_setup()
467 struct cma *cma; in rmem_cma_setup() local
471 pr_info("Reserved memory: bypass %s node, using cmdline CMA params instead\n", in rmem_cma_setup()
481 pr_err("Reserved memory: incorrect alignment of CMA region\n"); in rmem_cma_setup()
485 err = cma_init_reserved_mem(rmem->base, rmem->size, 0, rmem->name, &cma); in rmem_cma_setup()
487 pr_err("Reserved memory: unable to setup CMA region\n"); in rmem_cma_setup()
494 dma_contiguous_default_area = cma; in rmem_cma_setup()
497 rmem->priv = cma; in rmem_cma_setup()
499 pr_info("Reserved memory: created CMA memory pool at %pa, size %ld MiB\n", in rmem_cma_setup()
504 RESERVEDMEM_OF_DECLARE(cma, "shared-dma-pool", rmem_cma_setup);