diff options
Diffstat (limited to 'drivers')
-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 | } |