Skip to content
Snippets Groups Projects
Commit 417f7da1 authored by Laura Abbott's avatar Laura Abbott Committed by Stephen Boyd
Browse files

drivers: Add option to reserve default CMA region


CMA provides good utilization of memory but for some use cases, the
allocation time is too costly. Add a Kconfig option to allow the
default region to be permanently set aside for contiguous use cases.

Change-Id: I1eef508d37cf6ae3b7b7a652fc59391b186fc122
Signed-off-by: default avatarLaura Abbott <lauraa@codeaurora.org>
parent a4c113d0
No related branches found
No related tags found
No related merge requests found
......@@ -290,6 +290,19 @@ config CMA_AREAS
If unsure, leave the default value "7".
config CMA_RESERVE_DEFAULT_AREA
bool "Permanently reserve the default area"
help
By default, contiguous regions are given back to the page allocator so
the memory may be used when not in contiguous forms. This has better
utilization but the allocation time may be slower. Say Y here to
never have the default region be returned to the page allocator.
This means the memory will always be available for contiguous
allocations but the pages will never be available for anything else
except contiguous allocations.
If unsure, say n.
endif
endmenu
......@@ -97,6 +97,11 @@ static struct cma *cma_get_area_by_name(const char *name)
#define CMA_SIZE_MBYTES 0
#endif
#ifdef CONFIG_CMA_RESERVE_DEFAULT_AREA
#define CMA_RESERVE_AREA 1
#else
#define CMA_RESERVE_AREA 0
#endif
/*
* Default global CMA area size can be defined in kernel's .config.
* This is usefull mainly for distro maintainers to create a kernel
......@@ -275,7 +280,7 @@ void __init dma_contiguous_reserve(phys_addr_t limit)
(unsigned long)sel_size / SZ_1M);
if (dma_contiguous_reserve_area(sel_size, &base, limit, NULL,
true) == 0)
CMA_RESERVE_AREA) == 0)
dma_contiguous_def_base = base;
}
#ifdef CONFIG_OF
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment