From 6bd7d22c0f248d0d29ea44b06798b247d0d2753a Mon Sep 17 00:00:00 2001 From: Alex Waterman Date: Wed, 31 May 2017 11:52:06 -0700 Subject: gpu: nvgpu: Fix big_pages logic in nvgpu_vm_init Fix the way big_pages is handled in nvgpu_vm_init(). Prior to this patch big_pages could wind up being true even if disable_bigpages is set in the mm struct. Clearly this is wrong. The logic is now simplified a little bit and makes it so that if the disable_bigpages field is set then the resulting VM created by nvgpu_vm_init() has only one user area (no need for a second LP user area) and the big_pages field for the VM is set to false. JIRA NVGPU-12 JIRA NVGPU-30 Change-Id: If5dc7fcf3fa4e070f87295406f0afe414269b702 Signed-off-by: Alex Waterman Reviewed-on: http://git-master/r/1493318 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: svccoveritychecker Reviewed-by: Aingara Paramakuru GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom --- drivers/gpu/nvgpu/common/mm/vm.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'drivers') diff --git a/drivers/gpu/nvgpu/common/mm/vm.c b/drivers/gpu/nvgpu/common/mm/vm.c index 904284ec..b957e755 100644 --- a/drivers/gpu/nvgpu/common/mm/vm.c +++ b/drivers/gpu/nvgpu/common/mm/vm.c @@ -279,7 +279,6 @@ int nvgpu_init_vm(struct mm_gk20a *mm, vm->va_start = low_hole; vm->va_limit = aperture_size; - vm->big_pages = big_pages; vm->big_page_size = vm->gmmu_page_sizes[gmmu_page_size_big]; vm->userspace_managed = userspace_managed; @@ -292,7 +291,13 @@ int nvgpu_init_vm(struct mm_gk20a *mm, /* Setup vma limits. */ if (kernel_reserved + low_hole < aperture_size) { - if (nvgpu_is_enabled(g, NVGPU_MM_UNIFY_ADDRESS_SPACES)) { + /* + * If big_pages are disabled for this VM then it only makes + * sense to make one VM, same as if the unified address flag + * is set. + */ + if (!big_pages || + nvgpu_is_enabled(g, NVGPU_MM_UNIFY_ADDRESS_SPACES)) { user_vma_start = low_hole; user_vma_limit = vm->va_limit - kernel_reserved; user_lp_vma_start = user_vma_limit; @@ -346,11 +351,13 @@ int nvgpu_init_vm(struct mm_gk20a *mm, * space is used then check the user_lp vma instead of the user vma. */ if (nvgpu_is_enabled(g, NVGPU_MM_UNIFY_ADDRESS_SPACES)) - vm->big_pages = nvgpu_big_pages_possible(vm, user_vma_start, - user_vma_limit - user_vma_start); + vm->big_pages = big_pages && + nvgpu_big_pages_possible(vm, user_vma_start, + user_vma_limit - user_vma_start); else - vm->big_pages = nvgpu_big_pages_possible(vm, user_lp_vma_start, - user_lp_vma_limit - user_lp_vma_start); + vm->big_pages = big_pages && + nvgpu_big_pages_possible(vm, user_lp_vma_start, + user_lp_vma_limit - user_lp_vma_start); /* * User VMA. -- cgit v1.2.2