summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gv11b/gr_gv11b.c
diff options
context:
space:
mode:
authorSandarbh Jain <sanjain@nvidia.com>2017-07-27 03:43:37 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-07-28 08:14:04 -0400
commitb859393ffee2b9e29fd3a18f6fc78594fed7eda1 (patch)
tree4e99289bbe2ec45e2dffae0059f136c9c8303c62 /drivers/gpu/nvgpu/gv11b/gr_gv11b.c
parentf457e808f0d1097cec02a022eb42c77a075ef881 (diff)
gpu: nvgpu: gv11b: fix no_of_sm
Number of sm is being reported incorrectly. This is because we are not taking into account that each TPC have 2 sm. Bug 1951026 Change-Id: I7c666aa2a0470a14aad29ab1a80ae9d23958a743 Signed-off-by: Sandarbh Jain <sanjain@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1527771 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Alexander Lewkowicz <alewkowicz@nvidia.com> Tested-by: Alexander Lewkowicz <alewkowicz@nvidia.com> Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gv11b/gr_gv11b.c')
-rw-r--r--drivers/gpu/nvgpu/gv11b/gr_gv11b.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/gpu/nvgpu/gv11b/gr_gv11b.c b/drivers/gpu/nvgpu/gv11b/gr_gv11b.c
index 1ba0c523..850315f7 100644
--- a/drivers/gpu/nvgpu/gv11b/gr_gv11b.c
+++ b/drivers/gpu/nvgpu/gv11b/gr_gv11b.c
@@ -2113,24 +2113,29 @@ static void gr_gv11b_detect_sm_arch(struct gk20a *g)
2113 2113
2114static void gr_gv11b_init_sm_id_table(struct gk20a *g) 2114static void gr_gv11b_init_sm_id_table(struct gk20a *g)
2115{ 2115{
2116 u32 gpc, tpc; 2116 u32 gpc, tpc, sm;
2117 u32 sm_id = 0; 2117 u32 sm_id = 0;
2118 u32 sm_per_tpc = nvgpu_get_litter_value(g, GPU_LIT_NUM_SM_PER_TPC);
2118 2119
2119 /* TODO populate smids based on power efficiency */ 2120 /* TODO populate smids based on power efficiency */
2120 for (tpc = 0; tpc < g->gr.max_tpc_per_gpc_count; tpc++) { 2121 for (tpc = 0; tpc < g->gr.max_tpc_per_gpc_count; tpc++) {
2121 for (gpc = 0; gpc < g->gr.gpc_count; gpc++) { 2122 for (gpc = 0; gpc < g->gr.gpc_count; gpc++) {
2122 2123
2123 if (tpc < g->gr.gpc_tpc_count[gpc]) { 2124 if (tpc >= g->gr.gpc_tpc_count[gpc])
2125 continue;
2126
2127 for (sm = 0; sm < sm_per_tpc; sm++) {
2124 g->gr.sm_to_cluster[sm_id].tpc_index = tpc; 2128 g->gr.sm_to_cluster[sm_id].tpc_index = tpc;
2125 g->gr.sm_to_cluster[sm_id].gpc_index = gpc; 2129 g->gr.sm_to_cluster[sm_id].gpc_index = gpc;
2126 g->gr.sm_to_cluster[sm_id].sm_index = sm_id % 2; 2130 g->gr.sm_to_cluster[sm_id].sm_index = sm_id % 2;
2127 g->gr.sm_to_cluster[sm_id].global_tpc_index = 2131 g->gr.sm_to_cluster[sm_id].global_tpc_index =
2128 sm_id; 2132 tpc;
2129 sm_id++; 2133 sm_id++;
2130 } 2134 }
2131 } 2135 }
2132 } 2136 }
2133 g->gr.no_of_sm = sm_id; 2137 g->gr.no_of_sm = sm_id;
2138 nvgpu_log_info(g, " total number of sm = %d", g->gr.no_of_sm);
2134} 2139}
2135 2140
2136static void gr_gv11b_program_sm_id_numbering(struct gk20a *g, 2141static void gr_gv11b_program_sm_id_numbering(struct gk20a *g,
@@ -2156,7 +2161,7 @@ static int gr_gv11b_load_smid_config(struct gk20a *g)
2156 u32 *tpc_sm_id; 2161 u32 *tpc_sm_id;
2157 u32 i, j; 2162 u32 i, j;
2158 u32 tpc_index, gpc_index, tpc_id; 2163 u32 tpc_index, gpc_index, tpc_id;
2159 u32 sms_per_tpc = nvgpu_get_litter_value(g, GPU_LIT_NUM_SM_PER_TPC); 2164 u32 sm_per_tpc = nvgpu_get_litter_value(g, GPU_LIT_NUM_SM_PER_TPC);
2160 int num_gpcs = nvgpu_get_litter_value(g, GPU_LIT_NUM_GPCS); 2165 int num_gpcs = nvgpu_get_litter_value(g, GPU_LIT_NUM_GPCS);
2161 2166
2162 tpc_sm_id = kcalloc(gr_cwd_sm_id__size_1_v(), sizeof(u32), GFP_KERNEL); 2167 tpc_sm_id = kcalloc(gr_cwd_sm_id__size_1_v(), sizeof(u32), GFP_KERNEL);
@@ -2174,7 +2179,7 @@ static int gr_gv11b_load_smid_config(struct gk20a *g)
2174 u32 bits; 2179 u32 bits;
2175 2180
2176 tpc_id = (i << 2) + j; 2181 tpc_id = (i << 2) + j;
2177 sm_id = tpc_id * sms_per_tpc; 2182 sm_id = tpc_id * sm_per_tpc;
2178 2183
2179 if (sm_id >= g->gr.no_of_sm) 2184 if (sm_id >= g->gr.no_of_sm)
2180 break; 2185 break;