summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/vgpu/mm_vgpu.c
diff options
context:
space:
mode:
authorAlex Waterman <alexw@nvidia.com>2017-04-25 18:56:12 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-05-19 18:34:12 -0400
commit29cc82844e03b6f9f0e6801169b6fa0e72d56628 (patch)
treef616b6c651ce80765ee344aa33ca204c555e67f2 /drivers/gpu/nvgpu/vgpu/mm_vgpu.c
parent014ace5a85f274de7debb4c6168d69c803445e19 (diff)
gpu: nvgpu: Split vm_area management into vm code
The vm_reserve_va_node struct is essentially a special VM area that can be used for sparse mappings and fixed mappings. The name of this struct is somewhat confusing (as node is typically used for list items). Though this struct is a part of a list it doesn't really make sense to call this a list item since it's much more. Based on that the struct has been renamed to nvgpu_vm_area to capture the actual use of the struct more accurately. This also moves all of the management code of vm areas to a new file devoted solely to vm_area management. Also add a brief overview of the VM architecture. This should help other people follow along the hierachy of ownership and lifetimes in the rather complex MM code. JIRA NVGPU-12 JIRA NVGPU-30 Change-Id: If85e1cf868031d0dc265e7bed50b58a2aed2602e Signed-off-by: Alex Waterman <alexw@nvidia.com> Reviewed-on: http://git-master/r/1477744 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/vgpu/mm_vgpu.c')
-rw-r--r--drivers/gpu/nvgpu/vgpu/mm_vgpu.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/drivers/gpu/nvgpu/vgpu/mm_vgpu.c b/drivers/gpu/nvgpu/vgpu/mm_vgpu.c
index f4004f42..b42fbcb3 100644
--- a/drivers/gpu/nvgpu/vgpu/mm_vgpu.c
+++ b/drivers/gpu/nvgpu/vgpu/mm_vgpu.c
@@ -18,6 +18,7 @@
18#include <nvgpu/kmem.h> 18#include <nvgpu/kmem.h>
19#include <nvgpu/dma.h> 19#include <nvgpu/dma.h>
20#include <nvgpu/bug.h> 20#include <nvgpu/bug.h>
21#include <nvgpu/vm_area.h>
21 22
22#include "vgpu/vgpu.h" 23#include "vgpu/vgpu.h"
23#include "gk20a/mm_gk20a.h" 24#include "gk20a/mm_gk20a.h"
@@ -203,7 +204,7 @@ static void vgpu_vm_remove_support(struct vm_gk20a *vm)
203{ 204{
204 struct gk20a *g = vm->mm->g; 205 struct gk20a *g = vm->mm->g;
205 struct nvgpu_mapped_buf *mapped_buffer; 206 struct nvgpu_mapped_buf *mapped_buffer;
206 struct vm_reserved_va_node *va_node, *va_node_tmp; 207 struct nvgpu_vm_area *vm_area, *vm_area_tmp;
207 struct tegra_vgpu_cmd_msg msg; 208 struct tegra_vgpu_cmd_msg msg;
208 struct tegra_vgpu_as_share_params *p = &msg.params.as_share; 209 struct tegra_vgpu_as_share_params *p = &msg.params.as_share;
209 struct nvgpu_rbtree_node *node = NULL; 210 struct nvgpu_rbtree_node *node = NULL;
@@ -223,11 +224,11 @@ static void vgpu_vm_remove_support(struct vm_gk20a *vm)
223 } 224 }
224 225
225 /* destroy remaining reserved memory areas */ 226 /* destroy remaining reserved memory areas */
226 nvgpu_list_for_each_entry_safe(va_node, va_node_tmp, 227 nvgpu_list_for_each_entry_safe(vm_area, vm_area_tmp,
227 &vm->reserved_va_list, 228 &vm->vm_area_list,
228 vm_reserved_va_node, reserved_va_list) { 229 nvgpu_vm_area, vm_area_list) {
229 nvgpu_list_del(&va_node->reserved_va_list); 230 nvgpu_list_del(&vm_area->vm_area_list);
230 nvgpu_kfree(g, va_node); 231 nvgpu_kfree(g, vm_area);
231 } 232 }
232 233
233 msg.cmd = TEGRA_VGPU_CMD_AS_FREE_SHARE; 234 msg.cmd = TEGRA_VGPU_CMD_AS_FREE_SHARE;
@@ -413,7 +414,7 @@ static int vgpu_vm_alloc_share(struct gk20a_as_share *as_share,
413 414
414 nvgpu_mutex_init(&vm->update_gmmu_lock); 415 nvgpu_mutex_init(&vm->update_gmmu_lock);
415 kref_init(&vm->ref); 416 kref_init(&vm->ref);
416 nvgpu_init_list_node(&vm->reserved_va_list); 417 nvgpu_init_list_node(&vm->vm_area_list);
417 418
418 vm->enable_ctag = true; 419 vm->enable_ctag = true;
419 420