From 71afbe484f0bda343f73c3afcfd5ca4205be4e09 Mon Sep 17 00:00:00 2001 From: Mahantesh Kumbar Date: Sat, 29 Aug 2015 05:12:29 +0530 Subject: gpu: nvgpu: fuse read to boot in SECURE mode -Read fuse to boot in secure/production mode else non sercure mode. Bug N/A Change-Id: Ia66acff63a4a5ed9351c01cd8907a337e88dc8eb Signed-off-by: Mahantesh Kumbar Reviewed-on: http://git-master/r/791323 Reviewed-on: http://git-master/r/806191 Reviewed-by: Terje Bergstrom Tested-by: Terje Bergstrom --- drivers/gpu/nvgpu/gp10b/hal_gp10b.c | 39 ++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) (limited to 'drivers/gpu/nvgpu/gp10b/hal_gp10b.c') diff --git a/drivers/gpu/nvgpu/gp10b/hal_gp10b.c b/drivers/gpu/nvgpu/gp10b/hal_gp10b.c index 983b985d..a6131cea 100644 --- a/drivers/gpu/nvgpu/gp10b/hal_gp10b.c +++ b/drivers/gpu/nvgpu/gp10b/hal_gp10b.c @@ -37,6 +37,10 @@ #include "gm20b/fifo_gm20b.h" #include "gm20b/pmu_gm20b.h" #include "gm20b/clk_gm20b.h" +#include + +#define FUSE_OPT_PRIV_SEC_EN_0 0x264 +#define PRIV_SECURITY_ENABLED 0x01 static struct gpu_ops gp10b_ops = { .clock_gating = { @@ -91,7 +95,40 @@ int gp10b_init_hal(struct gk20a *g) struct nvgpu_gpu_characteristics *c = &g->gpu_characteristics; *gops = gp10b_ops; - gops->privsecurity = 0; + +#ifdef CONFIG_TEGRA_ACR + if (tegra_platform_is_linsim()) { + gops->privsecurity = 1; + gops->securegpccs = 1; + } else { + if (tegra_fuse_readl(FUSE_OPT_PRIV_SEC_EN_0) & + PRIV_SECURITY_ENABLED) { + gops->privsecurity = 1; + gops->securegpccs =1; + } else { + gk20a_dbg_info("priv security is disabled in HW"); + gops->privsecurity = 0; + gops->securegpccs = 0; + } + } +#else + if (tegra_platform_is_linsim()) { + gk20a_dbg_info("running ASIM with PRIV security disabled"); + gops->privsecurity = 0; + gops->securegpccs = 0; + } else { + if (tegra_fuse_readl(FUSE_OPT_PRIV_SEC_EN_0) & + PRIV_SECURITY_ENABLED) { + gk20a_dbg_info("priv security is not supported but enabled"); + gops->privsecurity = 1; + gops->securegpccs =1; + return -EPERM; + } else { + gops->privsecurity = 0; + gops->securegpccs = 0; + } + } +#endif gp10b_init_mc(gops); gp10b_init_gr(gops); -- cgit v1.2.2