summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/common/fifo/tsg.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu/common/fifo/tsg.c')
-rw-r--r--drivers/gpu/nvgpu/common/fifo/tsg.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/drivers/gpu/nvgpu/common/fifo/tsg.c b/drivers/gpu/nvgpu/common/fifo/tsg.c
index 7f61b273..65cee225 100644
--- a/drivers/gpu/nvgpu/common/fifo/tsg.c
+++ b/drivers/gpu/nvgpu/common/fifo/tsg.c
@@ -446,13 +446,14 @@ void gk20a_tsg_update_sm_error_state_locked(struct tsg_gk20a *tsg,
446 sm_error_state->hww_warp_esr_report_mask; 446 sm_error_state->hww_warp_esr_report_mask;
447} 447}
448 448
449int nvgpu_tsg_set_mmu_debug_mode(struct tsg_gk20a *tsg, 449int nvgpu_tsg_set_mmu_debug_mode(struct channel_gk20a *ch, bool enable)
450 struct channel_gk20a *ch, bool enable)
451{ 450{
452 struct gk20a *g; 451 struct gk20a *g;
453 int err = 0; 452 int err = 0;
453 u32 ch_refcnt;
454 u32 tsg_refcnt; 454 u32 tsg_refcnt;
455 u32 fb_refcnt; 455 u32 fb_refcnt;
456 struct tsg_gk20a *tsg = tsg_gk20a_from_ch(ch);
456 457
457 if ((ch == NULL) || (tsg == NULL)) { 458 if ((ch == NULL) || (tsg == NULL)) {
458 return -EINVAL; 459 return -EINVAL;
@@ -465,17 +466,11 @@ int nvgpu_tsg_set_mmu_debug_mode(struct tsg_gk20a *tsg,
465 } 466 }
466 467
467 if (enable) { 468 if (enable) {
468 if (ch->mmu_debug_mode_enabled) { 469 ch_refcnt = ch->mmu_debug_mode_refcnt + 1U;
469 /* already enabled for this channel */
470 return 0;
471 }
472 tsg_refcnt = tsg->mmu_debug_mode_refcnt + 1U; 470 tsg_refcnt = tsg->mmu_debug_mode_refcnt + 1U;
473 fb_refcnt = g->mmu_debug_mode_refcnt + 1U; 471 fb_refcnt = g->mmu_debug_mode_refcnt + 1U;
474 } else { 472 } else {
475 if (!ch->mmu_debug_mode_enabled) { 473 ch_refcnt = ch->mmu_debug_mode_refcnt - 1U;
476 /* already disabled for this channel */
477 return 0;
478 }
479 tsg_refcnt = tsg->mmu_debug_mode_refcnt - 1U; 474 tsg_refcnt = tsg->mmu_debug_mode_refcnt - 1U;
480 fb_refcnt = g->mmu_debug_mode_refcnt - 1U; 475 fb_refcnt = g->mmu_debug_mode_refcnt - 1U;
481 } 476 }
@@ -500,7 +495,7 @@ int nvgpu_tsg_set_mmu_debug_mode(struct tsg_gk20a *tsg,
500 g->ops.fb.set_mmu_debug_mode(g, fb_refcnt > 0U); 495 g->ops.fb.set_mmu_debug_mode(g, fb_refcnt > 0U);
501 } 496 }
502 497
503 ch->mmu_debug_mode_enabled = enable; 498 ch->mmu_debug_mode_refcnt = ch_refcnt;
504 tsg->mmu_debug_mode_refcnt = tsg_refcnt; 499 tsg->mmu_debug_mode_refcnt = tsg_refcnt;
505 g->mmu_debug_mode_refcnt = fb_refcnt; 500 g->mmu_debug_mode_refcnt = fb_refcnt;
506 501