From 91d977ced46f5db02da077df8703e958c5e2af4e Mon Sep 17 00:00:00 2001 From: Alex Waterman Date: Tue, 8 Nov 2016 11:40:10 -0800 Subject: gpu: nvgpu: Misc fixes for crashes on shutdown Fix miscellaneous issues seen during driver shutdown. o Make sure pointers are valid before accessing them. o Busy the GPU during channel timeout. o Cancel delayed work on channels. o Avoid access to channels that may have been freed. Bug 1816516 Bug 1807277 Change-Id: I62df40373fdfb1c4a011364e8c435176a08a7a96 Signed-off-by: Alex Waterman Reviewed-on: http://git-master/r/1250026 (cherry picked from commit 64a95fc96c8ef7c5af9c53c4bb3402626e0d2f60) Reviewed-on: http://git-master/r/1274474 GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom --- drivers/gpu/nvgpu/gk20a/mm_gk20a.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'drivers/gpu/nvgpu/gk20a/mm_gk20a.c') diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c index 792fa098..2e338fef 100644 --- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c @@ -219,6 +219,11 @@ static inline void pramin_access_batch_rd_n(struct gk20a *g, u32 start, { u32 r = start, *dest_u32 = *arg; + if (!g->regs) { + __gk20a_warn_on_no_regs(); + return; + } + while (words--) { *dest_u32++ = gk20a_readl(g, r); r += sizeof(u32); @@ -232,6 +237,11 @@ static inline void pramin_access_batch_wr_n(struct gk20a *g, u32 start, { u32 r = start, *src_u32 = *arg; + if (!g->regs) { + __gk20a_warn_on_no_regs(); + return; + } + while (words--) { writel_relaxed(*src_u32++, g->regs + r); r += sizeof(u32); @@ -245,6 +255,11 @@ static inline void pramin_access_batch_set(struct gk20a *g, u32 start, { u32 r = start, repeat = **arg; + if (!g->regs) { + __gk20a_warn_on_no_regs(); + return; + } + while (words--) { writel_relaxed(repeat, g->regs + r); r += sizeof(u32); -- cgit v1.2.2