summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/gk20a.c
diff options
context:
space:
mode:
authorSupriya <ssharatkumar@nvidia.com>2017-11-02 02:24:03 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-12-28 06:01:48 -0500
commitea1b69d3f5e419ab1e66340779fda143e8f4ebc3 (patch)
tree9c07bc5e9efab1f781bb28d07a89598469948f2a /drivers/gpu/nvgpu/gk20a/gk20a.c
parent3a956a573d2ecb9a7520680ec6bcd6f626054488 (diff)
gpu: nvgpu: Fix crash on read fail of mc_boot_0_r
This CL handles - erroneous use of boot_0 function pointer before being assigned in __nvgpu_check_gpu_state - And proper handling of error returned from gk20a_readl in gk20a_mc_boot_0 With these fixes crash is not seen in case mc_boot_0 read returns 0 in gk20a_mc_boot_0 - And also this handles the recursion caused by mc.boot_0() calling nvgpu_readl and nvgpu_readl in turn calling mc.boot_0 in case of read failure Bug 2010966 Change-Id: Ia087811c67d88948b7fc5fff35e0fabc6ea91989 Signed-off-by: Supriya <ssharatkumar@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1616274 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/gk20a.c')
-rw-r--r--drivers/gpu/nvgpu/gk20a/gk20a.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.c b/drivers/gpu/nvgpu/gk20a/gk20a.c
index c72b6193..0ccc8f6c 100644
--- a/drivers/gpu/nvgpu/gk20a/gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/gk20a.c
@@ -54,11 +54,17 @@
54 54
55void __nvgpu_check_gpu_state(struct gk20a *g) 55void __nvgpu_check_gpu_state(struct gk20a *g)
56{ 56{
57 u32 boot_0 = g->ops.mc.boot_0(g, NULL, NULL, NULL); 57 u32 boot_0 = 0xffffffff;
58 58
59 if (!g->ops.mc.boot_0) {
60 nvgpu_err(g, "Can't determine GPU state, mc.boot_0 unset");
61 return;
62 }
63
64 boot_0 = g->ops.mc.boot_0(g, NULL, NULL, NULL);
59 if (boot_0 == 0xffffffff) { 65 if (boot_0 == 0xffffffff) {
60 pr_err("nvgpu: GPU has disappeared from bus!!\n"); 66 nvgpu_err(g, "GPU has disappeared from bus!!");
61 pr_err("nvgpu: Rebooting system!!\n"); 67 nvgpu_err(g, "Rebooting system!!");
62 kernel_restart(NULL); 68 kernel_restart(NULL);
63 } 69 }
64} 70}