summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a
diff options
context:
space:
mode:
authorDeepak Nibade <dnibade@nvidia.com>2015-12-23 05:26:50 -0500
committerSachin Nikam <snikam@nvidia.com>2016-01-13 02:00:08 -0500
commitb51ffba58f83f0324e22884906fcb70d055c287a (patch)
treef790e8959a8784cb22db3d161e87ff5b05d2883b /drivers/gpu/nvgpu/gk20a
parent4bc0a42f32f16b2050b9f190909d0d5df4d80e44 (diff)
gpu: nvgpu: API to extract context id
Add new API gr_gk20a_get_ctx_id() to get/extract context id from GR context Bug 200156699 Change-Id: If0e8887a9a6b139cd795bf03f5def64fd664d12b Signed-off-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-on: http://git-master/r/927130 GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a')
-rw-r--r--drivers/gpu/nvgpu/gk20a/gr_gk20a.c25
-rw-r--r--drivers/gpu/nvgpu/gk20a/gr_gk20a.h4
-rw-r--r--drivers/gpu/nvgpu/gk20a/hw_ctxsw_prog_gk20a.h4
3 files changed, 33 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 */
87static void gr_gk20a_enable_elcg(struct gk20a *g); 87static void gr_gk20a_enable_elcg(struct gk20a *g);
88 88
89int 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
89void gk20a_fecs_dump_falcon_stats(struct gk20a *g) 114void gk20a_fecs_dump_falcon_stats(struct gk20a *g)
90{ 115{
91 int i; 116 int i;
diff --git a/drivers/gpu/nvgpu/gk20a/gr_gk20a.h b/drivers/gpu/nvgpu/gk20a/gr_gk20a.h
index 29c2dcf6..74da0cf1 100644
--- a/drivers/gpu/nvgpu/gk20a/gr_gk20a.h
+++ b/drivers/gpu/nvgpu/gk20a/gr_gk20a.h
@@ -562,4 +562,8 @@ int gr_gk20a_ctx_wait_ucode(struct gk20a *g, u32 mailbox_id,
562 u32 mailbox_ok, u32 opc_fail, 562 u32 mailbox_ok, u32 opc_fail,
563 u32 mailbox_fail, bool sleepduringwait); 563 u32 mailbox_fail, bool sleepduringwait);
564 564
565int gr_gk20a_get_ctx_id(struct gk20a *g,
566 struct channel_gk20a *c,
567 u32 *ctx_id);
568
565#endif /*__GR_GK20A_H__*/ 569#endif /*__GR_GK20A_H__*/
diff --git a/drivers/gpu/nvgpu/gk20a/hw_ctxsw_prog_gk20a.h b/drivers/gpu/nvgpu/gk20a/hw_ctxsw_prog_gk20a.h
index 4e3fae13..39cbbb58 100644
--- a/drivers/gpu/nvgpu/gk20a/hw_ctxsw_prog_gk20a.h
+++ b/drivers/gpu/nvgpu/gk20a/hw_ctxsw_prog_gk20a.h
@@ -242,4 +242,8 @@ static inline u32 ctxsw_prog_main_image_misc_options_verif_features_disabled_f(v
242{ 242{
243 return 0x0; 243 return 0x0;
244} 244}
245static inline u32 ctxsw_prog_main_image_context_id_o(void)
246{
247 return 0x000000f0;
248}
245#endif 249#endif