microblaze: Wire CMA allocator
authorMichal Simek <michal.simek@xilinx.com>
Tue, 14 Jan 2020 09:05:24 +0000 (10:05 +0100)
committerMichal Simek <michal.simek@xilinx.com>
Tue, 4 Feb 2020 10:38:59 +0000 (11:38 +0100)
Based on commit 04e3543e228f ("microblaze: use the generic dma coherent
remap allocator")
CMA can be easily enabled by calling dma_contiguous_reserve() at the end of
mmu_init(). High limit is end of lowmem space which is completely unused at
this point of time.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
arch/microblaze/Kconfig
arch/microblaze/configs/mmu_defconfig
arch/microblaze/mm/init.c

index 5f46ebe..e628929 100644 (file)
@@ -27,6 +27,7 @@ config MICROBLAZE
        select HAVE_ARCH_HASH
        select HAVE_ARCH_KGDB
        select HAVE_DEBUG_KMEMLEAK
+       select HAVE_DMA_CONTIGUOUS
        select HAVE_DYNAMIC_FTRACE
        select HAVE_FTRACE_MCOUNT_RECORD
        select HAVE_FUNCTION_GRAPH_TRACER
index dd63766..9b8a50f 100644 (file)
@@ -26,6 +26,7 @@ CONFIG_MODULE_UNLOAD=y
 # CONFIG_BLK_DEV_BSG is not set
 CONFIG_PARTITION_ADVANCED=y
 # CONFIG_EFI_PARTITION is not set
+CONFIG_CMA=y
 CONFIG_NET=y
 CONFIG_PACKET=y
 CONFIG_UNIX=y
@@ -82,6 +83,7 @@ CONFIG_NFS_FS=y
 CONFIG_CIFS=y
 CONFIG_CIFS_STATS2=y
 CONFIG_ENCRYPTED_KEYS=y
+CONFIG_DMA_CMA=y
 CONFIG_DEBUG_INFO=y
 CONFIG_KGDB=y
 CONFIG_KGDB_TESTS=y
index 050fc62..1056f16 100644 (file)
@@ -7,6 +7,7 @@
  * for more details.
  */
 
+#include <linux/dma-contiguous.h>
 #include <linux/memblock.h>
 #include <linux/init.h>
 #include <linux/kernel.h>
@@ -345,6 +346,9 @@ asmlinkage void __init mmu_init(void)
        /* This will also cause that unflatten device tree will be allocated
         * inside 768MB limit */
        memblock_set_current_limit(memory_start + lowmem_size - 1);
+
+       /* CMA initialization */
+       dma_contiguous_reserve(memory_start + lowmem_size - 1);
 }
 
 /* This is only called until mem_init is done. */