From 744e2d202e2d38b0d8ff8b55e1e84daf75e39b48 Mon Sep 17 00:00:00 2001 From: Terje Bergstrom Date: Mon, 1 May 2017 13:55:22 -0700 Subject: gpu: nvgpu: Add flag gk20a->is_virtual Instead of calling gk20a_gpu_is_virtual() which requires struct device pointer fill in flag gk20a->is_virtual and use that. JIRA NVGPU-16 Change-Id: I24382c041ee69940c703ca1ea7f5c667c5731cd1 Signed-off-by: Terje Bergstrom Reviewed-on: http://git-master/r/1473707 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c | 4 ++-- drivers/gpu/nvgpu/gk20a/gk20a.c | 2 +- drivers/gpu/nvgpu/gk20a/gk20a.h | 2 ++ drivers/gpu/nvgpu/gk20a/regops_gk20a.c | 2 +- drivers/gpu/nvgpu/gp10b/hal_gp10b.c | 2 +- drivers/gpu/nvgpu/vgpu/vgpu.c | 2 ++ 6 files changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c b/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c index 2988fdec..e4bdd8e3 100644 --- a/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/dbg_gpu_gk20a.c @@ -1185,7 +1185,7 @@ static int nvgpu_ioctl_channel_reg_ops(struct dbg_session_gk20a *dbg_s, } /* be sure that ctx info is in place */ - if (!gk20a_gpu_is_virtual(dbg_s->dev) && + if (!g->is_virtual && !gr_context_info_available(dbg_s, &g->gr)) { nvgpu_err(g, "gr context data not available\n"); return -ENODEV; @@ -1196,7 +1196,7 @@ static int nvgpu_ioctl_channel_reg_ops(struct dbg_session_gk20a *dbg_s, * on other channels */ nvgpu_mutex_acquire(&g->dbg_sessions_lock); - if (!dbg_s->is_pg_disabled && !gk20a_gpu_is_virtual(dbg_s->dev)) { + if (!dbg_s->is_pg_disabled && !g->is_virtual) { /* In the virtual case, the server will handle * disabling/enabling powergating when processing reg ops */ diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.c b/drivers/gpu/nvgpu/gk20a/gk20a.c index 51b0ba11..8ea2929f 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/gk20a.c @@ -379,7 +379,7 @@ void gk20a_driver_start_unload(struct gk20a *g) g->driver_is_dying = 1; up_write(&g->busy_lock); - if (gk20a_gpu_is_virtual(g->dev)) + if (g->is_virtual) return; gk20a_wait_for_idle(g->dev); diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.h b/drivers/gpu/nvgpu/gk20a/gk20a.h index 7ac1d909..c8d06b4f 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/gk20a.h @@ -1017,6 +1017,8 @@ struct gk20a { bool support_pmu; + bool is_virtual; + u32 emc3d_ratio; #ifdef CONFIG_DEBUG_FS diff --git a/drivers/gpu/nvgpu/gk20a/regops_gk20a.c b/drivers/gpu/nvgpu/gk20a/regops_gk20a.c index bc64dbac..c4b357b1 100644 --- a/drivers/gpu/nvgpu/gk20a/regops_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/regops_gk20a.c @@ -401,7 +401,7 @@ int exec_regops_gk20a(struct dbg_session_gk20a *dbg_s, * regops implementation, so we return -ENOSYS. This will allow * compute apps to run with vgpu. Tools will not work in this * configuration and are not required to work at this time. */ - if (gk20a_gpu_is_virtual(dbg_s->dev)) + if (g->is_virtual) return -ENOSYS; ok = validate_reg_ops(dbg_s, diff --git a/drivers/gpu/nvgpu/gp10b/hal_gp10b.c b/drivers/gpu/nvgpu/gp10b/hal_gp10b.c index e8cd6a71..40e49e13 100644 --- a/drivers/gpu/nvgpu/gp10b/hal_gp10b.c +++ b/drivers/gpu/nvgpu/gp10b/hal_gp10b.c @@ -198,7 +198,7 @@ int gp10b_init_hal(struct gk20a *g) if (g->is_fmodel) { gops->privsecurity = 0; gops->securegpccs = 0; - } else if (gk20a_gpu_is_virtual(g->dev)) { + } else if (g->is_virtual) { gops->privsecurity = 1; gops->securegpccs = 1; } else { diff --git a/drivers/gpu/nvgpu/vgpu/vgpu.c b/drivers/gpu/nvgpu/vgpu/vgpu.c index 0f1fa814..d8ec1cbb 100644 --- a/drivers/gpu/nvgpu/vgpu/vgpu.c +++ b/drivers/gpu/nvgpu/vgpu/vgpu.c @@ -583,6 +583,8 @@ int vgpu_probe(struct platform_device *pdev) if (tegra_platform_is_linsim() || tegra_platform_is_vdk()) gk20a->is_fmodel = true; + gk20a->is_virtual = true; + nvgpu_kmem_init(gk20a); priv = nvgpu_kzalloc(gk20a, sizeof(*priv)); -- cgit v1.2.2