gpu: nvgpu: simplify gmmu unmap calls

Introduce nvgpu_gmmu_unmap_addr() to unmap a nvgpu_mem that was mapped
at some other address than mem.gpu_va, which can be the case for buffers
that are shared across different address spaces. Delete the address
parameter from nvgpu_gmmu_unmap(), as the common case is to store the
address to mem.gpu_va when mapping the buffer.

Modify some instances of consecutive unmap + free calls to call just
nvgpu_dma_unmap_free().

Change-Id: Iecd7c9aa41d04e9f48e055f6bc0c9227cd759c69
Signed-off-by: Konsta Hölttä <kholtta@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2601787
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: Gerrit_Virtual_Submit
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Konsta Hölttä
2021-09-28 09:24:13 +03:00
committed by mobile promotions
parent 9bdb8f1a10
commit 44422db851
15 changed files with 41 additions and 35 deletions

View File

@@ -109,7 +109,7 @@ __must_hold(&cde_app->mutex)
/* release mapped memory */
gk20a_deinit_cde_img(cde_ctx);
nvgpu_gmmu_unmap(vm, &cbc->compbit_store.mem,
nvgpu_gmmu_unmap_addr(vm, &cbc->compbit_store.mem,
cde_ctx->backing_store_vaddr);
/*
@@ -1442,7 +1442,7 @@ static int gk20a_cde_load(struct gk20a_cde_ctx *cde_ctx)
return 0;
err_init_cde_img:
nvgpu_gmmu_unmap(ch->vm, &cbc->compbit_store.mem, vaddr);
nvgpu_gmmu_unmap_addr(ch->vm, &cbc->compbit_store.mem, vaddr);
err_map_backingstore:
err_setup_bind:
nvgpu_vm_put(ch->vm);