aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/Kconfig
diff options
context:
space:
mode:
authorMarek Szyprowski <m.szyprowski@samsung.com>2011-12-29 07:09:51 -0500
committerMarek Szyprowski <m.szyprowski@samsung.com>2012-05-21 09:09:37 -0400
commitc64be2bb1c6eb43c838b2c6d57b074078be208dd (patch)
treed0720eda4a440ff91f3296b0f90cc53ac514d4b9 /drivers/base/Kconfig
parent49f223a9cd96c7293d7258ff88c2bdf83065f69c (diff)
drivers: add Contiguous Memory Allocator
The Contiguous Memory Allocator is a set of helper functions for DMA mapping framework that improves allocations of contiguous memory chunks. CMA grabs memory on system boot, marks it with MIGRATE_CMA migrate type and gives back to the system. Kernel is allowed to allocate only movable pages within CMA's managed memory so that it can be used for example for page cache when DMA mapping do not use it. On dma_alloc_from_contiguous() request such pages are migrated out of CMA area to free required contiguous block and fulfill the request. This allows to allocate large contiguous chunks of memory at any time assuming that there is enough free memory available in the system. This code is heavily based on earlier works by Michal Nazarewicz. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Michal Nazarewicz <mina86@mina86.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Tested-by: Rob Clark <rob.clark@linaro.org> Tested-by: Ohad Ben-Cohen <ohad@wizery.com> Tested-by: Benjamin Gaignard <benjamin.gaignard@linaro.org> Tested-by: Robert Nelson <robertcnelson@gmail.com> Tested-by: Barry Song <Baohua.Song@csr.com>
Diffstat (limited to 'drivers/base/Kconfig')
-rw-r--r--drivers/base/Kconfig89
1 files changed, 89 insertions, 0 deletions
diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig
index 9aa618acfe9..9b21469482a 100644
--- a/drivers/base/Kconfig
+++ b/drivers/base/Kconfig
@@ -192,4 +192,93 @@ config DMA_SHARED_BUFFER
192 APIs extension; the file's descriptor can then be passed on to other 192 APIs extension; the file's descriptor can then be passed on to other
193 driver. 193 driver.
194 194
195config CMA
196 bool "Contiguous Memory Allocator (EXPERIMENTAL)"
197 depends on HAVE_DMA_CONTIGUOUS && HAVE_MEMBLOCK && EXPERIMENTAL
198 select MIGRATION
199 help
200 This enables the Contiguous Memory Allocator which allows drivers
201 to allocate big physically-contiguous blocks of memory for use with
202 hardware components that do not support I/O map nor scatter-gather.
203
204 For more information see <include/linux/dma-contiguous.h>.
205 If unsure, say "n".
206
207if CMA
208
209config CMA_DEBUG
210 bool "CMA debug messages (DEVELOPMENT)"
211 depends on DEBUG_KERNEL
212 help
213 Turns on debug messages in CMA. This produces KERN_DEBUG
214 messages for every CMA call as well as various messages while
215 processing calls such as dma_alloc_from_contiguous().
216 This option does not affect warning and error messages.
217
218comment "Default contiguous memory area size:"
219
220config CMA_SIZE_MBYTES
221 int "Size in Mega Bytes"
222 depends on !CMA_SIZE_SEL_PERCENTAGE
223 default 16
224 help
225 Defines the size (in MiB) of the default memory area for Contiguous
226 Memory Allocator.
227
228config CMA_SIZE_PERCENTAGE
229 int "Percentage of total memory"
230 depends on !CMA_SIZE_SEL_MBYTES
231 default 10
232 help
233 Defines the size of the default memory area for Contiguous Memory
234 Allocator as a percentage of the total memory in the system.
235
236choice
237 prompt "Selected region size"
238 default CMA_SIZE_SEL_ABSOLUTE
239
240config CMA_SIZE_SEL_MBYTES
241 bool "Use mega bytes value only"
242
243config CMA_SIZE_SEL_PERCENTAGE
244 bool "Use percentage value only"
245
246config CMA_SIZE_SEL_MIN
247 bool "Use lower value (minimum)"
248
249config CMA_SIZE_SEL_MAX
250 bool "Use higher value (maximum)"
251
252endchoice
253
254config CMA_ALIGNMENT
255 int "Maximum PAGE_SIZE order of alignment for contiguous buffers"
256 range 4 9
257 default 8
258 help
259 DMA mapping framework by default aligns all buffers to the smallest
260 PAGE_SIZE order which is greater than or equal to the requested buffer
261 size. This works well for buffers up to a few hundreds kilobytes, but
262 for larger buffers it just a memory waste. With this parameter you can
263 specify the maximum PAGE_SIZE order for contiguous buffers. Larger
264 buffers will be aligned only to this specified order. The order is
265 expressed as a power of two multiplied by the PAGE_SIZE.
266
267 For example, if your system defaults to 4KiB pages, the order value
268 of 8 means that the buffers will be aligned up to 1MiB only.
269
270 If unsure, leave the default value "8".
271
272config CMA_AREAS
273 int "Maximum count of the CMA device-private areas"
274 default 7
275 help
276 CMA allows to create CMA areas for particular devices. This parameter
277 sets the maximum number of such device private CMA areas in the
278 system.
279
280 If unsure, leave the default value "7".
281
282endif
283
195endmenu 284endmenu