diff options
author | sujeet baranwal <sbaranwal@nvidia.com> | 2015-03-02 18:36:22 -0500 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2015-04-04 21:58:04 -0400 |
commit | 895675e1d5790e2361b22edb50d702f7dd9a8edd (patch) | |
tree | dbe3586cec5351fd2c2eb13d91c258e663d73b08 /drivers/gpu/nvgpu/gk20a/gr_gk20a.c | |
parent | cf0085ec231246748b34081d2786c29cedcbd706 (diff) |
gpu: nvgpu: Removal of regops from CUDA driver
The current CUDA drivers have been using the regops to
directly accessing the GPU registers from user space through
the dbg node. This is a security hole and needs to be avoided.
The patch alternatively implements the similar functionality
in the kernel and provide an ioctl for it.
Bug 200083334
Change-Id: Ic5ff5a215cbabe7a46837bc4e15efcceb0df0367
Signed-off-by: sujeet baranwal <sbaranwal@nvidia.com>
Reviewed-on: http://git-master/r/711758
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Tested-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/gr_gk20a.c')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/gr_gk20a.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c index 4217658c..7e8d4e13 100644 --- a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c | |||
@@ -1273,7 +1273,6 @@ static int gr_gk20a_ctx_state_floorsweep(struct gk20a *g) | |||
1273 | u32 tpc_index, gpc_index; | 1273 | u32 tpc_index, gpc_index; |
1274 | u32 tpc_offset, gpc_offset; | 1274 | u32 tpc_offset, gpc_offset; |
1275 | u32 sm_id = 0, gpc_id = 0; | 1275 | u32 sm_id = 0, gpc_id = 0; |
1276 | u32 sm_id_to_gpc_id[proj_scal_max_gpcs_v() * proj_scal_max_tpc_per_gpc_v()]; | ||
1277 | u32 tpc_per_gpc; | 1276 | u32 tpc_per_gpc; |
1278 | u32 max_ways_evict = INVALID_MAX_WAYS; | 1277 | u32 max_ways_evict = INVALID_MAX_WAYS; |
1279 | u32 l1c_dbg_reg_val; | 1278 | u32 l1c_dbg_reg_val; |
@@ -1295,7 +1294,9 @@ static int gr_gk20a_ctx_state_floorsweep(struct gk20a *g) | |||
1295 | gk20a_writel(g, gr_gpc0_tpc0_pe_cfg_smid_r() + gpc_offset + tpc_offset, | 1294 | gk20a_writel(g, gr_gpc0_tpc0_pe_cfg_smid_r() + gpc_offset + tpc_offset, |
1296 | gr_gpc0_tpc0_pe_cfg_smid_value_f(sm_id)); | 1295 | gr_gpc0_tpc0_pe_cfg_smid_value_f(sm_id)); |
1297 | 1296 | ||
1298 | sm_id_to_gpc_id[sm_id] = gpc_index; | 1297 | g->gr.sm_to_cluster[sm_id].tpc_index = tpc_index; |
1298 | g->gr.sm_to_cluster[sm_id].gpc_index = gpc_index; | ||
1299 | |||
1299 | sm_id++; | 1300 | sm_id++; |
1300 | } | 1301 | } |
1301 | 1302 | ||
@@ -1306,6 +1307,8 @@ static int gr_gk20a_ctx_state_floorsweep(struct gk20a *g) | |||
1306 | } | 1307 | } |
1307 | } | 1308 | } |
1308 | 1309 | ||
1310 | gr->no_of_sm = sm_id; | ||
1311 | |||
1309 | for (tpc_index = 0, gpc_id = 0; | 1312 | for (tpc_index = 0, gpc_id = 0; |
1310 | tpc_index < gr_pd_num_tpc_per_gpc__size_1_v(); | 1313 | tpc_index < gr_pd_num_tpc_per_gpc__size_1_v(); |
1311 | tpc_index++, gpc_id += 8) { | 1314 | tpc_index++, gpc_id += 8) { |
@@ -2997,6 +3000,7 @@ static void gk20a_remove_gr_support(struct gr_gk20a *gr) | |||
2997 | kfree(gr->pes_tpc_count[1]); | 3000 | kfree(gr->pes_tpc_count[1]); |
2998 | kfree(gr->pes_tpc_mask[0]); | 3001 | kfree(gr->pes_tpc_mask[0]); |
2999 | kfree(gr->pes_tpc_mask[1]); | 3002 | kfree(gr->pes_tpc_mask[1]); |
3003 | kfree(gr->sm_to_cluster); | ||
3000 | kfree(gr->gpc_skip_mask); | 3004 | kfree(gr->gpc_skip_mask); |
3001 | kfree(gr->map_tiles); | 3005 | kfree(gr->map_tiles); |
3002 | gr->gpc_tpc_count = NULL; | 3006 | gr->gpc_tpc_count = NULL; |
@@ -3089,6 +3093,7 @@ static int gr_gk20a_init_gr_config(struct gk20a *g, struct gr_gk20a *gr) | |||
3089 | gr->pes_tpc_count[1] = kzalloc(gr->gpc_count * sizeof(u32), GFP_KERNEL); | 3093 | gr->pes_tpc_count[1] = kzalloc(gr->gpc_count * sizeof(u32), GFP_KERNEL); |
3090 | gr->pes_tpc_mask[0] = kzalloc(gr->gpc_count * sizeof(u32), GFP_KERNEL); | 3094 | gr->pes_tpc_mask[0] = kzalloc(gr->gpc_count * sizeof(u32), GFP_KERNEL); |
3091 | gr->pes_tpc_mask[1] = kzalloc(gr->gpc_count * sizeof(u32), GFP_KERNEL); | 3095 | gr->pes_tpc_mask[1] = kzalloc(gr->gpc_count * sizeof(u32), GFP_KERNEL); |
3096 | |||
3092 | gr->gpc_skip_mask = | 3097 | gr->gpc_skip_mask = |
3093 | kzalloc(gr_pd_dist_skip_table__size_1_v() * 4 * sizeof(u32), | 3098 | kzalloc(gr_pd_dist_skip_table__size_1_v() * 4 * sizeof(u32), |
3094 | GFP_KERNEL); | 3099 | GFP_KERNEL); |
@@ -3159,6 +3164,10 @@ static int gr_gk20a_init_gr_config(struct gk20a *g, struct gr_gk20a *gr) | |||
3159 | gr->gpc_skip_mask[gpc_index] = gpc_new_skip_mask; | 3164 | gr->gpc_skip_mask[gpc_index] = gpc_new_skip_mask; |
3160 | } | 3165 | } |
3161 | 3166 | ||
3167 | gr->sm_to_cluster = kzalloc(gr->gpc_count * gr->tpc_count * | ||
3168 | sizeof(struct sm_info), GFP_KERNEL); | ||
3169 | gr->no_of_sm = 0; | ||
3170 | |||
3162 | gk20a_dbg_info("fbps: %d", gr->num_fbps); | 3171 | gk20a_dbg_info("fbps: %d", gr->num_fbps); |
3163 | gk20a_dbg_info("max_gpc_count: %d", gr->max_gpc_count); | 3172 | gk20a_dbg_info("max_gpc_count: %d", gr->max_gpc_count); |
3164 | gk20a_dbg_info("max_fbps_count: %d", gr->max_fbps_count); | 3173 | gk20a_dbg_info("max_fbps_count: %d", gr->max_fbps_count); |