mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-23 01:50:07 +03:00
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>
This commit is contained in:
committed by
Sachin Nikam
parent
4bc0a42f32
commit
b51ffba58f
@@ -86,6 +86,31 @@ static int gr_gk20a_init_golden_ctx_image(struct gk20a *g,
|
||||
/*elcg init */
|
||||
static void gr_gk20a_enable_elcg(struct gk20a *g);
|
||||
|
||||
int gr_gk20a_get_ctx_id(struct gk20a *g,
|
||||
struct channel_gk20a *c,
|
||||
u32 *ctx_id)
|
||||
{
|
||||
struct channel_ctx_gk20a *ch_ctx = &c->ch_ctx;
|
||||
void *ctx_ptr = NULL;
|
||||
|
||||
/* Channel gr_ctx buffer is gpu cacheable.
|
||||
Flush and invalidate before cpu update. */
|
||||
g->ops.mm.l2_flush(g, true);
|
||||
|
||||
ctx_ptr = vmap(ch_ctx->gr_ctx->mem.pages,
|
||||
PAGE_ALIGN(ch_ctx->gr_ctx->mem.size) >> PAGE_SHIFT,
|
||||
0, pgprot_writecombine(PAGE_KERNEL));
|
||||
if (!ctx_ptr)
|
||||
return -ENOMEM;
|
||||
|
||||
*ctx_id = gk20a_mem_rd32(ctx_ptr +
|
||||
ctxsw_prog_main_image_context_id_o(), 0);
|
||||
|
||||
vunmap(ctx_ptr);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void gk20a_fecs_dump_falcon_stats(struct gk20a *g)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -562,4 +562,8 @@ int gr_gk20a_ctx_wait_ucode(struct gk20a *g, u32 mailbox_id,
|
||||
u32 mailbox_ok, u32 opc_fail,
|
||||
u32 mailbox_fail, bool sleepduringwait);
|
||||
|
||||
int gr_gk20a_get_ctx_id(struct gk20a *g,
|
||||
struct channel_gk20a *c,
|
||||
u32 *ctx_id);
|
||||
|
||||
#endif /*__GR_GK20A_H__*/
|
||||
|
||||
@@ -242,4 +242,8 @@ static inline u32 ctxsw_prog_main_image_misc_options_verif_features_disabled_f(v
|
||||
{
|
||||
return 0x0;
|
||||
}
|
||||
static inline u32 ctxsw_prog_main_image_context_id_o(void)
|
||||
{
|
||||
return 0x000000f0;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -270,4 +270,8 @@ static inline u32 ctxsw_prog_main_image_preemption_options_control_cta_enabled_f
|
||||
{
|
||||
return 0x1;
|
||||
}
|
||||
static inline u32 ctxsw_prog_main_image_context_id_o(void)
|
||||
{
|
||||
return 0x000000f0;
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user