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
46 #include <linux/cma.h>
55 struct cma *dma_contiguous_default_area;
58 * Default global CMA area size can be defined in kernel's .config.
64 * Users, who want to set the size of global CMA area for their system
65 * should use cma= kernel parameter.
91 early_param("cma", early_cma);
95 static struct cma *dma_contiguous_numa_area[MAX_NUMNODES];
97 static struct cma *dma_contiguous_pernuma_area[MAX_NUMNODES];
165 struct cma **cma; in dma_numa_cma_reserve() local
175 cma = &dma_contiguous_pernuma_area[nid]; in dma_numa_cma_reserve()
178 0, false, name, cma, nid); in dma_numa_cma_reserve()
186 cma = &dma_contiguous_numa_area[nid]; in dma_numa_cma_reserve()
189 name, cma, nid); in dma_numa_cma_reserve()
261 * @res_cma: Pointer to store the created cma region.
274 phys_addr_t limit, struct cma **res_cma, in dma_contiguous_reserve_area()
328 static struct page *cma_alloc_aligned(struct cma *cma, size_t size, gfp_t gfp) in cma_alloc_aligned() argument
332 return cma_alloc(cma, size >> PAGE_SHIFT, align, gfp & __GFP_NOWARN); in cma_alloc_aligned()
342 * tries to use per-numa cma, if the allocation fails, it will fallback to
347 * there is no need to waste CMA pages for that kind; it also helps reduce
356 /* CMA can be used only in the context which permits sleeping */ in dma_alloc_contiguous()
366 struct cma *cma = dma_contiguous_pernuma_area[nid]; in dma_alloc_contiguous() local
369 if (cma) { in dma_alloc_contiguous()
370 page = cma_alloc_aligned(cma, size, gfp); in dma_alloc_contiguous()
375 cma = dma_contiguous_numa_area[nid]; in dma_alloc_contiguous()
376 if (cma) { in dma_alloc_contiguous()
377 page = cma_alloc_aligned(cma, size, gfp); in dma_alloc_contiguous()
404 /* if dev has its own cma, free page from there */ in dma_free_contiguous()
410 * otherwise, page is from either per-numa cma or default cma in dma_free_contiguous()
424 /* not in any cma, free from buddy */ in dma_free_contiguous()
459 bool default_cma = of_get_flat_dt_prop(node, "linux,cma-default", NULL); in rmem_cma_setup()
460 struct cma *cma; in rmem_cma_setup() local
464 pr_info("Reserved memory: bypass %s node, using cmdline CMA params instead\n", in rmem_cma_setup()
474 pr_err("Reserved memory: incorrect alignment of CMA region\n"); in rmem_cma_setup()
478 err = cma_init_reserved_mem(rmem->base, rmem->size, 0, rmem->name, &cma); in rmem_cma_setup()
480 pr_err("Reserved memory: unable to setup CMA region\n"); in rmem_cma_setup()
487 dma_contiguous_default_area = cma; in rmem_cma_setup()
490 rmem->priv = cma; in rmem_cma_setup()
492 pr_info("Reserved memory: created CMA memory pool at %pa, size %ld MiB\n", in rmem_cma_setup()
497 RESERVEDMEM_OF_DECLARE(cma, "shared-dma-pool", rmem_cma_setup);