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 <alexw@nvidia.com>
Reviewed-on: http://git-master/r/1493318
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com>
Reviewed-by: Aingara Paramakuru <aparamakuru@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
This commit is contained in:
Alex Waterman
2017-05-31 11:52:06 -07:00
committed by mobile promotions
parent 80197d2c9d
commit 6bd7d22c0f

View File

@@ -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.