gpu: nvgpu: do not alloc ctx buffers if already allocated

Bug 200393029

Change-Id: Ic2946958e34bcb9247179fcf2e8735c822155cce
Signed-off-by: Seema Khowala <seemaj@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1665338
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Rajkumar Kasirajan <rkasirajan@nvidia.com>
Reviewed-by: Shreshtha Sahu <ssahu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Seema Khowala
2018-02-27 13:53:55 -08:00
committed by mobile promotions
parent ba8fa334f4
commit abe829338c
2 changed files with 8 additions and 0 deletions

View File

@@ -122,6 +122,9 @@ static int gk20a_tegra_secure_alloc(struct gk20a *g,
int err = 0; int err = 0;
size_t aligned_size = PAGE_ALIGN(size); size_t aligned_size = PAGE_ALIGN(size);
if (nvgpu_mem_is_valid(&desc->mem))
return 0;
/* We ran out of preallocated memory */ /* We ran out of preallocated memory */
if (secure_buffer->used + aligned_size > secure_buffer->size) { if (secure_buffer->used + aligned_size > secure_buffer->size) {
nvgpu_err(platform->g, "failed to alloc %zu bytes of VPR, %zu/%zu used", nvgpu_err(platform->g, "failed to alloc %zu bytes of VPR, %zu/%zu used",

View File

@@ -2482,6 +2482,11 @@ static int gk20a_gr_alloc_ctx_buffer(struct gk20a *g,
{ {
int err = 0; 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, err = nvgpu_dma_alloc_flags_sys(g, NVGPU_DMA_NO_KERNEL_MAPPING,
size, &desc->mem); size, &desc->mem);
if (err) if (err)