diff options
Diffstat (limited to 'drivers/gpu/nvgpu/common/mm')
-rw-r--r-- | drivers/gpu/nvgpu/common/mm/vm.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/common/mm/vm.c b/drivers/gpu/nvgpu/common/mm/vm.c index e90437a3..19cc9fc5 100644 --- a/drivers/gpu/nvgpu/common/mm/vm.c +++ b/drivers/gpu/nvgpu/common/mm/vm.c | |||
@@ -60,6 +60,26 @@ int vm_aspace_id(struct vm_gk20a *vm) | |||
60 | return vm->as_share ? vm->as_share->id : -1; | 60 | return vm->as_share ? vm->as_share->id : -1; |
61 | } | 61 | } |
62 | 62 | ||
63 | /* | ||
64 | * Determine how many bits of the address space each last level PDE covers. For | ||
65 | * example, for gp10b, with a last level address bit PDE range of 28 to 21 the | ||
66 | * amount of memory each last level PDE addresses is 21 bits - i.e 2MB. | ||
67 | */ | ||
68 | int nvgpu_vm_pde_coverage_bit_count(struct vm_gk20a *vm) | ||
69 | { | ||
70 | int final_pde_level = 0; | ||
71 | |||
72 | /* | ||
73 | * Find the second to last level of the page table programming | ||
74 | * heirarchy: the last level is PTEs so we really want the level | ||
75 | * before that which is the last level of PDEs. | ||
76 | */ | ||
77 | while (vm->mmu_levels[final_pde_level + 2].update_entry) | ||
78 | final_pde_level++; | ||
79 | |||
80 | return vm->mmu_levels[final_pde_level].lo_bit[0]; | ||
81 | } | ||
82 | |||
63 | static void __nvgpu_vm_free_entries(struct vm_gk20a *vm, | 83 | static void __nvgpu_vm_free_entries(struct vm_gk20a *vm, |
64 | struct nvgpu_gmmu_pd *pd, | 84 | struct nvgpu_gmmu_pd *pd, |
65 | int level) | 85 | int level) |