From 7a5d498a711833990a9d8fc3f5d3f3e26bee301c Mon Sep 17 00:00:00 2001 From: Richard Zhao Date: Tue, 5 Jun 2018 16:40:50 -0700 Subject: gpu: nvgpu: handle replayable mmu fault during waiting for SM lockdown outstanding replayable mmu fault will prevent SM from lockdown, so handle the replayable mmu fault while polling lockdown status. Jira EVLR-2643 Bug 200405202 Change-Id: I811f16ef4394a6cc42a5f37a17e426dd749c5652 Signed-off-by: Richard Zhao Reviewed-on: https://git-master.nvidia.com/r/1741997 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/gv11b/fb_gv11b.c | 12 ++++++++++++ drivers/gpu/nvgpu/gv11b/fb_gv11b.h | 1 + drivers/gpu/nvgpu/gv11b/gr_gv11b.c | 23 ++++++++++++++--------- 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/nvgpu/gv11b/fb_gv11b.c b/drivers/gpu/nvgpu/gv11b/fb_gv11b.c index 9fd6c857..18906c01 100644 --- a/drivers/gpu/nvgpu/gv11b/fb_gv11b.c +++ b/drivers/gpu/nvgpu/gv11b/fb_gv11b.c @@ -1289,6 +1289,18 @@ void gv11b_fb_handle_dropped_mmu_fault(struct gk20a *g, u32 fault_status) } } +void gv11b_fb_handle_replayable_mmu_fault(struct gk20a *g) +{ + u32 fault_status = gk20a_readl(g, fb_mmu_fault_status_r()); + + if (!(fault_status & fb_mmu_fault_status_replayable_m())) + return; + + if (gv11b_fb_is_fault_buf_enabled(g, NONREPLAY_REG_INDEX)) { + gv11b_fb_handle_mmu_nonreplay_replay_fault(g, + fault_status, REPLAY_REG_INDEX); + } +} static void gv11b_fb_handle_mmu_fault(struct gk20a *g, u32 niso_intr) { diff --git a/drivers/gpu/nvgpu/gv11b/fb_gv11b.h b/drivers/gpu/nvgpu/gv11b/fb_gv11b.h index a28d1ff7..6f809b89 100644 --- a/drivers/gpu/nvgpu/gv11b/fb_gv11b.h +++ b/drivers/gpu/nvgpu/gv11b/fb_gv11b.h @@ -77,6 +77,7 @@ void gv11b_fb_handle_nonreplay_fault_overflow(struct gk20a *g, u32 fault_status); void gv11b_fb_handle_replay_fault_overflow(struct gk20a *g, u32 fault_status); +void gv11b_fb_handle_replayable_mmu_fault(struct gk20a *g); void gv11b_handle_l2tlb_ecc_isr(struct gk20a *g, u32 ecc_status); void gv11b_handle_hubtlb_ecc_isr(struct gk20a *g, u32 ecc_status); void gv11b_handle_fillunit_ecc_isr(struct gk20a *g, u32 ecc_status); diff --git a/drivers/gpu/nvgpu/gv11b/gr_gv11b.c b/drivers/gpu/nvgpu/gv11b/gr_gv11b.c index 378bdc13..9bd48fdc 100644 --- a/drivers/gpu/nvgpu/gv11b/gr_gv11b.c +++ b/drivers/gpu/nvgpu/gv11b/gr_gv11b.c @@ -48,6 +48,7 @@ #include "gv11b/subctx_gv11b.h" #include "gv11b/gv11b.h" #include "gv11b/gr_pri_gv11b.h" +#include "gv11b/fb_gv11b.h" #include #include @@ -3735,15 +3736,19 @@ int gv11b_gr_wait_for_sm_lock_down(struct gk20a *g, return 0; } - /* if an mmu fault is pending and mmu debug mode is not - * enabled, the sm will never lock down. - */ - if (!mmu_debug_mode_enabled && - (g->ops.mm.mmu_fault_pending(g))) { - nvgpu_err(g, - "GPC%d TPC%d: mmu fault pending," - " SM%d will never lock down!", gpc, tpc, sm); - return -EFAULT; + if (mmu_debug_mode_enabled) { + gv11b_fb_handle_replayable_mmu_fault(g); + } else { + /* if an mmu fault is pending and mmu debug mode is not + * enabled, the sm will never lock down. + */ + if (g->ops.mm.mmu_fault_pending(g)) { + nvgpu_err(g, + "GPC%d TPC%d: mmu fault pending," + " SM%d will never lock down!", + gpc, tpc, sm); + return -EFAULT; + } } nvgpu_usleep_range(delay, delay * 2); -- cgit v1.2.2