summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/nvgpu/gk20a/gk20a.h1
-rw-r--r--drivers/gpu/nvgpu/gk20a/ltc_common.c7
-rw-r--r--drivers/gpu/nvgpu/gm20b/ltc_gm20b.c14
3 files changed, 21 insertions, 1 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.h b/drivers/gpu/nvgpu/gk20a/gk20a.h
index 081ec077..f16be5a1 100644
--- a/drivers/gpu/nvgpu/gk20a/gk20a.h
+++ b/drivers/gpu/nvgpu/gk20a/gk20a.h
@@ -84,6 +84,7 @@ struct gpu_ops {
84 void (*init_fs_state)(struct gk20a *g); 84 void (*init_fs_state)(struct gk20a *g);
85 void (*elpg_flush)(struct gk20a *g); 85 void (*elpg_flush)(struct gk20a *g);
86 void (*isr)(struct gk20a *g); 86 void (*isr)(struct gk20a *g);
87 u32 (*cbc_fix_config)(struct gk20a *g, int base);
87 } ltc; 88 } ltc;
88 struct { 89 struct {
89 int (*init_fs_state)(struct gk20a *g); 90 int (*init_fs_state)(struct gk20a *g);
diff --git a/drivers/gpu/nvgpu/gk20a/ltc_common.c b/drivers/gpu/nvgpu/gk20a/ltc_common.c
index 72477983..75530b25 100644
--- a/drivers/gpu/nvgpu/gk20a/ltc_common.c
+++ b/drivers/gpu/nvgpu/gk20a/ltc_common.c
@@ -291,7 +291,7 @@ static void gk20a_ltc_init_cbc(struct gk20a *g, struct gr_gk20a *gr)
291 compbit_base_post_divide64 = compbit_store_base_iova >> 291 compbit_base_post_divide64 = compbit_store_base_iova >>
292 ltc_ltcs_ltss_cbc_base_alignment_shift_v(); 292 ltc_ltcs_ltss_cbc_base_alignment_shift_v();
293 293
294 do_div(compbit_base_post_divide64, gr->num_fbps); 294 do_div(compbit_base_post_divide64, g->ltc_count);
295 compbit_base_post_divide = u64_lo32(compbit_base_post_divide64); 295 compbit_base_post_divide = u64_lo32(compbit_base_post_divide64);
296 296
297 compbit_base_post_multiply64 = ((u64)compbit_base_post_divide * 297 compbit_base_post_multiply64 = ((u64)compbit_base_post_divide *
@@ -300,6 +300,11 @@ static void gk20a_ltc_init_cbc(struct gk20a *g, struct gr_gk20a *gr)
300 if (compbit_base_post_multiply64 < compbit_store_base_iova) 300 if (compbit_base_post_multiply64 < compbit_store_base_iova)
301 compbit_base_post_divide++; 301 compbit_base_post_divide++;
302 302
303 /* Bug 1477079 indicates sw adjustment on the posted divided base. */
304 if (g->ops.ltc.cbc_fix_config)
305 compbit_base_post_divide =
306 g->ops.ltc.cbc_fix_config(g, compbit_base_post_divide);
307
303 gk20a_writel(g, ltc_ltcs_ltss_cbc_base_r(), 308 gk20a_writel(g, ltc_ltcs_ltss_cbc_base_r(),
304 compbit_base_post_divide); 309 compbit_base_post_divide);
305 310
diff --git a/drivers/gpu/nvgpu/gm20b/ltc_gm20b.c b/drivers/gpu/nvgpu/gm20b/ltc_gm20b.c
index 43c90970..91046d93 100644
--- a/drivers/gpu/nvgpu/gm20b/ltc_gm20b.c
+++ b/drivers/gpu/nvgpu/gm20b/ltc_gm20b.c
@@ -237,6 +237,19 @@ static void gm20b_ltc_g_elpg_flush_locked(struct gk20a *g)
237 "g_elpg_flush too many retries"); 237 "g_elpg_flush too many retries");
238} 238}
239 239
240u32 gm20b_ltc_cbc_fix_config(struct gk20a *g, int base)
241{
242 u32 val = gk20a_readl(g, ltc_ltcs_ltss_cbc_num_active_ltcs_r());
243 if (val == 2) {
244 return base * 2;
245 } else if (val != 1) {
246 gk20a_err(dev_from_gk20a(g),
247 "Invalid number of active ltcs: %08x\n", val);
248 }
249
250 return base;
251}
252
240void gm20b_init_ltc(struct gpu_ops *gops) 253void gm20b_init_ltc(struct gpu_ops *gops)
241{ 254{
242 /* Gk20a reused ops. */ 255 /* Gk20a reused ops. */
@@ -255,4 +268,5 @@ void gm20b_init_ltc(struct gpu_ops *gops)
255 gops->ltc.cbc_ctrl = gm20b_ltc_cbc_ctrl; 268 gops->ltc.cbc_ctrl = gm20b_ltc_cbc_ctrl;
256 gops->ltc.elpg_flush = gm20b_ltc_g_elpg_flush_locked; 269 gops->ltc.elpg_flush = gm20b_ltc_g_elpg_flush_locked;
257 gops->ltc.isr = gm20b_ltc_isr; 270 gops->ltc.isr = gm20b_ltc_isr;
271 gops->ltc.cbc_fix_config = gm20b_ltc_cbc_fix_config;
258} 272}