diff --git a/drivers/gpu/nvgpu/common/mm/allocators/buddy_allocator.c b/drivers/gpu/nvgpu/common/mm/allocators/buddy_allocator.c index 929308908..64db2c83a 100644 --- a/drivers/gpu/nvgpu/common/mm/allocators/buddy_allocator.c +++ b/drivers/gpu/nvgpu/common/mm/allocators/buddy_allocator.c @@ -1325,10 +1325,8 @@ int nvgpu_buddy_allocator_init(struct gk20a *g, struct nvgpu_allocator *na, return -EINVAL; } - /* Needs to be fixed, return -EINVAL*/ if (size == 0U) { - /* Setting to fixed size 1G to avoid further issues */ - size = 0x40000000; + return -EINVAL; } /* If this is to manage a GVA space we need a VM. */ diff --git a/drivers/gpu/nvgpu/common/mm/vm.c b/drivers/gpu/nvgpu/common/mm/vm.c index 0edecb8df..1e5f91e72 100644 --- a/drivers/gpu/nvgpu/common/mm/vm.c +++ b/drivers/gpu/nvgpu/common/mm/vm.c @@ -503,21 +503,25 @@ int nvgpu_vm_do_init(struct mm_gk20a *mm, } /* - * Kernel VMA. Must always exist for an address space. + * Kernel VMA. + * Note: Kernel VMA does not exist for VGPU. */ - (void) strcpy(alloc_name, "gk20a_"); - (void) strcat(alloc_name, name); - (void) strcat(alloc_name, "-sys"); - err = nvgpu_allocator_init(g, &vm->kernel, - vm, alloc_name, - kernel_vma_start, - kernel_vma_limit - kernel_vma_start, - SZ_4K, - GPU_BALLOC_MAX_ORDER, - kernel_vma_flags, - BUDDY_ALLOCATOR); - if (err != 0) { - goto clean_up_allocators; + if (kernel_vma_start < kernel_vma_limit) { + (void) strcpy(alloc_name, "gk20a_"); + (void) strcat(alloc_name, name); + (void) strcat(alloc_name, "-sys"); + err = nvgpu_allocator_init(g, &vm->kernel, + vm, alloc_name, + kernel_vma_start, + kernel_vma_limit - + kernel_vma_start, + SZ_4K, + GPU_BALLOC_MAX_ORDER, + kernel_vma_flags, + BUDDY_ALLOCATOR); + if (err != 0) { + goto clean_up_allocators; + } } vm->mapped_buffers = NULL;