diff options
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/gr_gk20a.c')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/gr_gk20a.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c index 7f02dc43..bfb11566 100644 --- a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c | |||
@@ -86,6 +86,31 @@ static int gr_gk20a_init_golden_ctx_image(struct gk20a *g, | |||
86 | /*elcg init */ | 86 | /*elcg init */ |
87 | static void gr_gk20a_enable_elcg(struct gk20a *g); | 87 | static void gr_gk20a_enable_elcg(struct gk20a *g); |
88 | 88 | ||
89 | int gr_gk20a_get_ctx_id(struct gk20a *g, | ||
90 | struct channel_gk20a *c, | ||
91 | u32 *ctx_id) | ||
92 | { | ||
93 | struct channel_ctx_gk20a *ch_ctx = &c->ch_ctx; | ||
94 | void *ctx_ptr = NULL; | ||
95 | |||
96 | /* Channel gr_ctx buffer is gpu cacheable. | ||
97 | Flush and invalidate before cpu update. */ | ||
98 | g->ops.mm.l2_flush(g, true); | ||
99 | |||
100 | ctx_ptr = vmap(ch_ctx->gr_ctx->mem.pages, | ||
101 | PAGE_ALIGN(ch_ctx->gr_ctx->mem.size) >> PAGE_SHIFT, | ||
102 | 0, pgprot_writecombine(PAGE_KERNEL)); | ||
103 | if (!ctx_ptr) | ||
104 | return -ENOMEM; | ||
105 | |||
106 | *ctx_id = gk20a_mem_rd32(ctx_ptr + | ||
107 | ctxsw_prog_main_image_context_id_o(), 0); | ||
108 | |||
109 | vunmap(ctx_ptr); | ||
110 | |||
111 | return 0; | ||
112 | } | ||
113 | |||
89 | void gk20a_fecs_dump_falcon_stats(struct gk20a *g) | 114 | void gk20a_fecs_dump_falcon_stats(struct gk20a *g) |
90 | { | 115 | { |
91 | int i; | 116 | int i; |