summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/nvgpu/gv11b/gr_gv11b.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/gv11b/gr_gv11b.c b/drivers/gpu/nvgpu/gv11b/gr_gv11b.c
index eefbdf3b..00bfde6b 100644
--- a/drivers/gpu/nvgpu/gv11b/gr_gv11b.c
+++ b/drivers/gpu/nvgpu/gv11b/gr_gv11b.c
@@ -30,6 +30,7 @@
30#include "gk20a/gr_gk20a.h" 30#include "gk20a/gr_gk20a.h"
31#include "gk20a/dbg_gpu_gk20a.h" 31#include "gk20a/dbg_gpu_gk20a.h"
32#include "gk20a/regops_gk20a.h" 32#include "gk20a/regops_gk20a.h"
33#include "gk20a/gr_pri_gk20a.h"
33 34
34#include "gm20b/gr_gm20b.h" 35#include "gm20b/gr_gm20b.h"
35 36
@@ -3334,6 +3335,49 @@ static void gv11b_gr_get_ovr_perf_regs(struct gk20a *g, u32 *num_ovr_perf_regs,
3334 *ovr_perf_regs = _ovr_perf_regs; 3335 *ovr_perf_regs = _ovr_perf_regs;
3335} 3336}
3336 3337
3338static void gv11b_gr_access_smpc_reg(struct gk20a *g, u32 quad, u32 offset)
3339{
3340 u32 reg_val;
3341 u32 quad_ctrl;
3342 u32 half_ctrl;
3343 u32 tpc, gpc;
3344 u32 gpc_tpc_addr;
3345 u32 gpc_tpc_stride;
3346 u32 gpc_stride = nvgpu_get_litter_value(g, GPU_LIT_GPC_STRIDE);
3347 u32 tpc_in_gpc_stride = nvgpu_get_litter_value(g,
3348 GPU_LIT_TPC_IN_GPC_STRIDE);
3349
3350 nvgpu_log(g, gpu_dbg_fn | gpu_dbg_gpu_dbg, "offset=0x%x", offset);
3351
3352 gpc = pri_get_gpc_num(g, offset);
3353 gpc_tpc_addr = pri_gpccs_addr_mask(offset);
3354 tpc = g->ops.gr.get_tpc_num(g, gpc_tpc_addr);
3355
3356 quad_ctrl = quad & 0x1; /* first bit tells us quad */
3357 half_ctrl = (quad >> 1) & 0x1; /* second bit tells us half */
3358
3359 gpc_tpc_stride = gpc * gpc_stride + tpc * tpc_in_gpc_stride;
3360 gpc_tpc_addr = gr_gpc0_tpc0_sm_halfctl_ctrl_r() + gpc_tpc_stride;
3361
3362 /* read from unicast reg */
3363 reg_val = gk20a_readl(g, gpc_tpc_addr);
3364 reg_val = set_field(reg_val,
3365 gr_gpcs_tpcs_sm_halfctl_ctrl_sctl_read_quad_ctl_m(),
3366 gr_gpcs_tpcs_sm_halfctl_ctrl_sctl_read_quad_ctl_f(quad_ctrl));
3367
3368 /* write to broadcast reg */
3369 gk20a_writel(g, gr_gpcs_tpcs_sm_halfctl_ctrl_r(), reg_val);
3370
3371 gpc_tpc_addr = gr_gpc0_tpc0_sm_debug_sfe_control_r() + gpc_tpc_stride;
3372 reg_val = gk20a_readl(g, gpc_tpc_addr);
3373 reg_val = set_field(reg_val,
3374 gr_gpcs_tpcs_sm_debug_sfe_control_read_half_ctl_m(),
3375 gr_gpcs_tpcs_sm_debug_sfe_control_read_half_ctl_f(half_ctrl));
3376
3377 /* write to broadcast reg */
3378 gk20a_writel(g, gr_gpcs_tpcs_sm_debug_sfe_control_r(), reg_val);
3379}
3380
3337void gv11b_init_gr(struct gpu_ops *gops) 3381void gv11b_init_gr(struct gpu_ops *gops)
3338{ 3382{
3339 gp10b_init_gr(gops); 3383 gp10b_init_gr(gops);
@@ -3423,4 +3467,5 @@ void gv11b_init_gr(struct gpu_ops *gops)
3423 gops->gr.get_sm_dsm_perf_regs = gv11b_gr_get_sm_dsm_perf_regs; 3467 gops->gr.get_sm_dsm_perf_regs = gv11b_gr_get_sm_dsm_perf_regs;
3424 gops->gr.get_sm_dsm_perf_ctrl_regs = gv11b_gr_get_sm_dsm_perf_ctrl_regs; 3468 gops->gr.get_sm_dsm_perf_ctrl_regs = gv11b_gr_get_sm_dsm_perf_ctrl_regs;
3425 gops->gr.get_ovr_perf_regs = gv11b_gr_get_ovr_perf_regs; 3469 gops->gr.get_ovr_perf_regs = gv11b_gr_get_ovr_perf_regs;
3470 gops->gr.access_smpc_reg = gv11b_gr_access_smpc_reg;
3426} 3471}