aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/include/asm/dma-contiguous.h2
-rw-r--r--arch/arm/mm/dma-mapping.c6
-rw-r--r--drivers/base/Kconfig20
-rw-r--r--drivers/base/Makefile2
-rw-r--r--include/linux/dma-contiguous.h2
-rw-r--r--mm/Kconfig24
6 files changed, 34 insertions, 22 deletions
diff --git a/arch/arm/include/asm/dma-contiguous.h b/arch/arm/include/asm/dma-contiguous.h
index 3ed37b4d93da..e072bb2ba1b1 100644
--- a/arch/arm/include/asm/dma-contiguous.h
+++ b/arch/arm/include/asm/dma-contiguous.h
@@ -2,7 +2,7 @@
2#define ASMARM_DMA_CONTIGUOUS_H 2#define ASMARM_DMA_CONTIGUOUS_H
3 3
4#ifdef __KERNEL__ 4#ifdef __KERNEL__
5#ifdef CONFIG_CMA 5#ifdef CONFIG_DMA_CMA
6 6
7#include <linux/types.h> 7#include <linux/types.h>
8#include <asm-generic/dma-contiguous.h> 8#include <asm-generic/dma-contiguous.h>
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index 7f9b1798c6cf..dbddc07a3bbd 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -358,7 +358,7 @@ static int __init atomic_pool_init(void)
358 if (!pages) 358 if (!pages)
359 goto no_pages; 359 goto no_pages;
360 360
361 if (IS_ENABLED(CONFIG_CMA)) 361 if (IS_ENABLED(CONFIG_DMA_CMA))
362 ptr = __alloc_from_contiguous(NULL, pool->size, prot, &page, 362 ptr = __alloc_from_contiguous(NULL, pool->size, prot, &page,
363 atomic_pool_init); 363 atomic_pool_init);
364 else 364 else
@@ -670,7 +670,7 @@ static void *__dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
670 addr = __alloc_simple_buffer(dev, size, gfp, &page); 670 addr = __alloc_simple_buffer(dev, size, gfp, &page);
671 else if (!(gfp & __GFP_WAIT)) 671 else if (!(gfp & __GFP_WAIT))
672 addr = __alloc_from_pool(size, &page); 672 addr = __alloc_from_pool(size, &page);
673 else if (!IS_ENABLED(CONFIG_CMA)) 673 else if (!IS_ENABLED(CONFIG_DMA_CMA))
674 addr = __alloc_remap_buffer(dev, size, gfp, prot, &page, caller); 674 addr = __alloc_remap_buffer(dev, size, gfp, prot, &page, caller);
675 else 675 else
676 addr = __alloc_from_contiguous(dev, size, prot, &page, caller); 676 addr = __alloc_from_contiguous(dev, size, prot, &page, caller);
@@ -759,7 +759,7 @@ static void __arm_dma_free(struct device *dev, size_t size, void *cpu_addr,
759 __dma_free_buffer(page, size); 759 __dma_free_buffer(page, size);
760 } else if (__free_from_pool(cpu_addr, size)) { 760 } else if (__free_from_pool(cpu_addr, size)) {
761 return; 761 return;
762 } else if (!IS_ENABLED(CONFIG_CMA)) { 762 } else if (!IS_ENABLED(CONFIG_DMA_CMA)) {
763 __dma_free_remap(cpu_addr, size); 763 __dma_free_remap(cpu_addr, size);
764 __dma_free_buffer(page, size); 764 __dma_free_buffer(page, size);
765 } else { 765 } else {
diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig
index 5daa2599ed48..e373671652b0 100644
--- a/drivers/base/Kconfig
+++ b/drivers/base/Kconfig
@@ -200,11 +200,9 @@ config DMA_SHARED_BUFFER
200 APIs extension; the file's descriptor can then be passed on to other 200 APIs extension; the file's descriptor can then be passed on to other
201 driver. 201 driver.
202 202
203config CMA 203config DMA_CMA
204 bool "Contiguous Memory Allocator" 204 bool "DMA Contiguous Memory Allocator"
205 depends on HAVE_DMA_CONTIGUOUS && HAVE_MEMBLOCK 205 depends on HAVE_DMA_CONTIGUOUS && CMA
206 select MIGRATION
207 select MEMORY_ISOLATION
208 help 206 help
209 This enables the Contiguous Memory Allocator which allows drivers 207 This enables the Contiguous Memory Allocator which allows drivers
210 to allocate big physically-contiguous blocks of memory for use with 208 to allocate big physically-contiguous blocks of memory for use with
@@ -213,17 +211,7 @@ config CMA
213 For more information see <include/linux/dma-contiguous.h>. 211 For more information see <include/linux/dma-contiguous.h>.
214 If unsure, say "n". 212 If unsure, say "n".
215 213
216if CMA 214if DMA_CMA
217
218config CMA_DEBUG
219 bool "CMA debug messages (DEVELOPMENT)"
220 depends on DEBUG_KERNEL
221 help
222 Turns on debug messages in CMA. This produces KERN_DEBUG
223 messages for every CMA call as well as various messages while
224 processing calls such as dma_alloc_from_contiguous().
225 This option does not affect warning and error messages.
226
227comment "Default contiguous memory area size:" 215comment "Default contiguous memory area size:"
228 216
229config CMA_SIZE_MBYTES 217config CMA_SIZE_MBYTES
diff --git a/drivers/base/Makefile b/drivers/base/Makefile
index 48029aa477d9..94e8a80e87f8 100644
--- a/drivers/base/Makefile
+++ b/drivers/base/Makefile
@@ -6,7 +6,7 @@ obj-y := core.o bus.o dd.o syscore.o \
6 attribute_container.o transport_class.o \ 6 attribute_container.o transport_class.o \
7 topology.o 7 topology.o
8obj-$(CONFIG_DEVTMPFS) += devtmpfs.o 8obj-$(CONFIG_DEVTMPFS) += devtmpfs.o
9obj-$(CONFIG_CMA) += dma-contiguous.o 9obj-$(CONFIG_DMA_CMA) += dma-contiguous.o
10obj-y += power/ 10obj-y += power/
11obj-$(CONFIG_HAS_DMA) += dma-mapping.o 11obj-$(CONFIG_HAS_DMA) += dma-mapping.o
12obj-$(CONFIG_HAVE_GENERIC_DMA_COHERENT) += dma-coherent.o 12obj-$(CONFIG_HAVE_GENERIC_DMA_COHERENT) += dma-coherent.o
diff --git a/include/linux/dma-contiguous.h b/include/linux/dma-contiguous.h
index 01b5c84be828..00141d3325fe 100644
--- a/include/linux/dma-contiguous.h
+++ b/include/linux/dma-contiguous.h
@@ -57,7 +57,7 @@ struct cma;
57struct page; 57struct page;
58struct device; 58struct device;
59 59
60#ifdef CONFIG_CMA 60#ifdef CONFIG_DMA_CMA
61 61
62/* 62/*
63 * There is always at least global CMA area and a few optional device 63 * There is always at least global CMA area and a few optional device
diff --git a/mm/Kconfig b/mm/Kconfig
index 8028dcc6615c..256bfd0f6007 100644
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -519,3 +519,27 @@ config MEM_SOFT_DIRTY
519 it can be cleared by hands. 519 it can be cleared by hands.
520 520
521 See Documentation/vm/soft-dirty.txt for more details. 521 See Documentation/vm/soft-dirty.txt for more details.
522
523config CMA
524 bool "Contiguous Memory Allocator"
525 depends on HAVE_MEMBLOCK
526 select MIGRATION
527 select MEMORY_ISOLATION
528 help
529 This enables the Contiguous Memory Allocator which allows other
530 subsystems to allocate big physically-contiguous blocks of memory.
531 CMA reserves a region of memory and allows only movable pages to
532 be allocated from it. This way, the kernel can use the memory for
533 pagecache and when a subsystem requests for contiguous area, the
534 allocated pages are migrated away to serve the contiguous request.
535
536 If unsure, say "n".
537
538config CMA_DEBUG
539 bool "CMA debug messages (DEVELOPMENT)"
540 depends on DEBUG_KERNEL && CMA
541 help
542 Turns on debug messages in CMA. This produces KERN_DEBUG
543 messages for every CMA call as well as various messages while
544 processing calls such as dma_alloc_from_contiguous().
545 This option does not affect warning and error messages.