diff options
author | Seema Khowala <seemaj@nvidia.com> | 2017-06-20 15:12:42 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-06-21 18:24:48 -0400 |
commit | 8ca81687c7746048d1465a82ca81e826285fe3f1 (patch) | |
tree | 5a614fda7fc458304cb6cc701eea636e41f843b4 /drivers/gpu/nvgpu | |
parent | 476b84ea86afadde58907ee1a04769c3312e744e (diff) |
gpu: nvgpu: get ctx id from valid ctx mem
ctx id should be read from right mem area else
it will return 0 and cause issue with fecs methods
that depend on ctx id
Bug 200289491
Change-Id: Iba74f653afccf34e95cd90175833e3270239c264
Signed-off-by: Seema Khowala <seemaj@nvidia.com>
Reviewed-on: http://git-master/r/1505902
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/gr_gk20a.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c index f101d3ba..4219e841 100644 --- a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c | |||
@@ -102,18 +102,27 @@ int gr_gk20a_get_ctx_id(struct gk20a *g, | |||
102 | u32 *ctx_id) | 102 | u32 *ctx_id) |
103 | { | 103 | { |
104 | struct channel_ctx_gk20a *ch_ctx = &c->ch_ctx; | 104 | struct channel_ctx_gk20a *ch_ctx = &c->ch_ctx; |
105 | struct ctx_header_desc *ctx_header = &ch_ctx->ctx_header; | ||
106 | struct nvgpu_mem *ctx_header_mem = &ctx_header->mem; | ||
107 | struct nvgpu_mem *mem; | ||
105 | 108 | ||
106 | /* Channel gr_ctx buffer is gpu cacheable. | 109 | /* Channel gr_ctx buffer is gpu cacheable. |
107 | Flush and invalidate before cpu update. */ | 110 | Flush and invalidate before cpu update. */ |
108 | g->ops.mm.l2_flush(g, true); | 111 | g->ops.mm.l2_flush(g, true); |
109 | 112 | ||
110 | if (nvgpu_mem_begin(g, &ch_ctx->gr_ctx->mem)) | 113 | if (ctx_header_mem->gpu_va) |
114 | mem = ctx_header_mem; | ||
115 | else | ||
116 | mem = &ch_ctx->gr_ctx->mem; | ||
117 | |||
118 | if (nvgpu_mem_begin(g, mem)) | ||
111 | return -ENOMEM; | 119 | return -ENOMEM; |
112 | 120 | ||
113 | *ctx_id = nvgpu_mem_rd(g, &ch_ctx->gr_ctx->mem, | 121 | *ctx_id = nvgpu_mem_rd(g, mem, |
114 | ctxsw_prog_main_image_context_id_o()); | 122 | ctxsw_prog_main_image_context_id_o()); |
123 | gk20a_dbg(gpu_dbg_fn | gpu_dbg_intr, "ctx_id: 0x%x", *ctx_id); | ||
115 | 124 | ||
116 | nvgpu_mem_end(g, &ch_ctx->gr_ctx->mem); | 125 | nvgpu_mem_end(g, mem); |
117 | 126 | ||
118 | return 0; | 127 | return 0; |
119 | } | 128 | } |