diff options
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/mm_gk20a.c | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c index d8dacad8..43758712 100644 --- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c | |||
@@ -1312,16 +1312,25 @@ u64 gk20a_vm_map(struct vm_gk20a *vm, | |||
1312 | bfr.pgsz_idx = -1; | 1312 | bfr.pgsz_idx = -1; |
1313 | mapping_size = mapping_size ? mapping_size : bfr.size; | 1313 | mapping_size = mapping_size ? mapping_size : bfr.size; |
1314 | 1314 | ||
1315 | /* If FIX_OFFSET is set, pgsz is determined. Otherwise, select | 1315 | if (vm->big_pages) |
1316 | * page size according to memory alignment */ | 1316 | gmmu_select_page_size(vm, &bfr); |
1317 | else | ||
1318 | bfr.pgsz_idx = gmmu_page_size_small; | ||
1319 | |||
1320 | /* If FIX_OFFSET is set, pgsz is determined at address allocation | ||
1321 | * time. The alignment at address alloc time must be the same as | ||
1322 | * the alignment determined by gmmu_select_page_size(). | ||
1323 | */ | ||
1317 | if (flags & NVGPU_AS_MAP_BUFFER_FLAGS_FIXED_OFFSET) { | 1324 | if (flags & NVGPU_AS_MAP_BUFFER_FLAGS_FIXED_OFFSET) { |
1318 | bfr.pgsz_idx = NV_GMMU_VA_IS_UPPER(offset_align) ? | 1325 | int pgsz_idx = NV_GMMU_VA_IS_UPPER(offset_align) ? |
1319 | gmmu_page_size_big : gmmu_page_size_small; | 1326 | gmmu_page_size_big : gmmu_page_size_small; |
1320 | } else { | 1327 | if (pgsz_idx > bfr.pgsz_idx) { |
1321 | if (vm->big_pages) | 1328 | gk20a_err(d, "%llx buffer pgsz %d, VA pgsz %d", |
1322 | gmmu_select_page_size(vm, &bfr); | 1329 | offset_align, bfr.pgsz_idx, pgsz_idx); |
1323 | else | 1330 | err = -EINVAL; |
1324 | bfr.pgsz_idx = gmmu_page_size_small; | 1331 | goto clean_up; |
1332 | } | ||
1333 | bfr.pgsz_idx = min(bfr.pgsz_idx, pgsz_idx); | ||
1325 | } | 1334 | } |
1326 | 1335 | ||
1327 | /* validate/adjust bfr attributes */ | 1336 | /* validate/adjust bfr attributes */ |
@@ -2495,17 +2504,8 @@ int gk20a_vm_free_space(struct gk20a_as_share *as_share, | |||
2495 | args->pages, args->offset); | 2504 | args->pages, args->offset); |
2496 | 2505 | ||
2497 | /* determine pagesz idx */ | 2506 | /* determine pagesz idx */ |
2498 | for (pgsz_idx = gmmu_page_size_small; | 2507 | pgsz_idx = NV_GMMU_VA_IS_UPPER(args->offset) ? |
2499 | pgsz_idx < gmmu_nr_page_sizes; | 2508 | gmmu_page_size_big : gmmu_page_size_small; |
2500 | pgsz_idx++) { | ||
2501 | if (vm->gmmu_page_sizes[pgsz_idx] == args->page_size) | ||
2502 | break; | ||
2503 | } | ||
2504 | |||
2505 | if (pgsz_idx >= gmmu_nr_page_sizes) { | ||
2506 | err = -EINVAL; | ||
2507 | goto clean_up; | ||
2508 | } | ||
2509 | 2509 | ||
2510 | start_page_nr = (u32)(args->offset >> | 2510 | start_page_nr = (u32)(args->offset >> |
2511 | ilog2(vm->gmmu_page_sizes[pgsz_idx])); | 2511 | ilog2(vm->gmmu_page_sizes[pgsz_idx])); |