From 12f245163d835d8367c0446798ab42aea6cf7ed9 Mon Sep 17 00:00:00 2001 From: Alex Waterman Date: Thu, 11 Jun 2015 14:16:50 -0700 Subject: gpu: nvgpu: Fix address space limit computation The address space limit was being computed with the assumption that the va_limit field is inclusive. The va_limit field is actually not inclusive. It points to the first invalid byte. Thus when generating the adr_limit register the code incorrectly calculated that the address limit should be 0. To fix this the computation now just uses va_limit - 1. Also, the bitwise OR of 0xfff into the lower limit word was incorrect. The bottom 12 bits of the lower 32 bit word are ignored by the GPU and as such should not be populated. Change-Id: Ifcc13343aaf50776f3cf1a1e3726e73ffde5003f Signed-off-by: Alex Waterman Reviewed-on: http://git-master/r/756690 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Terje Bergstrom Reviewed-on: http://git-master/r/771151 Reviewed-by: Yu-Huan Hsu --- drivers/gpu/nvgpu/gk20a/mm_gk20a.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers') diff --git a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c index 0deadfd0..32ccc5b8 100644 --- a/drivers/gpu/nvgpu/gk20a/mm_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/mm_gk20a.c @@ -3209,10 +3209,10 @@ void gk20a_init_inst_block(struct mem_desc *inst_block, struct vm_gk20a *vm, g->ops.mm.init_pdb(g, inst_ptr, pde_addr); gk20a_mem_wr32(inst_ptr, ram_in_adr_limit_lo_w(), - u64_lo32(vm->va_limit) | 0xFFF); + u64_lo32(vm->va_limit - 1) & ~0xfff); gk20a_mem_wr32(inst_ptr, ram_in_adr_limit_hi_w(), - ram_in_adr_limit_hi_f(u64_hi32(vm->va_limit))); + ram_in_adr_limit_hi_f(u64_hi32(vm->va_limit - 1))); if (big_page_size && g->ops.mm.set_big_page_size) g->ops.mm.set_big_page_size(g, inst_ptr, big_page_size); -- cgit v1.2.2