From f3d22faef874901808746d957d2f97e6ca07a977 Mon Sep 17 00:00:00 2001 From: Aparna Das Date: Mon, 9 Apr 2018 13:49:38 -0700 Subject: nvgpu: vgpu: fix gmmu unmap Unmap gpu va at vsrv before freeing the address at guest to ensure there is no valid IPA to PA mapping when the address is reallocated at guest. Bug 200399982 Change-Id: If9375c69eac0f0dee23995f61b6486465618bf10 Signed-off-by: Aparna Das Reviewed-on: https://git-master.nvidia.com/r/1691532 Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/vgpu/mm_vgpu.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/nvgpu/vgpu/mm_vgpu.c b/drivers/gpu/nvgpu/vgpu/mm_vgpu.c index c10a1982..cba77ecf 100644 --- a/drivers/gpu/nvgpu/vgpu/mm_vgpu.c +++ b/drivers/gpu/nvgpu/vgpu/mm_vgpu.c @@ -97,14 +97,6 @@ void vgpu_locked_gmmu_unmap(struct vm_gk20a *vm, gk20a_dbg_fn(""); - if (va_allocated) { - err = __nvgpu_vm_free_va(vm, vaddr, pgsz_idx); - if (err) { - nvgpu_err(g, "failed to free va"); - return; - } - } - msg.cmd = TEGRA_VGPU_CMD_AS_UNMAP; msg.handle = vgpu_get_handle(g); p->handle = vm->handle; @@ -113,6 +105,11 @@ void vgpu_locked_gmmu_unmap(struct vm_gk20a *vm, if (err || msg.ret) nvgpu_err(g, "failed to update gmmu ptes on unmap"); + if (va_allocated) { + err = __nvgpu_vm_free_va(vm, vaddr, pgsz_idx); + if (err) + nvgpu_err(g, "failed to free va"); + } /* TLB invalidate handled on server side */ } -- cgit v1.2.2