diff options
author | Alex Waterman <alexw@nvidia.com> | 2017-05-31 14:52:06 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-06-06 20:09:05 -0400 |
commit | 6bd7d22c0f248d0d29ea44b06798b247d0d2753a (patch) | |
tree | 7d79130eb0934fa351d8af9be900c7231eb0c91c /drivers/gpu | |
parent | 80197d2c9daa8e2320cc0b15741904eb3c1b9ba7 (diff) |
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>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/nvgpu/common/mm/vm.c | 19 |
1 files changed, 13 insertions, 6 deletions
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, | |||
279 | 279 | ||
280 | vm->va_start = low_hole; | 280 | vm->va_start = low_hole; |
281 | vm->va_limit = aperture_size; | 281 | vm->va_limit = aperture_size; |
282 | vm->big_pages = big_pages; | ||
283 | 282 | ||
284 | vm->big_page_size = vm->gmmu_page_sizes[gmmu_page_size_big]; | 283 | vm->big_page_size = vm->gmmu_page_sizes[gmmu_page_size_big]; |
285 | vm->userspace_managed = userspace_managed; | 284 | vm->userspace_managed = userspace_managed; |
@@ -292,7 +291,13 @@ int nvgpu_init_vm(struct mm_gk20a *mm, | |||
292 | 291 | ||
293 | /* Setup vma limits. */ | 292 | /* Setup vma limits. */ |
294 | if (kernel_reserved + low_hole < aperture_size) { | 293 | if (kernel_reserved + low_hole < aperture_size) { |
295 | if (nvgpu_is_enabled(g, NVGPU_MM_UNIFY_ADDRESS_SPACES)) { | 294 | /* |
295 | * If big_pages are disabled for this VM then it only makes | ||
296 | * sense to make one VM, same as if the unified address flag | ||
297 | * is set. | ||
298 | */ | ||
299 | if (!big_pages || | ||
300 | nvgpu_is_enabled(g, NVGPU_MM_UNIFY_ADDRESS_SPACES)) { | ||
296 | user_vma_start = low_hole; | 301 | user_vma_start = low_hole; |
297 | user_vma_limit = vm->va_limit - kernel_reserved; | 302 | user_vma_limit = vm->va_limit - kernel_reserved; |
298 | user_lp_vma_start = user_vma_limit; | 303 | user_lp_vma_start = user_vma_limit; |
@@ -346,11 +351,13 @@ int nvgpu_init_vm(struct mm_gk20a *mm, | |||
346 | * space is used then check the user_lp vma instead of the user vma. | 351 | * space is used then check the user_lp vma instead of the user vma. |
347 | */ | 352 | */ |
348 | if (nvgpu_is_enabled(g, NVGPU_MM_UNIFY_ADDRESS_SPACES)) | 353 | if (nvgpu_is_enabled(g, NVGPU_MM_UNIFY_ADDRESS_SPACES)) |
349 | vm->big_pages = nvgpu_big_pages_possible(vm, user_vma_start, | 354 | vm->big_pages = big_pages && |
350 | user_vma_limit - user_vma_start); | 355 | nvgpu_big_pages_possible(vm, user_vma_start, |
356 | user_vma_limit - user_vma_start); | ||
351 | else | 357 | else |
352 | vm->big_pages = nvgpu_big_pages_possible(vm, user_lp_vma_start, | 358 | vm->big_pages = big_pages && |
353 | user_lp_vma_limit - user_lp_vma_start); | 359 | nvgpu_big_pages_possible(vm, user_lp_vma_start, |
360 | user_lp_vma_limit - user_lp_vma_start); | ||
354 | 361 | ||
355 | /* | 362 | /* |
356 | * User VMA. | 363 | * User VMA. |