diff options
Diffstat (limited to 'drivers/gpu/nvgpu')
-rw-r--r-- | drivers/gpu/nvgpu/gp10b/fb_gp10b.c | 6 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gp10b/ltc_gp10b.c | 95 |
2 files changed, 99 insertions, 2 deletions
diff --git a/drivers/gpu/nvgpu/gp10b/fb_gp10b.c b/drivers/gpu/nvgpu/gp10b/fb_gp10b.c index df35c5b0..bd1b7bf0 100644 --- a/drivers/gpu/nvgpu/gp10b/fb_gp10b.c +++ b/drivers/gpu/nvgpu/gp10b/fb_gp10b.c | |||
@@ -87,9 +87,15 @@ static void gp10b_init_kind_attr(void) | |||
87 | } | 87 | } |
88 | } | 88 | } |
89 | 89 | ||
90 | static int gp10b_fb_compression_page_size(struct gk20a *g) | ||
91 | { | ||
92 | return SZ_64K; | ||
93 | } | ||
94 | |||
90 | void gp10b_init_fb(struct gpu_ops *gops) | 95 | void gp10b_init_fb(struct gpu_ops *gops) |
91 | { | 96 | { |
92 | gm20b_init_fb(gops); | 97 | gm20b_init_fb(gops); |
98 | gops->fb.compression_page_size = gp10b_fb_compression_page_size; | ||
93 | 99 | ||
94 | gp10b_init_uncompressed_kind_map(); | 100 | gp10b_init_uncompressed_kind_map(); |
95 | gp10b_init_kind_attr(); | 101 | gp10b_init_kind_attr(); |
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 | |||
22 | static int gp10b_determine_L2_size_bytes(struct gk20a *g) | 24 | static 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 | ||
42 | void gp10b_init_ltc(struct gpu_ops *gops) | 44 | static 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 | |||
119 | void 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 | } |