gpu: nvgpu: Add checks for tracing enabled

Add checks for all ctxsw trace functions declared in header. This
makes sure chips without tracing support continue to work.

Change-Id: Ic658a00821b589a7b770c1fde52afede02dc1c9c
Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-on: http://git-master/r/1151918
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Thomas Fleury <tfleury@nvidia.com>
GVS: Gerrit_Virtual_Submit
This commit is contained in:
Terje Bergstrom
2016-05-23 10:22:29 -07:00
parent fb64e1f1b9
commit d16da3baec
2 changed files with 14 additions and 2 deletions

View File

@@ -557,6 +557,9 @@ int gk20a_ctxsw_trace_write(struct gk20a *g,
const char *reason;
u32 write_idx;
if (!g->ctxsw_trace)
return 0;
if (unlikely(entry->vmid >= GK20A_CTXSW_TRACE_NUM_DEVS))
return -ENODEV;
@@ -643,8 +646,12 @@ done:
void gk20a_ctxsw_trace_wake_up(struct gk20a *g, int vmid)
{
struct gk20a_ctxsw_dev *dev = &g->ctxsw_trace->devs[vmid];
struct gk20a_ctxsw_dev *dev;
if (!g->ctxsw_trace)
return;
dev = &g->ctxsw_trace->devs[vmid];
wake_up_interruptible(&dev->readout_wq);
}
@@ -659,6 +666,9 @@ void gk20a_ctxsw_trace_channel_reset(struct gk20a *g, struct channel_gk20a *ch)
.pid = ch->pid,
};
if (!g->ctxsw_trace)
return;
gk20a_ctxsw_trace_write(g, &entry);
gk20a_ctxsw_trace_wake_up(g, 0);
#endif
@@ -677,6 +687,9 @@ void gk20a_ctxsw_trace_tsg_reset(struct gk20a *g, struct tsg_gk20a *tsg)
};
struct channel_gk20a *ch;
if (!g->ctxsw_trace)
return;
mutex_lock(&tsg->ch_list_lock);
ch = list_entry(&tsg->ch_list, struct channel_gk20a, ch_entry);
mutex_unlock(&tsg->ch_list_lock);

View File

@@ -35,7 +35,6 @@ unsigned int gk20a_ctxsw_dev_poll(struct file *, struct poll_table_struct *);
int gk20a_ctxsw_dev_mmap(struct file *, struct vm_area_struct *);
int gk20a_ctxsw_trace_init(struct gk20a *);
int gk20a_ctxsw_trace_setup(struct gk20a *, void *ctx_ptr);
void gk20a_ctxsw_trace_cleanup(struct gk20a *);
int gk20a_ctxsw_trace_write(struct gk20a *, struct nvgpu_ctxsw_trace_entry *);
void gk20a_ctxsw_trace_wake_up(struct gk20a *g, int vmid);