diff options
author | Sunny He <suhe@nvidia.com> | 2017-06-22 19:43:51 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-06-27 13:44:11 -0400 |
commit | 0dc80244eea4c7e504976d8028a3ddb72ba60b0e (patch) | |
tree | 99e87c3d5cab98a4593a7bb0fe2737d72ccfb805 /drivers/gpu | |
parent | 773df3f5e9fdda028ade319990d1b672ce68592f (diff) |
gpu: nvgpu: Reorganize ltc HAL initialization
Reorganize HAL initialization to remove inheritance and construct
the gpu_ops struct at compile time. This patch only covers the ltc
sub-module of the gpu_ops struct.
Perform HAL function assignments in hal_gxxxx.c through the
population of a chip-specific copy of gpu_ops.
Jira NVGPU-74
Change-Id: I1110e301e57b502cf7f97e6739424cb33cc52a69
Signed-off-by: Sunny He <suhe@nvidia.com>
Reviewed-on: https://git-master/r/1507564
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/nvgpu/Makefile.nvgpu | 1 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/hal_gk20a.c | 17 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/ltc_gk20a.c | 33 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/ltc_gk20a.h | 20 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gm20b/hal_gm20b.c | 20 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gm20b/ltc_gm20b.c | 26 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gm20b/ltc_gm20b.h | 7 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gp106/hal_gp106.c | 22 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gp106/ltc_gp106.c | 27 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gp106/ltc_gp106.h | 19 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gp10b/hal_gp10b.c | 20 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gp10b/ltc_gp10b.c | 27 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gp10b/ltc_gp10b.h | 10 |
13 files changed, 117 insertions, 132 deletions
diff --git a/drivers/gpu/nvgpu/Makefile.nvgpu b/drivers/gpu/nvgpu/Makefile.nvgpu index 6ffbdc44..cc1632a0 100644 --- a/drivers/gpu/nvgpu/Makefile.nvgpu +++ b/drivers/gpu/nvgpu/Makefile.nvgpu | |||
@@ -197,7 +197,6 @@ nvgpu-y += \ | |||
197 | gp106/acr_gp106.o \ | 197 | gp106/acr_gp106.o \ |
198 | gp106/sec2_gp106.o \ | 198 | gp106/sec2_gp106.o \ |
199 | gp106/fifo_gp106.o \ | 199 | gp106/fifo_gp106.o \ |
200 | gp106/ltc_gp106.o \ | ||
201 | gp106/fb_gp106.o \ | 200 | gp106/fb_gp106.o \ |
202 | gp106/regops_gp106.o \ | 201 | gp106/regops_gp106.o \ |
203 | pstate/pstate.o \ | 202 | pstate/pstate.o \ |
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 | ||
46 | static struct gpu_ops gk20a_ops = { | 46 | static 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: */ |
54 | static int gk20a_ltc_init_comptags(struct gk20a *g, struct gr_gk20a *gr) | 54 | int 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 | ||
128 | static int gk20a_ltc_cbc_ctrl(struct gk20a *g, enum gk20a_cbc_op op, | 128 | int 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 | ||
199 | static void gk20a_ltc_init_fs_state(struct gk20a *g) | 199 | void 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 | ||
206 | static void gk20a_ltc_isr(struct gk20a *g) | 206 | void 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 | ||
215 | static int gk20a_determine_L2_size_bytes(struct gk20a *g) | 215 | int 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 | */ |
259 | static void gk20a_ltc_set_zbc_color_entry(struct gk20a *g, | 259 | void 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 | */ |
280 | static void gk20a_ltc_set_zbc_depth_entry(struct gk20a *g, | 280 | void 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 | ||
295 | static void gk20a_ltc_init_cbc(struct gk20a *g, struct gr_gk20a *gr) | 295 | void 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 |
345 | static void gk20a_ltc_sync_debugfs(struct gk20a *g) | 345 | void 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 | |||
367 | void 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 |
18 | struct gpu_ops; | 18 | struct gpu_ops; |
19 | struct gr_gk20a; | ||
20 | struct zbc_entry; | ||
21 | enum gk20a_cbc_op; | ||
19 | 22 | ||
20 | void gk20a_init_ltc(struct gpu_ops *gops); | 23 | int gk20a_ltc_init_comptags(struct gk20a *g, struct gr_gk20a *gr); |
24 | int gk20a_ltc_cbc_ctrl(struct gk20a *g, enum gk20a_cbc_op op, | ||
25 | u32 min, u32 max); | ||
26 | void gk20a_ltc_init_fs_state(struct gk20a *g); | ||
27 | void gk20a_ltc_isr(struct gk20a *g); | ||
28 | int gk20a_determine_L2_size_bytes(struct gk20a *g); | ||
29 | void gk20a_ltc_set_zbc_color_entry(struct gk20a *g, | ||
30 | struct zbc_entry *color_val, | ||
31 | u32 index); | ||
32 | void gk20a_ltc_set_zbc_depth_entry(struct gk20a *g, | ||
33 | struct zbc_entry *depth_val, | ||
34 | u32 index); | ||
35 | void gk20a_ltc_init_cbc(struct gk20a *g, struct gr_gk20a *gr); | ||
36 | #ifdef CONFIG_DEBUG_FS | ||
37 | void gk20a_ltc_sync_debugfs(struct gk20a *g); | ||
38 | #endif | ||
21 | int gk20a_ltc_alloc_phys_cbc(struct gk20a *g, size_t compbit_backing_size); | 39 | int gk20a_ltc_alloc_phys_cbc(struct gk20a *g, size_t compbit_backing_size); |
22 | int gk20a_ltc_alloc_virt_cbc(struct gk20a *g, size_t compbit_backing_size); | 40 | int gk20a_ltc_alloc_virt_cbc(struct gk20a *g, size_t compbit_backing_size); |
23 | #endif | 41 | #endif |
diff --git a/drivers/gpu/nvgpu/gm20b/hal_gm20b.c b/drivers/gpu/nvgpu/gm20b/hal_gm20b.c index 831fd5da..53542702 100644 --- a/drivers/gpu/nvgpu/gm20b/hal_gm20b.c +++ b/drivers/gpu/nvgpu/gm20b/hal_gm20b.c | |||
@@ -46,7 +46,22 @@ | |||
46 | 46 | ||
47 | #define PRIV_SECURITY_DISABLE 0x01 | 47 | #define PRIV_SECURITY_DISABLE 0x01 |
48 | 48 | ||
49 | static struct gpu_ops gm20b_ops = { | 49 | static const struct gpu_ops gm20b_ops = { |
50 | .ltc = { | ||
51 | .determine_L2_size_bytes = gm20b_determine_L2_size_bytes, | ||
52 | .set_zbc_color_entry = gm20b_ltc_set_zbc_color_entry, | ||
53 | .set_zbc_depth_entry = gm20b_ltc_set_zbc_depth_entry, | ||
54 | .init_cbc = gm20b_ltc_init_cbc, | ||
55 | .init_fs_state = gm20b_ltc_init_fs_state, | ||
56 | .init_comptags = gm20b_ltc_init_comptags, | ||
57 | .cbc_ctrl = gm20b_ltc_cbc_ctrl, | ||
58 | .isr = gm20b_ltc_isr, | ||
59 | .cbc_fix_config = gm20b_ltc_cbc_fix_config, | ||
60 | .flush = gm20b_flush_ltc, | ||
61 | #ifdef CONFIG_DEBUG_FS | ||
62 | .sync_debugfs = gm20b_ltc_sync_debugfs, | ||
63 | #endif | ||
64 | }, | ||
50 | .clock_gating = { | 65 | .clock_gating = { |
51 | .slcg_bus_load_gating_prod = | 66 | .slcg_bus_load_gating_prod = |
52 | gm20b_slcg_bus_load_gating_prod, | 67 | gm20b_slcg_bus_load_gating_prod, |
@@ -189,6 +204,7 @@ int gm20b_init_hal(struct gk20a *g) | |||
189 | struct nvgpu_gpu_characteristics *c = &g->gpu_characteristics; | 204 | struct nvgpu_gpu_characteristics *c = &g->gpu_characteristics; |
190 | u32 val; | 205 | u32 val; |
191 | 206 | ||
207 | gops->ltc = gm20b_ops.ltc; | ||
192 | gops->clock_gating = gm20b_ops.clock_gating; | 208 | gops->clock_gating = gm20b_ops.clock_gating; |
193 | gops->securegpccs = false; | 209 | gops->securegpccs = false; |
194 | gops->pmupstate = false; | 210 | gops->pmupstate = false; |
@@ -222,9 +238,7 @@ int gm20b_init_hal(struct gk20a *g) | |||
222 | gk20a_init_bus(gops); | 238 | gk20a_init_bus(gops); |
223 | gm20b_init_mc(gops); | 239 | gm20b_init_mc(gops); |
224 | gk20a_init_priv_ring(gops); | 240 | gk20a_init_priv_ring(gops); |
225 | gm20b_init_ltc(gops); | ||
226 | gm20b_init_gr(gops); | 241 | gm20b_init_gr(gops); |
227 | gm20b_init_ltc(gops); | ||
228 | gm20b_init_fb(gops); | 242 | gm20b_init_fb(gops); |
229 | gm20b_init_fifo(gops); | 243 | gm20b_init_fifo(gops); |
230 | gm20b_init_ce2(gops); | 244 | gm20b_init_ce2(gops); |
diff --git a/drivers/gpu/nvgpu/gm20b/ltc_gm20b.c b/drivers/gpu/nvgpu/gm20b/ltc_gm20b.c index e4e385fb..5e938141 100644 --- a/drivers/gpu/nvgpu/gm20b/ltc_gm20b.c +++ b/drivers/gpu/nvgpu/gm20b/ltc_gm20b.c | |||
@@ -29,7 +29,7 @@ | |||
29 | #include "gk20a/ltc_gk20a.h" | 29 | #include "gk20a/ltc_gk20a.h" |
30 | #include "ltc_gm20b.h" | 30 | #include "ltc_gm20b.h" |
31 | 31 | ||
32 | static int gm20b_ltc_init_comptags(struct gk20a *g, struct gr_gk20a *gr) | 32 | int gm20b_ltc_init_comptags(struct gk20a *g, struct gr_gk20a *gr) |
33 | { | 33 | { |
34 | /* max memory size (MB) to cover */ | 34 | /* max memory size (MB) to cover */ |
35 | u32 max_size = gr->max_comptag_mem; | 35 | u32 max_size = gr->max_comptag_mem; |
@@ -309,7 +309,7 @@ void gm20b_flush_ltc(struct gk20a *g) | |||
309 | } | 309 | } |
310 | } | 310 | } |
311 | 311 | ||
312 | static int gm20b_determine_L2_size_bytes(struct gk20a *g) | 312 | int gm20b_determine_L2_size_bytes(struct gk20a *g) |
313 | { | 313 | { |
314 | u32 lts_per_ltc; | 314 | u32 lts_per_ltc; |
315 | u32 ways; | 315 | u32 ways; |
@@ -438,7 +438,7 @@ void gm20b_ltc_init_cbc(struct gk20a *g, struct gr_gk20a *gr) | |||
438 | } | 438 | } |
439 | 439 | ||
440 | #ifdef CONFIG_DEBUG_FS | 440 | #ifdef CONFIG_DEBUG_FS |
441 | static void gm20b_ltc_sync_debugfs(struct gk20a *g) | 441 | void gm20b_ltc_sync_debugfs(struct gk20a *g) |
442 | { | 442 | { |
443 | u32 reg_f = ltc_ltcs_ltss_tstg_set_mgmt_2_l2_bypass_mode_enabled_f(); | 443 | u32 reg_f = ltc_ltcs_ltss_tstg_set_mgmt_2_l2_bypass_mode_enabled_f(); |
444 | 444 | ||
@@ -459,23 +459,3 @@ static void gm20b_ltc_sync_debugfs(struct gk20a *g) | |||
459 | nvgpu_spinlock_release(&g->debugfs_lock); | 459 | nvgpu_spinlock_release(&g->debugfs_lock); |
460 | } | 460 | } |
461 | #endif | 461 | #endif |
462 | |||
463 | void gm20b_init_ltc(struct gpu_ops *gops) | ||
464 | { | ||
465 | /* Gk20a reused ops. */ | ||
466 | gops->ltc.determine_L2_size_bytes = gm20b_determine_L2_size_bytes; | ||
467 | gops->ltc.set_zbc_color_entry = gm20b_ltc_set_zbc_color_entry; | ||
468 | gops->ltc.set_zbc_depth_entry = gm20b_ltc_set_zbc_depth_entry; | ||
469 | gops->ltc.init_cbc = gm20b_ltc_init_cbc; | ||
470 | |||
471 | /* GM20b specific ops. */ | ||
472 | gops->ltc.init_fs_state = gm20b_ltc_init_fs_state; | ||
473 | gops->ltc.init_comptags = gm20b_ltc_init_comptags; | ||
474 | gops->ltc.cbc_ctrl = gm20b_ltc_cbc_ctrl; | ||
475 | gops->ltc.isr = gm20b_ltc_isr; | ||
476 | gops->ltc.cbc_fix_config = gm20b_ltc_cbc_fix_config; | ||
477 | gops->ltc.flush = gm20b_flush_ltc; | ||
478 | #ifdef CONFIG_DEBUG_FS | ||
479 | gops->ltc.sync_debugfs = gm20b_ltc_sync_debugfs; | ||
480 | #endif | ||
481 | } | ||
diff --git a/drivers/gpu/nvgpu/gm20b/ltc_gm20b.h b/drivers/gpu/nvgpu/gm20b/ltc_gm20b.h index 4fe83250..b5661d4e 100644 --- a/drivers/gpu/nvgpu/gm20b/ltc_gm20b.h +++ b/drivers/gpu/nvgpu/gm20b/ltc_gm20b.h | |||
@@ -17,6 +17,8 @@ | |||
17 | #define _NVHOST_GM20B_LTC | 17 | #define _NVHOST_GM20B_LTC |
18 | struct gpu_ops; | 18 | struct gpu_ops; |
19 | 19 | ||
20 | int gm20b_ltc_init_comptags(struct gk20a *g, struct gr_gk20a *gr); | ||
21 | int gm20b_determine_L2_size_bytes(struct gk20a *g); | ||
20 | void gm20b_ltc_set_zbc_color_entry(struct gk20a *g, | 22 | void gm20b_ltc_set_zbc_color_entry(struct gk20a *g, |
21 | struct zbc_entry *color_val, | 23 | struct zbc_entry *color_val, |
22 | u32 index); | 24 | u32 index); |
@@ -24,8 +26,9 @@ void gm20b_ltc_set_zbc_depth_entry(struct gk20a *g, | |||
24 | struct zbc_entry *depth_val, | 26 | struct zbc_entry *depth_val, |
25 | u32 index); | 27 | u32 index); |
26 | void gm20b_ltc_init_cbc(struct gk20a *g, struct gr_gk20a *gr); | 28 | void gm20b_ltc_init_cbc(struct gk20a *g, struct gr_gk20a *gr); |
27 | 29 | #ifdef CONFIG_DEBUG_FS | |
28 | void gm20b_init_ltc(struct gpu_ops *gops); | 30 | void gm20b_ltc_sync_debugfs(struct gk20a *g); |
31 | #endif | ||
29 | void gm20b_ltc_init_fs_state(struct gk20a *g); | 32 | void gm20b_ltc_init_fs_state(struct gk20a *g); |
30 | int gm20b_ltc_cbc_ctrl(struct gk20a *g, enum gk20a_cbc_op op, | 33 | int gm20b_ltc_cbc_ctrl(struct gk20a *g, enum gk20a_cbc_op op, |
31 | u32 min, u32 max); | 34 | u32 min, u32 max); |
diff --git a/drivers/gpu/nvgpu/gp106/hal_gp106.c b/drivers/gpu/nvgpu/gp106/hal_gp106.c index d923e5e9..adea3eb8 100644 --- a/drivers/gpu/nvgpu/gp106/hal_gp106.c +++ b/drivers/gpu/nvgpu/gp106/hal_gp106.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include "gk20a/pramin_gk20a.h" | 20 | #include "gk20a/pramin_gk20a.h" |
21 | #include "gk20a/flcn_gk20a.h" | 21 | #include "gk20a/flcn_gk20a.h" |
22 | 22 | ||
23 | #include "gp10b/ltc_gp10b.h" | ||
23 | #include "gp10b/gr_gp10b.h" | 24 | #include "gp10b/gr_gp10b.h" |
24 | #include "gp10b/fecs_trace_gp10b.h" | 25 | #include "gp10b/fecs_trace_gp10b.h" |
25 | #include "gp10b/mc_gp10b.h" | 26 | #include "gp10b/mc_gp10b.h" |
@@ -32,6 +33,7 @@ | |||
32 | #include "gp106/fifo_gp106.h" | 33 | #include "gp106/fifo_gp106.h" |
33 | #include "gp106/regops_gp106.h" | 34 | #include "gp106/regops_gp106.h" |
34 | 35 | ||
36 | #include "gm20b/ltc_gm20b.h" | ||
35 | #include "gm20b/gr_gm20b.h" | 37 | #include "gm20b/gr_gm20b.h" |
36 | #include "gm20b/fifo_gm20b.h" | 38 | #include "gm20b/fifo_gm20b.h" |
37 | #include "gm20b/pmu_gm20b.h" | 39 | #include "gm20b/pmu_gm20b.h" |
@@ -42,7 +44,6 @@ | |||
42 | #include "gp106/therm_gp106.h" | 44 | #include "gp106/therm_gp106.h" |
43 | #include "gp106/xve_gp106.h" | 45 | #include "gp106/xve_gp106.h" |
44 | #include "gp106/fifo_gp106.h" | 46 | #include "gp106/fifo_gp106.h" |
45 | #include "gp106/ltc_gp106.h" | ||
46 | #include "gp106/clk_gp106.h" | 47 | #include "gp106/clk_gp106.h" |
47 | #include "gp106/mm_gp106.h" | 48 | #include "gp106/mm_gp106.h" |
48 | #include "gp106/pmu_gp106.h" | 49 | #include "gp106/pmu_gp106.h" |
@@ -58,7 +59,22 @@ | |||
58 | 59 | ||
59 | #include <nvgpu/hw/gp106/hw_proj_gp106.h> | 60 | #include <nvgpu/hw/gp106/hw_proj_gp106.h> |
60 | 61 | ||
61 | static struct gpu_ops gp106_ops = { | 62 | static const struct gpu_ops gp106_ops = { |
63 | .ltc = { | ||
64 | .determine_L2_size_bytes = gp10b_determine_L2_size_bytes, | ||
65 | .set_zbc_color_entry = gm20b_ltc_set_zbc_color_entry, | ||
66 | .set_zbc_depth_entry = gm20b_ltc_set_zbc_depth_entry, | ||
67 | .init_cbc = NULL, | ||
68 | .init_fs_state = gm20b_ltc_init_fs_state, | ||
69 | .init_comptags = gp10b_ltc_init_comptags, | ||
70 | .cbc_ctrl = gm20b_ltc_cbc_ctrl, | ||
71 | .isr = gp10b_ltc_isr, | ||
72 | .cbc_fix_config = NULL, | ||
73 | .flush = gm20b_flush_ltc, | ||
74 | #ifdef CONFIG_DEBUG_FS | ||
75 | .sync_debugfs = gp10b_ltc_sync_debugfs, | ||
76 | #endif | ||
77 | }, | ||
62 | .clock_gating = { | 78 | .clock_gating = { |
63 | .slcg_bus_load_gating_prod = | 79 | .slcg_bus_load_gating_prod = |
64 | gp106_slcg_bus_load_gating_prod, | 80 | gp106_slcg_bus_load_gating_prod, |
@@ -229,6 +245,7 @@ int gp106_init_hal(struct gk20a *g) | |||
229 | 245 | ||
230 | gk20a_dbg_fn(""); | 246 | gk20a_dbg_fn(""); |
231 | 247 | ||
248 | gops->ltc = gp106_ops.ltc; | ||
232 | gops->clock_gating = gp106_ops.clock_gating; | 249 | gops->clock_gating = gp106_ops.clock_gating; |
233 | 250 | ||
234 | gops->privsecurity = 1; | 251 | gops->privsecurity = 1; |
@@ -239,7 +256,6 @@ int gp106_init_hal(struct gk20a *g) | |||
239 | gp10b_init_priv_ring(gops); | 256 | gp10b_init_priv_ring(gops); |
240 | gp106_init_gr(gops); | 257 | gp106_init_gr(gops); |
241 | gp10b_init_fecs_trace_ops(gops); | 258 | gp10b_init_fecs_trace_ops(gops); |
242 | gp106_init_ltc(gops); | ||
243 | gp106_init_fb(gops); | 259 | gp106_init_fb(gops); |
244 | gp106_init_fifo(gops); | 260 | gp106_init_fifo(gops); |
245 | gp10b_init_ce(gops); | 261 | gp10b_init_ce(gops); |
diff --git a/drivers/gpu/nvgpu/gp106/ltc_gp106.c b/drivers/gpu/nvgpu/gp106/ltc_gp106.c deleted file mode 100644 index 755e4b05..00000000 --- a/drivers/gpu/nvgpu/gp106/ltc_gp106.c +++ /dev/null | |||
@@ -1,27 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms and conditions of the GNU General Public License, | ||
6 | * version 2, as published by the Free Software Foundation. | ||
7 | * | ||
8 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
11 | * more details. | ||
12 | */ | ||
13 | |||
14 | #include "gk20a/gk20a.h" | ||
15 | #include "gm20b/ltc_gm20b.h" | ||
16 | #include "gp10b/ltc_gp10b.h" | ||
17 | #include "gp106/ltc_gp106.h" | ||
18 | |||
19 | void gp106_init_ltc(struct gpu_ops *gops) | ||
20 | { | ||
21 | gp10b_init_ltc(gops); | ||
22 | |||
23 | /* dGPU does not need the LTC hack */ | ||
24 | gops->ltc.cbc_fix_config = NULL; | ||
25 | gops->ltc.init_cbc = NULL; | ||
26 | gops->ltc.init_fs_state = gm20b_ltc_init_fs_state; | ||
27 | } | ||
diff --git a/drivers/gpu/nvgpu/gp106/ltc_gp106.h b/drivers/gpu/nvgpu/gp106/ltc_gp106.h deleted file mode 100644 index 4720d7a1..00000000 --- a/drivers/gpu/nvgpu/gp106/ltc_gp106.h +++ /dev/null | |||
@@ -1,19 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms and conditions of the GNU General Public License, | ||
6 | * version 2, as published by the Free Software Foundation. | ||
7 | * | ||
8 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
11 | * more details. | ||
12 | */ | ||
13 | |||
14 | #ifndef LTC_GP106_H | ||
15 | #define LTC_GP106_H | ||
16 | struct gpu_ops; | ||
17 | |||
18 | void gp106_init_ltc(struct gpu_ops *gops); | ||
19 | #endif | ||
diff --git a/drivers/gpu/nvgpu/gp10b/hal_gp10b.c b/drivers/gpu/nvgpu/gp10b/hal_gp10b.c index a1906a08..bf7a039c 100644 --- a/drivers/gpu/nvgpu/gp10b/hal_gp10b.c +++ b/drivers/gpu/nvgpu/gp10b/hal_gp10b.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include "gp10b/therm_gp10b.h" | 36 | #include "gp10b/therm_gp10b.h" |
37 | #include "gp10b/priv_ring_gp10b.h" | 37 | #include "gp10b/priv_ring_gp10b.h" |
38 | 38 | ||
39 | #include "gm20b/ltc_gm20b.h" | ||
39 | #include "gm20b/gr_gm20b.h" | 40 | #include "gm20b/gr_gm20b.h" |
40 | #include "gm20b/fifo_gm20b.h" | 41 | #include "gm20b/fifo_gm20b.h" |
41 | #include "gm20b/pmu_gm20b.h" | 42 | #include "gm20b/pmu_gm20b.h" |
@@ -51,7 +52,22 @@ | |||
51 | #include <nvgpu/hw/gp10b/hw_proj_gp10b.h> | 52 | #include <nvgpu/hw/gp10b/hw_proj_gp10b.h> |
52 | #include <nvgpu/hw/gp10b/hw_fuse_gp10b.h> | 53 | #include <nvgpu/hw/gp10b/hw_fuse_gp10b.h> |
53 | 54 | ||
54 | static struct gpu_ops gp10b_ops = { | 55 | static const struct gpu_ops gp10b_ops = { |
56 | .ltc = { | ||
57 | .determine_L2_size_bytes = gp10b_determine_L2_size_bytes, | ||
58 | .set_zbc_color_entry = gm20b_ltc_set_zbc_color_entry, | ||
59 | .set_zbc_depth_entry = gm20b_ltc_set_zbc_depth_entry, | ||
60 | .init_cbc = gm20b_ltc_init_cbc, | ||
61 | .init_fs_state = gp10b_ltc_init_fs_state, | ||
62 | .init_comptags = gp10b_ltc_init_comptags, | ||
63 | .cbc_ctrl = gm20b_ltc_cbc_ctrl, | ||
64 | .isr = gp10b_ltc_isr, | ||
65 | .cbc_fix_config = gm20b_ltc_cbc_fix_config, | ||
66 | .flush = gm20b_flush_ltc, | ||
67 | #ifdef CONFIG_DEBUG_FS | ||
68 | .sync_debugfs = gp10b_ltc_sync_debugfs, | ||
69 | #endif | ||
70 | }, | ||
55 | .clock_gating = { | 71 | .clock_gating = { |
56 | .slcg_bus_load_gating_prod = | 72 | .slcg_bus_load_gating_prod = |
57 | gp10b_slcg_bus_load_gating_prod, | 73 | gp10b_slcg_bus_load_gating_prod, |
@@ -196,6 +212,7 @@ int gp10b_init_hal(struct gk20a *g) | |||
196 | struct nvgpu_gpu_characteristics *c = &g->gpu_characteristics; | 212 | struct nvgpu_gpu_characteristics *c = &g->gpu_characteristics; |
197 | u32 val; | 213 | u32 val; |
198 | 214 | ||
215 | gops->ltc = gp10b_ops.ltc; | ||
199 | gops->clock_gating = gp10b_ops.clock_gating; | 216 | gops->clock_gating = gp10b_ops.clock_gating; |
200 | gops->pmupstate = false; | 217 | gops->pmupstate = false; |
201 | #ifdef CONFIG_TEGRA_ACR | 218 | #ifdef CONFIG_TEGRA_ACR |
@@ -240,7 +257,6 @@ int gp10b_init_hal(struct gk20a *g) | |||
240 | gp10b_init_priv_ring(gops); | 257 | gp10b_init_priv_ring(gops); |
241 | gp10b_init_gr(gops); | 258 | gp10b_init_gr(gops); |
242 | gp10b_init_fecs_trace_ops(gops); | 259 | gp10b_init_fecs_trace_ops(gops); |
243 | gp10b_init_ltc(gops); | ||
244 | gp10b_init_fb(gops); | 260 | gp10b_init_fb(gops); |
245 | gp10b_init_fifo(gops); | 261 | gp10b_init_fifo(gops); |
246 | gp10b_init_ce(gops); | 262 | gp10b_init_ce(gops); |
diff --git a/drivers/gpu/nvgpu/gp10b/ltc_gp10b.c b/drivers/gpu/nvgpu/gp10b/ltc_gp10b.c index d94e56ce..baa275c7 100644 --- a/drivers/gpu/nvgpu/gp10b/ltc_gp10b.c +++ b/drivers/gpu/nvgpu/gp10b/ltc_gp10b.c | |||
@@ -27,7 +27,7 @@ | |||
27 | #include "gk20a/ltc_gk20a.h" | 27 | #include "gk20a/ltc_gk20a.h" |
28 | #include "ltc_gp10b.h" | 28 | #include "ltc_gp10b.h" |
29 | 29 | ||
30 | static int gp10b_determine_L2_size_bytes(struct gk20a *g) | 30 | int gp10b_determine_L2_size_bytes(struct gk20a *g) |
31 | { | 31 | { |
32 | u32 tmp; | 32 | u32 tmp; |
33 | int ret; | 33 | int ret; |
@@ -47,7 +47,7 @@ static int gp10b_determine_L2_size_bytes(struct gk20a *g) | |||
47 | return ret; | 47 | return ret; |
48 | } | 48 | } |
49 | 49 | ||
50 | static int gp10b_ltc_init_comptags(struct gk20a *g, struct gr_gk20a *gr) | 50 | int gp10b_ltc_init_comptags(struct gk20a *g, struct gr_gk20a *gr) |
51 | { | 51 | { |
52 | /* max memory size (MB) to cover */ | 52 | /* max memory size (MB) to cover */ |
53 | u32 max_size = gr->max_comptag_mem; | 53 | u32 max_size = gr->max_comptag_mem; |
@@ -188,7 +188,7 @@ void gp10b_ltc_isr(struct gk20a *g) | |||
188 | } | 188 | } |
189 | } | 189 | } |
190 | 190 | ||
191 | static void gp10b_ltc_init_fs_state(struct gk20a *g) | 191 | void gp10b_ltc_init_fs_state(struct gk20a *g) |
192 | { | 192 | { |
193 | u32 ltc_intr; | 193 | u32 ltc_intr; |
194 | 194 | ||
@@ -206,7 +206,7 @@ static void gp10b_ltc_init_fs_state(struct gk20a *g) | |||
206 | } | 206 | } |
207 | 207 | ||
208 | #ifdef CONFIG_DEBUG_FS | 208 | #ifdef CONFIG_DEBUG_FS |
209 | static void gp10b_ltc_sync_debugfs(struct gk20a *g) | 209 | void gp10b_ltc_sync_debugfs(struct gk20a *g) |
210 | { | 210 | { |
211 | u32 reg_f = ltc_ltcs_ltss_tstg_set_mgmt_2_l2_bypass_mode_enabled_f(); | 211 | u32 reg_f = ltc_ltcs_ltss_tstg_set_mgmt_2_l2_bypass_mode_enabled_f(); |
212 | 212 | ||
@@ -227,22 +227,3 @@ static void gp10b_ltc_sync_debugfs(struct gk20a *g) | |||
227 | nvgpu_spinlock_release(&g->debugfs_lock); | 227 | nvgpu_spinlock_release(&g->debugfs_lock); |
228 | } | 228 | } |
229 | #endif | 229 | #endif |
230 | |||
231 | void gp10b_init_ltc(struct gpu_ops *gops) | ||
232 | { | ||
233 | gops->ltc.determine_L2_size_bytes = gp10b_determine_L2_size_bytes; | ||
234 | gops->ltc.set_zbc_color_entry = gm20b_ltc_set_zbc_color_entry; | ||
235 | gops->ltc.set_zbc_depth_entry = gm20b_ltc_set_zbc_depth_entry; | ||
236 | gops->ltc.init_cbc = gm20b_ltc_init_cbc; | ||
237 | |||
238 | /* GM20b specific ops. */ | ||
239 | gops->ltc.init_fs_state = gp10b_ltc_init_fs_state; | ||
240 | gops->ltc.init_comptags = gp10b_ltc_init_comptags; | ||
241 | gops->ltc.cbc_ctrl = gm20b_ltc_cbc_ctrl; | ||
242 | gops->ltc.isr = gp10b_ltc_isr; | ||
243 | gops->ltc.cbc_fix_config = gm20b_ltc_cbc_fix_config; | ||
244 | gops->ltc.flush = gm20b_flush_ltc; | ||
245 | #ifdef CONFIG_DEBUG_FS | ||
246 | gops->ltc.sync_debugfs = gp10b_ltc_sync_debugfs; | ||
247 | #endif | ||
248 | } | ||
diff --git a/drivers/gpu/nvgpu/gp10b/ltc_gp10b.h b/drivers/gpu/nvgpu/gp10b/ltc_gp10b.h index d7571c8d..b5f2cda6 100644 --- a/drivers/gpu/nvgpu/gp10b/ltc_gp10b.h +++ b/drivers/gpu/nvgpu/gp10b/ltc_gp10b.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2014, NVIDIA CORPORATION. All rights reserved. | 2 | * Copyright (c) 2014-2017, NVIDIA CORPORATION. All rights reserved. |
3 | * | 3 | * |
4 | * This program is free software; you can redistribute it and/or modify it | 4 | * This program is free software; you can redistribute it and/or modify it |
5 | * under the terms and conditions of the GNU General Public License, | 5 | * under the terms and conditions of the GNU General Public License, |
@@ -16,5 +16,11 @@ | |||
16 | struct gpu_ops; | 16 | struct gpu_ops; |
17 | 17 | ||
18 | void gp10b_ltc_isr(struct gk20a *g); | 18 | void gp10b_ltc_isr(struct gk20a *g); |
19 | void gp10b_init_ltc(struct gpu_ops *gops); | 19 | |
20 | int gp10b_determine_L2_size_bytes(struct gk20a *g); | ||
21 | int gp10b_ltc_init_comptags(struct gk20a *g, struct gr_gk20a *gr); | ||
22 | void gp10b_ltc_init_fs_state(struct gk20a *g); | ||
23 | #ifdef CONFIG_DEBUG_FS | ||
24 | void gp10b_ltc_sync_debugfs(struct gk20a *g); | ||
25 | #endif | ||
20 | #endif | 26 | #endif |