From 5463b04f509c46131a729b62f0c0102fb7830b56 Mon Sep 17 00:00:00 2001 From: Deepak Nibade Date: Fri, 8 Dec 2017 01:20:38 -0800 Subject: gpu: nvgpu: fix gpc_tpc_mask setting for gv11b Pre-gv11b we only had 2 TPCs in a GPC. But on gv11b we have 4 TPCs in a GPC. Hence update gr_gv11b_set_gpc_tpc_mask() as per new configuration and allow setting bits based on number of TPCs Bug 2031635 Change-Id: I44f5f6ce5f3e2501c229c9fcda36fb330ebf8bd0 Signed-off-by: Deepak Nibade Reviewed-on: https://git-master.nvidia.com/r/1614044 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/gv11b/gr_gv11b.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'drivers') diff --git a/drivers/gpu/nvgpu/gv11b/gr_gv11b.c b/drivers/gpu/nvgpu/gv11b/gr_gv11b.c index 28812792..033d83d5 100644 --- a/drivers/gpu/nvgpu/gv11b/gr_gv11b.c +++ b/drivers/gpu/nvgpu/gv11b/gr_gv11b.c @@ -1683,15 +1683,29 @@ void gr_gv11b_commit_global_attrib_cb(struct gk20a *g, void gr_gv11b_set_gpc_tpc_mask(struct gk20a *g, u32 gpc_index) { + u32 tpc_count_mask; + u32 fuse_val; + + if (!g->gr.gpc_tpc_mask[gpc_index]) + return; + + /* + * For s/w value g->gr.gpc_tpc_mask[gpc_index], bit value 1 indicates + * corresponding TPC is enabled. But for h/w fuse register, bit value 1 + * indicates corresponding TPC is disabled. + * So we need to flip the bits and ensure we don't write to bits greater + * than TPC count + */ + tpc_count_mask = (1 << gr_gk20a_get_tpc_count(&g->gr, gpc_index)) - 1; + + fuse_val = g->gr.gpc_tpc_mask[gpc_index]; + fuse_val = ~fuse_val; + fuse_val = fuse_val & tpc_count_mask; + nvgpu_tegra_fuse_write_bypass(g, 0x1); nvgpu_tegra_fuse_write_access_sw(g, 0x0); - if (g->gr.gpc_tpc_mask[gpc_index] == 0x1) - nvgpu_tegra_fuse_write_opt_gpu_tpc0_disable(g, 0x2); - else if (g->gr.gpc_tpc_mask[gpc_index] == 0x2) - nvgpu_tegra_fuse_write_opt_gpu_tpc0_disable(g, 0x1); - else - nvgpu_tegra_fuse_write_opt_gpu_tpc0_disable(g, 0x0); + nvgpu_tegra_fuse_write_opt_gpu_tpc0_disable(g, fuse_val); } void gr_gv11b_get_access_map(struct gk20a *g, -- cgit v1.2.2