From 7b5b4fc84ff0067fb0e7b5a3b86a4b16784e8ffa Mon Sep 17 00:00:00 2001 From: seshendra Gadagottu Date: Thu, 9 Mar 2017 11:30:14 -0800 Subject: gpu: nvgpu: gv11b: function to get max veid Defined function to get max number of subcontexs supported and used it where max subcontext count required. JIRA GV11B-23 Change-Id: I4f6307162486bab1e91cbf66abfee7763c70fe7b Signed-off-by: seshendra Gadagottu Signed-off-by: Seema Khowala Reviewed-on: http://git-master/r/1318146 Reviewed-by: svccoveritychecker GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom --- drivers/gpu/nvgpu/gv11b/gr_gv11b.c | 3 +-- drivers/gpu/nvgpu/gv11b/subctx_gv11b.c | 8 ++++++++ drivers/gpu/nvgpu/gv11b/subctx_gv11b.h | 4 +++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/nvgpu/gv11b/gr_gv11b.c b/drivers/gpu/nvgpu/gv11b/gr_gv11b.c index 5b0526b0..33a5067e 100644 --- a/drivers/gpu/nvgpu/gv11b/gr_gv11b.c +++ b/drivers/gpu/nvgpu/gv11b/gr_gv11b.c @@ -1649,10 +1649,9 @@ static void gv11b_write_bundle_veid_state(struct gk20a *g, u32 index) struct av_list_gk20a *sw_veid_bundle_init = &g->gr.ctx_vars.sw_veid_bundle_init; u32 j; - u32 data = gk20a_readl(g, gr_pri_fe_chip_def_info_r()); u32 num_subctx, err = 0; - num_subctx = gr_pri_fe_chip_def_info_max_veid_count_v(data); + num_subctx = gv11b_get_max_subctx_count(g); for (j = 0; j < num_subctx; j++) { diff --git a/drivers/gpu/nvgpu/gv11b/subctx_gv11b.c b/drivers/gpu/nvgpu/gv11b/subctx_gv11b.c index 4d68926f..c3ff9185 100644 --- a/drivers/gpu/nvgpu/gv11b/subctx_gv11b.c +++ b/drivers/gpu/nvgpu/gv11b/subctx_gv11b.c @@ -25,6 +25,7 @@ #include #include +#include static void gv11b_init_subcontext_pdb(struct channel_gk20a *c, struct nvgpu_mem *inst_block); @@ -147,3 +148,10 @@ int gv11b_update_subctx_header(struct channel_gk20a *c, u64 gpu_va) nvgpu_mem_end(g, gr_mem); return ret; } + +int gv11b_get_max_subctx_count(struct gk20a *g) +{ + u32 data = gk20a_readl(g, gr_pri_fe_chip_def_info_r()); + + return gr_pri_fe_chip_def_info_max_veid_count_v(data); +} diff --git a/drivers/gpu/nvgpu/gv11b/subctx_gv11b.h b/drivers/gpu/nvgpu/gv11b/subctx_gv11b.h index 357cd254..fdfe9e3b 100644 --- a/drivers/gpu/nvgpu/gv11b/subctx_gv11b.h +++ b/drivers/gpu/nvgpu/gv11b/subctx_gv11b.h @@ -2,7 +2,7 @@ * * Volta GPU series Subcontext * - * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2016 - 2017, NVIDIA CORPORATION. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -24,4 +24,6 @@ int gv11b_alloc_subctx_header(struct channel_gk20a *c); void gv11b_free_subctx_header(struct channel_gk20a *c); int gv11b_update_subctx_header(struct channel_gk20a *c, u64 gpu_va); + +int gv11b_get_max_subctx_count(struct gk20a *g); #endif /* __SUBCONTEXT_GV11B_H__ */ -- cgit v1.2.2