aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/kernel
diff options
context:
space:
mode:
authorZubair Lutfullah Kakakhel <Zubair.Kakakhel@imgtec.com>2014-07-16 11:51:32 -0400
committerRalf Baechle <ralf@linux-mips.org>2014-09-22 07:35:52 -0400
commitf46493826a79f6a2bf9d8a0030e627e0255bbf48 (patch)
tree1ab960daaf90654f3267f00ec70080543e175261 /arch/mips/kernel
parent8057b30814e1c90e9425bb7b3be868b55bf5435c (diff)
MIPS: DMA: Add cma support
Adds cma support to the MIPS architecture. cma uses memblock. However, mips uses bootmem. bootmem is informed about any regions reserved by memblock dma api is modified to use cma reserved memory regions when available Tested using cma_test. cma_test is a simple driver that assigns blocks of memory from cma reserved sections. Signed-off-by: Zubair Lutfullah Kakakhel <Zubair.Kakakhel@imgtec.com> Acked-by: Michal Nazarewicz <mina86@mina86.com> Cc: catalin.marinas@arm.com Cc: will.deacon@arm.com Cc: tglx@linutronix.de Cc: mingo@redhat.com Cc: hpa@zytor.com Cc: arnd@arndb.de Cc: gregkh@linuxfoundation.org Cc: m.szyprowski@samsung.com Cc: x86@kernel.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Cc: linux-mips@linux-mips.org Cc: linux-arch@vger.kernel.org Patchwork: https://patchwork.linux-mips.org/patch/7360/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/kernel')
-rw-r--r--arch/mips/kernel/setup.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/arch/mips/kernel/setup.c b/arch/mips/kernel/setup.c
index 7c1fe2b42d40..b3b8f0d9d4a7 100644
--- a/arch/mips/kernel/setup.c
+++ b/arch/mips/kernel/setup.c
@@ -24,6 +24,8 @@
24#include <linux/debugfs.h> 24#include <linux/debugfs.h>
25#include <linux/kexec.h> 25#include <linux/kexec.h>
26#include <linux/sizes.h> 26#include <linux/sizes.h>
27#include <linux/device.h>
28#include <linux/dma-contiguous.h>
27 29
28#include <asm/addrspace.h> 30#include <asm/addrspace.h>
29#include <asm/bootinfo.h> 31#include <asm/bootinfo.h>
@@ -476,6 +478,7 @@ static void __init bootmem_init(void)
476 * o bootmem_init() 478 * o bootmem_init()
477 * o sparse_init() 479 * o sparse_init()
478 * o paging_init() 480 * o paging_init()
481 * o dma_continguous_reserve()
479 * 482 *
480 * At this stage the bootmem allocator is ready to use. 483 * At this stage the bootmem allocator is ready to use.
481 * 484 *
@@ -609,6 +612,7 @@ static void __init request_crashkernel(struct resource *res)
609 612
610static void __init arch_mem_init(char **cmdline_p) 613static void __init arch_mem_init(char **cmdline_p)
611{ 614{
615 struct memblock_region *reg;
612 extern void plat_mem_setup(void); 616 extern void plat_mem_setup(void);
613 617
614 /* call board setup routine */ 618 /* call board setup routine */
@@ -675,6 +679,11 @@ static void __init arch_mem_init(char **cmdline_p)
675 sparse_init(); 679 sparse_init();
676 plat_swiotlb_setup(); 680 plat_swiotlb_setup();
677 paging_init(); 681 paging_init();
682
683 dma_contiguous_reserve(PFN_PHYS(max_low_pfn));
684 /* Tell bootmem about cma reserved memblock section */
685 for_each_memblock(reserved, reg)
686 reserve_bootmem(reg->base, reg->size, BOOTMEM_DEFAULT);
678} 687}
679 688
680static void __init resource_init(void) 689static void __init resource_init(void)