]> git.hungrycats.org Git - linux/commitdiff
drm/xe: Reject page faults from non-fault-mode scratch VMs
authorArvind Yadav <arvind.yadav@intel.com>
Thu, 20 Aug 2026 06:54:45 +0000 (12:24 +0530)
committerRodrigo Vivi <rodrigo.vivi@intel.com>
Thu, 27 Aug 2026 13:23:07 +0000 (09:23 -0400)
Having scratch enabled does not make a VM capable of handling recoverable
page faults. Allowing scratch VMs through the ASID lookup also admits
dma-fence mode VMs.

If such a VM faults on an already valid VMA, the handler reports success
without fixing the fault, causing the GPU to retry indefinitely.

Only allow fault-mode VMs through the ASID lookup. Fault-mode VMs using
scratch remain supported, while faults from 3D VMs are rejected.

Fixes: ad9843aac91a ("drm/xe/madvise: Implement purgeable buffer object support")
Cc: Matthew Brost <matthew.brost@intel.com>
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Cc: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
Suggested-by: Matthew Brost <matthew.brost@intel.com>
Signed-off-by: Arvind Yadav <arvind.yadav@intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
Signed-off-by: Matthew Brost <matthew.brost@intel.com>
Link: https://patch.msgid.link/20260820065445.567228-1-arvind.yadav@intel.com
(cherry picked from commit bfb24a06405b652d37831f3fb66b71d33a6605de)
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
drivers/gpu/drm/xe/xe_pagefault.c

index dd3c068e1a39912f5de793b2f8a0fe4485b36bbc..dbf8f71d3328a747aaf79a8cda7b63430c461abd 100644 (file)
@@ -158,7 +158,7 @@ static struct xe_vm *xe_pagefault_asid_to_vm(struct xe_device *xe, u32 asid)
 
        down_read(&xe->usm.lock);
        vm = xa_load(&xe->usm.asid_to_vm, asid);
-       if (vm && (xe_vm_in_fault_mode(vm) || xe_vm_has_scratch(vm)))
+       if (vm && xe_vm_in_fault_mode(vm))
                xe_vm_get(vm);
        else
                vm = ERR_PTR(-EINVAL);