From b8dbc853d79a086c30b4be5e15d25cc305320e8b Mon Sep 17 00:00:00 2001 From: Alex Waterman Date: Tue, 16 Jan 2018 16:44:18 -0800 Subject: gpu: nvgpu: Use real PDE size to determine pte_blk_order In the buddy allocator use the actual size of the PDE to determine the pte_blk_order field which is used to determine what page size a buddy has (or doesn't). Previously this was just set as the large page size times 1024 which would over allocate PDE ranges for Pascal+ chips. This caused userspace, which was using the real PDE size, to sometime allocate small and large pages in what the buddy allocator mistakenly thought was one PDE. Bug 200105199 Change-Id: I7ab7db7962015fc268bad61b558a18704133e1cb Signed-off-by: Alex Waterman Reviewed-on: https://git-master.nvidia.com/r/1639731 Reviewed-by: svc-mobile-coverity GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/mm/buddy_allocator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/gpu/nvgpu/common/mm') diff --git a/drivers/gpu/nvgpu/common/mm/buddy_allocator.c b/drivers/gpu/nvgpu/common/mm/buddy_allocator.c index a2546e9d..e5a9b62b 100644 --- a/drivers/gpu/nvgpu/common/mm/buddy_allocator.c +++ b/drivers/gpu/nvgpu/common/mm/buddy_allocator.c @@ -1255,7 +1255,7 @@ int __nvgpu_buddy_allocator_init(struct gk20a *g, struct nvgpu_allocator *__a, a->vm = vm; if (flags & GPU_ALLOC_GVA_SPACE) { - pde_size = ((u64)vm->big_page_size) << 10; + pde_size = 1ULL << nvgpu_vm_pde_coverage_bit_count(vm); a->pte_blk_order = balloc_get_order(a, pde_size); } -- cgit v1.2.2