Skip to content

Commit f1ae98d

Browse files
committed
ARM: dma-mapping: remove unconditional dependency on CMA
CMA has been enabled unconditionally on all ARMv6+ systems to solve the long standing issue of double kernel mappings for all dma coherent buffers. This however created a dependency on CONFIG_EXPERIMENTAL for the whole ARM architecture what should be really avoided. This patch removes this dependency and lets one use old, well-tested dma-mapping implementation also on ARMv6+ systems without the need to use EXPERIMENTAL stuff. Reported-by: Russell King <[email protected]> Signed-off-by: Marek Szyprowski <[email protected]>
1 parent f8f5701 commit f1ae98d

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

arch/arm/Kconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ config ARM
77
select HAVE_IDE if PCI || ISA || PCMCIA
88
select HAVE_DMA_ATTRS
99
select HAVE_DMA_CONTIGUOUS if (CPU_V6 || CPU_V6K || CPU_V7)
10-
select CMA if (CPU_V6 || CPU_V6K || CPU_V7)
1110
select HAVE_MEMBLOCK
1211
select RTC_LIB
1312
select SYS_SUPPORTS_APM_EMULATION

arch/arm/mm/dma-mapping.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -268,10 +268,8 @@ static int __init consistent_init(void)
268268
unsigned long base = consistent_base;
269269
unsigned long num_ptes = (CONSISTENT_END - base) >> PMD_SHIFT;
270270

271-
#ifndef CONFIG_ARM_DMA_USE_IOMMU
272-
if (cpu_architecture() >= CPU_ARCH_ARMv6)
271+
if (IS_ENABLED(CONFIG_CMA) && !IS_ENABLED(CONFIG_ARM_DMA_USE_IOMMU))
273272
return 0;
274-
#endif
275273

276274
consistent_pte = kmalloc(num_ptes * sizeof(pte_t), GFP_KERNEL);
277275
if (!consistent_pte) {
@@ -342,7 +340,7 @@ static int __init coherent_init(void)
342340
struct page *page;
343341
void *ptr;
344342

345-
if (cpu_architecture() < CPU_ARCH_ARMv6)
343+
if (!IS_ENABLED(CONFIG_CMA))
346344
return 0;
347345

348346
ptr = __alloc_from_contiguous(NULL, size, prot, &page);
@@ -704,7 +702,7 @@ static void *__dma_alloc(struct device *dev, size_t size, dma_addr_t *handle,
704702

705703
if (arch_is_coherent() || nommu())
706704
addr = __alloc_simple_buffer(dev, size, gfp, &page);
707-
else if (cpu_architecture() < CPU_ARCH_ARMv6)
705+
else if (!IS_ENABLED(CONFIG_CMA))
708706
addr = __alloc_remap_buffer(dev, size, gfp, prot, &page, caller);
709707
else if (gfp & GFP_ATOMIC)
710708
addr = __alloc_from_pool(dev, size, &page, caller);
@@ -773,7 +771,7 @@ void arm_dma_free(struct device *dev, size_t size, void *cpu_addr,
773771

774772
if (arch_is_coherent() || nommu()) {
775773
__dma_free_buffer(page, size);
776-
} else if (cpu_architecture() < CPU_ARCH_ARMv6) {
774+
} else if (!IS_ENABLED(CONFIG_CMA)) {
777775
__dma_free_remap(cpu_addr, size);
778776
__dma_free_buffer(page, size);
779777
} else {

0 commit comments

Comments
 (0)