gpu: nvgpu: add check for max gpc count

Patch adds a BUG() in the gm20b_fuse_status_opt_tpc_gpc() if input gpc
is more than max gpc count.

Jira NVGPU-6410

Change-Id: Iefd346bcf8865b831543e6fe389c63a79f3653ec
Signed-off-by: Prateek sethi <prsethi@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2548477
(cherry picked from commit bc8fd66432ee8369324de7371d1683336b6f896e)
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2552296
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Prateek sethi
2021-06-22 19:06:20 +05:30
committed by mobile promotions
parent e0ffd1a217
commit fdd768a302

View File

@@ -49,6 +49,11 @@ u32 gm20b_fuse_status_opt_l2_fbp(struct gk20a *g, u32 fbp)
u32 gm20b_fuse_status_opt_tpc_gpc(struct gk20a *g, u32 gpc) u32 gm20b_fuse_status_opt_tpc_gpc(struct gk20a *g, u32 gpc)
{ {
u32 max_gpc_count = g->ops.top.get_max_gpc_count(g);
if (gpc >= max_gpc_count) {
BUG();
}
return nvgpu_readl(g, fuse_status_opt_tpc_gpc_r(gpc)); return nvgpu_readl(g, fuse_status_opt_tpc_gpc_r(gpc));
} }