diff options
author | Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com> | 2013-07-02 01:45:15 -0400 |
---|---|---|
committer | Marek Szyprowski <m.szyprowski@samsung.com> | 2013-07-02 04:08:22 -0400 |
commit | f825c736e75b11adb59ec52a4a1096efddd2ec97 (patch) | |
tree | 0592b3e3cf216341da2daa072874be0fc7d284d9 | |
parent | 8bb495e3f02401ee6f76d1b1d77f3ac9f079e376 (diff) |
mm/cma: Move dma contiguous changes into a seperate config
We want to use CMA for allocating hash page table and real mode area for
PPC64. Hence move DMA contiguous related changes into a seperate config
so that ppc64 can enable CMA without requiring DMA contiguous.
Acked-by: Michal Nazarewicz <mina86@mina86.com>
Acked-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
[removed defconfig changes]
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
-rw-r--r-- | arch/arm/include/asm/dma-contiguous.h | 2 | ||||
-rw-r--r-- | arch/arm/mm/dma-mapping.c | 6 | ||||
-rw-r--r-- | drivers/base/Kconfig | 20 | ||||
-rw-r--r-- | drivers/base/Makefile | 2 | ||||
-rw-r--r-- | include/linux/dma-contiguous.h | 2 | ||||
-rw-r--r-- | mm/Kconfig | 24 |
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 ef3e0f3aac96..1fb40dc37ec2 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 07abd9d76f7f..10cd80af2aec 100644 --- a/drivers/base/Kconfig +++ b/drivers/base/Kconfig | |||
@@ -202,11 +202,9 @@ config DMA_SHARED_BUFFER | |||
202 | APIs extension; the file's descriptor can then be passed on to other | 202 | APIs extension; the file's descriptor can then be passed on to other |
203 | driver. | 203 | driver. |
204 | 204 | ||
205 | config CMA | 205 | config DMA_CMA |
206 | bool "Contiguous Memory Allocator" | 206 | bool "DMA Contiguous Memory Allocator" |
207 | depends on HAVE_DMA_CONTIGUOUS && HAVE_MEMBLOCK | 207 | depends on HAVE_DMA_CONTIGUOUS && CMA |
208 | select MIGRATION | ||
209 | select MEMORY_ISOLATION | ||
210 | help | 208 | help |
211 | This enables the Contiguous Memory Allocator which allows drivers | 209 | This enables the Contiguous Memory Allocator which allows drivers |
212 | to allocate big physically-contiguous blocks of memory for use with | 210 | to allocate big physically-contiguous blocks of memory for use with |
@@ -215,17 +213,7 @@ config CMA | |||
215 | For more information see <include/linux/dma-contiguous.h>. | 213 | For more information see <include/linux/dma-contiguous.h>. |
216 | If unsure, say "n". | 214 | If unsure, say "n". |
217 | 215 | ||
218 | if CMA | 216 | if DMA_CMA |
219 | |||
220 | config CMA_DEBUG | ||
221 | bool "CMA debug messages (DEVELOPMENT)" | ||
222 | depends on DEBUG_KERNEL | ||
223 | help | ||
224 | Turns on debug messages in CMA. This produces KERN_DEBUG | ||
225 | messages for every CMA call as well as various messages while | ||
226 | processing calls such as dma_alloc_from_contiguous(). | ||
227 | This option does not affect warning and error messages. | ||
228 | |||
229 | comment "Default contiguous memory area size:" | 217 | comment "Default contiguous memory area size:" |
230 | 218 | ||
231 | config CMA_SIZE_MBYTES | 219 | config CMA_SIZE_MBYTES |
diff --git a/drivers/base/Makefile b/drivers/base/Makefile index 4e22ce3ed73d..5d93bb519753 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 |
8 | obj-$(CONFIG_DEVTMPFS) += devtmpfs.o | 8 | obj-$(CONFIG_DEVTMPFS) += devtmpfs.o |
9 | obj-$(CONFIG_CMA) += dma-contiguous.o | 9 | obj-$(CONFIG_DMA_CMA) += dma-contiguous.o |
10 | obj-y += power/ | 10 | obj-y += power/ |
11 | obj-$(CONFIG_HAS_DMA) += dma-mapping.o | 11 | obj-$(CONFIG_HAS_DMA) += dma-mapping.o |
12 | obj-$(CONFIG_HAVE_GENERIC_DMA_COHERENT) += dma-coherent.o | 12 | obj-$(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; | |||
57 | struct page; | 57 | struct page; |
58 | struct device; | 58 | struct 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 e742d06285b7..26a5f815cfc3 100644 --- a/mm/Kconfig +++ b/mm/Kconfig | |||
@@ -477,3 +477,27 @@ config FRONTSWAP | |||
477 | and swap data is stored as normal on the matching swap device. | 477 | and swap data is stored as normal on the matching swap device. |
478 | 478 | ||
479 | If unsure, say Y to enable frontswap. | 479 | If unsure, say Y to enable frontswap. |
480 | |||
481 | config CMA | ||
482 | bool "Contiguous Memory Allocator" | ||
483 | depends on HAVE_MEMBLOCK | ||
484 | select MIGRATION | ||
485 | select MEMORY_ISOLATION | ||
486 | help | ||
487 | This enables the Contiguous Memory Allocator which allows other | ||
488 | subsystems to allocate big physically-contiguous blocks of memory. | ||
489 | CMA reserves a region of memory and allows only movable pages to | ||
490 | be allocated from it. This way, the kernel can use the memory for | ||
491 | pagecache and when a subsystem requests for contiguous area, the | ||
492 | allocated pages are migrated away to serve the contiguous request. | ||
493 | |||
494 | If unsure, say "n". | ||
495 | |||
496 | config CMA_DEBUG | ||
497 | bool "CMA debug messages (DEVELOPMENT)" | ||
498 | depends on DEBUG_KERNEL && CMA | ||
499 | help | ||
500 | Turns on debug messages in CMA. This produces KERN_DEBUG | ||
501 | messages for every CMA call as well as various messages while | ||
502 | processing calls such as dma_alloc_from_contiguous(). | ||
503 | This option does not affect warning and error messages. | ||