summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/common/mm/vm_area.c
diff options
context:
space:
mode:
authorAlex Waterman <alexw@nvidia.com>2017-10-17 13:55:00 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-11-01 22:06:23 -0400
commitd13c256d5ee11da1664377481543005142d9bd30 (patch)
treee00ef697d05a20428619c8920ddfcb645fc095d8 /drivers/gpu/nvgpu/common/mm/vm_area.c
parenta37cec19f0cf5212cbd472cd8d94acaa1e1cff6d (diff)
gpu: nvgpu: VM unmap refactoring
Re-organize the unmap code to be better split between OS specific requirements and common core requirements. The new code flow works as follows: nvgpu_vm_unmap() Is the primary entrance to the unmap path. It takes a VM and a GPU virtual address to unmap. There's also an optional batch mapping struct. This function is responsible for making sure there is a real buffer and that if it's being called on a fixed mapping then the mapping will definitely be freed (since buffers are ref-counted). Then this function decrements the ref-count and returns. If the ref-count hits zero then __nvgpu_vm_unmap_ref() is called which just calls __nvgpu_vm_unmap() with the relevant batch struct if present. This is where the real work is done. __nvgpu_vm_unmap() clears the GMMU mapping, removes the mapped buffer from the various lists and trees it may be in and then calls the nvgpu_vm_unmap_system() function. This function handles any OS specific stuff and must be defined by all VM OS implementations. There's a a short cut used by some other core VM code to free mappings without going through nvgpu_vm_map(). Mostly they just directly decrement the mapping ref-count which can then call __nvgpu_vm_unmap_ref() if the ref-count hits zero. JIRA NVGPU-30 JIRA NVGPU-71 Change-Id: Ic626d37ab936819841bab45214f027b40ffa4e5a Signed-off-by: Alex Waterman <alexw@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1583982 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/common/mm/vm_area.c')
-rw-r--r--drivers/gpu/nvgpu/common/mm/vm_area.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpu/nvgpu/common/mm/vm_area.c b/drivers/gpu/nvgpu/common/mm/vm_area.c
index 88758b85..fddec357 100644
--- a/drivers/gpu/nvgpu/common/mm/vm_area.c
+++ b/drivers/gpu/nvgpu/common/mm/vm_area.c
@@ -208,7 +208,7 @@ int nvgpu_vm_area_free(struct vm_gk20a *vm, u64 addr)
208 &vm_area->buffer_list_head, 208 &vm_area->buffer_list_head,
209 nvgpu_mapped_buf, buffer_list) { 209 nvgpu_mapped_buf, buffer_list) {
210 nvgpu_list_del(&buffer->buffer_list); 210 nvgpu_list_del(&buffer->buffer_list);
211 nvgpu_ref_put(&buffer->ref, nvgpu_vm_unmap_locked_ref); 211 nvgpu_ref_put(&buffer->ref, __nvgpu_vm_unmap_ref);
212 } 212 }
213 213
214 /* if this was a sparse mapping, free the va */ 214 /* if this was a sparse mapping, free the va */