diff options
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c b/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c index fea3b0fa..71cba9ec 100644 --- a/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/fecs_trace_gk20a.c | |||
@@ -67,6 +67,7 @@ struct gk20a_fecs_trace { | |||
67 | struct nvgpu_mutex hash_lock; | 67 | struct nvgpu_mutex hash_lock; |
68 | struct nvgpu_mutex poll_lock; | 68 | struct nvgpu_mutex poll_lock; |
69 | struct nvgpu_thread poll_task; | 69 | struct nvgpu_thread poll_task; |
70 | bool init; | ||
70 | }; | 71 | }; |
71 | 72 | ||
72 | #ifdef CONFIG_GK20A_CTXSW_TRACE | 73 | #ifdef CONFIG_GK20A_CTXSW_TRACE |
@@ -547,23 +548,12 @@ static void gk20a_fecs_trace_debugfs_init(struct gk20a *g) | |||
547 | &gk20a_fecs_trace_debugfs_ring_fops); | 548 | &gk20a_fecs_trace_debugfs_ring_fops); |
548 | } | 549 | } |
549 | 550 | ||
550 | static void gk20a_fecs_trace_debugfs_cleanup(struct gk20a *g) | ||
551 | { | ||
552 | struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g); | ||
553 | |||
554 | debugfs_remove_recursive(l->debugfs); | ||
555 | } | ||
556 | |||
557 | #else | 551 | #else |
558 | 552 | ||
559 | static void gk20a_fecs_trace_debugfs_init(struct gk20a *g) | 553 | static void gk20a_fecs_trace_debugfs_init(struct gk20a *g) |
560 | { | 554 | { |
561 | } | 555 | } |
562 | 556 | ||
563 | static inline void gk20a_fecs_trace_debugfs_cleanup(struct gk20a *g) | ||
564 | { | ||
565 | } | ||
566 | |||
567 | #endif /* CONFIG_DEBUG_FS */ | 557 | #endif /* CONFIG_DEBUG_FS */ |
568 | 558 | ||
569 | int gk20a_fecs_trace_init(struct gk20a *g) | 559 | int gk20a_fecs_trace_init(struct gk20a *g) |
@@ -598,6 +588,9 @@ int gk20a_fecs_trace_init(struct gk20a *g) | |||
598 | NVGPU_GPU_FLAGS_SUPPORT_FECS_CTXSW_TRACE; | 588 | NVGPU_GPU_FLAGS_SUPPORT_FECS_CTXSW_TRACE; |
599 | 589 | ||
600 | gk20a_fecs_trace_debugfs_init(g); | 590 | gk20a_fecs_trace_debugfs_init(g); |
591 | |||
592 | trace->init = true; | ||
593 | |||
601 | return 0; | 594 | return 0; |
602 | 595 | ||
603 | clean_hash_lock: | 596 | clean_hash_lock: |
@@ -682,15 +675,17 @@ int gk20a_fecs_trace_unbind_channel(struct gk20a *g, struct channel_gk20a *ch) | |||
682 | { | 675 | { |
683 | u32 context_ptr = gk20a_fecs_trace_fecs_context_ptr(g, ch); | 676 | u32 context_ptr = gk20a_fecs_trace_fecs_context_ptr(g, ch); |
684 | 677 | ||
685 | gk20a_dbg(gpu_dbg_fn|gpu_dbg_ctxsw, | 678 | if (g->fecs_trace) { |
679 | gk20a_dbg(gpu_dbg_fn|gpu_dbg_ctxsw, | ||
686 | "ch=%p context_ptr=%x", ch, context_ptr); | 680 | "ch=%p context_ptr=%x", ch, context_ptr); |
687 | 681 | ||
688 | if (g->ops.fecs_trace.is_enabled(g)) { | 682 | if (g->ops.fecs_trace.is_enabled(g)) { |
689 | if (g->ops.fecs_trace.flush) | 683 | if (g->ops.fecs_trace.flush) |
690 | g->ops.fecs_trace.flush(g); | 684 | g->ops.fecs_trace.flush(g); |
691 | gk20a_fecs_trace_poll(g); | 685 | gk20a_fecs_trace_poll(g); |
686 | } | ||
687 | gk20a_fecs_trace_hash_del(g, context_ptr); | ||
692 | } | 688 | } |
693 | gk20a_fecs_trace_hash_del(g, context_ptr); | ||
694 | return 0; | 689 | return 0; |
695 | } | 690 | } |
696 | 691 | ||
@@ -709,7 +704,9 @@ int gk20a_fecs_trace_deinit(struct gk20a *g) | |||
709 | { | 704 | { |
710 | struct gk20a_fecs_trace *trace = g->fecs_trace; | 705 | struct gk20a_fecs_trace *trace = g->fecs_trace; |
711 | 706 | ||
712 | gk20a_fecs_trace_debugfs_cleanup(g); | 707 | if (!trace->init) |
708 | return 0; | ||
709 | |||
713 | nvgpu_thread_stop(&trace->poll_task); | 710 | nvgpu_thread_stop(&trace->poll_task); |
714 | gk20a_fecs_trace_free_ring(g); | 711 | gk20a_fecs_trace_free_ring(g); |
715 | gk20a_fecs_trace_free_hash_table(g); | 712 | gk20a_fecs_trace_free_hash_table(g); |