From 20294264468eecc8c1a065aa83d5f1b46ff07e7e Mon Sep 17 00:00:00 2001 From: David Nieto Date: Mon, 23 Oct 2017 14:01:28 -0700 Subject: 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 Reviewed-on: https://git-master.nvidia.com/r/1584034 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/gv100/gr_gv100.c | 53 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) (limited to 'drivers/gpu/nvgpu/gv100/gr_gv100.c') 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) gk20a_writel(g, gr_fe_tpc_fs_r(0), u64_lo32(pes_tpc_mask)); gk20a_writel(g, gr_fe_tpc_fs_r(1), u64_hi32(pes_tpc_mask)); } + +u32 gr_gv100_get_patch_slots(struct gk20a *g) +{ + struct gr_gk20a *gr = &g->gr; + struct fifo_gk20a *f = &g->fifo; + u32 size = 0; + + /* + * CMD to update PE table + */ + size++; + + /* + * Update PE table contents + * for PE table, each patch buffer update writes 32 TPCs + */ + size += DIV_ROUND_UP(gr->tpc_count, 32); + + /* + * Update the PL table contents + * For PL table, each patch buffer update configures 4 TPCs + */ + size += DIV_ROUND_UP(gr->tpc_count, 4); + + /* + * We need this for all subcontexts + */ + size *= f->t19x.max_subctx_count; + + /* + * Add space for a partition mode change as well + * reserve two slots since DYNAMIC -> STATIC requires + * DYNAMIC -> NONE -> STATIC + */ + size += 2; + + /* + * Add current patch buffer size + */ + size += gr_gk20a_get_patch_slots(g); + + /* + * Align to 4K size + */ + size = ALIGN(size, PATCH_CTX_SLOTS_PER_PAGE); + + /* + * Increase the size to accommodate for additional TPC partition update + */ + size += 2 * PATCH_CTX_SLOTS_PER_PAGE; + + return size; +} -- cgit v1.2.2