]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commitdiff
arm: tegra: reserve contiguous mem using CMA
authorVandana Salve <vsalve@nvidia.com>
Thu, 19 Sep 2013 12:34:48 +0000 (18:04 +0530)
committerKrishna Reddy <vdumpa@nvidia.com>
Fri, 11 Oct 2013 18:13:06 +0000 (11:13 -0700)
Reserve contiguous memory using dma_declare_contiguous
for generic and VPR carveout.

Change-Id: If3dbc3ecb1e664ed21f4c804f5c7d7f536ca8bc1
Signed-off-by: Vandana Salve <vsalve@nvidia.com>
Signed-off-by: Krishna Reddy <vdumpa@nvidia.com>
Reviewed-on: http://git-master/r/289420
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Hiroshi Doyu <hdoyu@nvidia.com>
arch/arm/mach-tegra/common.c
arch/arm/mach-tegra/common.h

index bd55499f8511f6b70d63bc5ed39b6f85dba68475..5d5a3e378352ab2c1a70e16b9be99e070f93e42c 100644 (file)
@@ -43,6 +43,7 @@
 #include <linux/bootmem.h>
 #include <linux/tegra-soc.h>
 #include <trace/events/nvsecurity.h>
+#include <linux/dma-contiguous.h>
 
 #ifdef CONFIG_ARM64
 #include <linux/irqchip/gic.h>
@@ -170,6 +171,9 @@ static u8 display_config;
 
 static int tegra_split_mem_set;
 
+struct device tegra_generic_cma_dev;
+struct device tegra_vpr_cma_dev;
+
 /*
  * Storage for debug-macro.S's state.
  *
@@ -1783,7 +1787,6 @@ void __init tegra_reserve(unsigned long carveout_size, unsigned long fb_size,
        unsigned long fb2_size)
 {
        const size_t avp_kernel_reserve = SZ_32M;
-       int i = 0;
        struct iommu_linear_map map[4];
 
 #if !defined(CONFIG_TEGRA_AVP_KERNEL_ON_MMU) /* Tegra2 with AVP MMU */ && \
@@ -1807,6 +1810,7 @@ void __init tegra_reserve(unsigned long carveout_size, unsigned long fb_size,
        }
 #endif
 
+#ifndef CONFIG_NVMAP_USE_CMA_FOR_CARVEOUT
        if (carveout_size) {
                /*
                 * Place the carveout below the 4 GB physical address limit
@@ -1823,6 +1827,7 @@ void __init tegra_reserve(unsigned long carveout_size, unsigned long fb_size,
                } else
                        tegra_carveout_size = carveout_size;
        }
+#endif
 
        if (fb2_size) {
                /*
@@ -2088,6 +2093,21 @@ void __init tegra_reserve(unsigned long carveout_size, unsigned long fb_size,
        }
 #endif
 
+#ifdef CONFIG_NVMAP_USE_CMA_FOR_CARVEOUT
+       /* Keep these at the end */
+       if (carveout_size) {
+               if (dma_declare_contiguous(&tegra_generic_cma_dev,
+                       carveout_size, 0, memblock_end_of_4G()))
+                       pr_err("dma_declare_contiguous failed for generic\n");
+               tegra_carveout_size = carveout_size;
+       }
+
+       if (tegra_vpr_size)
+               if (dma_declare_contiguous(&tegra_vpr_cma_dev,
+                       tegra_vpr_size, 0, memblock_end_of_4G()))
+                       pr_err("dma_declare_contiguous failed VPR carveout\n");
+#endif
+
        tegra_fb_linear_set(map);
 }
 
index 70d08d954929469dc8439ffef677e08415687834..313d54616137449bee38ec41032c3504df7b0ead 100644 (file)
@@ -19,3 +19,6 @@ extern int tegra_cpu_kill(unsigned int cpu);
 extern phys_addr_t tegra_avp_kernel_start;
 extern phys_addr_t tegra_avp_kernel_size;
 void ahb_gizmo_writel(unsigned long val, void __iomem *reg);
+
+extern struct device tegra_generic_cma_dev;
+extern struct device tegra_vpr_cma_dev;