summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a')
-rw-r--r--drivers/gpu/nvgpu/gk20a/hal_gk20a.c17
-rw-r--r--drivers/gpu/nvgpu/gk20a/ltc_gk20a.c33
-rw-r--r--drivers/gpu/nvgpu/gk20a/ltc_gk20a.h20
3 files changed, 43 insertions, 27 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/hal_gk20a.c b/drivers/gpu/nvgpu/gk20a/hal_gk20a.c
index b19398a6..27ddbca1 100644
--- a/drivers/gpu/nvgpu/gk20a/hal_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/hal_gk20a.c
@@ -43,7 +43,20 @@
43 43
44#include <nvgpu/hw/gk20a/hw_proj_gk20a.h> 44#include <nvgpu/hw/gk20a/hw_proj_gk20a.h>
45 45
46static struct gpu_ops gk20a_ops = { 46static const struct gpu_ops gk20a_ops = {
47 .ltc = {
48 .determine_L2_size_bytes = gk20a_determine_L2_size_bytes,
49 .init_comptags = gk20a_ltc_init_comptags,
50 .cbc_ctrl = gk20a_ltc_cbc_ctrl,
51 .set_zbc_color_entry = gk20a_ltc_set_zbc_color_entry,
52 .set_zbc_depth_entry = gk20a_ltc_set_zbc_depth_entry,
53 .init_cbc = gk20a_ltc_init_cbc,
54#ifdef CONFIG_DEBUG_FS
55 .sync_debugfs = gk20a_ltc_sync_debugfs,
56#endif
57 .init_fs_state = gk20a_ltc_init_fs_state,
58 .isr = gk20a_ltc_isr,
59 },
47 .clock_gating = { 60 .clock_gating = {
48 .slcg_gr_load_gating_prod = 61 .slcg_gr_load_gating_prod =
49 gr_gk20a_slcg_gr_load_gating_prod, 62 gr_gk20a_slcg_gr_load_gating_prod,
@@ -151,6 +164,7 @@ int gk20a_init_hal(struct gk20a *g)
151 struct gpu_ops *gops = &g->ops; 164 struct gpu_ops *gops = &g->ops;
152 struct nvgpu_gpu_characteristics *c = &g->gpu_characteristics; 165 struct nvgpu_gpu_characteristics *c = &g->gpu_characteristics;
153 166
167 gops->ltc = gk20a_ops.ltc;
154 gops->clock_gating = gk20a_ops.clock_gating; 168 gops->clock_gating = gk20a_ops.clock_gating;
155 gops->privsecurity = 0; 169 gops->privsecurity = 0;
156 gops->securegpccs = 0; 170 gops->securegpccs = 0;
@@ -158,7 +172,6 @@ int gk20a_init_hal(struct gk20a *g)
158 gk20a_init_bus(gops); 172 gk20a_init_bus(gops);
159 gk20a_init_mc(gops); 173 gk20a_init_mc(gops);
160 gk20a_init_priv_ring(gops); 174 gk20a_init_priv_ring(gops);
161 gk20a_init_ltc(gops);
162 gk20a_init_gr_ops(gops); 175 gk20a_init_gr_ops(gops);
163 gk20a_init_fecs_trace_ops(gops); 176 gk20a_init_fecs_trace_ops(gops);
164 gk20a_init_fb(gops); 177 gk20a_init_fb(gops);
diff --git a/drivers/gpu/nvgpu/gk20a/ltc_gk20a.c b/drivers/gpu/nvgpu/gk20a/ltc_gk20a.c
index 1d517c27..9220685a 100644
--- a/drivers/gpu/nvgpu/gk20a/ltc_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/ltc_gk20a.c
@@ -51,7 +51,7 @@ int gk20a_ltc_alloc_virt_cbc(struct gk20a *g, size_t compbit_backing_size)
51} 51}
52 52
53/* HW reg dependent stuff: */ 53/* HW reg dependent stuff: */
54static int gk20a_ltc_init_comptags(struct gk20a *g, struct gr_gk20a *gr) 54int gk20a_ltc_init_comptags(struct gk20a *g, struct gr_gk20a *gr)
55{ 55{
56 /* max memory size (MB) to cover */ 56 /* max memory size (MB) to cover */
57 u32 max_size = gr->max_comptag_mem; 57 u32 max_size = gr->max_comptag_mem;
@@ -125,7 +125,7 @@ static int gk20a_ltc_init_comptags(struct gk20a *g, struct gr_gk20a *gr)
125 return 0; 125 return 0;
126} 126}
127 127
128static int gk20a_ltc_cbc_ctrl(struct gk20a *g, enum gk20a_cbc_op op, 128int gk20a_ltc_cbc_ctrl(struct gk20a *g, enum gk20a_cbc_op op,
129 u32 min, u32 max) 129 u32 min, u32 max)
130{ 130{
131 int err = 0; 131 int err = 0;
@@ -196,14 +196,14 @@ out:
196} 196}
197 197
198 198
199static void gk20a_ltc_init_fs_state(struct gk20a *g) 199void gk20a_ltc_init_fs_state(struct gk20a *g)
200{ 200{
201 gk20a_dbg_info("initialize gk20a L2"); 201 gk20a_dbg_info("initialize gk20a L2");
202 202
203 g->max_ltc_count = g->ltc_count = 1; 203 g->max_ltc_count = g->ltc_count = 1;
204} 204}
205 205
206static void gk20a_ltc_isr(struct gk20a *g) 206void gk20a_ltc_isr(struct gk20a *g)
207{ 207{
208 u32 intr; 208 u32 intr;
209 209
@@ -212,7 +212,7 @@ static void gk20a_ltc_isr(struct gk20a *g)
212 gk20a_writel(g, ltc_ltc0_ltss_intr_r(), intr); 212 gk20a_writel(g, ltc_ltc0_ltss_intr_r(), intr);
213} 213}
214 214
215static int gk20a_determine_L2_size_bytes(struct gk20a *g) 215int gk20a_determine_L2_size_bytes(struct gk20a *g)
216{ 216{
217 u32 lts_per_ltc; 217 u32 lts_per_ltc;
218 u32 ways; 218 u32 ways;
@@ -256,7 +256,7 @@ static int gk20a_determine_L2_size_bytes(struct gk20a *g)
256/* 256/*
257 * Sets the ZBC color for the passed index. 257 * Sets the ZBC color for the passed index.
258 */ 258 */
259static void gk20a_ltc_set_zbc_color_entry(struct gk20a *g, 259void gk20a_ltc_set_zbc_color_entry(struct gk20a *g,
260 struct zbc_entry *color_val, 260 struct zbc_entry *color_val,
261 u32 index) 261 u32 index)
262{ 262{
@@ -277,7 +277,7 @@ static void gk20a_ltc_set_zbc_color_entry(struct gk20a *g,
277/* 277/*
278 * Sets the ZBC depth for the passed index. 278 * Sets the ZBC depth for the passed index.
279 */ 279 */
280static void gk20a_ltc_set_zbc_depth_entry(struct gk20a *g, 280void gk20a_ltc_set_zbc_depth_entry(struct gk20a *g,
281 struct zbc_entry *depth_val, 281 struct zbc_entry *depth_val,
282 u32 index) 282 u32 index)
283{ 283{
@@ -292,7 +292,7 @@ static void gk20a_ltc_set_zbc_depth_entry(struct gk20a *g,
292 gk20a_readl(g, ltc_ltcs_ltss_dstg_zbc_index_r()); 292 gk20a_readl(g, ltc_ltcs_ltss_dstg_zbc_index_r());
293} 293}
294 294
295static void gk20a_ltc_init_cbc(struct gk20a *g, struct gr_gk20a *gr) 295void gk20a_ltc_init_cbc(struct gk20a *g, struct gr_gk20a *gr)
296{ 296{
297 u32 max_size = gr->max_comptag_mem; 297 u32 max_size = gr->max_comptag_mem;
298 u32 max_comptag_lines = max_size << 3; 298 u32 max_comptag_lines = max_size << 3;
@@ -342,7 +342,7 @@ static void gk20a_ltc_init_cbc(struct gk20a *g, struct gr_gk20a *gr)
342} 342}
343 343
344#ifdef CONFIG_DEBUG_FS 344#ifdef CONFIG_DEBUG_FS
345static void gk20a_ltc_sync_debugfs(struct gk20a *g) 345void gk20a_ltc_sync_debugfs(struct gk20a *g)
346{ 346{
347 u32 reg_f = ltc_ltcs_ltss_tstg_set_mgmt_2_l2_bypass_mode_enabled_f(); 347 u32 reg_f = ltc_ltcs_ltss_tstg_set_mgmt_2_l2_bypass_mode_enabled_f();
348 348
@@ -363,18 +363,3 @@ static void gk20a_ltc_sync_debugfs(struct gk20a *g)
363 nvgpu_spinlock_release(&g->debugfs_lock); 363 nvgpu_spinlock_release(&g->debugfs_lock);
364} 364}
365#endif 365#endif
366
367void gk20a_init_ltc(struct gpu_ops *gops)
368{
369 gops->ltc.determine_L2_size_bytes = gk20a_determine_L2_size_bytes;
370 gops->ltc.init_comptags = gk20a_ltc_init_comptags;
371 gops->ltc.cbc_ctrl = gk20a_ltc_cbc_ctrl;
372 gops->ltc.set_zbc_color_entry = gk20a_ltc_set_zbc_color_entry;
373 gops->ltc.set_zbc_depth_entry = gk20a_ltc_set_zbc_depth_entry;
374 gops->ltc.init_cbc = gk20a_ltc_init_cbc;
375#ifdef CONFIG_DEBUG_FS
376 gops->ltc.sync_debugfs = gk20a_ltc_sync_debugfs;
377#endif
378 gops->ltc.init_fs_state = gk20a_ltc_init_fs_state;
379 gops->ltc.isr = gk20a_ltc_isr;
380}
diff --git a/drivers/gpu/nvgpu/gk20a/ltc_gk20a.h b/drivers/gpu/nvgpu/gk20a/ltc_gk20a.h
index 30d4163f..ee7d7f91 100644
--- a/drivers/gpu/nvgpu/gk20a/ltc_gk20a.h
+++ b/drivers/gpu/nvgpu/gk20a/ltc_gk20a.h
@@ -16,8 +16,26 @@
16#ifndef LTC_GK20A_H 16#ifndef LTC_GK20A_H
17#define LTC_GK20A_H 17#define LTC_GK20A_H
18struct gpu_ops; 18struct gpu_ops;
19struct gr_gk20a;
20struct zbc_entry;
21enum gk20a_cbc_op;
19 22
20void gk20a_init_ltc(struct gpu_ops *gops); 23int gk20a_ltc_init_comptags(struct gk20a *g, struct gr_gk20a *gr);
24int gk20a_ltc_cbc_ctrl(struct gk20a *g, enum gk20a_cbc_op op,
25 u32 min, u32 max);
26void gk20a_ltc_init_fs_state(struct gk20a *g);
27void gk20a_ltc_isr(struct gk20a *g);
28int gk20a_determine_L2_size_bytes(struct gk20a *g);
29void gk20a_ltc_set_zbc_color_entry(struct gk20a *g,
30 struct zbc_entry *color_val,
31 u32 index);
32void gk20a_ltc_set_zbc_depth_entry(struct gk20a *g,
33 struct zbc_entry *depth_val,
34 u32 index);
35void gk20a_ltc_init_cbc(struct gk20a *g, struct gr_gk20a *gr);
36#ifdef CONFIG_DEBUG_FS
37void gk20a_ltc_sync_debugfs(struct gk20a *g);
38#endif
21int gk20a_ltc_alloc_phys_cbc(struct gk20a *g, size_t compbit_backing_size); 39int gk20a_ltc_alloc_phys_cbc(struct gk20a *g, size_t compbit_backing_size);
22int gk20a_ltc_alloc_virt_cbc(struct gk20a *g, size_t compbit_backing_size); 40int gk20a_ltc_alloc_virt_cbc(struct gk20a *g, size_t compbit_backing_size);
23#endif 41#endif