gpu: nvgpu: fix pid mapping for dGPU FECS traces

For dGPU, instance block is in vidmem, and context_ptr
was not properly computed, leading to reporting pid=0 in
FECS traces.
Use gk20a_mm_inst_block_addr, which handles all cases
to determine instance block physical address.

Bug 1899195

Change-Id: If003d9f00aff66d808e66c06baf6ded38699981a
Signed-off-by: Thomas Fleury <tfleury@nvidia.com>
Reviewed-on: http://git-master/r/1461646
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Richard Zhao <rizhao@nvidia.com>
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
This commit is contained in:
Thomas Fleury
2017-04-12 11:31:51 -07:00
committed by mobile promotions
parent 167d3524d1
commit 0a58c5ace0

View File

@@ -77,9 +77,9 @@ static inline u64 gk20a_fecs_trace_record_ts_timestamp_v(u64 ts)
} }
static u32 gk20a_fecs_trace_fecs_context_ptr(struct channel_gk20a *ch) static u32 gk20a_fecs_trace_fecs_context_ptr(struct gk20a *g, struct channel_gk20a *ch)
{ {
return (u32) (sg_phys(ch->inst_block.sgt->sgl) >> 12LL); return (u32) (gk20a_mm_inst_block_addr(g, &ch->inst_block) >> 12LL);
} }
static inline int gk20a_fecs_trace_num_ts(void) static inline int gk20a_fecs_trace_num_ts(void)
@@ -610,7 +610,7 @@ static int gk20a_fecs_trace_bind_channel(struct gk20a *g,
struct channel_ctx_gk20a *ch_ctx = &ch->ch_ctx; struct channel_ctx_gk20a *ch_ctx = &ch->ch_ctx;
struct gk20a_fecs_trace *trace = g->fecs_trace; struct gk20a_fecs_trace *trace = g->fecs_trace;
struct mem_desc *mem = &ch_ctx->gr_ctx->mem; struct mem_desc *mem = &ch_ctx->gr_ctx->mem;
u32 context_ptr = gk20a_fecs_trace_fecs_context_ptr(ch); u32 context_ptr = gk20a_fecs_trace_fecs_context_ptr(g, ch);
pid_t pid; pid_t pid;
u32 aperture; u32 aperture;
@@ -666,7 +666,7 @@ static int gk20a_fecs_trace_bind_channel(struct gk20a *g,
static int gk20a_fecs_trace_unbind_channel(struct gk20a *g, struct channel_gk20a *ch) static int gk20a_fecs_trace_unbind_channel(struct gk20a *g, struct channel_gk20a *ch)
{ {
u32 context_ptr = gk20a_fecs_trace_fecs_context_ptr(ch); u32 context_ptr = gk20a_fecs_trace_fecs_context_ptr(g, ch);
gk20a_dbg(gpu_dbg_fn|gpu_dbg_ctxsw, gk20a_dbg(gpu_dbg_fn|gpu_dbg_ctxsw,
"ch=%p context_ptr=%x", ch, context_ptr); "ch=%p context_ptr=%x", ch, context_ptr);