summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/mm_gk20a.c
diff options
context:
space:
mode:
authorSami Kiminki <skiminki@nvidia.com>2015-05-20 11:38:10 -0400
committerTerje Bergstrom <tbergstrom@nvidia.com>2015-06-06 10:25:21 -0400
commit5e85069f4f4f1f9849fcba02829c802cb1849618 (patch)
tree9899e00e4c9442a92a99787f731014c0720b3ae2 /drivers/gpu/nvgpu/gk20a/mm_gk20a.c
parent34a3e35631b5d7111a35c8709fd6210c5f5c79e3 (diff)
gpu: nvgpu: Fix compbits mapping
Commit e99aa2485f8992eabe3556f3ebcb57bdc8ad91ff broke compbits mapping. So, let's fix it. Bug 200077571 Change-Id: I02dc150fbcb4cd59660f510adde9f029290efdfb Signed-off-by: Sami Kiminki <skiminki@nvidia.com> Reviewed-on: http://git-master/r/745001 (cherry picked from commit 86fc7ec9a05999bea8de320840b962db3ee11410) Reviewed-on: http://git-master/r/753281 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com> Tested-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/mm_gk20a.c')
-rw-r--r--drivers/gpu/nvgpu/gk20a/mm_gk20a.c47
1 files changed, 37 insertions, 10 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c
index 342d3ace..e3ec3f10 100644
--- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c
@@ -271,7 +271,6 @@ static int gk20a_alloc_comptags(struct gk20a *g,
271 271
272 if (ctaglines_to_allocate < lines) 272 if (ctaglines_to_allocate < lines)
273 return -EINVAL; /* integer overflow */ 273 return -EINVAL; /* integer overflow */
274 pr_info("user-mapped CTAGS: %u\n", ctaglines_to_allocate);
275 } 274 }
276 275
277 /* store the allocator so we can use it when we free the ctags */ 276 /* store the allocator so we can use it when we free the ctags */
@@ -282,9 +281,19 @@ static int gk20a_alloc_comptags(struct gk20a *g,
282 281
283 priv->comptags.lines = lines; 282 priv->comptags.lines = lines;
284 priv->comptags.real_offset = offset; 283 priv->comptags.real_offset = offset;
284 priv->comptags.allocated_lines = ctaglines_to_allocate;
285
286 if (user_mappable) {
287 u64 win_size =
288 DIV_ROUND_UP(lines, g->gr.comptags_per_cacheline) *
289 aggregate_cacheline_sz;
290 win_size = roundup(win_size, small_pgsz);
285 291
286 if (user_mappable)
287 offset = DIV_ROUND_UP(offset, ctagline_align) * ctagline_align; 292 offset = DIV_ROUND_UP(offset, ctagline_align) * ctagline_align;
293 *ctag_map_win_ctagline = offset;
294 *ctag_map_win_size = win_size;
295 }
296
288 297
289 priv->comptags.offset = offset; 298 priv->comptags.offset = offset;
290 299
@@ -1458,14 +1467,32 @@ u64 gk20a_vm_map(struct vm_gk20a *vm,
1458 gk20a_get_comptags(d, dmabuf, &comptags); 1467 gk20a_get_comptags(d, dmabuf, &comptags);
1459 clear_ctags = true; 1468 clear_ctags = true;
1460 1469
1461 if (comptags.lines < comptags.allocated_lines) { 1470 comptags.user_mappable = user_mappable;
1462 /* clear tail-padding comptags */ 1471
1463 u32 ctagmin = comptags.offset + comptags.lines; 1472 if (user_mappable) {
1464 u32 ctagmax = comptags.offset + 1473 /* comptags for the buffer will be
1465 comptags.allocated_lines - 1; 1474 cleared later, but we need to make
1466 1475 sure the whole comptags allocation
1467 g->ops.ltc.cbc_ctrl(g, gk20a_cbc_op_clear, 1476 (which may be bigger) is cleared in
1468 ctagmin, ctagmax); 1477 order not to leak compbits */
1478
1479 const u32 buffer_ctag_end =
1480 comptags.offset + comptags.lines;
1481 const u32 alloc_ctag_end =
1482 comptags.real_offset +
1483 comptags.allocated_lines;
1484
1485 if (comptags.real_offset < comptags.offset)
1486 g->ops.ltc.cbc_ctrl(
1487 g, gk20a_cbc_op_clear,
1488 comptags.real_offset,
1489 comptags.offset - 1);
1490
1491 if (buffer_ctag_end < alloc_ctag_end)
1492 g->ops.ltc.cbc_ctrl(
1493 g, gk20a_cbc_op_clear,
1494 buffer_ctag_end,
1495 alloc_ctag_end - 1);
1469 } 1496 }
1470 } 1497 }
1471 } 1498 }