diff options
author | Alex Waterman <alexw@nvidia.com> | 2017-05-09 21:34:54 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-06-06 20:09:16 -0400 |
commit | c21f5bca9ae81804130e30ea3e6f7a18d51203dc (patch) | |
tree | fb1a2d67532df19d70468610ad2a62c3464876c1 /drivers/gpu/nvgpu/gp10b | |
parent | c2b63150cd947557b8d17637258b988459b8e0ec (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')
-rw-r--r-- | drivers/gpu/nvgpu/gp10b/mm_gp10b.c | 14 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gp10b/rpfb_gp10b.c | 4 |
2 files changed, 10 insertions, 8 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 | ||
90 | clean_up_va: | 92 | clean_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 | |||
96 | static int gb10b_init_bar2_mm_hw_setup(struct gk20a *g) | 97 | static 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 | ||
diff --git a/drivers/gpu/nvgpu/gp10b/rpfb_gp10b.c b/drivers/gpu/nvgpu/gp10b/rpfb_gp10b.c index 0fb4248c..56786929 100644 --- a/drivers/gpu/nvgpu/gp10b/rpfb_gp10b.c +++ b/drivers/gpu/nvgpu/gp10b/rpfb_gp10b.c | |||
@@ -28,7 +28,7 @@ int gp10b_replayable_pagefault_buffer_init(struct gk20a *g) | |||
28 | { | 28 | { |
29 | u32 addr_lo; | 29 | u32 addr_lo; |
30 | u32 addr_hi; | 30 | u32 addr_hi; |
31 | struct vm_gk20a *vm = &g->mm.bar2.vm; | 31 | struct vm_gk20a *vm = g->mm.bar2.vm; |
32 | int err; | 32 | int err; |
33 | size_t rbfb_size = NV_UVM_FAULT_BUF_SIZE * | 33 | size_t rbfb_size = NV_UVM_FAULT_BUF_SIZE * |
34 | fifo_replay_fault_buffer_size_hw_entries_v(); | 34 | fifo_replay_fault_buffer_size_hw_entries_v(); |
@@ -57,7 +57,7 @@ int gp10b_replayable_pagefault_buffer_init(struct gk20a *g) | |||
57 | 57 | ||
58 | void gp10b_replayable_pagefault_buffer_deinit(struct gk20a *g) | 58 | void gp10b_replayable_pagefault_buffer_deinit(struct gk20a *g) |
59 | { | 59 | { |
60 | struct vm_gk20a *vm = &g->mm.bar2.vm; | 60 | struct vm_gk20a *vm = g->mm.bar2.vm; |
61 | 61 | ||
62 | nvgpu_dma_unmap_free(vm, &g->mm.bar2_desc); | 62 | nvgpu_dma_unmap_free(vm, &g->mm.bar2_desc); |
63 | } | 63 | } |