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

@@ -552,7 +552,7 @@ int test_nvgpu_gmmu_map_unmap(struct unit_module *m, struct gk20a *g,
}
/* Now unmap the buffer and make sure the PTE is now invalid */
nvgpu_gmmu_unmap(g->mm.pmu.vm, &mem, mem.gpu_va);
nvgpu_gmmu_unmap(g->mm.pmu.vm, &mem);
result = nvgpu_get_pte(g, g->mm.pmu.vm, mem.gpu_va, &pte[0]);
if (result != 0) {
@@ -856,7 +856,7 @@ int test_nvgpu_gmmu_map_unmap_adv(struct unit_module *m,
g->ops.fb.tlb_invalidate = hal_fb_tlb_invalidate_fail;
}
nvgpu_gmmu_unmap(g->mm.pmu.vm, &mem, vaddr);
nvgpu_gmmu_unmap_addr(g->mm.pmu.vm, &mem, vaddr);
if (params->special_unmap_tbl_invalidate_fail) {
/* Restore previous op */
@@ -1074,7 +1074,7 @@ int test_nvgpu_page_table_c1_full(struct unit_module *m, struct gk20a *g,
}
/* 3.3. Free the mapping */
nvgpu_gmmu_unmap(vm, &mem[mem_i], mem[mem_i].gpu_va);
nvgpu_gmmu_unmap(vm, &mem[mem_i]);
/* 3.4. Verify that the mapping has been cleared */
if (check_pte_invalidated(m, g, vm, &mem[mem_i]) != 0) {
@@ -1115,7 +1115,7 @@ static int c2_fixed_allocation(struct unit_module *m, struct gk20a *g,
}
/* Free the mapping */
nvgpu_gmmu_unmap(vm, mem_fixed, mem_fixed->gpu_va);
nvgpu_gmmu_unmap(vm, mem_fixed);
/* Verify that the mapping has been cleared */
if (check_pte_invalidated(m, g, vm, mem_fixed) != 0) {