Skip to content

Commit e775e2a

Browse files
Thomas Hellströmrodrigovivi
authored andcommitted
drm/xe/vm: Validate userptr during gpu vma prefetching
If a userptr vma subject to prefetching was already invalidated or invalidated during the prefetch operation, the operation would repeatedly return -EAGAIN which would typically cause an infinite loop. Validate the userptr to ensure this doesn't happen. v2: - Don't fallthrough from UNMAP to PREFETCH (Matthew Brost) Fixes: 5bd24e7 ("drm/xe/vm: Subclass userptr vmas") Fixes: 617eebb ("drm/xe: Fix array of binds") Cc: Matthew Brost <matthew.brost@intel.com> Cc: <stable@vger.kernel.org> # v6.9+ Suggested-by: Matthew Brost <matthew.brost@intel.com> Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com> Reviewed-by: Matthew Brost <matthew.brost@intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20250228073058.59510-2-thomas.hellstrom@linux.intel.com (cherry picked from commit 03c346d) Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
1 parent 54f94dc commit e775e2a

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

drivers/gpu/drm/xe/xe_vm.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2286,8 +2286,17 @@ static int vm_bind_ioctl_ops_parse(struct xe_vm *vm, struct drm_gpuva_ops *ops,
22862286
break;
22872287
}
22882288
case DRM_GPUVA_OP_UNMAP:
2289+
xe_vma_ops_incr_pt_update_ops(vops, op->tile_mask);
2290+
break;
22892291
case DRM_GPUVA_OP_PREFETCH:
2290-
/* FIXME: Need to skip some prefetch ops */
2292+
vma = gpuva_to_vma(op->base.prefetch.va);
2293+
2294+
if (xe_vma_is_userptr(vma)) {
2295+
err = xe_vma_userptr_pin_pages(to_userptr_vma(vma));
2296+
if (err)
2297+
return err;
2298+
}
2299+
22912300
xe_vma_ops_incr_pt_update_ops(vops, op->tile_mask);
22922301
break;
22932302
default:

0 commit comments

Comments
 (0)