summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/vgpu/mm_vgpu.c
diff options
context:
space:
mode:
authorAlex Waterman <alexw@nvidia.com>2015-05-15 12:13:28 -0400
committerTerje Bergstrom <tbergstrom@nvidia.com>2015-05-19 16:09:00 -0400
commit01f359f3f1bbf95d7ac4453a6c1de811bf0aee11 (patch)
treec35c928fcacaae7be13b4601538032dae9f672c6 /drivers/gpu/nvgpu/vgpu/mm_vgpu.c
parent7ddd6e261ed620dbb388202be89ca4e6843e3947 (diff)
Revert "Revert "gpu: nvgpu: New allocator for VA space""
This reverts commit 7eb42bc239dbd207208ff491c3fb65c3d83274d8. The original commit was actually fine. Change-Id: I564ce6530ac73fcfad17dcec9c53f0353b4f02d4 Signed-off-by: Alex Waterman <alexw@nvidia.com> Reviewed-on: http://git-master/r/743300 (cherry picked from commit e99aa2485f8992eabe3556f3ebcb57bdc8ad91ff) Reviewed-on: http://git-master/r/743301 Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com> Tested-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/vgpu/mm_vgpu.c')
-rw-r--r--drivers/gpu/nvgpu/vgpu/mm_vgpu.c36
1 files changed, 14 insertions, 22 deletions
diff --git a/drivers/gpu/nvgpu/vgpu/mm_vgpu.c b/drivers/gpu/nvgpu/vgpu/mm_vgpu.c
index 94e4602f..855aac0d 100644
--- a/drivers/gpu/nvgpu/vgpu/mm_vgpu.c
+++ b/drivers/gpu/nvgpu/vgpu/mm_vgpu.c
@@ -243,11 +243,9 @@ static int vgpu_vm_alloc_share(struct gk20a_as_share *as_share,
243 struct tegra_vgpu_as_share_params *p = &msg.params.as_share; 243 struct tegra_vgpu_as_share_params *p = &msg.params.as_share;
244 struct mm_gk20a *mm = &g->mm; 244 struct mm_gk20a *mm = &g->mm;
245 struct vm_gk20a *vm; 245 struct vm_gk20a *vm;
246 u32 num_small_pages, num_large_pages, low_hole_pages;
247 u64 small_vma_size, large_vma_size; 246 u64 small_vma_size, large_vma_size;
248 char name[32]; 247 char name[32];
249 int err, i; 248 int err, i;
250 u32 start;
251 249
252 /* note: keep the page sizes sorted lowest to highest here */ 250 /* note: keep the page sizes sorted lowest to highest here */
253 u32 gmmu_page_sizes[gmmu_nr_page_sizes] = { 251 u32 gmmu_page_sizes[gmmu_nr_page_sizes] = {
@@ -294,33 +292,27 @@ static int vgpu_vm_alloc_share(struct gk20a_as_share *as_share,
294 small_vma_size = (u64)16 << 30; 292 small_vma_size = (u64)16 << 30;
295 large_vma_size = vm->va_limit - small_vma_size; 293 large_vma_size = vm->va_limit - small_vma_size;
296 294
297 num_small_pages = (u32)(small_vma_size >>
298 ilog2(vm->gmmu_page_sizes[gmmu_page_size_small]));
299
300 /* num_pages above is without regard to the low-side hole. */
301 low_hole_pages = (vm->va_start >>
302 ilog2(vm->gmmu_page_sizes[gmmu_page_size_small]));
303
304 snprintf(name, sizeof(name), "gk20a_as_%d-%dKB", as_share->id, 295 snprintf(name, sizeof(name), "gk20a_as_%d-%dKB", as_share->id,
305 gmmu_page_sizes[gmmu_page_size_small]>>10); 296 gmmu_page_sizes[gmmu_page_size_small]>>10);
306 err = gk20a_allocator_init(&vm->vma[gmmu_page_size_small], 297 err = __gk20a_allocator_init(&vm->vma[gmmu_page_size_small],
307 name, 298 vm, name,
308 low_hole_pages, /*start*/ 299 vm->va_start,
309 num_small_pages - low_hole_pages);/* length*/ 300 small_vma_size - vm->va_start,
301 SZ_4K,
302 GPU_BALLOC_MAX_ORDER,
303 GPU_BALLOC_GVA_SPACE);
310 if (err) 304 if (err)
311 goto clean_up_share; 305 goto clean_up_share;
312 306
313 start = (u32)(small_vma_size >>
314 ilog2(vm->gmmu_page_sizes[gmmu_page_size_big]));
315 num_large_pages = (u32)(large_vma_size >>
316 ilog2(vm->gmmu_page_sizes[gmmu_page_size_big]));
317
318 snprintf(name, sizeof(name), "gk20a_as_%d-%dKB", as_share->id, 307 snprintf(name, sizeof(name), "gk20a_as_%d-%dKB", as_share->id,
319 gmmu_page_sizes[gmmu_page_size_big]>>10); 308 gmmu_page_sizes[gmmu_page_size_big]>>10);
320 err = gk20a_allocator_init(&vm->vma[gmmu_page_size_big], 309 err = __gk20a_allocator_init(&vm->vma[gmmu_page_size_big],
321 name, 310 vm, name,
322 start, /* start */ 311 small_vma_size,
323 num_large_pages); /* length */ 312 large_vma_size,
313 big_page_size,
314 GPU_BALLOC_MAX_ORDER,
315 GPU_BALLOC_GVA_SPACE);
324 if (err) 316 if (err)
325 goto clean_up_small_allocator; 317 goto clean_up_small_allocator;
326 318