diff options
author | Alex Waterman <alexw@nvidia.com> | 2017-05-11 13:25:47 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-06-06 20:09:22 -0400 |
commit | 048c6b062ae381a329dccbc7ca0599113dbd7417 (patch) | |
tree | 24712fcaf967e22bd91bcb6a81195cf79ac08cc1 /drivers/gpu/nvgpu/common/mm/vm.c | |
parent | c21f5bca9ae81804130e30ea3e6f7a18d51203dc (diff) |
gpu: nvgpu: Separate GMMU mapping impl from mm_gk20a.c
Separate the non-chip specific GMMU mapping implementation code
out of mm_gk20a.c. This puts all of the chip-agnostic code into
common/mm/gmmu.c in preparation for rewriting it.
JIRA NVGPU-12
JIRA NVGPU-30
Change-Id: I6f7fdac3422703f5e80bb22ad304dc27bba4814d
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: http://git-master/r/1480228
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/common/mm/vm.c')
-rw-r--r-- | drivers/gpu/nvgpu/common/mm/vm.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/drivers/gpu/nvgpu/common/mm/vm.c b/drivers/gpu/nvgpu/common/mm/vm.c index e24d40bf..5ba386c9 100644 --- a/drivers/gpu/nvgpu/common/mm/vm.c +++ b/drivers/gpu/nvgpu/common/mm/vm.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <nvgpu/dma.h> | 18 | #include <nvgpu/dma.h> |
19 | #include <nvgpu/vm.h> | 19 | #include <nvgpu/vm.h> |
20 | #include <nvgpu/vm_area.h> | 20 | #include <nvgpu/vm_area.h> |
21 | #include <nvgpu/gmmu.h> | ||
21 | #include <nvgpu/lock.h> | 22 | #include <nvgpu/lock.h> |
22 | #include <nvgpu/list.h> | 23 | #include <nvgpu/list.h> |
23 | #include <nvgpu/rbtree.h> | 24 | #include <nvgpu/rbtree.h> |
@@ -34,6 +35,22 @@ int vm_aspace_id(struct vm_gk20a *vm) | |||
34 | return vm->as_share ? vm->as_share->id : -1; | 35 | return vm->as_share ? vm->as_share->id : -1; |
35 | } | 36 | } |
36 | 37 | ||
38 | static void nvgpu_vm_free_entries(struct vm_gk20a *vm, | ||
39 | struct gk20a_mm_entry *parent, | ||
40 | int level) | ||
41 | { | ||
42 | int i; | ||
43 | |||
44 | if (parent->entries) | ||
45 | for (i = 0; i < parent->num_entries; i++) | ||
46 | nvgpu_vm_free_entries(vm, &parent->entries[i], level+1); | ||
47 | |||
48 | if (parent->mem.size) | ||
49 | nvgpu_free_gmmu_pages(vm, parent); | ||
50 | nvgpu_vfree(vm->mm->g, parent->entries); | ||
51 | parent->entries = NULL; | ||
52 | } | ||
53 | |||
37 | u64 __nvgpu_vm_alloc_va(struct vm_gk20a *vm, u64 size, | 54 | u64 __nvgpu_vm_alloc_va(struct vm_gk20a *vm, u64 size, |
38 | enum gmmu_pgsz_gk20a pgsz_idx) | 55 | enum gmmu_pgsz_gk20a pgsz_idx) |
39 | 56 | ||
@@ -421,7 +438,7 @@ clean_up_allocators: | |||
421 | clean_up_page_tables: | 438 | clean_up_page_tables: |
422 | /* Cleans up nvgpu_vm_init_page_tables() */ | 439 | /* Cleans up nvgpu_vm_init_page_tables() */ |
423 | nvgpu_vfree(g, vm->pdb.entries); | 440 | nvgpu_vfree(g, vm->pdb.entries); |
424 | free_gmmu_pages(vm, &vm->pdb); | 441 | nvgpu_free_gmmu_pages(vm, &vm->pdb); |
425 | clean_up_vgpu_vm: | 442 | clean_up_vgpu_vm: |
426 | #ifdef CONFIG_TEGRA_GR_VIRTUALIZATION | 443 | #ifdef CONFIG_TEGRA_GR_VIRTUALIZATION |
427 | if (g->is_virtual) | 444 | if (g->is_virtual) |
@@ -537,7 +554,7 @@ static void __nvgpu_vm_remove(struct vm_gk20a *vm) | |||
537 | if (nvgpu_alloc_initialized(&vm->user_lp)) | 554 | if (nvgpu_alloc_initialized(&vm->user_lp)) |
538 | nvgpu_alloc_destroy(&vm->user_lp); | 555 | nvgpu_alloc_destroy(&vm->user_lp); |
539 | 556 | ||
540 | gk20a_vm_free_entries(vm, &vm->pdb, 0); | 557 | nvgpu_vm_free_entries(vm, &vm->pdb, 0); |
541 | 558 | ||
542 | #ifdef CONFIG_TEGRA_GR_VIRTUALIZATION | 559 | #ifdef CONFIG_TEGRA_GR_VIRTUALIZATION |
543 | if (g->is_virtual) | 560 | if (g->is_virtual) |