From aa25a952ea2b19a081fa746f043228c270f43f94 Mon Sep 17 00:00:00 2001 From: Terje Bergstrom Date: Mon, 11 May 2015 19:28:11 -0700 Subject: Revert "gpu: nvgpu: New allocator for VA space" This reverts commit 2e235ac150fa4af8632c9abf0f109a10973a0bf5. Change-Id: I3aa745152124c2bc09c6c6dc5aeb1084ae7e08a4 Signed-off-by: Terje Bergstrom Reviewed-on: http://git-master/r/741469 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Hiroshi Doyu Tested-by: Hiroshi Doyu --- drivers/gpu/nvgpu/vgpu/ltc_vgpu.c | 5 +++-- drivers/gpu/nvgpu/vgpu/mm_vgpu.c | 36 ++++++++++++++++++++++-------------- 2 files changed, 25 insertions(+), 16 deletions(-) (limited to 'drivers/gpu/nvgpu/vgpu') diff --git a/drivers/gpu/nvgpu/vgpu/ltc_vgpu.c b/drivers/gpu/nvgpu/vgpu/ltc_vgpu.c index 211e34b5..1beac216 100644 --- a/drivers/gpu/nvgpu/vgpu/ltc_vgpu.c +++ b/drivers/gpu/nvgpu/vgpu/ltc_vgpu.c @@ -41,8 +41,9 @@ static int vgpu_ltc_init_comptags(struct gk20a *g, struct gr_gk20a *gr) if (max_comptag_lines < 2) return -ENXIO; - __gk20a_allocator_init(&gr->comp_tags, NULL, "comptag", - 1, max_comptag_lines - 1, 1, 10, 0); /* length*/ + gk20a_allocator_init(&gr->comp_tags, "comptag", + 1, /* start */ + max_comptag_lines - 1); /* length*/ return 0; } diff --git a/drivers/gpu/nvgpu/vgpu/mm_vgpu.c b/drivers/gpu/nvgpu/vgpu/mm_vgpu.c index 855aac0d..94e4602f 100644 --- a/drivers/gpu/nvgpu/vgpu/mm_vgpu.c +++ b/drivers/gpu/nvgpu/vgpu/mm_vgpu.c @@ -243,9 +243,11 @@ static int vgpu_vm_alloc_share(struct gk20a_as_share *as_share, struct tegra_vgpu_as_share_params *p = &msg.params.as_share; struct mm_gk20a *mm = &g->mm; struct vm_gk20a *vm; + u32 num_small_pages, num_large_pages, low_hole_pages; u64 small_vma_size, large_vma_size; char name[32]; int err, i; + u32 start; /* note: keep the page sizes sorted lowest to highest here */ u32 gmmu_page_sizes[gmmu_nr_page_sizes] = { @@ -292,27 +294,33 @@ static int vgpu_vm_alloc_share(struct gk20a_as_share *as_share, small_vma_size = (u64)16 << 30; large_vma_size = vm->va_limit - small_vma_size; + num_small_pages = (u32)(small_vma_size >> + ilog2(vm->gmmu_page_sizes[gmmu_page_size_small])); + + /* num_pages above is without regard to the low-side hole. */ + low_hole_pages = (vm->va_start >> + ilog2(vm->gmmu_page_sizes[gmmu_page_size_small])); + snprintf(name, sizeof(name), "gk20a_as_%d-%dKB", as_share->id, gmmu_page_sizes[gmmu_page_size_small]>>10); - err = __gk20a_allocator_init(&vm->vma[gmmu_page_size_small], - vm, name, - vm->va_start, - small_vma_size - vm->va_start, - SZ_4K, - GPU_BALLOC_MAX_ORDER, - GPU_BALLOC_GVA_SPACE); + err = gk20a_allocator_init(&vm->vma[gmmu_page_size_small], + name, + low_hole_pages, /*start*/ + num_small_pages - low_hole_pages);/* length*/ if (err) goto clean_up_share; + start = (u32)(small_vma_size >> + ilog2(vm->gmmu_page_sizes[gmmu_page_size_big])); + num_large_pages = (u32)(large_vma_size >> + ilog2(vm->gmmu_page_sizes[gmmu_page_size_big])); + snprintf(name, sizeof(name), "gk20a_as_%d-%dKB", as_share->id, gmmu_page_sizes[gmmu_page_size_big]>>10); - err = __gk20a_allocator_init(&vm->vma[gmmu_page_size_big], - vm, name, - small_vma_size, - large_vma_size, - big_page_size, - GPU_BALLOC_MAX_ORDER, - GPU_BALLOC_GVA_SPACE); + err = gk20a_allocator_init(&vm->vma[gmmu_page_size_big], + name, + start, /* start */ + num_large_pages); /* length */ if (err) goto clean_up_small_allocator; -- cgit v1.2.2