Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c7909509 authored by Marek Szyprowski's avatar Marek Szyprowski
Browse files

ARM: integrate CMA with DMA-mapping subsystem



This patch adds support for CMA to dma-mapping subsystem for ARM
architecture. By default a global CMA area is used, but specific devices
are allowed to have their private memory areas if required (they can be
created with dma_declare_contiguous() function during board
initialisation).

Contiguous memory areas reserved for DMA are remapped with 2-level page
tables on boot. Once a buffer is requested, a low memory kernel mapping
is updated to to match requested memory access type.

GFP_ATOMIC allocations are performed from special pool which is created
early during boot. This way remapping page attributes is not needed on
allocation time.

CMA has been enabled unconditionally for ARMv6+ systems.

Signed-off-by: default avatarMarek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
CC: Michal Nazarewicz <mina86@mina86.com>
Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
Tested-by: default avatarRob Clark <rob.clark@linaro.org>
Tested-by: default avatarOhad Ben-Cohen <ohad@wizery.com>
Tested-by: default avatarBenjamin Gaignard <benjamin.gaignard@linaro.org>
Tested-by: default avatarRobert Nelson <robertcnelson@gmail.com>
Tested-by: default avatarBarry Song <Baohua.Song@csr.com>
parent 0a2b9a6e
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -520,6 +520,10 @@ bytes respectively. Such letter suffixes can also be entirely omitted.
			a hypervisor.
			Default: yes

	coherent_pool=nn[KMG]	[ARM,KNL]
			Sets the size of memory pool for coherent, atomic dma
			allocations if Contiguous Memory Allocator (CMA) is used.

	code_bytes	[X86] How many bytes of object code to print
			in an oops report.
			Range: 0 - 8192
+2 −0
Original line number Diff line number Diff line
@@ -4,6 +4,8 @@ config ARM
	select HAVE_AOUT
	select HAVE_DMA_API_DEBUG
	select HAVE_IDE if PCI || ISA || PCMCIA
	select HAVE_DMA_CONTIGUOUS if (CPU_V6 || CPU_V6K || CPU_V7)
	select CMA if (CPU_V6 || CPU_V6K || CPU_V7)
	select HAVE_MEMBLOCK
	select RTC_LIB
	select SYS_SUPPORTS_APM_EMULATION
+15 −0
Original line number Diff line number Diff line
#ifndef ASMARM_DMA_CONTIGUOUS_H
#define ASMARM_DMA_CONTIGUOUS_H

#ifdef __KERNEL__
#ifdef CONFIG_CMA

#include <linux/types.h>
#include <asm-generic/dma-contiguous.h>

void dma_contiguous_early_fixup(phys_addr_t base, unsigned long size);

#endif
#endif

#endif
+1 −0
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ struct map_desc {
#define MT_MEMORY_DTCM		12
#define MT_MEMORY_ITCM		13
#define MT_MEMORY_SO		14
#define MT_MEMORY_DMA_READY	15

#ifdef CONFIG_MMU
extern void iotable_init(struct map_desc *, int);
+3 −6
Original line number Diff line number Diff line
@@ -81,6 +81,7 @@ __setup("fpe=", fpe_setup);
extern void paging_init(struct machine_desc *desc);
extern void sanity_check_meminfo(void);
extern void reboot_setup(char *str);
extern void setup_dma_zone(struct machine_desc *desc);

unsigned int processor_id;
EXPORT_SYMBOL(processor_id);
@@ -939,12 +940,8 @@ void __init setup_arch(char **cmdline_p)
	machine_desc = mdesc;
	machine_name = mdesc->name;

#ifdef CONFIG_ZONE_DMA
	if (mdesc->dma_zone_size) {
		extern unsigned long arm_dma_zone_size;
		arm_dma_zone_size = mdesc->dma_zone_size;
	}
#endif
	setup_dma_zone(mdesc);

	if (mdesc->restart_mode)
		reboot_setup(&mdesc->restart_mode);

Loading