]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
drm/gpusvm, drm/xe: Fix userptr to not allow device private pages
authorThomas Hellström <thomas.hellstrom@linux.intel.com>
Tue, 30 Sep 2025 12:27:52 +0000 (14:27 +0200)
committerThomas Hellström <thomas.hellstrom@linux.intel.com>
Thu, 2 Oct 2025 09:50:12 +0000 (11:50 +0200)
commitad298d9ec957414dbf3d51f3c8bca4b6d2416c0c
tree5204597ce415278ebd5fad6c4ea53a22f86bbac5
parentd9c401d8f37cd5510cc64647b0421f95e62fe3a2
drm/gpusvm, drm/xe: Fix userptr to not allow device private pages

When userptr is used on SVM-enabled VMs, a non-NULL
hmm_range::dev_private_owner value might mean that
hmm_range_fault() attempts to return device private pages.
Either that will fail, or the userptr code will not know
how to handle those.

Use NULL for hmm_range::dev_private_owner to migrate
such pages to system. In order to do that, move the
struct drm_gpusvm::device_private_page_owner field to
struct drm_gpusvm_ctx::device_private_page_owner so that
it doesn't remain immutable over the drm_gpusvm lifetime.

v2:
- Don't conditionally compile xe_svm_devm_owner().
- Kerneldoc xe_svm_devm_owner().

Fixes: 9e9787414882 ("drm/xe/userptr: replace xe_hmm with gpusvm")
Cc: Matthew Auld <matthew.auld@intel.com>
Cc: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com>
Cc: Matthew Brost <matthew.brost@intel.com>
Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Reviewed-by: Matthew Auld <matthew.auld@intel.com>
Reviewed-by: Matthew Brost <matthew.brost@intel.com>
Acked-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: https://lore.kernel.org/r/20250930122752.96034-1-thomas.hellstrom@linux.intel.com
drivers/gpu/drm/drm_gpusvm.c
drivers/gpu/drm/xe/xe_svm.c
drivers/gpu/drm/xe/xe_svm.h
drivers/gpu/drm/xe/xe_userptr.c
drivers/gpu/drm/xe/xe_vm.c
include/drm/drm_gpusvm.h