ARM: shmobile: CMA prototype test code
Magnus Damm
maintainerPATCH 1/1 ARM: shmobile: CMA prototype test code
From: Magnus Damm <[email protected]>
This is some basic prototype code that uses CMA to reserve a 256 MiB physically contiguous memory window at 0x7000000.
It may be used on r8a7790 Lager, r8a7791 Koelsch or r8a7794 Alt.
Through some hackish test code it then allocates several 16MiB chunks with 16MiB alignment from the CMA window.
The following kernel configuration parameters are required:CONFIG_CMA=yCONFIG_DMA_CMA=y
A couple of notes about known short comings:
- The default CMA area is overriden - a new CMA area should be added instead
- NULL is passed as struct device * - the driver model should be used
- The test is allocating 15 times to keep some space in the default CMA area
For information about the DMA API and the DMA attributes, please see:Documentation/DMA-API-HOWTO.txtDocumentation/DMA-API.txtDocumentation/DMA-attributes.txt
Not for upstream merge. Written to show how CMA can be used to reserve and allocate memory.
---
Based on "[PATCH] ARM: shmobile: CMA prototype test code for Koelsch" Written on top of renesas-devel-20140911-v3.17-rc4, tested on Lager.
arch/arm/mach-shmobile/Makefile | 2 - arch/arm/mach-shmobile/cma-test.c | 58 ++++++++++++++++++++++++++++++ arch/arm/mach-shmobile/setup-rcar-gen2.c | 3 + 3 files changed, 62 insertions(+), 1 deletion(-)
arch/arm/mach-shmobile/Makefile +1 -1
@@ -3,7 +3,7 @@ # # Common objects -obj-y := timer.o console.o +obj-y := timer.o console.o cma-test.o # CPU objects obj-$(CONFIG_ARCH_SH7372) += setup-sh7372.o intc-sh7372.o pm-sh7372.o
arch/arm/mach-shmobile/cma-test.c new file +58 -0
58 lines not on this page · raw message
arch/arm/mach-shmobile/setup-rcar-gen2.c +3 -0
@@ -177,6 +177,9 @@ void __init rcar_gen2_reserve(void)of_scan_flat_dt (rcar_gen2_scan_mem, &mrc);#ifdef CONFIG_DMA_CMA +/* override default CMA area */ +dma_contiguous_reserve_area (0x10000000 ,0x70000000 ,0xffffffff , + &dma_contiguous_default_area, true);if (mrc.size)dma_contiguous_reserve_area (mrc.size, mrc.base,0 , &rcar_gen2_dma_contiguous, true);