diff --git a/drivers/gpu/nvgpu/common/linux/platform_gk20a_tegra.c b/drivers/gpu/nvgpu/common/linux/platform_gk20a_tegra.c index 952a7ed1e..3e1c69961 100644 --- a/drivers/gpu/nvgpu/common/linux/platform_gk20a_tegra.c +++ b/drivers/gpu/nvgpu/common/linux/platform_gk20a_tegra.c @@ -122,6 +122,9 @@ static int gk20a_tegra_secure_alloc(struct gk20a *g, int err = 0; size_t aligned_size = PAGE_ALIGN(size); + if (nvgpu_mem_is_valid(&desc->mem)) + return 0; + /* We ran out of preallocated memory */ if (secure_buffer->used + aligned_size > secure_buffer->size) { nvgpu_err(platform->g, "failed to alloc %zu bytes of VPR, %zu/%zu used", diff --git a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c index 8db6b42f4..7160ab6fa 100644 --- a/drivers/gpu/nvgpu/gk20a/gr_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/gr_gk20a.c @@ -2482,6 +2482,11 @@ static int gk20a_gr_alloc_ctx_buffer(struct gk20a *g, { int err = 0; + nvgpu_log_fn(g, " "); + + if (nvgpu_mem_is_valid(&desc->mem)) + return 0; + err = nvgpu_dma_alloc_flags_sys(g, NVGPU_DMA_NO_KERNEL_MAPPING, size, &desc->mem); if (err)