From d8b80c4e2aa37f6c41da5081917f8b5add51fb1a Mon Sep 17 00:00:00 2001 From: Konsta Holtta Date: Tue, 9 Oct 2018 17:16:18 +0300 Subject: [PATCH] gpu: nvgpu: pass gr_ctx to init_golden_ctx_image Simplify object ownership by passing the gr_ctx around directly instead of reading from tsg via a channel; the caller holds the gr_ctx already. Jira NVGPU-1149 Change-Id: I22e333247229db06bb79c40be30b5d2b48b350d7 Signed-off-by: Konsta Holtta Reviewed-on: https://git-master.nvidia.com/r/1925425 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/gk20a/gr_gk20a.c | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c index 7fa5d5e96..10d5d002c 100644 --- a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c @@ -85,9 +85,6 @@ static void gr_gk20a_free_channel_patch_ctx(struct gk20a *g, struct vm_gk20a *vm, struct nvgpu_gr_ctx *gr_ctx); -/* golden ctx image */ -static int gr_gk20a_init_golden_ctx_image(struct gk20a *g, - struct channel_gk20a *c); /*elcg init */ static void gr_gk20a_enable_elcg(struct gk20a *g); @@ -1312,11 +1309,10 @@ error: /* init global golden image from a fresh gr_ctx in channel ctx. save a copy in local_golden_image in ctx_vars */ static int gr_gk20a_init_golden_ctx_image(struct gk20a *g, - struct channel_gk20a *c) + struct channel_gk20a *c, + struct nvgpu_gr_ctx *gr_ctx) { struct gr_gk20a *gr = &g->gr; - struct tsg_gk20a *tsg; - struct nvgpu_gr_ctx *gr_ctx = NULL; u32 ctx_header_bytes = ctxsw_prog_fecs_header_v(); u32 ctx_header_words; u32 i; @@ -1330,12 +1326,6 @@ static int gr_gk20a_init_golden_ctx_image(struct gk20a *g, nvgpu_log_fn(g, " "); - tsg = tsg_gk20a_from_ch(c); - if (tsg == NULL) { - return -EINVAL; - } - - gr_ctx = tsg->gr_ctx; gr_mem = &gr_ctx->mem; /* golden ctx is global to all channels. Although only the first @@ -2981,7 +2971,7 @@ int gk20a_alloc_obj_ctx(struct channel_gk20a *c, u32 class_num, u32 flags) } /* init golden image, ELPG enabled after this is done */ - err = gr_gk20a_init_golden_ctx_image(g, c); + err = gr_gk20a_init_golden_ctx_image(g, c, gr_ctx); if (err != 0) { nvgpu_err(g, "fail to init golden ctx image");