summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a')
-rw-r--r--drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c22
-rw-r--r--drivers/gpu/nvgpu/gk20a/gk20a.h1
2 files changed, 18 insertions, 5 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c b/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c
index abf1cc55..4bfbf503 100644
--- a/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c
@@ -651,9 +651,11 @@ static int gk20a_fecs_trace_unbind_channel(struct gk20a *g, struct channel_gk20a
651 gk20a_dbg(gpu_dbg_fn|gpu_dbg_ctxsw, 651 gk20a_dbg(gpu_dbg_fn|gpu_dbg_ctxsw,
652 "ch=%p context_ptr=%x", ch, context_ptr); 652 "ch=%p context_ptr=%x", ch, context_ptr);
653 653
654 if (g->ops.fecs_trace.flush) 654 if (g->ops.fecs_trace.is_enabled(g)) {
655 g->ops.fecs_trace.flush(g); 655 if (g->ops.fecs_trace.flush)
656 gk20a_fecs_trace_poll(g); 656 g->ops.fecs_trace.flush(g);
657 gk20a_fecs_trace_poll(g);
658 }
657 gk20a_fecs_trace_hash_del(g, context_ptr); 659 gk20a_fecs_trace_hash_del(g, context_ptr);
658 return 0; 660 return 0;
659} 661}
@@ -662,8 +664,9 @@ static int gk20a_fecs_trace_reset(struct gk20a *g)
662{ 664{
663 gk20a_dbg(gpu_dbg_fn|gpu_dbg_ctxsw, ""); 665 gk20a_dbg(gpu_dbg_fn|gpu_dbg_ctxsw, "");
664 666
665 if (g->ops.fecs_trace.flush) 667 if (!g->ops.fecs_trace.is_enabled(g))
666 g->ops.fecs_trace.flush(g); 668 return 0;
669
667 gk20a_fecs_trace_poll(g); 670 gk20a_fecs_trace_poll(g);
668 return gk20a_fecs_trace_set_read_index(g, 0); 671 return gk20a_fecs_trace_set_read_index(g, 0);
669} 672}
@@ -725,6 +728,14 @@ static int gk20a_fecs_trace_disable(struct gk20a *g)
725 return -EPERM; 728 return -EPERM;
726} 729}
727 730
731static bool gk20a_fecs_trace_is_enabled(struct gk20a *g)
732{
733 struct gk20a_fecs_trace *trace = g->fecs_trace;
734
735 return (trace && trace->poll_task);
736}
737
738
728void gk20a_init_fecs_trace_ops(struct gpu_ops *ops) 739void gk20a_init_fecs_trace_ops(struct gpu_ops *ops)
729{ 740{
730 gk20a_ctxsw_trace_init_ops(ops); 741 gk20a_ctxsw_trace_init_ops(ops);
@@ -732,6 +743,7 @@ void gk20a_init_fecs_trace_ops(struct gpu_ops *ops)
732 ops->fecs_trace.deinit = gk20a_fecs_trace_deinit; 743 ops->fecs_trace.deinit = gk20a_fecs_trace_deinit;
733 ops->fecs_trace.enable = gk20a_fecs_trace_enable; 744 ops->fecs_trace.enable = gk20a_fecs_trace_enable;
734 ops->fecs_trace.disable = gk20a_fecs_trace_disable; 745 ops->fecs_trace.disable = gk20a_fecs_trace_disable;
746 ops->fecs_trace.is_enabled = gk20a_fecs_trace_is_enabled;
735 ops->fecs_trace.reset = gk20a_fecs_trace_reset; 747 ops->fecs_trace.reset = gk20a_fecs_trace_reset;
736 ops->fecs_trace.flush = NULL; 748 ops->fecs_trace.flush = NULL;
737 ops->fecs_trace.poll = gk20a_fecs_trace_poll; 749 ops->fecs_trace.poll = gk20a_fecs_trace_poll;
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.h b/drivers/gpu/nvgpu/gk20a/gk20a.h
index 463317e3..2b348677 100644
--- a/drivers/gpu/nvgpu/gk20a/gk20a.h
+++ b/drivers/gpu/nvgpu/gk20a/gk20a.h
@@ -484,6 +484,7 @@ struct gpu_ops {
484 int (*poll)(struct gk20a *g); 484 int (*poll)(struct gk20a *g);
485 int (*enable)(struct gk20a *g); 485 int (*enable)(struct gk20a *g);
486 int (*disable)(struct gk20a *g); 486 int (*disable)(struct gk20a *g);
487 bool (*is_enabled)(struct gk20a *g);
487 int (*reset)(struct gk20a *g); 488 int (*reset)(struct gk20a *g);
488 int (*bind_channel)(struct gk20a *, struct channel_gk20a *); 489 int (*bind_channel)(struct gk20a *, struct channel_gk20a *);
489 int (*unbind_channel)(struct gk20a *, struct channel_gk20a *); 490 int (*unbind_channel)(struct gk20a *, struct channel_gk20a *);