diff options
author | Deepak Nibade <dnibade@nvidia.com> | 2017-03-31 02:46:33 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-04-06 13:57:28 -0400 |
commit | ce3c30f14f1eed9ace2028b48c7e8f6cdd6b65cb (patch) | |
tree | f4fcc21aeccd99aa56d19ca67fdbee38dc4e311a /drivers/gpu/nvgpu/vgpu/mm_vgpu.c | |
parent | 6dda47a114d1ecbef4f5fa77e8100d795ee23ff1 (diff) |
gpu: nvgpu: use nvgpu rbtree to store mapped buffers
Use nvgpu rbtree instead of linux rbtree to store
mapped buffers for each VM
Move to use "struct nvgpu_rbtree_node" instead of
"struct rb_node"
And similarly use rbtree APIs from <nvgpu/rbtree.h>
instead of linux APIs
Jira NVGPU-13
Change-Id: Id96ba76e20fa9ecad016cd5d5a6a7d40579a70f2
Signed-off-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-on: http://git-master/r/1453043
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.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/gpu/nvgpu/vgpu/mm_vgpu.c b/drivers/gpu/nvgpu/vgpu/mm_vgpu.c index 7d0f7e9c..54ac36db 100644 --- a/drivers/gpu/nvgpu/vgpu/mm_vgpu.c +++ b/drivers/gpu/nvgpu/vgpu/mm_vgpu.c | |||
@@ -202,7 +202,7 @@ static void vgpu_vm_remove_support(struct vm_gk20a *vm) | |||
202 | struct vm_reserved_va_node *va_node, *va_node_tmp; | 202 | struct vm_reserved_va_node *va_node, *va_node_tmp; |
203 | struct tegra_vgpu_cmd_msg msg; | 203 | struct tegra_vgpu_cmd_msg msg; |
204 | struct tegra_vgpu_as_share_params *p = &msg.params.as_share; | 204 | struct tegra_vgpu_as_share_params *p = &msg.params.as_share; |
205 | struct rb_node *node; | 205 | struct nvgpu_rbtree_node *node = NULL; |
206 | int err; | 206 | int err; |
207 | 207 | ||
208 | gk20a_dbg_fn(""); | 208 | gk20a_dbg_fn(""); |
@@ -211,12 +211,11 @@ static void vgpu_vm_remove_support(struct vm_gk20a *vm) | |||
211 | /* TBD: add a flag here for the unmap code to recognize teardown | 211 | /* TBD: add a flag here for the unmap code to recognize teardown |
212 | * and short-circuit any otherwise expensive operations. */ | 212 | * and short-circuit any otherwise expensive operations. */ |
213 | 213 | ||
214 | node = rb_first(&vm->mapped_buffers); | 214 | nvgpu_rbtree_enum_start(0, &node, vm->mapped_buffers); |
215 | while (node) { | 215 | while (node) { |
216 | mapped_buffer = | 216 | mapped_buffer = mapped_buffer_from_rbtree_node(node); |
217 | container_of(node, struct mapped_buffer_node, node); | ||
218 | gk20a_vm_unmap_locked(mapped_buffer, NULL); | 217 | gk20a_vm_unmap_locked(mapped_buffer, NULL); |
219 | node = rb_first(&vm->mapped_buffers); | 218 | nvgpu_rbtree_enum_start(0, &node, vm->mapped_buffers); |
220 | } | 219 | } |
221 | 220 | ||
222 | /* destroy remaining reserved memory areas */ | 221 | /* destroy remaining reserved memory areas */ |
@@ -406,7 +405,7 @@ static int vgpu_vm_alloc_share(struct gk20a_as_share *as_share, | |||
406 | if (err) | 405 | if (err) |
407 | goto clean_up_user_allocator; | 406 | goto clean_up_user_allocator; |
408 | 407 | ||
409 | vm->mapped_buffers = RB_ROOT; | 408 | vm->mapped_buffers = NULL; |
410 | 409 | ||
411 | nvgpu_mutex_init(&vm->update_gmmu_lock); | 410 | nvgpu_mutex_init(&vm->update_gmmu_lock); |
412 | kref_init(&vm->ref); | 411 | kref_init(&vm->ref); |