summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gp10b/mm_gp10b.c
diff options
context:
space:
mode:
authorAlex Waterman <alexw@nvidia.com>2017-05-09 21:34:54 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-06-06 20:09:16 -0400
commitc21f5bca9ae81804130e30ea3e6f7a18d51203dc (patch)
treefb1a2d67532df19d70468610ad2a62c3464876c1 /drivers/gpu/nvgpu/gp10b/mm_gp10b.c
parentc2b63150cd947557b8d17637258b988459b8e0ec (diff)
gpu: nvgpu: Remove extraneous VM init/deinit APIs
Support only VM pointers and ref-counting for maintaining VMs. This dramatically reduces the complexity of the APIs, avoids the API abuse that has existed, and ensures that future VM usage is consistent with current usage. Also remove the combined VM free/instance block deletion. Any place where this was done is now replaced with an explict free of the instance block and a nvgpu_vm_put(). JIRA NVGPU-12 JIRA NVGPU-30 Change-Id: Ib73e8d574ecc9abf6dad0b40a2c5795d6396cc8c Signed-off-by: Alex Waterman <alexw@nvidia.com> Reviewed-on: http://git-master/r/1480227 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gp10b/mm_gp10b.c')
-rw-r--r--drivers/gpu/nvgpu/gp10b/mm_gp10b.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/drivers/gpu/nvgpu/gp10b/mm_gp10b.c b/drivers/gpu/nvgpu/gp10b/mm_gp10b.c
index bc4aee3a..3cd3eb50 100644
--- a/drivers/gpu/nvgpu/gp10b/mm_gp10b.c
+++ b/drivers/gpu/nvgpu/gp10b/mm_gp10b.c
@@ -67,32 +67,33 @@ static int gb10b_init_bar2_vm(struct gk20a *g)
67{ 67{
68 int err; 68 int err;
69 struct mm_gk20a *mm = &g->mm; 69 struct mm_gk20a *mm = &g->mm;
70 struct vm_gk20a *vm = &mm->bar2.vm;
71 struct nvgpu_mem *inst_block = &mm->bar2.inst_block; 70 struct nvgpu_mem *inst_block = &mm->bar2.inst_block;
72 u32 big_page_size = gk20a_get_platform(g->dev)->default_big_page_size; 71 u32 big_page_size = gk20a_get_platform(g->dev)->default_big_page_size;
73 72
74 /* BAR2 aperture size is 32MB */ 73 /* BAR2 aperture size is 32MB */
75 mm->bar2.aperture_size = 32 << 20; 74 mm->bar2.aperture_size = 32 << 20;
76 gk20a_dbg_info("bar2 vm size = 0x%x", mm->bar2.aperture_size); 75 gk20a_dbg_info("bar2 vm size = 0x%x", mm->bar2.aperture_size);
77 nvgpu_init_vm(mm, vm, big_page_size, SZ_4K, 76
77 mm->bar2.vm = nvgpu_vm_init(g, big_page_size, SZ_4K,
78 mm->bar2.aperture_size - SZ_4K, 78 mm->bar2.aperture_size - SZ_4K,
79 mm->bar2.aperture_size, false, false, "bar2"); 79 mm->bar2.aperture_size, false, false, "bar2");
80 if (!mm->bar2.vm)
81 return -ENOMEM;
80 82
81 /* allocate instance mem for bar2 */ 83 /* allocate instance mem for bar2 */
82 err = gk20a_alloc_inst_block(g, inst_block); 84 err = gk20a_alloc_inst_block(g, inst_block);
83 if (err) 85 if (err)
84 goto clean_up_va; 86 goto clean_up_va;
85 87
86 g->ops.mm.init_inst_block(inst_block, vm, big_page_size); 88 g->ops.mm.init_inst_block(inst_block, mm->bar2.vm, big_page_size);
87 89
88 return 0; 90 return 0;
89 91
90clean_up_va: 92clean_up_va:
91 nvgpu_deinit_vm(vm); 93 nvgpu_vm_put(mm->bar2.vm);
92 return err; 94 return err;
93} 95}
94 96
95
96static int gb10b_init_bar2_mm_hw_setup(struct gk20a *g) 97static int gb10b_init_bar2_mm_hw_setup(struct gk20a *g)
97{ 98{
98 struct mm_gk20a *mm = &g->mm; 99 struct mm_gk20a *mm = &g->mm;
@@ -401,7 +402,8 @@ static void gp10b_remove_bar2_vm(struct gk20a *g)
401 struct mm_gk20a *mm = &g->mm; 402 struct mm_gk20a *mm = &g->mm;
402 403
403 gp10b_replayable_pagefault_buffer_deinit(g); 404 gp10b_replayable_pagefault_buffer_deinit(g);
404 nvgpu_vm_remove_inst(&mm->bar2.vm, &mm->bar2.inst_block); 405 gk20a_free_inst_block(g, &mm->bar2.inst_block);
406 nvgpu_vm_put(mm->bar2.vm);
405} 407}
406 408
407 409