summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/mm_gk20a.c
diff options
context:
space:
mode:
authorAlex Waterman <alexw@nvidia.com>2017-05-05 18:00:23 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-05-26 06:33:57 -0400
commit0bb47c3675d2030545d40353931e2b8120541de4 (patch)
tree1a23b45c1ac19dbc98e1d4a585822eb47b7dfeb2 /drivers/gpu/nvgpu/gk20a/mm_gk20a.c
parentfbafc7eba41ba7654dfdadf51a53acf1638e9fa1 (diff)
gpu: nvgpu: Add and use VM init/deinit APIs
Remove the VM init/de-init from the HAL and instead use a single set of routines that init/de-init VMs. This prevents code divergence between vGPUs and regular GPUs. This patch also clears up the naming of the routines a little bit. Since some VMs are used inplace and others are dynamically allocated the APIs for freeing them were confusing. Also some free calls also clean up an instance block (this is API abuse - but this is how it currently exists). The new API looks like this: void __nvgpu_vm_remove(struct vm_gk20a *vm); void nvgpu_vm_remove(struct vm_gk20a *vm); void nvgpu_vm_remove_inst(struct vm_gk20a *vm, struct nvgpu_mem *inst_block); void nvgpu_vm_remove_vgpu(struct vm_gk20a *vm); int nvgpu_init_vm(struct mm_gk20a *mm, struct vm_gk20a *vm, u32 big_page_size, u64 low_hole, u64 kernel_reserved, u64 aperture_size, bool big_pages, bool userspace_managed, char *name); void nvgpu_deinit_vm(struct vm_gk20a *vm); JIRA NVGPU-12 JIRA NVGPU-30 Change-Id: Ia4016384c54746bfbcaa4bdd0d29d03d5d7f7f1b Signed-off-by: Alex Waterman <alexw@nvidia.com> Reviewed-on: http://git-master/r/1477747 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/mm_gk20a.c')
-rw-r--r--drivers/gpu/nvgpu/gk20a/mm_gk20a.c28
1 files changed, 7 insertions, 21 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c
index 17f1622f..183a540a 100644
--- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c
@@ -464,7 +464,7 @@ static void gk20a_remove_mm_ce_support(struct mm_gk20a *mm)
464 464
465 mm->vidmem.ce_ctx_id = (u32)~0; 465 mm->vidmem.ce_ctx_id = (u32)~0;
466 466
467 nvgpu_vm_remove_support_nofree(&mm->ce.vm); 467 __nvgpu_vm_remove(&mm->ce.vm);
468 468
469} 469}
470 470
@@ -476,11 +476,11 @@ static void gk20a_remove_mm_support(struct mm_gk20a *mm)
476 g->ops.mm.remove_bar2_vm(g); 476 g->ops.mm.remove_bar2_vm(g);
477 477
478 if (g->ops.mm.is_bar1_supported(g)) 478 if (g->ops.mm.is_bar1_supported(g))
479 nvgpu_vm_remove(&mm->bar1.vm, &mm->bar1.inst_block); 479 nvgpu_vm_remove_inst(&mm->bar1.vm, &mm->bar1.inst_block);
480 480
481 nvgpu_vm_remove(&mm->pmu.vm, &mm->pmu.inst_block); 481 nvgpu_vm_remove_inst(&mm->pmu.vm, &mm->pmu.inst_block);
482 gk20a_free_inst_block(gk20a_from_mm(mm), &mm->hwpm.inst_block); 482 gk20a_free_inst_block(gk20a_from_mm(mm), &mm->hwpm.inst_block);
483 nvgpu_vm_remove_support_nofree(&mm->cde.vm); 483 __nvgpu_vm_remove(&mm->cde.vm);
484 484
485 gk20a_semaphore_sea_destroy(g); 485 gk20a_semaphore_sea_destroy(g);
486 gk20a_vidmem_destroy(g); 486 gk20a_vidmem_destroy(g);
@@ -2337,10 +2337,9 @@ void nvgpu_vm_unmap_locked(struct nvgpu_mapped_buf *mapped_buffer,
2337 return; 2337 return;
2338} 2338}
2339 2339
2340 2340void gk20a_vm_free_entries(struct vm_gk20a *vm,
2341static void gk20a_vm_free_entries(struct vm_gk20a *vm, 2341 struct gk20a_mm_entry *parent,
2342 struct gk20a_mm_entry *parent, 2342 int level)
2343 int level)
2344{ 2343{
2345 int i; 2344 int i;
2346 2345
@@ -2663,18 +2662,6 @@ int nvgpu_vm_unmap_buffer(struct vm_gk20a *vm, u64 offset,
2663 return 0; 2662 return 0;
2664} 2663}
2665 2664
2666void nvgpu_deinit_vm(struct vm_gk20a *vm)
2667{
2668 if (nvgpu_alloc_initialized(&vm->kernel))
2669 nvgpu_alloc_destroy(&vm->kernel);
2670 if (nvgpu_alloc_initialized(&vm->user))
2671 nvgpu_alloc_destroy(&vm->user);
2672 if (nvgpu_alloc_initialized(&vm->user_lp))
2673 nvgpu_alloc_destroy(&vm->user_lp);
2674
2675 gk20a_vm_free_entries(vm, &vm->pdb, 0);
2676}
2677
2678int gk20a_alloc_inst_block(struct gk20a *g, struct nvgpu_mem *inst_block) 2665int gk20a_alloc_inst_block(struct gk20a *g, struct nvgpu_mem *inst_block)
2679{ 2666{
2680 int err; 2667 int err;
@@ -3151,7 +3138,6 @@ void gk20a_init_mm(struct gpu_ops *gops)
3151{ 3138{
3152 gops->mm.gmmu_map = gk20a_locked_gmmu_map; 3139 gops->mm.gmmu_map = gk20a_locked_gmmu_map;
3153 gops->mm.gmmu_unmap = gk20a_locked_gmmu_unmap; 3140 gops->mm.gmmu_unmap = gk20a_locked_gmmu_unmap;
3154 gops->mm.vm_remove = nvgpu_vm_remove_support;
3155 gops->mm.vm_alloc_share = gk20a_vm_alloc_share; 3141 gops->mm.vm_alloc_share = gk20a_vm_alloc_share;
3156 gops->mm.vm_bind_channel = gk20a_vm_bind_channel; 3142 gops->mm.vm_bind_channel = gk20a_vm_bind_channel;
3157 gops->mm.fb_flush = gk20a_mm_fb_flush; 3143 gops->mm.fb_flush = gk20a_mm_fb_flush;