diff options
author | Bo Yan <byan@nvidia.com> | 2014-04-01 02:47:53 -0400 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2015-03-18 15:09:37 -0400 |
commit | 2531751f53fc21bdeb0ece4af550ea1e8efb9653 (patch) | |
tree | 26ccad7f96afa188298445a296c8b33fdd80ea91 /drivers/gpu/nvgpu/gk20a | |
parent | 69cfb8a254b0f1b042f5dc5d255df7c1821293aa (diff) |
video: tegra: gk20a: remove redundant code
gk20a_ltc_init_comptags and gk20a_ltc_clear_comptags are defined
in ltc_gk20a.c, gm20b has its own init/clear functions, so remove
these two from ltc_common.c
change nvhost_allocator_init to gk20a_allocator_init, this is a
left-over after rebase, just like the above 2 function definitions,
so fix it.
Change-Id: I829639dd7fee9110dd65d5df7d7f0f8fe5fca6c1
Signed-off-by: Bo Yan <byan@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/ltc_common.c | 136 |
1 files changed, 0 insertions, 136 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/ltc_common.c b/drivers/gpu/nvgpu/gk20a/ltc_common.c index 463c5cf8..ac46a9a0 100644 --- a/drivers/gpu/nvgpu/gk20a/ltc_common.c +++ b/drivers/gpu/nvgpu/gk20a/ltc_common.c | |||
@@ -97,142 +97,6 @@ static void gk20a_ltc_set_max_ways_evict_last(struct gk20a *g, u32 max_ways) | |||
97 | gk20a_writel(g, ltc_ltcs_ltss_tstg_set_mgmt_r(), mgmt_reg); | 97 | gk20a_writel(g, ltc_ltcs_ltss_tstg_set_mgmt_r(), mgmt_reg); |
98 | } | 98 | } |
99 | 99 | ||
100 | static int gk20a_ltc_init_comptags(struct gk20a *g, struct gr_gk20a *gr) | ||
101 | { | ||
102 | struct device *d = dev_from_gk20a(g); | ||
103 | DEFINE_DMA_ATTRS(attrs); | ||
104 | dma_addr_t iova; | ||
105 | |||
106 | /* max memory size (MB) to cover */ | ||
107 | u32 max_size = gr->max_comptag_mem; | ||
108 | /* one tag line covers 128KB */ | ||
109 | u32 max_comptag_lines = max_size << 3; | ||
110 | |||
111 | u32 hw_max_comptag_lines = | ||
112 | ltc_ltcs_ltss_cbc_ctrl3_clear_upper_bound_init_v(); | ||
113 | |||
114 | u32 cbc_param = | ||
115 | gk20a_readl(g, ltc_ltcs_ltss_cbc_param_r()); | ||
116 | u32 comptags_per_cacheline = | ||
117 | ltc_ltcs_ltss_cbc_param_comptags_per_cache_line_v(cbc_param); | ||
118 | u32 slices_per_fbp = | ||
119 | ltc_ltcs_ltss_cbc_param_slices_per_fbp_v(cbc_param); | ||
120 | u32 cacheline_size = | ||
121 | 512 << ltc_ltcs_ltss_cbc_param_cache_line_size_v(cbc_param); | ||
122 | |||
123 | u32 compbit_backing_size; | ||
124 | |||
125 | gk20a_dbg_fn(""); | ||
126 | |||
127 | if (max_comptag_lines == 0) { | ||
128 | gr->compbit_store.size = 0; | ||
129 | return 0; | ||
130 | } | ||
131 | |||
132 | if (max_comptag_lines > hw_max_comptag_lines) | ||
133 | max_comptag_lines = hw_max_comptag_lines; | ||
134 | |||
135 | /* no hybird fb */ | ||
136 | compbit_backing_size = | ||
137 | DIV_ROUND_UP(max_comptag_lines, comptags_per_cacheline) * | ||
138 | cacheline_size * slices_per_fbp * gr->num_fbps; | ||
139 | |||
140 | /* aligned to 2KB * num_fbps */ | ||
141 | compbit_backing_size += | ||
142 | gr->num_fbps << ltc_ltcs_ltss_cbc_base_alignment_shift_v(); | ||
143 | |||
144 | /* must be a multiple of 64KB */ | ||
145 | compbit_backing_size = roundup(compbit_backing_size, 64*1024); | ||
146 | |||
147 | max_comptag_lines = | ||
148 | (compbit_backing_size * comptags_per_cacheline) / | ||
149 | cacheline_size * slices_per_fbp * gr->num_fbps; | ||
150 | |||
151 | if (max_comptag_lines > hw_max_comptag_lines) | ||
152 | max_comptag_lines = hw_max_comptag_lines; | ||
153 | |||
154 | gk20a_dbg_info("compbit backing store size : %d", | ||
155 | compbit_backing_size); | ||
156 | gk20a_dbg_info("max comptag lines : %d", | ||
157 | max_comptag_lines); | ||
158 | |||
159 | dma_set_attr(DMA_ATTR_NO_KERNEL_MAPPING, &attrs); | ||
160 | gr->compbit_store.size = compbit_backing_size; | ||
161 | gr->compbit_store.pages = dma_alloc_attrs(d, gr->compbit_store.size, | ||
162 | &iova, GFP_KERNEL, &attrs); | ||
163 | if (!gr->compbit_store.pages) { | ||
164 | gk20a_err(dev_from_gk20a(g), "failed to allocate" | ||
165 | "backing store for compbit : size %d", | ||
166 | compbit_backing_size); | ||
167 | return -ENOMEM; | ||
168 | } | ||
169 | gr->compbit_store.base_iova = iova; | ||
170 | |||
171 | gk20a_allocator_init(&gr->comp_tags, "comptag", | ||
172 | 1, /* start */ | ||
173 | max_comptag_lines - 1, /* length*/ | ||
174 | 1); /* align */ | ||
175 | |||
176 | return 0; | ||
177 | } | ||
178 | |||
179 | static int gk20a_ltc_clear_comptags(struct gk20a *g, u32 min, u32 max) | ||
180 | { | ||
181 | struct gr_gk20a *gr = &g->gr; | ||
182 | u32 fbp, slice, ctrl1, val; | ||
183 | unsigned long end_jiffies = jiffies + | ||
184 | msecs_to_jiffies(gk20a_get_gr_idle_timeout(g)); | ||
185 | u32 delay = GR_IDLE_CHECK_DEFAULT; | ||
186 | u32 slices_per_fbp = | ||
187 | ltc_ltcs_ltss_cbc_param_slices_per_fbp_v( | ||
188 | gk20a_readl(g, ltc_ltcs_ltss_cbc_param_r())); | ||
189 | |||
190 | gk20a_dbg_fn(""); | ||
191 | |||
192 | if (gr->compbit_store.size == 0) | ||
193 | return 0; | ||
194 | |||
195 | gk20a_writel(g, ltc_ltcs_ltss_cbc_ctrl2_r(), | ||
196 | ltc_ltcs_ltss_cbc_ctrl2_clear_lower_bound_f(min)); | ||
197 | gk20a_writel(g, ltc_ltcs_ltss_cbc_ctrl3_r(), | ||
198 | ltc_ltcs_ltss_cbc_ctrl3_clear_upper_bound_f(max)); | ||
199 | gk20a_writel(g, ltc_ltcs_ltss_cbc_ctrl1_r(), | ||
200 | gk20a_readl(g, ltc_ltcs_ltss_cbc_ctrl1_r()) | | ||
201 | ltc_ltcs_ltss_cbc_ctrl1_clear_active_f()); | ||
202 | |||
203 | for (fbp = 0; fbp < gr->num_fbps; fbp++) { | ||
204 | for (slice = 0; slice < slices_per_fbp; slice++) { | ||
205 | |||
206 | delay = GR_IDLE_CHECK_DEFAULT; | ||
207 | |||
208 | ctrl1 = ltc_ltc0_lts0_cbc_ctrl1_r() + | ||
209 | fbp * proj_ltc_stride_v() + | ||
210 | slice * proj_lts_stride_v(); | ||
211 | |||
212 | do { | ||
213 | val = gk20a_readl(g, ctrl1); | ||
214 | if (ltc_ltcs_ltss_cbc_ctrl1_clear_v(val) != | ||
215 | ltc_ltcs_ltss_cbc_ctrl1_clear_active_v()) | ||
216 | break; | ||
217 | |||
218 | usleep_range(delay, delay * 2); | ||
219 | delay = min_t(u32, delay << 1, | ||
220 | GR_IDLE_CHECK_MAX); | ||
221 | |||
222 | } while (time_before(jiffies, end_jiffies) || | ||
223 | !tegra_platform_is_silicon()); | ||
224 | |||
225 | if (!time_before(jiffies, end_jiffies)) { | ||
226 | gk20a_err(dev_from_gk20a(g), | ||
227 | "comp tag clear timeout\n"); | ||
228 | return -EBUSY; | ||
229 | } | ||
230 | } | ||
231 | } | ||
232 | |||
233 | return 0; | ||
234 | } | ||
235 | |||
236 | /* | 100 | /* |
237 | * Sets the ZBC color for the passed index. | 101 | * Sets the ZBC color for the passed index. |
238 | */ | 102 | */ |