mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-22 17:36:20 +03:00
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:
@@ -557,6 +557,9 @@ int gk20a_ctxsw_trace_write(struct gk20a *g,
|
|||||||
const char *reason;
|
const char *reason;
|
||||||
u32 write_idx;
|
u32 write_idx;
|
||||||
|
|
||||||
|
if (!g->ctxsw_trace)
|
||||||
|
return 0;
|
||||||
|
|
||||||
if (unlikely(entry->vmid >= GK20A_CTXSW_TRACE_NUM_DEVS))
|
if (unlikely(entry->vmid >= GK20A_CTXSW_TRACE_NUM_DEVS))
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
@@ -643,8 +646,12 @@ done:
|
|||||||
|
|
||||||
void gk20a_ctxsw_trace_wake_up(struct gk20a *g, int vmid)
|
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);
|
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,
|
.pid = ch->pid,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (!g->ctxsw_trace)
|
||||||
|
return;
|
||||||
|
|
||||||
gk20a_ctxsw_trace_write(g, &entry);
|
gk20a_ctxsw_trace_write(g, &entry);
|
||||||
gk20a_ctxsw_trace_wake_up(g, 0);
|
gk20a_ctxsw_trace_wake_up(g, 0);
|
||||||
#endif
|
#endif
|
||||||
@@ -677,6 +687,9 @@ void gk20a_ctxsw_trace_tsg_reset(struct gk20a *g, struct tsg_gk20a *tsg)
|
|||||||
};
|
};
|
||||||
struct channel_gk20a *ch;
|
struct channel_gk20a *ch;
|
||||||
|
|
||||||
|
if (!g->ctxsw_trace)
|
||||||
|
return;
|
||||||
|
|
||||||
mutex_lock(&tsg->ch_list_lock);
|
mutex_lock(&tsg->ch_list_lock);
|
||||||
ch = list_entry(&tsg->ch_list, struct channel_gk20a, ch_entry);
|
ch = list_entry(&tsg->ch_list, struct channel_gk20a, ch_entry);
|
||||||
mutex_unlock(&tsg->ch_list_lock);
|
mutex_unlock(&tsg->ch_list_lock);
|
||||||
|
|||||||
@@ -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_dev_mmap(struct file *, struct vm_area_struct *);
|
||||||
|
|
||||||
int gk20a_ctxsw_trace_init(struct gk20a *);
|
int gk20a_ctxsw_trace_init(struct gk20a *);
|
||||||
int gk20a_ctxsw_trace_setup(struct gk20a *, void *ctx_ptr);
|
|
||||||
void gk20a_ctxsw_trace_cleanup(struct gk20a *);
|
void gk20a_ctxsw_trace_cleanup(struct gk20a *);
|
||||||
int gk20a_ctxsw_trace_write(struct gk20a *, struct nvgpu_ctxsw_trace_entry *);
|
int gk20a_ctxsw_trace_write(struct gk20a *, struct nvgpu_ctxsw_trace_entry *);
|
||||||
void gk20a_ctxsw_trace_wake_up(struct gk20a *g, int vmid);
|
void gk20a_ctxsw_trace_wake_up(struct gk20a *g, int vmid);
|
||||||
|
|||||||
Reference in New Issue
Block a user