summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gp10b/ltc_gp10b.c
diff options
context:
space:
mode:
authorTerje Bergstrom <tbergstrom@nvidia.com>2015-01-27 12:19:10 -0500
committerDeepak Nibade <dnibade@nvidia.com>2016-12-27 04:52:03 -0500
commitc0fcbdf2fc853e6eaf60af131c6de1624d4d4858 (patch)
treebf0e93f0352894cc061669ea65e866e41b8385da /drivers/gpu/nvgpu/gp10b/ltc_gp10b.c
parentdf6d5ab07b5f68704ec392b1465331a47e682d4d (diff)
gpu: nvgpu: gp10b: Compression page size to 64k
Define compression page size for gp10b to be 64k. We also need to copy some LTC initialization code from gm20b to gp10b. Change-Id: I0235c32cdb1486a23d33eb98ebbc79c97a3c32d4 Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: http://git-master/r/677837
Diffstat (limited to 'drivers/gpu/nvgpu/gp10b/ltc_gp10b.c')
-rw-r--r--drivers/gpu/nvgpu/gp10b/ltc_gp10b.c95
1 files changed, 93 insertions, 2 deletions
diff --git a/drivers/gpu/nvgpu/gp10b/ltc_gp10b.c b/drivers/gpu/nvgpu/gp10b/ltc_gp10b.c
index 88f7b072..03454240 100644
--- a/drivers/gpu/nvgpu/gp10b/ltc_gp10b.c
+++ b/drivers/gpu/nvgpu/gp10b/ltc_gp10b.c
@@ -19,6 +19,8 @@
19#include "gm20b/ltc_gm20b.h" 19#include "gm20b/ltc_gm20b.h"
20#include "hw_ltc_gp10b.h" 20#include "hw_ltc_gp10b.h"
21 21
22#include "gk20a/ltc_common.c"
23
22static int gp10b_determine_L2_size_bytes(struct gk20a *g) 24static int gp10b_determine_L2_size_bytes(struct gk20a *g)
23{ 25{
24 u32 tmp; 26 u32 tmp;
@@ -39,9 +41,98 @@ static int gp10b_determine_L2_size_bytes(struct gk20a *g)
39 return ret; 41 return ret;
40} 42}
41 43
42void gp10b_init_ltc(struct gpu_ops *gops) 44static int gp10b_ltc_init_comptags(struct gk20a *g, struct gr_gk20a *gr)
43{ 45{
44 gm20b_init_ltc(gops); 46 /* max memory size (MB) to cover */
47 u32 max_size = gr->max_comptag_mem;
48 /* one tag line covers 64KB */
49 u32 max_comptag_lines = max_size << 4;
50
51 u32 hw_max_comptag_lines =
52 ltc_ltcs_ltss_cbc_ctrl3_clear_upper_bound_init_v();
53
54 u32 cbc_param =
55 gk20a_readl(g, ltc_ltcs_ltss_cbc_param_r());
56 u32 comptags_per_cacheline =
57 ltc_ltcs_ltss_cbc_param_comptags_per_cache_line_v(cbc_param);
58 u32 cacheline_size =
59 512 << ltc_ltcs_ltss_cbc_param_cache_line_size_v(cbc_param);
60 u32 slices_per_ltc =
61 ltc_ltcs_ltss_cbc_param_slices_per_ltc_v(cbc_param);
62
63 u32 compbit_backing_size;
64
65 int err;
66
67 gk20a_dbg_fn("");
68
69 if (max_comptag_lines == 0) {
70 gr->compbit_store.size = 0;
71 return 0;
72 }
73
74 if (max_comptag_lines > hw_max_comptag_lines)
75 max_comptag_lines = hw_max_comptag_lines;
76
77 compbit_backing_size =
78 DIV_ROUND_UP(max_comptag_lines, comptags_per_cacheline) *
79 cacheline_size * slices_per_ltc * g->ltc_count;
80
81 /* aligned to 2KB * ltc_count */
82 compbit_backing_size +=
83 g->ltc_count << ltc_ltcs_ltss_cbc_base_alignment_shift_v();
84
85 /* must be a multiple of 64KB */
86 compbit_backing_size = roundup(compbit_backing_size, 64*1024);
45 87
88 max_comptag_lines =
89 (compbit_backing_size * comptags_per_cacheline) /
90 (cacheline_size * slices_per_ltc * g->ltc_count);
91
92 if (max_comptag_lines > hw_max_comptag_lines)
93 max_comptag_lines = hw_max_comptag_lines;
94
95 gk20a_dbg_info("compbit backing store size : %d",
96 compbit_backing_size);
97 gk20a_dbg_info("max comptag lines : %d",
98 max_comptag_lines);
99
100 if (tegra_platform_is_linsim())
101 err = gk20a_ltc_alloc_phys_cbc(g, compbit_backing_size);
102 else
103 err = gk20a_ltc_alloc_virt_cbc(g, compbit_backing_size);
104
105 if (err)
106 return err;
107
108 gk20a_allocator_init(&gr->comp_tags, "comptag",
109 1, /* start */
110 max_comptag_lines - 1); /* length*/
111
112 gr->comptags_per_cacheline = comptags_per_cacheline;
113 gr->slices_per_ltc = slices_per_ltc;
114 gr->cacheline_size = cacheline_size;
115
116 return 0;
117}
118
119void gp10b_init_ltc(struct gpu_ops *gops)
120{
46 gops->ltc.determine_L2_size_bytes = gp10b_determine_L2_size_bytes; 121 gops->ltc.determine_L2_size_bytes = gp10b_determine_L2_size_bytes;
122 gops->ltc.set_max_ways_evict_last = gk20a_ltc_set_max_ways_evict_last;
123 gops->ltc.set_zbc_color_entry = gk20a_ltc_set_zbc_color_entry;
124 gops->ltc.set_zbc_depth_entry = gk20a_ltc_set_zbc_depth_entry;
125 gops->ltc.init_cbc = gk20a_ltc_init_cbc;
126
127 /* GM20b specific ops. */
128 gops->ltc.init_fs_state = gm20b_ltc_init_fs_state;
129 gops->ltc.init_comptags = gp10b_ltc_init_comptags;
130 gops->ltc.cbc_ctrl = gm20b_ltc_cbc_ctrl;
131 gops->ltc.elpg_flush = gm20b_ltc_g_elpg_flush_locked;
132 gops->ltc.isr = gm20b_ltc_isr;
133 gops->ltc.cbc_fix_config = gm20b_ltc_cbc_fix_config;
134 gops->ltc.flush = gm20b_flush_ltc;
135#ifdef CONFIG_DEBUG_FS
136 gops->ltc.sync_debugfs = gk20a_ltc_sync_debugfs;
137#endif
47} 138}