summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/vgpu/mm_vgpu.c
diff options
context:
space:
mode:
authorTerje Bergstrom <tbergstrom@nvidia.com>2015-02-09 23:37:02 -0500
committerDan Willemsen <dwillemsen@nvidia.com>2015-04-04 21:06:37 -0400
commita3b26f25a226ea56e84dbda1bb510c1a7bc11054 (patch)
treeaf422d027e1e4c6d058380fd26dee4eb95c8afa8 /drivers/gpu/nvgpu/vgpu/mm_vgpu.c
parent80d26baf051fa5fc05e4e15fe5fd6a7bac448a1c (diff)
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 <tbergstrom@nvidia.com> Signed-off-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-on: http://git-master/r/696413 Reviewed-by: Automatic_Commit_Validation_User
Diffstat (limited to 'drivers/gpu/nvgpu/vgpu/mm_vgpu.c')
-rw-r--r--drivers/gpu/nvgpu/vgpu/mm_vgpu.c16
1 files changed, 4 insertions, 12 deletions
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 @@
1/* 1/*
2 * Virtualized GPU Memory Management 2 * Virtualized GPU Memory Management
3 * 3 *
4 * Copyright (c) 2014 NVIDIA CORPORATION. All rights reserved. 4 * Copyright (c) 2014-2015, NVIDIA CORPORATION. All rights reserved.
5 * 5 *
6 * This program is free software; you can redistribute it and/or modify it 6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License, 7 * 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,
114 if (err || msg.ret) 114 if (err || msg.ret)
115 goto fail; 115 goto fail;
116 116
117 vm->tlb_dirty = true; 117 g->ops.mm.tlb_invalidate(vm);
118
118 return map_offset; 119 return map_offset;
119fail: 120fail:
120 gk20a_err(d, "%s: failed with err=%d\n", __func__, err); 121 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,
154 dev_err(dev_from_vm(vm), 155 dev_err(dev_from_vm(vm),
155 "failed to update gmmu ptes on unmap"); 156 "failed to update gmmu ptes on unmap");
156 157
157 vm->tlb_dirty = true; 158 g->ops.mm.tlb_invalidate(vm);
158} 159}
159 160
160static void vgpu_vm_remove_support(struct vm_gk20a *vm) 161static void vgpu_vm_remove_support(struct vm_gk20a *vm)
@@ -402,20 +403,11 @@ static void vgpu_mm_tlb_invalidate(struct vm_gk20a *vm)
402 403
403 gk20a_dbg_fn(""); 404 gk20a_dbg_fn("");
404 405
405 /* No need to invalidate if tlb is clean */
406 mutex_lock(&vm->update_gmmu_lock);
407 if (!vm->tlb_dirty) {
408 mutex_unlock(&vm->update_gmmu_lock);
409 return;
410 }
411
412 msg.cmd = TEGRA_VGPU_CMD_AS_INVALIDATE; 406 msg.cmd = TEGRA_VGPU_CMD_AS_INVALIDATE;
413 msg.handle = platform->virt_handle; 407 msg.handle = platform->virt_handle;
414 p->handle = vm->handle; 408 p->handle = vm->handle;
415 err = vgpu_comm_sendrecv(&msg, sizeof(msg), sizeof(msg)); 409 err = vgpu_comm_sendrecv(&msg, sizeof(msg), sizeof(msg));
416 WARN_ON(err || msg.ret); 410 WARN_ON(err || msg.ret);
417 vm->tlb_dirty = false;
418 mutex_unlock(&vm->update_gmmu_lock);
419} 411}
420 412
421void vgpu_init_mm_ops(struct gpu_ops *gops) 413void vgpu_init_mm_ops(struct gpu_ops *gops)