gpu: nvgpu: gk20a: dma_alloc only if needed
Bibek Basu [Fri, 22 May 2015 09:55:53 +0000 (14:55 +0530)]
if vpr memory is carved out, then only call dma_alloc
for secure memory.

Bug 200057068

Change-Id: I12557cfaa48f7db729ccab17d3151916d35ce0f1
Signed-off-by: Bibek Basu <bbasu@nvidia.com>
Reviewed-on: http://git-master/r/746153
GVS: Gerrit_Virtual_Submit
Reviewed-by: Venkat Moganty <vmoganty@nvidia.com>

arch/arm/mach-tegra/common.c
drivers/gpu/nvgpu/gk20a/gk20a.c
drivers/gpu/nvgpu/gk20a/platform_gk20a_tegra.c

index 07faddf..542e2b6 100644 (file)
@@ -135,6 +135,7 @@ phys_addr_t tegra_carveout_start;
 phys_addr_t tegra_carveout_size;
 phys_addr_t tegra_vpr_start;
 phys_addr_t tegra_vpr_size;
+EXPORT_SYMBOL(tegra_vpr_size);
 phys_addr_t tegra_tsec_start;
 phys_addr_t tegra_tsec_size;
 phys_addr_t tegra_lp0_vec_start;
index 03d466e..f5f2c13 100644 (file)
@@ -1310,11 +1310,10 @@ int gk20a_secure_page_alloc(struct platform_device *pdev)
                udelay(10);
                err = platform->secure_page_alloc(pdev);
                tegra_periph_reset_deassert(platform->clk[0]);
+               if (!err)
+                       platform->secure_alloc_ready = true;
        }
 
-       if (!err)
-               platform->secure_alloc_ready = true;
-
        return err;
 }
 
index edeacda..c94d351 100644 (file)
@@ -39,6 +39,7 @@
 #define TEGRA_GK20A_SIM_SIZE 0x1000     /*tbd: this is a high-side guess */
 
 extern struct device tegra_vpr_dev;
+extern phys_addr_t tegra_vpr_size;
 struct gk20a_platform t132_gk20a_tegra_platform;
 
 struct gk20a_emc_params {
@@ -457,6 +458,8 @@ static int gk20a_tegra_probe(struct platform_device *dev)
                *platform = t132_gk20a_tegra_platform;
        }
 
+       if (tegra_vpr_size == 0)
+               platform->secure_page_alloc = NULL;
        gk20a_tegra_get_clocks(dev);
 
        return 0;