summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gv100/gr_gv100.c
diff options
context:
space:
mode:
authorDavid Nieto <dmartineznie@nvidia.com>2017-10-23 17:01:28 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-10-26 20:56:15 -0400
commit20294264468eecc8c1a065aa83d5f1b46ff07e7e (patch)
tree32c498100afb27216ab580907917d83c6e730c51 /drivers/gpu/nvgpu/gv100/gr_gv100.c
parent938785f1525ce0ae654c2be0911e15816617995d (diff)
gpu: nvgpu: gv1xx: resize patch buffer
Follow the sizing consideration in bug 1753763 to support dynamic TPC modes and subcontexts. bug 200350539 Change-Id: Ibbdbf02f9c2ea3f082c1b2810ae7176b0775d461 Signed-off-by: David Nieto <dmartineznie@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1584034 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gv100/gr_gv100.c')
-rw-r--r--drivers/gpu/nvgpu/gv100/gr_gv100.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/gv100/gr_gv100.c b/drivers/gpu/nvgpu/gv100/gr_gv100.c
index 8a4b88b4..430c7cd0 100644
--- a/drivers/gpu/nvgpu/gv100/gr_gv100.c
+++ b/drivers/gpu/nvgpu/gv100/gr_gv100.c
@@ -294,3 +294,56 @@ void gr_gv100_load_tpc_mask(struct gk20a *g)
294 gk20a_writel(g, gr_fe_tpc_fs_r(0), u64_lo32(pes_tpc_mask)); 294 gk20a_writel(g, gr_fe_tpc_fs_r(0), u64_lo32(pes_tpc_mask));
295 gk20a_writel(g, gr_fe_tpc_fs_r(1), u64_hi32(pes_tpc_mask)); 295 gk20a_writel(g, gr_fe_tpc_fs_r(1), u64_hi32(pes_tpc_mask));
296} 296}
297
298u32 gr_gv100_get_patch_slots(struct gk20a *g)
299{
300 struct gr_gk20a *gr = &g->gr;
301 struct fifo_gk20a *f = &g->fifo;
302 u32 size = 0;
303
304 /*
305 * CMD to update PE table
306 */
307 size++;
308
309 /*
310 * Update PE table contents
311 * for PE table, each patch buffer update writes 32 TPCs
312 */
313 size += DIV_ROUND_UP(gr->tpc_count, 32);
314
315 /*
316 * Update the PL table contents
317 * For PL table, each patch buffer update configures 4 TPCs
318 */
319 size += DIV_ROUND_UP(gr->tpc_count, 4);
320
321 /*
322 * We need this for all subcontexts
323 */
324 size *= f->t19x.max_subctx_count;
325
326 /*
327 * Add space for a partition mode change as well
328 * reserve two slots since DYNAMIC -> STATIC requires
329 * DYNAMIC -> NONE -> STATIC
330 */
331 size += 2;
332
333 /*
334 * Add current patch buffer size
335 */
336 size += gr_gk20a_get_patch_slots(g);
337
338 /*
339 * Align to 4K size
340 */
341 size = ALIGN(size, PATCH_CTX_SLOTS_PER_PAGE);
342
343 /*
344 * Increase the size to accommodate for additional TPC partition update
345 */
346 size += 2 * PATCH_CTX_SLOTS_PER_PAGE;
347
348 return size;
349}