From a0242464f5f12d9f10fbf0d05614bfadde84386c Mon Sep 17 00:00:00 2001 From: Alex Waterman Date: Mon, 7 Nov 2016 16:12:45 -0800 Subject: gpu: nvgpu: Handle no GPU cases in helper funcs In many helper functions like gk20a_readl() the code assumed that the GPU is present and registers and available. However, during GPU shutdown this may not be the case. In theory the driver should not be accessing GPU registers during GPU shutdown (since shutdown is triggered by GPU registers being unavailable) but these changes handle any missed cases where this may happen. This goes for GPU device access as well. Many parts of the code assume that if the struct gk20a is valid, the the GPU dev must be there are well. This isn't always the case, it seems. Bug 1816516 Bug 1807277 Change-Id: Icaf6fd56ab7860724e77bda0f5e8d48f0da15642 Signed-off-by: Alex Waterman Reviewed-on: http://git-master/r/1250024 (cherry picked from commit e8c9997b2d7cd424d798ecfce1307e6193c0cf32) Reviewed-on: http://git-master/r/1274473 GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom --- drivers/gpu/nvgpu/gk20a/gk20a.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'drivers/gpu/nvgpu/gk20a/gk20a.c') diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.c b/drivers/gpu/nvgpu/gk20a/gk20a.c index 5e56fc81..a65ca6c2 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/gk20a.c @@ -309,6 +309,11 @@ int gk20a_restore_registers(struct gk20a *g) return 0; } +void __gk20a_warn_on_no_regs(void) +{ + WARN_ONCE(1, "Attempted access to GPU regs after unmapping!"); +} + static void kunmap_and_free_iopage(void **kvaddr, struct page **page) { if (*kvaddr) { -- cgit v1.2.2