summaryrefslogtreecommitdiffstats
path: root/drivers/gpu
diff options
context:
space:
mode:
authorRichard Zhao <rizhao@nvidia.com>2018-08-01 14:38:17 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2018-08-06 20:36:26 -0400
commit6c9daf7626567fffc9d1ccd475865e81ae90a973 (patch)
tree0a088733457ce95943582a955b4b2492200732ca /drivers/gpu
parent9b9a54920511d560d114881a923437fb88deffad (diff)
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 <rizhao@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1790464 Reviewed-by: svc-misra-checker <svc-misra-checker@nvidia.com> Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-by: Alex Waterman <alexw@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/nvgpu/gk20a/gr_gk20a.c15
-rw-r--r--drivers/gpu/nvgpu/os/linux/ioctl_ctrl.c2
2 files changed, 10 insertions, 7 deletions
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)
3196 sizeof(u32)); 3196 sizeof(u32));
3197 3197
3198 if (gr->gpc_tpc_mask == NULL) 3198 if (gr->gpc_tpc_mask == NULL)
3199 gr->gpc_tpc_mask = nvgpu_kzalloc(g, gr->gpc_count * 3199 gr->gpc_tpc_mask = nvgpu_kzalloc(g, gr->max_gpc_count *
3200 sizeof(u32)); 3200 sizeof(u32));
3201 else 3201 else
3202 memset(gr->gpc_tpc_mask, 0, gr->gpc_count * 3202 memset(gr->gpc_tpc_mask, 0, gr->max_gpc_count *
3203 sizeof(u32)); 3203 sizeof(u32));
3204 3204
3205 if (gr->gpc_zcb_count == NULL) 3205 if (gr->gpc_zcb_count == NULL)
@@ -3228,6 +3228,13 @@ static int gr_gk20a_init_gr_config(struct gk20a *g, struct gr_gk20a *gr)
3228 !gr->gpc_ppc_count || !gr->gpc_skip_mask) 3228 !gr->gpc_ppc_count || !gr->gpc_skip_mask)
3229 goto clean_up; 3229 goto clean_up;
3230 3230
3231 for (gpc_index = 0; gpc_index < gr->max_gpc_count; gpc_index++) {
3232 if (g->ops.gr.get_gpc_tpc_mask) {
3233 gr->gpc_tpc_mask[gpc_index] =
3234 g->ops.gr.get_gpc_tpc_mask(g, gpc_index);
3235 }
3236 }
3237
3231 gr->ppc_count = 0; 3238 gr->ppc_count = 0;
3232 gr->tpc_count = 0; 3239 gr->tpc_count = 0;
3233 gr->zcb_count = 0; 3240 gr->zcb_count = 0;
@@ -3243,10 +3250,6 @@ static int gr_gk20a_init_gr_config(struct gk20a *g, struct gr_gk20a *gr)
3243 gr_gpc0_fs_gpc_num_available_zculls_v(tmp); 3250 gr_gpc0_fs_gpc_num_available_zculls_v(tmp);
3244 gr->zcb_count += gr->gpc_zcb_count[gpc_index]; 3251 gr->zcb_count += gr->gpc_zcb_count[gpc_index];
3245 3252
3246 if (g->ops.gr.get_gpc_tpc_mask)
3247 gr->gpc_tpc_mask[gpc_index] =
3248 g->ops.gr.get_gpc_tpc_mask(g, gpc_index);
3249
3250 for (pes_index = 0; pes_index < gr->pe_count_per_gpc; pes_index++) { 3253 for (pes_index = 0; pes_index < gr->pe_count_per_gpc; pes_index++) {
3251 if (!gr->pes_tpc_count[pes_index]) { 3254 if (!gr->pes_tpc_count[pes_index]) {
3252 gr->pes_tpc_count[pes_index] = 3255 gr->pes_tpc_count[pes_index] =
diff --git a/drivers/gpu/nvgpu/os/linux/ioctl_ctrl.c b/drivers/gpu/nvgpu/os/linux/ioctl_ctrl.c
index f7de17ad..e87d5822 100644
--- a/drivers/gpu/nvgpu/os/linux/ioctl_ctrl.c
+++ b/drivers/gpu/nvgpu/os/linux/ioctl_ctrl.c
@@ -515,7 +515,7 @@ static int gk20a_ctrl_get_tpc_masks(struct gk20a *g,
515{ 515{
516 struct gr_gk20a *gr = &g->gr; 516 struct gr_gk20a *gr = &g->gr;
517 int err = 0; 517 int err = 0;
518 const u32 gpc_tpc_mask_size = sizeof(u32) * gr->gpc_count; 518 const u32 gpc_tpc_mask_size = sizeof(u32) * gr->max_gpc_count;
519 519
520 if (args->mask_buf_size > 0) { 520 if (args->mask_buf_size > 0) {
521 size_t write_size = gpc_tpc_mask_size; 521 size_t write_size = gpc_tpc_mask_size;