From de399ccb0019513a5f9e8f2bcadb02486f99bc80 Mon Sep 17 00:00:00 2001 From: Peter Daifuku Date: Fri, 27 Oct 2017 15:46:53 -0700 Subject: gpu: nvgpu: fix patch buf count update for vidmem gr_gk20a_ctx_patch_write_begin() updates the patch buffer data_count when the associated graphics context memory buffer has been CPU-mapped; it was doing so by looking for a non-null cpu_va. However, if the graphics context has been allocated from vidmem, cpu_va is always 0, so we can't tell if nvgpu_mem_begin() was called for the context buffer or not. Instead: - add a cpu_accessible flag to the nvgpu_mem struct and set it in nvgpu_mem_begin() - return the value of that flag in nvgpu_mem_cpu_accessible() - gr_gk20a_ctx_patch_write_begin() now calls this new function instead of checking cpu_va. Bug 2012077 JIRA ESRM-74 Change-Id: I8401699f30b4ae7154111721c25c7ec3ff95d329 Signed-off-by: Peter Daifuku Reviewed-on: https://git-master.nvidia.com/r/1587293 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/gk20a/gr_gk20a.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/gpu/nvgpu/gk20a/gr_gk20a.c') diff --git a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c index 2a20c2d9..06fb5497 100644 --- a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c @@ -682,7 +682,7 @@ int gr_gk20a_ctx_patch_write_begin(struct gk20a *g, if (err) return err; - if (ch_ctx->gr_ctx->mem.cpu_va) { + if (nvgpu_mem_cpu_accessible(&ch_ctx->gr_ctx->mem)) { /* reset patch count if ucode has already processed it */ ch_ctx->patch_ctx.data_count = nvgpu_mem_rd(g, &ch_ctx->gr_ctx->mem, @@ -699,7 +699,7 @@ void gr_gk20a_ctx_patch_write_end(struct gk20a *g, nvgpu_mem_end(g, &ch_ctx->patch_ctx.mem); /* Write context count to context image if it is mapped */ - if (ch_ctx->gr_ctx->mem.cpu_va) { + if (nvgpu_mem_cpu_accessible(&ch_ctx->gr_ctx->mem)) { nvgpu_mem_wr(g, &ch_ctx->gr_ctx->mem, ctxsw_prog_main_image_patch_count_o(), ch_ctx->patch_ctx.data_count); -- cgit v1.2.2