diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/nvgpu/gv11b/gr_gv11b.c | 15 |
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 | ||
2114 | static void gr_gv11b_init_sm_id_table(struct gk20a *g) | 2114 | static 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 | ||
2136 | static void gr_gv11b_program_sm_id_numbering(struct gk20a *g, | 2141 | static 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; |