From 81b14ef5b1cf980f3911b92290d7650588bd11b4 Mon Sep 17 00:00:00 2001 From: Sagar Kamble Date: Tue, 14 Apr 2020 14:48:43 +0530 Subject: [PATCH] gpu: nvgpu: fix dbg log and comment in nvgpu_vm_find_mapping Following commit updated the debug message in the function nvgpu_vm_find_mapping w.r.t reuse of mapping. commit 2f00d9adfc4fc91a6b84b14cc513f9b855d39cad Author: Sagar Kamble gpu: nvgpu: fix null pointer access in nvgpu_vm_find_mapping That reuse log is about the mapping and not SGT. Fix the log and add details about different handling of SGT for dmabuf drvdata cases in the comment. Bug 2834141 Change-Id: I3630de1c45a2bf55ff18bdb426f0597efe83f72c Signed-off-by: Sagar Kamble Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2328427 Tested-by: mobile promotions Reviewed-by: automaticguardword Reviewed-by: Alex Waterman Reviewed-by: mobile promotions GVS: Gerrit_Virtual_Submit --- drivers/gpu/nvgpu/os/linux/vm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/nvgpu/os/linux/vm.c b/drivers/gpu/nvgpu/os/linux/vm.c index 5b21bce92..b843711ce 100644 --- a/drivers/gpu/nvgpu/os/linux/vm.c +++ b/drivers/gpu/nvgpu/os/linux/vm.c @@ -157,8 +157,7 @@ struct nvgpu_mapped_buf *nvgpu_vm_find_mapping(struct vm_gk20a *vm, "gv: 0x%04x_%08x + 0x%-7zu " "[dma: 0x%010llx, pa: 0x%010llx] " "pgsz=%-3dKb as=%-2d " - "flags=0x%x apt=%s (already pinned, " - "reused in case of dmabuf drvdata, unpinned otherwise)", + "flags=0x%x apt=%s (reused)", u64_hi32(mapped_buffer->addr), u64_lo32(mapped_buffer->addr), os_buf->dmabuf->size, (u64)sg_dma_address(mapped_buffer->os_priv.sgt->sgl), @@ -171,6 +170,9 @@ struct nvgpu_mapped_buf *nvgpu_vm_find_mapping(struct vm_gk20a *vm, /* * If we find the mapping here then that means we have mapped it already * and the prior pin and get must be undone. + * The SGT is reused in the case of the dmabuf supporting drvdata. When + * the dmabuf doesn't support drvdata, prior SGT is unpinned as the + * new SGT was pinned at the beginning of the current map call. */ gk20a_mm_unpin(os_buf->dev, os_buf->dmabuf, mapped_buffer->os_priv.attachment,