diff options
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/mm_gk20a.c | 9 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/mm_gk20a.h | 1 |
2 files changed, 6 insertions, 4 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c index bde8afae..4c0a773c 100644 --- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c | |||
@@ -1984,9 +1984,10 @@ static int update_gmmu_level_locked(struct vm_gk20a *vm, | |||
1984 | pte->entries = | 1984 | pte->entries = |
1985 | kzalloc(sizeof(struct gk20a_mm_entry) * | 1985 | kzalloc(sizeof(struct gk20a_mm_entry) * |
1986 | num_entries, GFP_KERNEL); | 1986 | num_entries, GFP_KERNEL); |
1987 | pte->pgsz = pgsz_idx; | ||
1988 | if (!pte->entries) | 1987 | if (!pte->entries) |
1989 | return -ENOMEM; | 1988 | return -ENOMEM; |
1989 | pte->pgsz = pgsz_idx; | ||
1990 | pte->num_entries = num_entries; | ||
1990 | } | 1991 | } |
1991 | next_pte = pte->entries + pde_i; | 1992 | next_pte = pte->entries + pde_i; |
1992 | 1993 | ||
@@ -2153,17 +2154,16 @@ static void gk20a_vm_free_entries(struct vm_gk20a *vm, | |||
2153 | struct gk20a_mm_entry *parent, | 2154 | struct gk20a_mm_entry *parent, |
2154 | int level) | 2155 | int level) |
2155 | { | 2156 | { |
2156 | const struct gk20a_mmu_level *l = &vm->mmu_levels[level]; | ||
2157 | int num_entries = 1 << (l->hi_bit[parent->pgsz] - l->lo_bit[parent->pgsz]); | ||
2158 | int i; | 2157 | int i; |
2159 | 2158 | ||
2160 | if (parent->entries) | 2159 | if (parent->entries) |
2161 | for (i = 0; i < num_entries; i++) | 2160 | for (i = 0; i < parent->num_entries; i++) |
2162 | gk20a_vm_free_entries(vm, &parent->entries[i], level+1); | 2161 | gk20a_vm_free_entries(vm, &parent->entries[i], level+1); |
2163 | 2162 | ||
2164 | if (parent->size) | 2163 | if (parent->size) |
2165 | free_gmmu_pages(vm, parent); | 2164 | free_gmmu_pages(vm, parent); |
2166 | kfree(parent->entries); | 2165 | kfree(parent->entries); |
2166 | parent->entries = NULL; | ||
2167 | } | 2167 | } |
2168 | 2168 | ||
2169 | static void gk20a_vm_remove_support_nofree(struct vm_gk20a *vm) | 2169 | static void gk20a_vm_remove_support_nofree(struct vm_gk20a *vm) |
@@ -2288,6 +2288,7 @@ int gk20a_init_vm(struct mm_gk20a *mm, | |||
2288 | &pde_lo, &pde_hi); | 2288 | &pde_lo, &pde_hi); |
2289 | vm->pdb.entries = kzalloc(sizeof(struct gk20a_mm_entry) * | 2289 | vm->pdb.entries = kzalloc(sizeof(struct gk20a_mm_entry) * |
2290 | (pde_hi + 1), GFP_KERNEL); | 2290 | (pde_hi + 1), GFP_KERNEL); |
2291 | vm->pdb.num_entries = pde_hi + 1; | ||
2291 | 2292 | ||
2292 | if (!vm->pdb.entries) | 2293 | if (!vm->pdb.entries) |
2293 | return -ENOMEM; | 2294 | return -ENOMEM; |
diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.h b/drivers/gpu/nvgpu/gk20a/mm_gk20a.h index df9ebec3..f6806309 100644 --- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.h | |||
@@ -150,6 +150,7 @@ struct gk20a_mm_entry { | |||
150 | size_t size; | 150 | size_t size; |
151 | int pgsz; | 151 | int pgsz; |
152 | struct gk20a_mm_entry *entries; | 152 | struct gk20a_mm_entry *entries; |
153 | int num_entries; | ||
153 | }; | 154 | }; |
154 | 155 | ||
155 | struct priv_cmd_queue { | 156 | struct priv_cmd_queue { |