Skip to content

Commit 9e97874

Browse files
committed
drm/xe/userptr: replace xe_hmm with gpusvm
Goal here is cut over to gpusvm and remove xe_hmm, relying instead on common code. The core facilities we need are get_pages(), unmap_pages() and free_pages() for a given useptr range, plus a vm level notifier lock, which is now provided by gpusvm. v2: - Reuse the same SVM vm struct we use for full SVM, that way we can use the same lock (Matt B & Himal) v3: - Re-use svm_init/fini for userptr. v4: - Allow building xe without userptr if we are missing DRM_GPUSVM config. (Matt B) - Always make .read_only match xe_vma_read_only() for the ctx. (Dafna) v5: - Fix missing conversion with CONFIG_DRM_XE_USERPTR_INVAL_INJECT v6: - Convert the new user in xe_vm_madise. Signed-off-by: Matthew Auld <matthew.auld@intel.com> Cc: Himal Prasad Ghimiray <himal.prasad.ghimiray@intel.com> Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com> Cc: Dafna Hirschfeld <dafna.hirschfeld@intel.com> Cc: Matthew Brost <matthew.brost@intel.com> Reviewed-by: Matthew Brost <matthew.brost@intel.com> Link: https://lore.kernel.org/r/20250828142430.615826-17-matthew.auld@intel.com
1 parent dd25b99 commit 9e97874

File tree

14 files changed

+173
-474
lines changed

14 files changed

+173
-474
lines changed

drivers/gpu/drm/xe/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@ config DRM_XE
4040
select DRM_TTM
4141
select DRM_TTM_HELPER
4242
select DRM_EXEC
43+
select DRM_GPUSVM if !UML && DEVICE_PRIVATE
4344
select DRM_GPUVM
4445
select DRM_SCHED
4546
select MMU_NOTIFIER
4647
select WANT_DEV_COREDUMP
4748
select AUXILIARY_BUS
48-
select HMM_MIRROR
4949
select REGMAP if I2C
5050
help
5151
Driver for Intel Xe2 series GPUs and later. Experimental support

drivers/gpu/drm/xe/Kconfig.debug

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ config DRM_XE_DEBUG_GUC
104104

105105
config DRM_XE_USERPTR_INVAL_INJECT
106106
bool "Inject userptr invalidation -EINVAL errors"
107+
depends on DRM_GPUSVM
107108
default n
108109
help
109110
Choose this option when debugging error paths that

drivers/gpu/drm/xe/Makefile

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ xe-y += xe_bb.o \
130130
xe_tuning.o \
131131
xe_uc.o \
132132
xe_uc_fw.o \
133-
xe_userptr.o \
134133
xe_vm.o \
135134
xe_vm_madvise.o \
136135
xe_vram.o \
@@ -141,8 +140,8 @@ xe-y += xe_bb.o \
141140
xe_wopcm.o
142141

143142
xe-$(CONFIG_I2C) += xe_i2c.o
144-
xe-$(CONFIG_HMM_MIRROR) += xe_hmm.o
145143
xe-$(CONFIG_DRM_XE_GPUSVM) += xe_svm.o
144+
xe-$(CONFIG_DRM_GPUSVM) += xe_userptr.o
146145

147146
# graphics hardware monitoring (HWMON) support
148147
xe-$(CONFIG_HWMON) += xe_hwmon.o

drivers/gpu/drm/xe/xe_exec.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "xe_ring_ops_types.h"
2020
#include "xe_sched_job.h"
2121
#include "xe_sync.h"
22+
#include "xe_svm.h"
2223
#include "xe_vm.h"
2324

2425
/**
@@ -294,7 +295,7 @@ int xe_exec_ioctl(struct drm_device *dev, void *data, struct drm_file *file)
294295
if (err)
295296
goto err_put_job;
296297

297-
err = down_read_interruptible(&vm->userptr.notifier_lock);
298+
err = xe_svm_notifier_lock_interruptible(vm);
298299
if (err)
299300
goto err_put_job;
300301

@@ -336,7 +337,7 @@ int xe_exec_ioctl(struct drm_device *dev, void *data, struct drm_file *file)
336337

337338
err_repin:
338339
if (!xe_vm_in_lr_mode(vm))
339-
up_read(&vm->userptr.notifier_lock);
340+
xe_svm_notifier_unlock(vm);
340341
err_put_job:
341342
if (err)
342343
xe_sched_job_put(job);

drivers/gpu/drm/xe/xe_hmm.c

Lines changed: 0 additions & 325 deletions
This file was deleted.

0 commit comments

Comments
 (0)