summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/mm_gk20a.c
diff options
context:
space:
mode:
authorAlex Waterman <alexw@nvidia.com>2015-04-16 14:46:22 -0400
committerTerje Bergstrom <tbergstrom@nvidia.com>2015-05-11 11:52:09 -0400
commit0566aee853eb32f4f796499b6b00ddf0f1d7de34 (patch)
treee640f945d82c598645b0b2c5cbc6eb194444026d /drivers/gpu/nvgpu/gk20a/mm_gk20a.c
parente206fdecb3e380adced41dd432779c848d18caa0 (diff)
gpu: nvgpu: WAR for simulator bug
On linsim, when the push buffers are allowed to be allocated with small pages above 4GB the simulator crashes. This patch ensures that for linsim all small page allocations are forced to be below 4GB in the GPU VA space. By doing so the simulator no longer crashes. This bug has come up because the GPU buddy allocator work generates allocations at the top of the address space first. Thus push buffers were located at between 12GB and 16GB in the GPU VA space. Change-Id: Iaef0af3fda3f37ac09a66b5e1179527d6fe08ccc Signed-off-by: Alex Waterman <alexw@nvidia.com> Reviewed-on: http://git-master/r/740728 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com> Tested-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/mm_gk20a.c')
-rw-r--r--drivers/gpu/nvgpu/gk20a/mm_gk20a.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c
index 7d359ff4..5d1ff563 100644
--- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c
@@ -1437,7 +1437,7 @@ u64 gk20a_vm_map(struct vm_gk20a *vm,
1437 * the alignment determined by gmmu_select_page_size(). 1437 * the alignment determined by gmmu_select_page_size().
1438 */ 1438 */
1439 if (flags & NVGPU_AS_MAP_BUFFER_FLAGS_FIXED_OFFSET) { 1439 if (flags & NVGPU_AS_MAP_BUFFER_FLAGS_FIXED_OFFSET) {
1440 int pgsz_idx = NV_GMMU_VA_IS_UPPER(offset_align) ? 1440 int pgsz_idx = __nv_gmmu_va_is_upper(vm, offset_align) ?
1441 gmmu_page_size_big : gmmu_page_size_small; 1441 gmmu_page_size_big : gmmu_page_size_small;
1442 if (pgsz_idx > bfr.pgsz_idx) { 1442 if (pgsz_idx > bfr.pgsz_idx) {
1443 gk20a_err(d, "%llx buffer pgsz %d, VA pgsz %d", 1443 gk20a_err(d, "%llx buffer pgsz %d, VA pgsz %d",
@@ -2441,6 +2441,13 @@ int gk20a_init_vm(struct mm_gk20a *mm,
2441 /* note: keep the page sizes sorted lowest to highest here */ 2441 /* note: keep the page sizes sorted lowest to highest here */
2442 u32 gmmu_page_sizes[gmmu_nr_page_sizes] = { SZ_4K, big_page_size }; 2442 u32 gmmu_page_sizes[gmmu_nr_page_sizes] = { SZ_4K, big_page_size };
2443 2443
2444 /*
2445 * Linsim bug: seems like we can't have pushbuffers above 4GB. Easy WAR for sim
2446 * is to just limit the address space to 4GB.
2447 */
2448 if (tegra_platform_is_linsim() && aperture_size > SZ_4G)
2449 aperture_size = SZ_4G;
2450
2444 vm->mm = mm; 2451 vm->mm = mm;
2445 2452
2446 vm->va_start = low_hole; 2453 vm->va_start = low_hole;
@@ -2483,7 +2490,7 @@ int gk20a_init_vm(struct mm_gk20a *mm,
2483 * remains is allocated to large pages. */ 2490 * remains is allocated to large pages. */
2484 small_vma_size = vm->va_limit; 2491 small_vma_size = vm->va_limit;
2485 if (big_pages) { 2492 if (big_pages) {
2486 small_vma_size = (u64)16 << 30; 2493 small_vma_size = __nv_gmmu_va_small_page_limit();
2487 large_vma_size = vm->va_limit - small_vma_size; 2494 large_vma_size = vm->va_limit - small_vma_size;
2488 } 2495 }
2489 2496
@@ -2698,7 +2705,7 @@ int gk20a_vm_free_space(struct gk20a_as_share *as_share,
2698 args->pages, args->offset); 2705 args->pages, args->offset);
2699 2706
2700 /* determine pagesz idx */ 2707 /* determine pagesz idx */
2701 pgsz_idx = NV_GMMU_VA_IS_UPPER(args->offset) ? 2708 pgsz_idx = __nv_gmmu_va_is_upper(vm, args->offset) ?
2702 gmmu_page_size_big : gmmu_page_size_small; 2709 gmmu_page_size_big : gmmu_page_size_small;
2703 2710
2704 start_page_nr = (u32)(args->offset >> 2711 start_page_nr = (u32)(args->offset >>