From b6569319c772d84087a0a1a6d7146bdcae8e9aab Mon Sep 17 00:00:00 2001 From: Alex Waterman Date: Fri, 24 Jun 2016 14:12:24 -0700 Subject: gpu: nvgpu: Support multiple types of allocators Support multiple types of allocation backends. Currently there is only one allocator implementation available: a buddy allocator. Buddy allocators have certain limitations though. For one the allocator requires metadata to be allocated from the kernel's system memory. This causes a given buddy allocation to potentially sleep on a kmalloc() call. This patch has been created so that a new backend can be created which will avoid any dynamic system memory management routines from being called. Bug 1781897 Change-Id: I98d6c8402c049942f13fee69c6901a166f177f65 Signed-off-by: Alex Waterman Reviewed-on: http://git-master/r/1172115 GVS: Gerrit_Virtual_Submit Reviewed-by: Konsta Holtta Reviewed-by: Yu-Huan Hsu --- drivers/gpu/nvgpu/gk20a/mm_gk20a.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'drivers/gpu/nvgpu/gk20a/mm_gk20a.h') diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.h b/drivers/gpu/nvgpu/gk20a/mm_gk20a.h index 2e9172c7..66e46480 100644 --- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.h @@ -424,12 +424,13 @@ static inline u64 __nv_gmmu_va_small_page_limit(void) static inline int __nv_gmmu_va_is_big_page_region(struct vm_gk20a *vm, u64 addr) { + struct gk20a_allocator *a = &vm->vma[gmmu_page_size_big]; + if (!vm->big_pages) return 0; - return addr >= vm->vma[gmmu_page_size_big].base && - addr < vm->vma[gmmu_page_size_big].base + - vm->vma[gmmu_page_size_big].length; + return addr >= gk20a_alloc_base(a) && + addr < gk20a_alloc_base(a) + gk20a_alloc_length(a); } /* -- cgit v1.2.2