From 8c5ea40ccaad022401e45e61d5b6ff3354ffa413 Mon Sep 17 00:00:00 2001 From: David Nieto Date: Mon, 16 Oct 2017 12:24:25 -0700 Subject: gpu: nvgpu: handle smid table init failures Handle the possibility of failing gr init due to smid table initialization failures bug 2004378 Change-Id: I904b918a0ea31c32292edb3ab8ac3b1459c38a28 Signed-off-by: David Nieto Reviewed-on: https://git-master.nvidia.com/r/1581661 Reviewed-by: Alex Waterman Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom --- drivers/gpu/nvgpu/gk20a/gr_gk20a.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'drivers/gpu/nvgpu/gk20a/gr_gk20a.c') diff --git a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c index 700dcdf8..1b9ecd86 100644 --- a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c @@ -1164,8 +1164,12 @@ int gr_gk20a_init_fs_state(struct gk20a *g) gk20a_dbg_fn(""); - if (g->ops.gr.init_sm_id_table) + if (g->ops.gr.init_sm_id_table) { g->ops.gr.init_sm_id_table(g); + /* Is table empty ? */ + if (g->gr.no_of_sm == 0) + return -EINVAL; + } for (sm_id = 0; sm_id < g->gr.no_of_sm; sm_id++) { tpc_index = g->gr.sm_to_cluster[sm_id].tpc_index; @@ -1459,7 +1463,9 @@ static int gr_gk20a_init_golden_ctx_image(struct gk20a *g, g->ops.gr.commit_global_timeslice(g, c, false); /* floorsweep anything left */ - g->ops.gr.init_fs_state(g); + err = g->ops.gr.init_fs_state(g); + if (err) + goto clean_up; err = gr_gk20a_wait_idle(g, gk20a_get_gr_idle_timeout(g), GR_IDLE_CHECK_DEFAULT); -- cgit v1.2.2