[Intel-xe] [PATCH 10/26] drm/xe: Convert pagefault rebind to use ops interface
Matthew Brost
matthew.brost at intel.com
Thu Oct 26 04:01:57 UTC 2023
Calling into the VM layer is correct not the PT layer. Also all bind
moving towards VMA operations interfaces.
Signed-off-by: Matthew Brost <matthew.brost at intel.com>
---
drivers/gpu/drm/xe/xe_gt_pagefault.c | 7 ++++---
drivers/gpu/drm/xe/xe_vm.c | 12 ++++--------
drivers/gpu/drm/xe/xe_vm.h | 3 +++
3 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/drivers/gpu/drm/xe/xe_gt_pagefault.c b/drivers/gpu/drm/xe/xe_gt_pagefault.c
index 2ec0db7a4b29..0c87e590a9d8 100644
--- a/drivers/gpu/drm/xe/xe_gt_pagefault.c
+++ b/drivers/gpu/drm/xe/xe_gt_pagefault.c
@@ -18,7 +18,6 @@
#include "xe_guc.h"
#include "xe_guc_ct.h"
#include "xe_migrate.h"
-#include "xe_pt.h"
#include "xe_trace.h"
#include "xe_vm.h"
@@ -204,8 +203,10 @@ static int handle_pagefault(struct xe_gt *gt, struct pagefault *pf)
/* Bind VMA only to the GT that has faulted */
trace_xe_vma_pf_bind(vma);
- fence = __xe_pt_bind_vma(tile, vma, xe_tile_migrate_engine(tile), NULL, 0,
- vma->tile_present & BIT(tile->id));
+ xe_vm_populate_dummy_rebind(vm, vma);
+ vm->dummy_ops.op.tile_mask = BIT(tile->id);
+ vm->dummy_ops.op.q = xe_tile_migrate_engine(tile);
+ fence = xe_vm_ops_execute(vm, &vm->dummy_ops.vops);
if (IS_ERR(fence)) {
ret = PTR_ERR(fence);
goto unlock_dma_resv;
diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c
index c1c23db19d9b..d07b82337ce0 100644
--- a/drivers/gpu/drm/xe/xe_vm.c
+++ b/drivers/gpu/drm/xe/xe_vm.c
@@ -829,7 +829,7 @@ int xe_vm_userptr_check_repin(struct xe_vm *vm)
list_empty_careful(&vm->userptr.invalidated)) ? 0 : -EAGAIN;
}
-static void xe_vm_populate_dummy_rebind(struct xe_vm *vm, struct xe_vma *vma)
+void xe_vm_populate_dummy_rebind(struct xe_vm *vm, struct xe_vma *vma)
{
vm->dummy_ops.op.base.op = DRM_GPUVA_OP_MAP;
vm->dummy_ops.op.base.map.va.addr = vma->gpuva.va.addr;
@@ -843,9 +843,6 @@ static void xe_vm_populate_dummy_rebind(struct xe_vm *vm, struct xe_vma *vma)
vm->dummy_ops.op.map.is_null = xe_vma_is_null(vma);
}
-static struct dma_fence *ops_execute(struct xe_vm *vm,
- struct xe_vma_ops *vops);
-
struct dma_fence *xe_vm_rebind(struct xe_vm *vm, bool rebind_worker)
{
struct dma_fence *fence = NULL;
@@ -868,7 +865,7 @@ struct dma_fence *xe_vm_rebind(struct xe_vm *vm, bool rebind_worker)
trace_xe_vma_rebind_exec(vma);
xe_vm_populate_dummy_rebind(vm, vma);
- fence = ops_execute(vm, &vm->dummy_ops.vops);
+ fence = xe_vm_ops_execute(vm, &vm->dummy_ops.vops);
if (IS_ERR(fence))
return fence;
}
@@ -2830,8 +2827,7 @@ static int vm_bind_ioctl_ops_lock(struct drm_exec *exec,
return 0;
}
-static struct dma_fence *ops_execute(struct xe_vm *vm,
- struct xe_vma_ops *vops)
+struct dma_fence *xe_vm_ops_execute(struct xe_vm *vm, struct xe_vma_ops *vops)
{
struct xe_vma_op *op, *next;
struct dma_fence *fence = NULL;
@@ -2864,7 +2860,7 @@ static int vm_bind_ioctl_ops_execute(struct xe_vm *vm,
if (err)
return err;
- fence = ops_execute(vm, vops);
+ fence = xe_vm_ops_execute(vm, vops);
if (IS_ERR(fence)) {
err = PTR_ERR(fence);
/* FIXME: Killing VM rather than proper error handling */
diff --git a/drivers/gpu/drm/xe/xe_vm.h b/drivers/gpu/drm/xe/xe_vm.h
index b08c75fbd8a1..7cbb512bcb10 100644
--- a/drivers/gpu/drm/xe/xe_vm.h
+++ b/drivers/gpu/drm/xe/xe_vm.h
@@ -224,6 +224,9 @@ int xe_analyze_vm(struct drm_printer *p, struct xe_vm *vm, int gt_id);
int xe_vm_prepare_vma(struct drm_exec *exec, struct xe_vma *vma,
unsigned int num_shared);
+void xe_vm_populate_dummy_rebind(struct xe_vm *vm, struct xe_vma *vma);
+struct dma_fence *xe_vm_ops_execute(struct xe_vm *vm, struct xe_vma_ops *vops);
+
#if IS_ENABLED(CONFIG_DRM_XE_DEBUG_VM)
#define vm_dbg drm_dbg
#else
--
2.34.1
More information about the Intel-xe
mailing list