Skip to contentSkip to conversation

Xe Core preparation for rebasing on drm-tip/drm-tip

PATCH In review Rodrigo Vivi 3 participants 9 messages Sep 29, 2023 – Oct 2, 2023

Subsystems (5)
lore
Share & tools
lore

Rodrigo Vivi

author maintainer
#0 lore raw

cover Xe Core preparation for rebasing on drm-tip/drm-tip

When rebasing on this week's drm-tip, I noticed that gpuva_manager was renamed to gpuvm. With this I needed to tweak some core patches.

Here is more informative. And the result final that I am about to push is at
https://gitlab.freedesktop.org/rodrigovivi/drm-xe/-/commits/drm-xe-next-rebase-ww39-t6

Thanks,
Rodrigo.

Danilo Krummrich (1):
drm/gpuvm: rename struct drm_gpuva_manager to struct drm_gpuvm

Rodrigo Vivi (3):
fixup! drm/xe: Port Xe to GPUVA
fixup! drm/xe: Fix array of binds
fixup! drm/xe: Rework xe_exec and the VM rebind worker to use the
drm_exec helper

 drivers/gpu/drm/Makefile                      |   2 +-
 drivers/gpu/drm/drm_debugfs.c                 |  16 +-
 .../gpu/drm/{drm_gpuva_mgr.c => drm_gpuvm.c}  | 404 +++++++++---------
 drivers/gpu/drm/nouveau/nouveau_exec.c        |   2 +-
 drivers/gpu/drm/nouveau/nouveau_uvmm.c        |  28 +-
 drivers/gpu/drm/nouveau/nouveau_uvmm.h        |   6 +-
 drivers/gpu/drm/xe/Kconfig                    |   2 +
 drivers/gpu/drm/xe/xe_vm.c                    |  32 +-
 drivers/gpu/drm/xe/xe_vm.h                    |   4 +-
 drivers/gpu/drm/xe/xe_vm_madvise.c            |   2 +-
 drivers/gpu/drm/xe/xe_vm_types.h              |   6 +-
 include/drm/drm_debugfs.h                     |   6 +-
 include/drm/{drm_gpuva_mgr.h => drm_gpuvm.h}  | 155 ++++---
 13 files changed, 333 insertions(+), 332 deletions(-)
 rename drivers/gpu/drm/{drm_gpuva_mgr.c => drm_gpuvm.c} (78%)
 rename include/drm/{drm_gpuva_mgr.h => drm_gpuvm.h} (78%)
Signature · 1 line
2.41.0
author maintainer
#1 lore raw

PATCH 1/4 drm/gpuvm: rename struct drm_gpuva_manager to struct drm_gpuvm

From: Danilo Krummrich <[email protected]>

Rename struct drm_gpuva_manager to struct drm_gpuvm including corresponding functions. This way the GPUVA manager's structures align very well with the documentation of VM_BIND [1] and VM_BIND locking [2].

It also provides a better foundation for the naming of data structures and functions introduced for implementing a common dma-resv per GPU-VM including tracking of external and evicted objects in subsequent patches.

[1] Documentation/gpu/drm-vm-bind-async.rst
[2] Documentation/gpu/drm-vm-bind-locking.rst

---
 drivers/gpu/drm/Makefile                      |   2 +-
 drivers/gpu/drm/drm_debugfs.c                 |  16 +-
 .../gpu/drm/{drm_gpuva_mgr.c => drm_gpuvm.c}  | 404 +++++++++---------
 drivers/gpu/drm/nouveau/nouveau_exec.c        |   2 +-
 drivers/gpu/drm/nouveau/nouveau_uvmm.c        |  28 +-
 drivers/gpu/drm/nouveau/nouveau_uvmm.h        |   6 +-
 include/drm/drm_debugfs.h                     |   6 +-
 include/drm/{drm_gpuva_mgr.h => drm_gpuvm.h}  | 155 ++++---
 8 files changed, 309 insertions(+), 310 deletions(-)
 rename drivers/gpu/drm/{drm_gpuva_mgr.c => drm_gpuvm.c} (78%)
 rename include/drm/{drm_gpuva_mgr.h => drm_gpuvm.h} (78%)
drivers/gpu/drm/Makefile +1 -1
index 1ad88efb1752..12fa794ede4a 100644
@@ -45,7 +45,7 @@ drm-y := \
 	drm_vblank.o \
 	drm_vblank_work.o \
 	drm_vma_manager.o \
-	drm_gpuva_mgr.o \
+	drm_gpuvm.o \
 	drm_writeback.o
 drm-$(CONFIG_DRM_LEGACY) += \
 	drm_agpsupport.o \
drivers/gpu/drm/drm_debugfs.c +8 -8
index 2de43ff3ce0a..e2342c1445e6 100644
@@ -40,7 +40,7 @@
 #include <drm/drm_file.h>
 #include <drm/drm_gem.h>
 #include <drm/drm_managed.h>
-#include <drm/drm_gpuva_mgr.h>
+#include <drm/drm_gpuvm.h>
 
 #include "drm_crtc_internal.h"
 #include "drm_internal.h"
@@ -180,31 +180,31 @@ static const struct file_operations drm_debugfs_fops = {
 /**
  * drm_debugfs_gpuva_info - dump the given DRM GPU VA space
  * @m: pointer to the &seq_file to write
- * @mgr: the &drm_gpuva_manager representing the GPU VA space
+ * @gpuvm: the &drm_gpuvm representing the GPU VA space
  *
  * Dumps the GPU VA mappings of a given DRM GPU VA manager.
  *
  * For each DRM GPU VA space drivers should call this function from their
  * &drm_info_list's show callback.
  *
- * Returns: 0 on success, -ENODEV if the &mgr is not initialized
+ * Returns: 0 on success, -ENODEV if the &gpuvm is not initialized
  */
 int drm_debugfs_gpuva_info(struct seq_file *m,
-			   struct drm_gpuva_manager *mgr)
+			   struct drm_gpuvm *gpuvm)
 {
-	struct drm_gpuva *va, *kva = &mgr->kernel_alloc_node;
+	struct drm_gpuva *va, *kva = &gpuvm->kernel_alloc_node;
 
-	if (!mgr->name)
+	if (!gpuvm->name)
 		return -ENODEV;
 
 	seq_printf(m, "DRM GPU VA space (%s) [0x%016llx;0x%016llx]\n",
-		   mgr->name, mgr->mm_start, mgr->mm_start + mgr->mm_range);
+		   gpuvm->name, gpuvm->mm_start, gpuvm->mm_start + gpuvm->mm_range);
 	seq_printf(m, "Kernel reserved node [0x%016llx;0x%016llx]\n",
 		   kva->va.addr, kva->va.addr + kva->va.range);
 	seq_puts(m, "\n");
 	seq_puts(m, " VAs | start              | range              | end                | object             | object offset\n");
 	seq_puts(m, "-------------------------------------------------------------------------------------------------------------\n");
-	drm_gpuva_for_each_va(va, mgr) {
+	drm_gpuvm_for_each_va(va, gpuvm) {
 		if (unlikely(va == kva))
 			continue;
 
drivers/gpu/drm/drm_gpuvm.c renamed from drivers/gpu/drm/drm_gpuva_mgr.c +202 -202

1,031 lines not on this page · raw message

drivers/gpu/drm/nouveau/nouveau_exec.c +1 -1
index a90c4cd8cbb2..c001952cd678 100644
@@ -106,7 +106,7 @@ nouveau_exec_job_submit(struct nouveau_job *job)
 	drm_exec_until_all_locked(exec) {
 		struct drm_gpuva *va;
 
-		drm_gpuva_for_each_va(va, &uvmm->umgr) {
+		drm_gpuvm_for_each_va(va, &uvmm->umgr) {
 			if (unlikely(va == &uvmm->umgr.kernel_alloc_node))
 				continue;
 
drivers/gpu/drm/nouveau/nouveau_uvmm.c +14 -14
index aae780e4a4aa..4ba198519b38 100644
@@ -329,7 +329,7 @@ nouveau_uvma_region_create(struct nouveau_uvmm *uvmm,
 	struct nouveau_uvma_region *reg;
 	int ret;
 
-	if (!drm_gpuva_interval_empty(&uvmm->umgr, addr, range))
+	if (!drm_gpuvm_interval_empty(&uvmm->umgr, addr, range))
 		return -ENOSPC;
 
 	ret = nouveau_uvma_region_alloc(&reg);
@@ -384,7 +384,7 @@ nouveau_uvma_region_empty(struct nouveau_uvma_region *reg)
 {
 	struct nouveau_uvmm *uvmm = reg->uvmm;
 
-	return drm_gpuva_interval_empty(&uvmm->umgr,
+	return drm_gpuvm_interval_empty(&uvmm->umgr,
 					reg->va.addr,
 					reg->va.range);
 }
@@ -444,7 +444,7 @@ op_map_prepare_unwind(struct nouveau_uvma *uvma)
 static void
 op_unmap_prepare_unwind(struct drm_gpuva *va)
 {
-	drm_gpuva_insert(va->mgr, va);
+	drm_gpuva_insert(va->vm, va);
 }
 
 static void
@@ -1194,7 +1194,7 @@ nouveau_uvmm_bind_job_submit(struct nouveau_job *job)
 				goto unwind_continue;
 			}
 
-			op->ops = drm_gpuva_sm_unmap_ops_create(&uvmm->umgr,
+			op->ops = drm_gpuvm_sm_unmap_ops_create(&uvmm->umgr,
 								op->va.addr,
 								op->va.range);
 			if (IS_ERR(op->ops)) {
@@ -1240,7 +1240,7 @@ nouveau_uvmm_bind_job_submit(struct nouveau_job *job)
 				}
 			}
 
-			op->ops = drm_gpuva_sm_map_ops_create(&uvmm->umgr,
+			op->ops = drm_gpuvm_sm_map_ops_create(&uvmm->umgr,
 							      op->va.addr,
 							      op->va.range,
 							      op->gem.obj,
@@ -1264,7 +1264,7 @@ nouveau_uvmm_bind_job_submit(struct nouveau_job *job)
 			break;
 		}
 		case OP_UNMAP:
-			op->ops = drm_gpuva_sm_unmap_ops_create(&uvmm->umgr,
+			op->ops = drm_gpuvm_sm_unmap_ops_create(&uvmm->umgr,
 								op->va.addr,
 								op->va.range);
 			if (IS_ERR(op->ops)) {
@@ -1836,11 +1836,11 @@ nouveau_uvmm_init(struct nouveau_uvmm *uvmm, struct nouveau_cli *cli,
 	uvmm->kernel_managed_addr = kernel_managed_addr;
 	uvmm->kernel_managed_size = kernel_managed_size;
 
-	drm_gpuva_manager_init(&uvmm->umgr, cli->name,
-			       NOUVEAU_VA_SPACE_START,
-			       NOUVEAU_VA_SPACE_END,
-			       kernel_managed_addr, kernel_managed_size,
-			       NULL);
+	drm_gpuvm_init(&uvmm->umgr, cli->name,
+		       NOUVEAU_VA_SPACE_START,
+		       NOUVEAU_VA_SPACE_END,
+		       kernel_managed_addr, kernel_managed_size,
+		       NULL);
 
 	ret = nvif_vmm_ctor(&cli->mmu, "uvmm",
 			    cli->vmm.vmm.object.oclass, RAW,
@@ -1855,7 +1855,7 @@ nouveau_uvmm_init(struct nouveau_uvmm *uvmm, struct nouveau_cli *cli,
 	return 0;
 
 out_free_gpuva_mgr:
-	drm_gpuva_manager_destroy(&uvmm->umgr);
+	drm_gpuvm_destroy(&uvmm->umgr);
 out_unlock:
 	mutex_unlock(&cli->mutex);
 	return ret;
@@ -1877,7 +1877,7 @@ nouveau_uvmm_fini(struct nouveau_uvmm *uvmm)
 	wait_event(entity->job.wq, list_empty(&entity->job.list.head));
 
 	nouveau_uvmm_lock(uvmm);
-	drm_gpuva_for_each_va_safe(va, next, &uvmm->umgr) {
+	drm_gpuvm_for_each_va_safe(va, next, &uvmm->umgr) {
 		struct nouveau_uvma *uvma = uvma_from_va(va);
 		struct drm_gem_object *obj = va->gem.obj;
 
@@ -1910,7 +1910,7 @@ nouveau_uvmm_fini(struct nouveau_uvmm *uvmm)
 
 	mutex_lock(&cli->mutex);
 	nouveau_vmm_fini(&uvmm->vmm);
-	drm_gpuva_manager_destroy(&uvmm->umgr);
+	drm_gpuvm_destroy(&uvmm->umgr);
 	mutex_unlock(&cli->mutex);
 
 	dma_resv_fini(&uvmm->resv);
drivers/gpu/drm/nouveau/nouveau_uvmm.h +3 -3
index fc7f6fd2a4e1..e96c9919d1bd 100644
@@ -3,13 +3,13 @@
 #ifndef __NOUVEAU_UVMM_H__
 #define __NOUVEAU_UVMM_H__
 
-#include <drm/drm_gpuva_mgr.h>
+#include <drm/drm_gpuvm.h>
 
 #include "nouveau_drv.h"
 
 struct nouveau_uvmm {
 	struct nouveau_vmm vmm;
-	struct drm_gpuva_manager umgr;
+	struct drm_gpuvm umgr;
 	struct maple_tree region_mt;
 	struct mutex mutex;
 	struct dma_resv resv;
@@ -44,7 +44,7 @@ struct nouveau_uvma {
 #define uvmm_from_mgr(x) container_of((x), struct nouveau_uvmm, umgr)
 #define uvma_from_va(x) container_of((x), struct nouveau_uvma, va)
 
-#define to_uvmm(x) uvmm_from_mgr((x)->va.mgr)
+#define to_uvmm(x) uvmm_from_mgr((x)->va.vm)
 
 struct nouveau_uvmm_bind_job {
 	struct nouveau_job base;
include/drm/drm_debugfs.h +3 -3
index cb2c1956a214..8c1f308ca33b 100644
@@ -35,7 +35,7 @@
 #include <linux/types.h>
 #include <linux/seq_file.h>
 
-#include <drm/drm_gpuva_mgr.h>
+#include <drm/drm_gpuvm.h>
 
 /**
  * DRM_DEBUGFS_GPUVA_INFO - &drm_info_list entry to dump a GPU VA space
@@ -152,7 +152,7 @@ void drm_debugfs_add_files(struct drm_device *dev,
 			   const struct drm_debugfs_info *files, int count);
 
 int drm_debugfs_gpuva_info(struct seq_file *m,
-			   struct drm_gpuva_manager *mgr);
+			   struct drm_gpuvm *gpuvm);
 #else
 static inline void drm_debugfs_create_files(const struct drm_info_list *files,
 					    int count, struct dentry *root,
@@ -176,7 +176,7 @@ static inline void drm_debugfs_add_files(struct drm_device *dev,
 {}
 
 static inline int drm_debugfs_gpuva_info(struct seq_file *m,
-					 struct drm_gpuva_manager *mgr)
+					 struct drm_gpuvm *gpuvm)
 {
 	return 0;
 }
include/drm/drm_gpuvm.h renamed from include/drm/drm_gpuva_mgr.h +77 -78

353 lines not on this page · raw message

Signature · 1 line
2.41.0
author maintainer
#2 lore raw

PATCH 2/4 fixup! drm/xe: Port Xe to GPUVA

In reply to Rodrigo Vivi
---
 drivers/gpu/drm/xe/Kconfig         |  1 +
 drivers/gpu/drm/xe/xe_vm.c         | 30 +++++++++++++++---------------
 drivers/gpu/drm/xe/xe_vm.h         |  4 ++--
 drivers/gpu/drm/xe/xe_vm_madvise.c |  2 +-
 drivers/gpu/drm/xe/xe_vm_types.h   |  6 +++---
 5 files changed, 22 insertions(+), 21 deletions(-)
drivers/gpu/drm/xe/Kconfig +1 -0
index d57181ff47e6..97ed2a00f862 100644
@@ -34,6 +34,7 @@ config DRM_XE
 	select VMAP_PFN
 	select DRM_TTM
 	select DRM_TTM_HELPER
+	select DRM_GPUVM
 	select DRM_SCHED
 	select MMU_NOTIFIER
 	select WANT_DEV_COREDUMP
drivers/gpu/drm/xe/xe_vm.c +15 -15
index 57ffac324564..3a761608bb68 100644
@@ -882,7 +882,7 @@ static struct xe_vma *xe_vma_create(struct xe_vm *vm,
 	INIT_LIST_HEAD(&vma->extobj.link);
 
 	INIT_LIST_HEAD(&vma->gpuva.gem.entry);
-	vma->gpuva.mgr = &vm->mgr;
+	vma->gpuva.vm = &vm->gpuvm;
 	vma->gpuva.va.addr = start;
 	vma->gpuva.va.range = end - start + 1;
 	if (read_only)
@@ -1147,7 +1147,7 @@ xe_vm_find_overlapping_vma(struct xe_vm *vm, u64 start, u64 range)
 
 	xe_assert(vm->xe, start + range <= vm->size);
 
-	gpuva = drm_gpuva_find_first(&vm->mgr, start, range);
+	gpuva = drm_gpuva_find_first(&vm->gpuvm, start, range);
 
 	return gpuva ? gpuva_to_vma(gpuva) : NULL;
 }
@@ -1159,7 +1159,7 @@ static int xe_vm_insert_vma(struct xe_vm *vm, struct xe_vma *vma)
 	xe_assert(vm->xe, xe_vma_vm(vma) == vm);
 	lockdep_assert_held(&vm->lock);
 
-	err = drm_gpuva_insert(&vm->mgr, &vma->gpuva);
+	err = drm_gpuva_insert(&vm->gpuvm, &vma->gpuva);
 	XE_WARN_ON(err);	/* Shouldn't be possible */
 
 	return err;
@@ -1187,7 +1187,7 @@ static struct drm_gpuva_op *xe_vm_op_alloc(void)
 	return &op->base;
 }
 
-static struct drm_gpuva_fn_ops gpuva_ops = {
+static struct drm_gpuvm_ops gpuvm_ops = {
 	.op_alloc = xe_vm_op_alloc,
 };
 
@@ -1372,8 +1372,8 @@ struct xe_vm *xe_vm_create(struct xe_device *xe, u32 flags)
 	if (err)
 		goto err_put;
 
-	drm_gpuva_manager_init(&vm->mgr, "Xe VM", 0, vm->size, 0, 0,
-			       &gpuva_ops);
+	drm_gpuvm_init(&vm->gpuvm, "Xe VM", 0, vm->size, 0, 0,
+		       &gpuvm_ops);
 	if (IS_DGFX(xe) && xe->info.vram_flags & XE_VRAM_FLAGS_NEED64K)
 		vm->flags |= XE_VM_FLAG_64K;
 
@@ -1479,7 +1479,7 @@ struct xe_vm *xe_vm_create(struct xe_device *xe, u32 flags)
 			xe_pt_destroy(vm->pt_root[id], vm->flags, NULL);
 	}
 	dma_resv_unlock(&vm->resv);
-	drm_gpuva_manager_destroy(&vm->mgr);
+	drm_gpuvm_destroy(&vm->gpuvm);
 err_put:
 	dma_resv_fini(&vm->resv);
 	for_each_tile(tile, xe, id)
@@ -1560,7 +1560,7 @@ void xe_vm_close_and_put(struct xe_vm *vm)
 
 	down_write(&vm->lock);
 	xe_vm_lock(vm, false);
-	drm_gpuva_for_each_va_safe(gpuva, next, &vm->mgr) {
+	drm_gpuvm_for_each_va_safe(gpuva, next, &vm->gpuvm) {
 		vma = gpuva_to_vma(gpuva);
 
 		if (xe_vma_has_no_bo(vma)) {
@@ -1619,7 +1619,7 @@ void xe_vm_close_and_put(struct xe_vm *vm)
 	xe_assert(xe, list_empty(&vm->extobj.list));
 	up_write(&vm->lock);
 
-	drm_gpuva_manager_destroy(&vm->mgr);
+	drm_gpuvm_destroy(&vm->gpuvm);
 
 	mutex_lock(&xe->usm.lock);
 	if (vm->flags & XE_VM_FLAG_FAULT_MODE)
@@ -2409,7 +2409,7 @@ vm_bind_ioctl_ops_create(struct xe_vm *vm, struct xe_bo *bo,
 	switch (VM_BIND_OP(operation)) {
 	case XE_VM_BIND_OP_MAP:
 	case XE_VM_BIND_OP_MAP_USERPTR:
-		ops = drm_gpuva_sm_map_ops_create(&vm->mgr, addr, range,
+		ops = drm_gpuvm_sm_map_ops_create(&vm->gpuvm, addr, range,
 						  obj, bo_offset_or_userptr);
 		if (IS_ERR(ops))
 			return ops;
@@ -2426,7 +2426,7 @@ vm_bind_ioctl_ops_create(struct xe_vm *vm, struct xe_bo *bo,
 		}
 		break;
 	case XE_VM_BIND_OP_UNMAP:
-		ops = drm_gpuva_sm_unmap_ops_create(&vm->mgr, addr, range);
+		ops = drm_gpuvm_sm_unmap_ops_create(&vm->gpuvm, addr, range);
 		if (IS_ERR(ops))
 			return ops;
 
@@ -2437,7 +2437,7 @@ vm_bind_ioctl_ops_create(struct xe_vm *vm, struct xe_bo *bo,
 		}
 		break;
 	case XE_VM_BIND_OP_PREFETCH:
-		ops = drm_gpuva_prefetch_ops_create(&vm->mgr, addr, range);
+		ops = drm_gpuvm_prefetch_ops_create(&vm->gpuvm, addr, range);
 		if (IS_ERR(ops))
 			return ops;
 
@@ -2454,7 +2454,7 @@ vm_bind_ioctl_ops_create(struct xe_vm *vm, struct xe_bo *bo,
 		err = xe_bo_lock(bo, true);
 		if (err)
 			return ERR_PTR(err);
-		ops = drm_gpuva_gem_unmap_ops_create(&vm->mgr, obj);
+		ops = drm_gpuvm_gem_unmap_ops_create(&vm->gpuvm, obj);
 		xe_bo_unlock(bo);
 		if (IS_ERR(ops))
 			return ops;
@@ -2971,7 +2971,7 @@ static void xe_vma_op_cleanup(struct xe_vm *vm, struct xe_vma_op *op)
 		spin_unlock_irq(&vm->async_ops.lock);
 	}
 	if (op->ops)
-		drm_gpuva_ops_free(&vm->mgr, op->ops);
+		drm_gpuva_ops_free(&vm->gpuvm, op->ops);
 	if (last)
 		xe_vm_put(vm);
 }
@@ -3664,7 +3664,7 @@ int xe_analyze_vm(struct drm_printer *p, struct xe_vm *vm, int gt_id)
 			   is_vram ? "VRAM" : "SYS");
 	}
 
-	drm_gpuva_for_each_va(gpuva, &vm->mgr) {
+	drm_gpuvm_for_each_va(gpuva, &vm->gpuvm) {
 		struct xe_vma *vma = gpuva_to_vma(gpuva);
 		bool is_userptr = xe_vma_is_userptr(vma);
 		bool is_null = xe_vma_is_null(vma);
drivers/gpu/drm/xe/xe_vm.h +2 -2
index f966ed39b711..4b32ce9cf9b1 100644
@@ -66,7 +66,7 @@ xe_vm_find_overlapping_vma(struct xe_vm *vm, u64 start, u64 range);
 
 static inline struct xe_vm *gpuva_to_vm(struct drm_gpuva *gpuva)
 {
-	return container_of(gpuva->mgr, struct xe_vm, mgr);
+	return container_of(gpuva->vm, struct xe_vm, gpuvm);
 }
 
 static inline struct xe_vma *gpuva_to_vma(struct drm_gpuva *gpuva)
@@ -111,7 +111,7 @@ static inline struct xe_bo *xe_vma_bo(struct xe_vma *vma)
 
 static inline struct xe_vm *xe_vma_vm(struct xe_vma *vma)
 {
-	return container_of(vma->gpuva.mgr, struct xe_vm, mgr);
+	return container_of(vma->gpuva.vm, struct xe_vm, gpuvm);
 }
 
 static inline bool xe_vma_read_only(struct xe_vma *vma)
drivers/gpu/drm/xe/xe_vm_madvise.c +1 -1
index d2fd99462756..0ef7d483d050 100644
@@ -217,7 +217,7 @@ get_vmas(struct xe_vm *vm, int *num_vmas, u64 addr, u64 range)
 	if (!vmas)
 		return NULL;
 
-	drm_gpuva_for_each_va_range(gpuva, &vm->mgr, addr, addr + range) {
+	drm_gpuvm_for_each_va_range(gpuva, &vm->gpuvm, addr, addr + range) {
 		struct xe_vma *vma = gpuva_to_vma(gpuva);
 
 		if (xe_vma_is_userptr(vma))
drivers/gpu/drm/xe/xe_vm_types.h +3 -3
index 1c5553b842d7..da5e6cb6f094 100644
@@ -6,7 +6,7 @@
 #ifndef _XE_VM_TYPES_H_
 #define _XE_VM_TYPES_H_
 
-#include <drm/drm_gpuva_mgr.h>
+#include <drm/drm_gpuvm.h>
 
 #include <linux/dma-resv.h>
 #include <linux/kref.h>
@@ -135,8 +135,8 @@ struct xe_device;
 #define xe_vm_assert_held(vm) dma_resv_assert_held(&(vm)->resv)
 
 struct xe_vm {
-	/** @mgr: base GPUVA used to track VMAs */
-	struct drm_gpuva_manager mgr;
+	/** @gpuvm: base GPUVM used to track VMAs */
+	struct drm_gpuvm gpuvm;
 
 	struct xe_device *xe;
 
Signature · 1 line
2.41.0
maintainer Reviewed-by on v1 2/4
#3 lore raw

Re: [Intel-xe] [PATCH 2/4] fixup! drm/xe: Port Xe to GPUVA

Quoted 7 lines · Rodrigo Vivi
---
  drivers/gpu/drm/xe/Kconfig         |  1 +
  drivers/gpu/drm/xe/xe_vm.c         | 30 +++++++++++++++---------------
  drivers/gpu/drm/xe/xe_vm.h         |  4 ++--
  drivers/gpu/drm/xe/xe_vm_madvise.c |  2 +-
  drivers/gpu/drm/xe/xe_vm_types.h   |  6 +++---
  5 files changed, 22 insertions(+), 21 deletions(-)
Quoted 203 lines
drivers/gpu/drm/xe/Kconfig +1 -0
index d57181ff47e6..97ed2a00f862 100644
@@ -34,6 +34,7 @@ config DRM_XE
  	select VMAP_PFN
  	select DRM_TTM
  	select DRM_TTM_HELPER
+	select DRM_GPUVM
  	select DRM_SCHED
  	select MMU_NOTIFIER
  	select WANT_DEV_COREDUMP
drivers/gpu/drm/xe/xe_vm.c +15 -15
index 57ffac324564..3a761608bb68 100644
@@ -882,7 +882,7 @@ static struct xe_vma *xe_vma_create(struct xe_vm *vm,
  	INIT_LIST_HEAD(&vma->extobj.link);
 
  	INIT_LIST_HEAD(&vma->gpuva.gem.entry);
-	vma->gpuva.mgr = &vm->mgr;
+	vma->gpuva.vm = &vm->gpuvm;
  	vma->gpuva.va.addr = start;
  	vma->gpuva.va.range = end - start + 1;
  	if (read_only)
@@ -1147,7 +1147,7 @@ xe_vm_find_overlapping_vma(struct xe_vm *vm, u64 start, u64 range)
 
  	xe_assert(vm->xe, start + range <= vm->size);
 
-	gpuva = drm_gpuva_find_first(&vm->mgr, start, range);
+	gpuva = drm_gpuva_find_first(&vm->gpuvm, start, range);
 
  	return gpuva ? gpuva_to_vma(gpuva) : NULL;
  }
@@ -1159,7 +1159,7 @@ static int xe_vm_insert_vma(struct xe_vm *vm, struct xe_vma *vma)
  	xe_assert(vm->xe, xe_vma_vm(vma) == vm);
  	lockdep_assert_held(&vm->lock);
 
-	err = drm_gpuva_insert(&vm->mgr, &vma->gpuva);
+	err = drm_gpuva_insert(&vm->gpuvm, &vma->gpuva);
  	XE_WARN_ON(err);	/* Shouldn't be possible */
 
  	return err;
@@ -1187,7 +1187,7 @@ static struct drm_gpuva_op *xe_vm_op_alloc(void)
  	return &op->base;
  }
 
-static struct drm_gpuva_fn_ops gpuva_ops = {
+static struct drm_gpuvm_ops gpuvm_ops = {
  	.op_alloc = xe_vm_op_alloc,
  };
 
@@ -1372,8 +1372,8 @@ struct xe_vm *xe_vm_create(struct xe_device *xe, u32 flags)
  	if (err)
  		goto err_put;
 
-	drm_gpuva_manager_init(&vm->mgr, "Xe VM", 0, vm->size, 0, 0,
-			       &gpuva_ops);
+	drm_gpuvm_init(&vm->gpuvm, "Xe VM", 0, vm->size, 0, 0,
+		       &gpuvm_ops);
  	if (IS_DGFX(xe) && xe->info.vram_flags & XE_VRAM_FLAGS_NEED64K)
  		vm->flags |= XE_VM_FLAG_64K;
 
@@ -1479,7 +1479,7 @@ struct xe_vm *xe_vm_create(struct xe_device *xe, u32 flags)
  			xe_pt_destroy(vm->pt_root[id], vm->flags, NULL);
  	}
  	dma_resv_unlock(&vm->resv);
-	drm_gpuva_manager_destroy(&vm->mgr);
+	drm_gpuvm_destroy(&vm->gpuvm);
  err_put:
  	dma_resv_fini(&vm->resv);
  	for_each_tile(tile, xe, id)
@@ -1560,7 +1560,7 @@ void xe_vm_close_and_put(struct xe_vm *vm)
 
  	down_write(&vm->lock);
  	xe_vm_lock(vm, false);
-	drm_gpuva_for_each_va_safe(gpuva, next, &vm->mgr) {
+	drm_gpuvm_for_each_va_safe(gpuva, next, &vm->gpuvm) {
  		vma = gpuva_to_vma(gpuva);
 
  		if (xe_vma_has_no_bo(vma)) {
@@ -1619,7 +1619,7 @@ void xe_vm_close_and_put(struct xe_vm *vm)
  	xe_assert(xe, list_empty(&vm->extobj.list));
  	up_write(&vm->lock);
 
-	drm_gpuva_manager_destroy(&vm->mgr);
+	drm_gpuvm_destroy(&vm->gpuvm);
 
  	mutex_lock(&xe->usm.lock);
  	if (vm->flags & XE_VM_FLAG_FAULT_MODE)
@@ -2409,7 +2409,7 @@ vm_bind_ioctl_ops_create(struct xe_vm *vm, struct xe_bo *bo,
  	switch (VM_BIND_OP(operation)) {
  	case XE_VM_BIND_OP_MAP:
  	case XE_VM_BIND_OP_MAP_USERPTR:
-		ops = drm_gpuva_sm_map_ops_create(&vm->mgr, addr, range,
+		ops = drm_gpuvm_sm_map_ops_create(&vm->gpuvm, addr, range,
  						  obj, bo_offset_or_userptr);
  		if (IS_ERR(ops))
  			return ops;
@@ -2426,7 +2426,7 @@ vm_bind_ioctl_ops_create(struct xe_vm *vm, struct xe_bo *bo,
  		}
  		break;
  	case XE_VM_BIND_OP_UNMAP:
-		ops = drm_gpuva_sm_unmap_ops_create(&vm->mgr, addr, range);
+		ops = drm_gpuvm_sm_unmap_ops_create(&vm->gpuvm, addr, range);
  		if (IS_ERR(ops))
  			return ops;
 
@@ -2437,7 +2437,7 @@ vm_bind_ioctl_ops_create(struct xe_vm *vm, struct xe_bo *bo,
  		}
  		break;
  	case XE_VM_BIND_OP_PREFETCH:
-		ops = drm_gpuva_prefetch_ops_create(&vm->mgr, addr, range);
+		ops = drm_gpuvm_prefetch_ops_create(&vm->gpuvm, addr, range);
  		if (IS_ERR(ops))
  			return ops;
 
@@ -2454,7 +2454,7 @@ vm_bind_ioctl_ops_create(struct xe_vm *vm, struct xe_bo *bo,
  		err = xe_bo_lock(bo, true);
  		if (err)
  			return ERR_PTR(err);
-		ops = drm_gpuva_gem_unmap_ops_create(&vm->mgr, obj);
+		ops = drm_gpuvm_gem_unmap_ops_create(&vm->gpuvm, obj);
  		xe_bo_unlock(bo);
  		if (IS_ERR(ops))
  			return ops;
@@ -2971,7 +2971,7 @@ static void xe_vma_op_cleanup(struct xe_vm *vm, struct xe_vma_op *op)
  		spin_unlock_irq(&vm->async_ops.lock);
  	}
  	if (op->ops)
-		drm_gpuva_ops_free(&vm->mgr, op->ops);
+		drm_gpuva_ops_free(&vm->gpuvm, op->ops);
  	if (last)
  		xe_vm_put(vm);
  }
@@ -3664,7 +3664,7 @@ int xe_analyze_vm(struct drm_printer *p, struct xe_vm *vm, int gt_id)
  			   is_vram ? "VRAM" : "SYS");
  	}
 
-	drm_gpuva_for_each_va(gpuva, &vm->mgr) {
+	drm_gpuvm_for_each_va(gpuva, &vm->gpuvm) {
  		struct xe_vma *vma = gpuva_to_vma(gpuva);
  		bool is_userptr = xe_vma_is_userptr(vma);
  		bool is_null = xe_vma_is_null(vma);
drivers/gpu/drm/xe/xe_vm.h +2 -2
index f966ed39b711..4b32ce9cf9b1 100644
@@ -66,7 +66,7 @@ xe_vm_find_overlapping_vma(struct xe_vm *vm, u64 start, u64 range);
 
  static inline struct xe_vm *gpuva_to_vm(struct drm_gpuva *gpuva)
  {
-	return container_of(gpuva->mgr, struct xe_vm, mgr);
+	return container_of(gpuva->vm, struct xe_vm, gpuvm);
  }
 
  static inline struct xe_vma *gpuva_to_vma(struct drm_gpuva *gpuva)
@@ -111,7 +111,7 @@ static inline struct xe_bo *xe_vma_bo(struct xe_vma *vma)
 
  static inline struct xe_vm *xe_vma_vm(struct xe_vma *vma)
  {
-	return container_of(vma->gpuva.mgr, struct xe_vm, mgr);
+	return container_of(vma->gpuva.vm, struct xe_vm, gpuvm);
  }
 
  static inline bool xe_vma_read_only(struct xe_vma *vma)
drivers/gpu/drm/xe/xe_vm_madvise.c +1 -1
index d2fd99462756..0ef7d483d050 100644
@@ -217,7 +217,7 @@ get_vmas(struct xe_vm *vm, int *num_vmas, u64 addr, u64 range)
  	if (!vmas)
  		return NULL;
 
-	drm_gpuva_for_each_va_range(gpuva, &vm->mgr, addr, addr + range) {
+	drm_gpuvm_for_each_va_range(gpuva, &vm->gpuvm, addr, addr + range) {
  		struct xe_vma *vma = gpuva_to_vma(gpuva);
 
  		if (xe_vma_is_userptr(vma))
drivers/gpu/drm/xe/xe_vm_types.h +3 -3
index 1c5553b842d7..da5e6cb6f094 100644
@@ -6,7 +6,7 @@
  #ifndef _XE_VM_TYPES_H_
  #define _XE_VM_TYPES_H_
 
-#include <drm/drm_gpuva_mgr.h>
+#include <drm/drm_gpuvm.h>
 
  #include <linux/dma-resv.h>
  #include <linux/kref.h>
@@ -135,8 +135,8 @@ struct xe_device;
  #define xe_vm_assert_held(vm) dma_resv_assert_held(&(vm)->resv)
 
  struct xe_vm {
-	/** @mgr: base GPUVA used to track VMAs */
-	struct drm_gpuva_manager mgr;
+	/** @gpuvm: base GPUVM used to track VMAs */
+	struct drm_gpuvm gpuvm;
 
  	struct xe_device *xe;
 
author maintainer
#4 lore raw

PATCH 3/4 fixup! drm/xe: Fix array of binds

In reply to Rodrigo Vivi
---
 drivers/gpu/drm/xe/xe_vm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/xe/xe_vm.c +1 -1
index 3a761608bb68..e90f59d6da55 100644
@@ -3179,7 +3179,7 @@ static void vm_bind_ioctl_ops_unwind(struct xe_vm *vm,
 					 op->flags & XE_VMA_OP_NEXT_COMMITTED);
 		}
 
-		drm_gpuva_ops_free(&vm->mgr, __ops);
+		drm_gpuva_ops_free(&vm->gpuvm, __ops);
 	}
 }
 
Signature · 1 line
2.41.0
maintainer Reviewed-by on v1 3/4
#5 lore raw

Re: [Intel-xe] [PATCH 3/4] fixup! drm/xe: Fix array of binds

Quoted 3 lines · Rodrigo Vivi
---
  drivers/gpu/drm/xe/xe_vm.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 14 lines
drivers/gpu/drm/xe/xe_vm.c +1 -1
index 3a761608bb68..e90f59d6da55 100644
@@ -3179,7 +3179,7 @@ static void vm_bind_ioctl_ops_unwind(struct xe_vm *vm,
  					 op->flags & XE_VMA_OP_NEXT_COMMITTED);
  		}
 
-		drm_gpuva_ops_free(&vm->mgr, __ops);
+		drm_gpuva_ops_free(&vm->gpuvm, __ops);
  	}
  }
 
author maintainer
#6 lore raw

PATCH 4/4 fixup! drm/xe: Rework xe_exec and the VM rebind worker to use the drm_exec helper

In reply to Rodrigo Vivi
---
 drivers/gpu/drm/xe/Kconfig | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/xe/Kconfig +1 -0
index 97ed2a00f862..9b74b05475cf 100644
@@ -34,6 +34,7 @@ config DRM_XE
 	select VMAP_PFN
 	select DRM_TTM
 	select DRM_TTM_HELPER
+	select DRM_EXEC
 	select DRM_GPUVM
 	select DRM_SCHED
 	select MMU_NOTIFIER
Signature · 1 line
2.41.0
maintainer Reviewed-by on v1 4/4
#7 lore raw

Re: [Intel-xe] [PATCH 4/4] fixup! drm/xe: Rework xe_exec and the VM rebind worker to use the drm_exec helper

Quoted 3 lines · Rodrigo Vivi
---
  drivers/gpu/drm/xe/Kconfig | 1 +
  1 file changed, 1 insertion(+)
Quoted 12 lines
drivers/gpu/drm/xe/Kconfig +1 -0
index 97ed2a00f862..9b74b05475cf 100644
@@ -34,6 +34,7 @@ config DRM_XE
  	select VMAP_PFN
  	select DRM_TTM
  	select DRM_TTM_HELPER
+	select DRM_EXEC
  	select DRM_GPUVM
  	select DRM_SCHED
  	select MMU_NOTIFIER
#8 lore raw

[Intel-xe] ✗ CI.Patch_applied: failure for Xe Core preparation for rebasing on drm-tip/drm-tip

In reply to Rodrigo Vivi
== Series Details ==

== Series Details ==

Series: Xe Core preparation for rebasing on drm-tip/drm-tip
URL : https://patchwork.freedesktop.org/series/124471/
State : failure

== Summary ==

=== Applying kernel patches on branch 'drm-xe-next' with base: === Base commit: 22fcf2404 drm/xe: timeout needs to be a signed value
=== git am output follows ===
error: patch failed: drivers/gpu/drm/Makefile:45
error: drivers/gpu/drm/Makefile: patch does not apply
error: patch failed: drivers/gpu/drm/drm_debugfs.c:40
error: drivers/gpu/drm/drm_debugfs.c: patch does not apply
error: drivers/gpu/drm/drm_gpuva_mgr.c: does not exist in index
error: patch failed: drivers/gpu/drm/nouveau/nouveau_exec.c:106
error: drivers/gpu/drm/nouveau/nouveau_exec.c: patch does not apply
error: patch failed: drivers/gpu/drm/nouveau/nouveau_uvmm.c:329
error: drivers/gpu/drm/nouveau/nouveau_uvmm.c: patch does not apply
error: patch failed: drivers/gpu/drm/nouveau/nouveau_uvmm.h:3
error: drivers/gpu/drm/nouveau/nouveau_uvmm.h: patch does not apply
error: patch failed: include/drm/drm_debugfs.h:35
error: include/drm/drm_debugfs.h: patch does not apply
error: include/drm/drm_gpuva_mgr.h: does not exist in index
hint: Use 'git am --show-current-patch' to see the failed patch
Applying: drm/gpuvm: rename struct drm_gpuva_manager to struct drm_gpuvm Patch failed at 0001 drm/gpuvm: rename struct drm_gpuva_manager to struct drm_gpuvm When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".