summaryrefslogtreecommitdiff
path: root/sys/dev/pci
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2020-08-26 12:51:27 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2020-08-26 12:51:27 +0000
commitbc0643fd4bd9af98726ca96bdbfb84e50e2ee449 (patch)
tree32fa9eb281f2b021afe445f1c1eb5610171ca41b /sys/dev/pci
parent0f544ff9c9b61085a505edf8e8dbd05cdfad08b4 (diff)
drm/ttm: fix offset in VMAs with a pg_offs in ttm_bo_vm_access
From Felix Kuehling be580abecf13ebdcf6c16ec79d941c35017c94be in linux 5.7.y/5.7.18 c0001213d195d1bac83e0744c06ff06dd5a8ba53 in mainline linux
Diffstat (limited to 'sys/dev/pci')
-rw-r--r--sys/dev/pci/drm/ttm/ttm_bo_vm.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/dev/pci/drm/ttm/ttm_bo_vm.c b/sys/dev/pci/drm/ttm/ttm_bo_vm.c
index 524b2eedccb..f96cc124813 100644
--- a/sys/dev/pci/drm/ttm/ttm_bo_vm.c
+++ b/sys/dev/pci/drm/ttm/ttm_bo_vm.c
@@ -734,8 +734,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)