summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c26
1 files changed, 19 insertions, 7 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c b/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c
index 6b77dff5..1f86fd8f 100644
--- a/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c
@@ -720,15 +720,27 @@ static int gk20a_fecs_trace_enable(struct gk20a *g)
720{ 720{
721 struct gk20a_fecs_trace *trace = g->fecs_trace; 721 struct gk20a_fecs_trace *trace = g->fecs_trace;
722 struct task_struct *task; 722 struct task_struct *task;
723 int write;
723 724
724 if (!trace->poll_task) { 725 if (!trace)
725 task = kthread_run(gk20a_fecs_trace_periodic_polling, g, __func__); 726 return -EINVAL;
726 if (unlikely(IS_ERR(task))) { 727
727 gk20a_warn(dev_from_gk20a(g), "failed to create FECS polling task"); 728 if (trace->poll_task)
728 return PTR_ERR(task); 729 return 0;
729 } 730
730 trace->poll_task = task; 731 /* drop data in hw buffer */
732 if (g->ops.fecs_trace.flush)
733 g->ops.fecs_trace.flush(g);
734 write = gk20a_fecs_trace_get_write_index(g);
735 gk20a_fecs_trace_set_read_index(g, write);
736
737 task = kthread_run(gk20a_fecs_trace_periodic_polling, g, __func__);
738 if (unlikely(IS_ERR(task))) {
739 gk20a_warn(dev_from_gk20a(g),
740 "failed to create FECS polling task");
741 return PTR_ERR(task);
731 } 742 }
743 trace->poll_task = task;
732 744
733 return 0; 745 return 0;
734} 746}