All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] drm/ttm: fix offset in VMAs with a pg_offs in ttm_bo_vm_access
@ 2020-07-28 18:27 ` Felix Kuehling
  0 siblings, 0 replies; 16+ messages in thread
From: Felix Kuehling @ 2020-07-28 18:27 UTC (permalink / raw)
  To: dri-devel, amd-gfx; +Cc: laurent.morichetti

VMAs with a pg_offs that's offset from the start of the vma_node need
to adjust the offset within the BO accordingly. This matches the
offset calculation in ttm_bo_vm_fault_reserved.

Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
Tested-by: Laurent Morichetti <laurent.morichetti@amd.com>
---
 drivers/gpu/drm/ttm/ttm_bo_vm.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/ttm/ttm_bo_vm.c b/drivers/gpu/drm/ttm/ttm_bo_vm.c
index 389128b8c4dd..60b41447bec8 100644
--- a/drivers/gpu/drm/ttm/ttm_bo_vm.c
+++ b/drivers/gpu/drm/ttm/ttm_bo_vm.c
@@ -405,8 +405,10 @@ static int ttm_bo_vm_access_kmap(struct ttm_buffer_object *bo,
 int ttm_bo_vm_access(struct vm_area_struct *vma, unsigned long addr,
 		     void *buf, int len, int write)
 {
-	unsigned long offset = (addr) - vma->vm_start;
 	struct ttm_buffer_object *bo = vma->vm_private_data;
+	unsigned long offset = (addr) - vma->vm_start +
+		((vma->vm_pgoff - drm_vma_node_start(&bo->base.vma_node))
+		 << PAGE_SHIFT);
 	int ret;
 
 	if (len < 1 || (offset + len) >> PAGE_SHIFT > bo->num_pages)
-- 
2.17.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2020-07-30 11:59 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-07-28 18:27 [PATCH 1/1] drm/ttm: fix offset in VMAs with a pg_offs in ttm_bo_vm_access Felix Kuehling
2020-07-28 18:27 ` Felix Kuehling
2020-07-29  8:08 ` Christian König
2020-07-29  8:08   ` Christian König
2020-07-29 14:15   ` Felix Kuehling
2020-07-29 14:15     ` Felix Kuehling
2020-07-29 15:30     ` Deucher, Alexander
2020-07-29 15:30       ` Deucher, Alexander
2020-07-29 15:33       ` Koenig, Christian
2020-07-29 15:33         ` Koenig, Christian
2020-07-30 11:40         ` Daniel Vetter
2020-07-30 11:40           ` Daniel Vetter
2020-07-30 11:50           ` Christian König
2020-07-30 11:50             ` Christian König
2020-07-30 11:59             ` Christian König
2020-07-30 11:59               ` Christian König

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.