gpu: nvgpu: optimize map calls in patch smpc

Copy the necessary ctx patching prologues and epilogues from patch_write
to gr_gk20a_exec_ctx_ops next to mapping of gr ctx, around a loop that
applies patches multiple times, in order to optimize the number of
maps/unmaps on the channel's patch context.

Bug 200075565

Change-Id: I7125be5c778192d639f0bbed1731bb900c7015da
Signed-off-by: Konsta Holtta <kholtta@nvidia.com>
(cherry picked from commit TODO-FILL-THIS-WHEN-MERGED)
Reviewed-on: http://git-master/r/839203
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Tested-by: Terje Bergstrom <tbergstrom@nvidia.com>
This commit is contained in:
Konsta Holtta
2015-07-10 14:15:48 +03:00
committed by Terje Bergstrom
parent 8feddd88d0
commit eb81d7d7e1

View File

@@ -648,7 +648,6 @@ int gr_gk20a_ctx_patch_write(struct gk20a *g,
if (!ch_ctx->patch_ctx.mem.cpu_va) {
int err;
gk20a_dbg_info("per-write ctx patch begin?");
/* yes, gr_gk20a_ctx_patch_smpc causes this one */
err = gr_gk20a_ctx_patch_write_begin(g, ch_ctx);
if (err)
return err;
@@ -6759,6 +6758,9 @@ int gr_gk20a_exec_ctx_ops(struct channel_gk20a *ch,
err = -ENOMEM;
goto cleanup;
}
err = gr_gk20a_ctx_patch_write_begin(g, ch_ctx);
if (err)
goto cleanup;
g->ops.mm.l2_flush(g, true);
@@ -6863,6 +6865,9 @@ int gr_gk20a_exec_ctx_ops(struct channel_gk20a *ch,
if (offsets)
kfree(offsets);
if (ch_ctx->patch_ctx.mem.cpu_va)
gr_gk20a_ctx_patch_write_end(g, ch_ctx);
if (ctx_ptr)
vunmap(ctx_ptr);