Skip to content

Commit c000121

Browse files
fxkamdChristianKoenigAMD
authored andcommitted
drm/ttm: fix offset in VMAs with a pg_offs in ttm_bo_vm_access
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 <[email protected]> Tested-by: Laurent Morichetti <[email protected]> Signed-off-by: Christian König <[email protected]> Link: https://patchwork.freedesktop.org/patch/381169/
1 parent f4a1692 commit c000121

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/gpu/drm/ttm/ttm_bo_vm.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,8 +505,10 @@ static int ttm_bo_vm_access_kmap(struct ttm_buffer_object *bo,
505505
int ttm_bo_vm_access(struct vm_area_struct *vma, unsigned long addr,
506506
void *buf, int len, int write)
507507
{
508-
unsigned long offset = (addr) - vma->vm_start;
509508
struct ttm_buffer_object *bo = vma->vm_private_data;
509+
unsigned long offset = (addr) - vma->vm_start +
510+
((vma->vm_pgoff - drm_vma_node_start(&bo->base.vma_node))
511+
<< PAGE_SHIFT);
510512
int ret;
511513

512514
if (len < 1 || (offset + len) >> PAGE_SHIFT > bo->num_pages)

0 commit comments

Comments
 (0)