diff options
author | Alex Waterman <alexw@nvidia.com> | 2016-10-31 16:17:44 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-01-31 19:23:07 -0500 |
commit | 95a3eb454ca2f1b1b1a5677fe024eacae79bc0ed (patch) | |
tree | 6b3daeb6e2f8ac5828faf1ddc448f61de8954b70 /drivers/gpu/nvgpu/gk20a/mm_gk20a.h | |
parent | b9b94c073ce551935be1c00cb8e756ad5ce5c631 (diff) |
gpu: nvgpu: Conditional address space unification
Allow platforms to choose whether or not to have unified GPU
VA spaces. This is useful for the dGPU where having a unified
address space has no problems. On iGPUs testing issues is
getting in the way of enabling this feature.
Bug 1396644
Bug 1729947
Change-Id: I65985f1f9a818f4b06219715cc09619911e4824b
Signed-off-by: Alex Waterman <alexw@nvidia.com>
Reviewed-on: http://git-master/r/1265303
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/mm_gk20a.h')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/mm_gk20a.h | 45 |
1 files changed, 15 insertions, 30 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.h b/drivers/gpu/nvgpu/gk20a/mm_gk20a.h index f362e27c..665aea42 100644 --- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.h +++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.h | |||
@@ -270,9 +270,16 @@ struct vm_gk20a { | |||
270 | 270 | ||
271 | struct gk20a_mm_entry pdb; | 271 | struct gk20a_mm_entry pdb; |
272 | 272 | ||
273 | /* | ||
274 | * These structs define the address spaces. In some cases it's possible | ||
275 | * to merge address spaces (user and user_lp) and in other cases it's | ||
276 | * not. vma[] allows the code to be agnostic to this by always using | ||
277 | * address spaces through this pointer array. | ||
278 | */ | ||
273 | struct nvgpu_allocator *vma[gmmu_nr_page_sizes]; | 279 | struct nvgpu_allocator *vma[gmmu_nr_page_sizes]; |
274 | struct nvgpu_allocator kernel; | 280 | struct nvgpu_allocator kernel; |
275 | struct nvgpu_allocator user; | 281 | struct nvgpu_allocator user; |
282 | struct nvgpu_allocator user_lp; | ||
276 | 283 | ||
277 | struct rb_root mapped_buffers; | 284 | struct rb_root mapped_buffers; |
278 | 285 | ||
@@ -433,41 +440,19 @@ static inline int bar1_aperture_size_mb_gk20a(void) | |||
433 | /* The default kernel-reserved GPU VA size */ | 440 | /* The default kernel-reserved GPU VA size */ |
434 | #define NV_MM_DEFAULT_KERNEL_SIZE (1ULL << 32) | 441 | #define NV_MM_DEFAULT_KERNEL_SIZE (1ULL << 32) |
435 | 442 | ||
436 | enum gmmu_pgsz_gk20a __get_pte_size_fixed_map(struct vm_gk20a *vm, | ||
437 | u64 base, u64 size); | ||
438 | |||
439 | /* | 443 | /* |
440 | * This determines the PTE size for a given alloc. Used by both the GVA space | 444 | * When not using unified address spaces the bottom 16GB of the space are used |
441 | * allocator and the mm core code so that agreement can be reached on how to | 445 | * for small pages and the remaining high memory is used for large pages. |
442 | * map allocations. | ||
443 | * | ||
444 | * The page size of a buffer is this: | ||
445 | * | ||
446 | * o If the VM doesn't support large pages then obviously small pages | ||
447 | * must be used. | ||
448 | * o If the base address is non-zero (fixed address map): | ||
449 | * - Attempt to find a reserved memory area and use the page size | ||
450 | * based on that. | ||
451 | * - If no reserved page size is available, default to small pages. | ||
452 | * o If the base is zero: | ||
453 | * - If the size is greater than or equal to the big page size, use big | ||
454 | * pages. | ||
455 | * - Otherwise use small pages. | ||
456 | */ | 446 | */ |
457 | static inline enum gmmu_pgsz_gk20a __get_pte_size(struct vm_gk20a *vm, | 447 | static inline u64 __nv_gmmu_va_small_page_limit(void) |
458 | u64 base, u64 size) | ||
459 | { | 448 | { |
460 | if (!vm->big_pages) | 449 | return ((u64)SZ_1G * 16); |
461 | return gmmu_page_size_small; | ||
462 | |||
463 | if (base) | ||
464 | return __get_pte_size_fixed_map(vm, base, size); | ||
465 | |||
466 | if (size >= vm->gmmu_page_sizes[gmmu_page_size_big]) | ||
467 | return gmmu_page_size_big; | ||
468 | return gmmu_page_size_small; | ||
469 | } | 450 | } |
470 | 451 | ||
452 | enum gmmu_pgsz_gk20a __get_pte_size_fixed_map(struct vm_gk20a *vm, | ||
453 | u64 base, u64 size); | ||
454 | enum gmmu_pgsz_gk20a __get_pte_size(struct vm_gk20a *vm, u64 base, u64 size); | ||
455 | |||
471 | /* | 456 | /* |
472 | * Buffer accessors - wrap between begin() and end() if there is no permanent | 457 | * Buffer accessors - wrap between begin() and end() if there is no permanent |
473 | * kernel mapping for this buffer. | 458 | * kernel mapping for this buffer. |