From a3b26f25a226ea56e84dbda1bb510c1a7bc11054 Mon Sep 17 00:00:00 2001 From: Terje Bergstrom Date: Mon, 9 Feb 2015 20:37:02 -0800 Subject: gpu: nvgpu: TLB invalidate after map/unmap Always invalidate TLB after mapping or unmapping, and remove the delayed TLB invalidate. Change-Id: I6df3c5c1fcca59f0f9e3f911168cb2f913c42815 Signed-off-by: Terje Bergstrom Signed-off-by: Deepak Nibade Reviewed-on: http://git-master/r/696413 Reviewed-by: Automatic_Commit_Validation_User --- drivers/gpu/nvgpu/vgpu/mm_vgpu.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'drivers/gpu/nvgpu/vgpu/mm_vgpu.c') diff --git a/drivers/gpu/nvgpu/vgpu/mm_vgpu.c b/drivers/gpu/nvgpu/vgpu/mm_vgpu.c index 6817b107..82d16bd1 100644 --- a/drivers/gpu/nvgpu/vgpu/mm_vgpu.c +++ b/drivers/gpu/nvgpu/vgpu/mm_vgpu.c @@ -1,7 +1,7 @@ /* * Virtualized GPU Memory Management * - * Copyright (c) 2014 NVIDIA CORPORATION. All rights reserved. + * Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, @@ -114,7 +114,8 @@ static u64 vgpu_locked_gmmu_map(struct vm_gk20a *vm, if (err || msg.ret) goto fail; - vm->tlb_dirty = true; + g->ops.mm.tlb_invalidate(vm); + return map_offset; fail: gk20a_err(d, "%s: failed with err=%d\n", __func__, err); @@ -154,7 +155,7 @@ static void vgpu_locked_gmmu_unmap(struct vm_gk20a *vm, dev_err(dev_from_vm(vm), "failed to update gmmu ptes on unmap"); - vm->tlb_dirty = true; + g->ops.mm.tlb_invalidate(vm); } static void vgpu_vm_remove_support(struct vm_gk20a *vm) @@ -402,20 +403,11 @@ static void vgpu_mm_tlb_invalidate(struct vm_gk20a *vm) gk20a_dbg_fn(""); - /* No need to invalidate if tlb is clean */ - mutex_lock(&vm->update_gmmu_lock); - if (!vm->tlb_dirty) { - mutex_unlock(&vm->update_gmmu_lock); - return; - } - msg.cmd = TEGRA_VGPU_CMD_AS_INVALIDATE; msg.handle = platform->virt_handle; p->handle = vm->handle; err = vgpu_comm_sendrecv(&msg, sizeof(msg), sizeof(msg)); WARN_ON(err || msg.ret); - vm->tlb_dirty = false; - mutex_unlock(&vm->update_gmmu_lock); } void vgpu_init_mm_ops(struct gpu_ops *gops) -- cgit v1.2.2