diff options
Diffstat (limited to 'drivers/gpu/nvgpu/gm20b/ltc_gm20b.c')
-rw-r--r-- | drivers/gpu/nvgpu/gm20b/ltc_gm20b.c | 43 |
1 files changed, 42 insertions, 1 deletions
diff --git a/drivers/gpu/nvgpu/gm20b/ltc_gm20b.c b/drivers/gpu/nvgpu/gm20b/ltc_gm20b.c index 96e5dbde..a089b59c 100644 --- a/drivers/gpu/nvgpu/gm20b/ltc_gm20b.c +++ b/drivers/gpu/nvgpu/gm20b/ltc_gm20b.c | |||
@@ -347,10 +347,51 @@ void gm20b_flush_ltc(struct gk20a *g) | |||
347 | ltc_ltc1_ltss_tstg_cmgmt0_invalidate_pending_f()); | 347 | ltc_ltc1_ltss_tstg_cmgmt0_invalidate_pending_f()); |
348 | } | 348 | } |
349 | 349 | ||
350 | static int gm20b_determine_L2_size_bytes(struct gk20a *g) | ||
351 | { | ||
352 | u32 lts_per_ltc; | ||
353 | u32 ways; | ||
354 | u32 sets; | ||
355 | u32 bytes_per_line; | ||
356 | u32 active_ltcs; | ||
357 | u32 cache_size; | ||
358 | |||
359 | u32 tmp; | ||
360 | u32 active_sets_value; | ||
361 | |||
362 | tmp = gk20a_readl(g, ltc_ltc0_lts0_tstg_cfg1_r()); | ||
363 | ways = hweight32(ltc_ltc0_lts0_tstg_cfg1_active_ways_v(tmp)); | ||
364 | |||
365 | active_sets_value = ltc_ltc0_lts0_tstg_cfg1_active_sets_v(tmp); | ||
366 | if (active_sets_value == ltc_ltc0_lts0_tstg_cfg1_active_sets_all_v()) { | ||
367 | sets = 64; | ||
368 | } else if (active_sets_value == | ||
369 | ltc_ltc0_lts0_tstg_cfg1_active_sets_half_v()) { | ||
370 | sets = 32; | ||
371 | } else if (active_sets_value == | ||
372 | ltc_ltc0_lts0_tstg_cfg1_active_sets_quarter_v()) { | ||
373 | sets = 16; | ||
374 | } else { | ||
375 | dev_err(dev_from_gk20a(g), | ||
376 | "Unknown constant %u for active sets", | ||
377 | (unsigned)active_sets_value); | ||
378 | sets = 0; | ||
379 | } | ||
380 | |||
381 | active_ltcs = g->gr.num_fbps; | ||
382 | |||
383 | /* chip-specific values */ | ||
384 | lts_per_ltc = 2; | ||
385 | bytes_per_line = 128; | ||
386 | cache_size = active_ltcs * lts_per_ltc * ways * sets * bytes_per_line; | ||
387 | |||
388 | return cache_size; | ||
389 | } | ||
390 | |||
350 | void gm20b_init_ltc(struct gpu_ops *gops) | 391 | void gm20b_init_ltc(struct gpu_ops *gops) |
351 | { | 392 | { |
352 | /* Gk20a reused ops. */ | 393 | /* Gk20a reused ops. */ |
353 | gops->ltc.determine_L2_size_bytes = gk20a_determine_L2_size_bytes; | 394 | gops->ltc.determine_L2_size_bytes = gm20b_determine_L2_size_bytes; |
354 | gops->ltc.set_max_ways_evict_last = gk20a_ltc_set_max_ways_evict_last; | 395 | gops->ltc.set_max_ways_evict_last = gk20a_ltc_set_max_ways_evict_last; |
355 | gops->ltc.set_zbc_color_entry = gk20a_ltc_set_zbc_color_entry; | 396 | gops->ltc.set_zbc_color_entry = gk20a_ltc_set_zbc_color_entry; |
356 | gops->ltc.set_zbc_depth_entry = gk20a_ltc_set_zbc_depth_entry; | 397 | gops->ltc.set_zbc_depth_entry = gk20a_ltc_set_zbc_depth_entry; |