From 6c9daf7626567fffc9d1ccd475865e81ae90a973 Mon Sep 17 00:00:00 2001 From: Richard Zhao Date: Wed, 1 Aug 2018 11:38:17 -0700 Subject: gpu: nvgpu: fix gpc_tpc_mask to use max_gpc_count gpc_tpc_mask uses gpc/tpc IDs directly read from fuse, so it needs to use max_gpc_count for any possible cases rather not gpc_count. Bug 2302005 Change-Id: I903ee3e0c10c4b329dd0d76c40d3516dc36ed303 Signed-off-by: Richard Zhao Reviewed-on: https://git-master.nvidia.com/r/1790464 Reviewed-by: svc-misra-checker Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Deepak Nibade Reviewed-by: Alex Waterman Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/gk20a/gr_gk20a.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'drivers/gpu/nvgpu/gk20a') diff --git a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c index e40f296e..4dfddf5d 100644 --- a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c @@ -3196,10 +3196,10 @@ static int gr_gk20a_init_gr_config(struct gk20a *g, struct gr_gk20a *gr) sizeof(u32)); if (gr->gpc_tpc_mask == NULL) - gr->gpc_tpc_mask = nvgpu_kzalloc(g, gr->gpc_count * + gr->gpc_tpc_mask = nvgpu_kzalloc(g, gr->max_gpc_count * sizeof(u32)); else - memset(gr->gpc_tpc_mask, 0, gr->gpc_count * + memset(gr->gpc_tpc_mask, 0, gr->max_gpc_count * sizeof(u32)); if (gr->gpc_zcb_count == NULL) @@ -3228,6 +3228,13 @@ static int gr_gk20a_init_gr_config(struct gk20a *g, struct gr_gk20a *gr) !gr->gpc_ppc_count || !gr->gpc_skip_mask) goto clean_up; + for (gpc_index = 0; gpc_index < gr->max_gpc_count; gpc_index++) { + if (g->ops.gr.get_gpc_tpc_mask) { + gr->gpc_tpc_mask[gpc_index] = + g->ops.gr.get_gpc_tpc_mask(g, gpc_index); + } + } + gr->ppc_count = 0; gr->tpc_count = 0; gr->zcb_count = 0; @@ -3243,10 +3250,6 @@ static int gr_gk20a_init_gr_config(struct gk20a *g, struct gr_gk20a *gr) gr_gpc0_fs_gpc_num_available_zculls_v(tmp); gr->zcb_count += gr->gpc_zcb_count[gpc_index]; - if (g->ops.gr.get_gpc_tpc_mask) - gr->gpc_tpc_mask[gpc_index] = - g->ops.gr.get_gpc_tpc_mask(g, gpc_index); - for (pes_index = 0; pes_index < gr->pe_count_per_gpc; pes_index++) { if (!gr->pes_tpc_count[pes_index]) { gr->pes_tpc_count[pes_index] = -- cgit v1.2.2