From 1771e370644e6ae67e5050fbfa47526338f76310 Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Wed, 30 Oct 2019 02:25:34 +0000 Subject: drm/ttm: Restore ttm prefaulting From Thomas Hellstrom 11377c3e997eca9c9ff562fc4fc7a41a455bddf6 in linux 4.19.y/4.19.81 941f2f72dbbe0cf8c2d6e0b180a8021a0ec477fa in mainline linux --- sys/dev/pci/drm/ttm/ttm_bo_vm.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'sys/dev/pci/drm') diff --git a/sys/dev/pci/drm/ttm/ttm_bo_vm.c b/sys/dev/pci/drm/ttm/ttm_bo_vm.c index cf275e8b524..487241c7dda 100644 --- a/sys/dev/pci/drm/ttm/ttm_bo_vm.c +++ b/sys/dev/pci/drm/ttm/ttm_bo_vm.c @@ -275,15 +275,13 @@ static vm_fault_t ttm_bo_vm_fault(struct vm_fault *vmf) else ret = vmf_insert_pfn(&cvma, address, pfn); - /* - * Somebody beat us to this PTE or prefaulting to - * an already populated PTE, or prefaulting error. - */ - - if (unlikely((ret == VM_FAULT_NOPAGE && i > 0))) - break; - else if (unlikely(ret & VM_FAULT_ERROR)) - goto out_io_unlock; + /* Never error on prefaulted PTEs */ + if (unlikely((ret & VM_FAULT_ERROR))) { + if (i == 0) + goto out_io_unlock; + else + break; + } address += PAGE_SIZE; if (unlikely(++page_offset >= page_last)) -- cgit v1.2.3