[PATCH v4 21/30] drm/xe: Update xe_vm_rebind to return int
Matthew Brost
matthew.brost at intel.com
Fri Mar 8 05:07:57 UTC 2024
From: Thomas Hellström <thomas.hellstrom at linux.intel.com>
Now that rebinds are installed in the kernel dma-resv slot the fence
returned from xe_vm_rebind is unused aside from error checking. Update
to xe_vm_rebind to return int.
Signed-off-by: Matthew Brost <matthew.brost at intel.com>
Signed-off-by: Thomas Hellström <thomas.hellstrom at linux.intel.com>
---
drivers/gpu/drm/xe/xe_exec.c | 8 ++------
drivers/gpu/drm/xe/xe_vm.c | 17 +++++++----------
drivers/gpu/drm/xe/xe_vm.h | 2 +-
3 files changed, 10 insertions(+), 17 deletions(-)
diff --git a/drivers/gpu/drm/xe/xe_exec.c b/drivers/gpu/drm/xe/xe_exec.c
index 4feff67620c4..7d676e3610fa 100644
--- a/drivers/gpu/drm/xe/xe_exec.c
+++ b/drivers/gpu/drm/xe/xe_exec.c
@@ -152,7 +152,6 @@ int xe_exec_ioctl(struct drm_device *dev, void *data, struct drm_file *file)
struct drm_exec *exec = &vm_exec.exec;
u32 i, num_syncs = 0, num_ufence = 0;
struct xe_sched_job *job;
- struct dma_fence *rebind_fence;
struct xe_vm *vm;
bool write_locked, skip_retry = false;
ktime_t end = 0;
@@ -289,12 +288,9 @@ int xe_exec_ioctl(struct drm_device *dev, void *data, struct drm_file *file)
* Rebind any invalidated userptr or evicted BOs in the VM, non-compute
* VM mode only.
*/
- rebind_fence = xe_vm_rebind(vm, false);
- if (IS_ERR(rebind_fence)) {
- err = PTR_ERR(rebind_fence);
+ err = xe_vm_rebind(vm, false);
+ if (err)
goto err_put_job;
- }
- dma_fence_put(rebind_fence);
/* Wait for rebinds */
if (!xe_vm_in_lr_mode(vm)) {
diff --git a/drivers/gpu/drm/xe/xe_vm.c b/drivers/gpu/drm/xe/xe_vm.c
index 47658465b735..47a0d3a6cda5 100644
--- a/drivers/gpu/drm/xe/xe_vm.c
+++ b/drivers/gpu/drm/xe/xe_vm.c
@@ -526,7 +526,6 @@ static void preempt_rebind_work_func(struct work_struct *w)
{
struct xe_vm *vm = container_of(w, struct xe_vm, preempt.rebind_work);
struct drm_exec exec;
- struct dma_fence *rebind_fence;
unsigned int fence_count = 0;
LIST_HEAD(preempt_fences);
ktime_t end = 0;
@@ -572,12 +571,9 @@ static void preempt_rebind_work_func(struct work_struct *w)
if (err)
goto out_unlock;
- rebind_fence = xe_vm_rebind(vm, true);
- if (IS_ERR(rebind_fence)) {
- err = PTR_ERR(rebind_fence);
+ err = xe_vm_rebind(vm, true);
+ if (err)
goto out_unlock;
- }
- dma_fence_put(rebind_fence);
/* Wait on rebinds */
wait = dma_resv_wait_timeout(xe_vm_resv(vm),
@@ -796,14 +792,14 @@ 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);
}
-struct dma_fence *xe_vm_rebind(struct xe_vm *vm, bool rebind_worker)
+int xe_vm_rebind(struct xe_vm *vm, bool rebind_worker)
{
struct dma_fence *fence = NULL;
struct xe_vma *vma, *next;
lockdep_assert_held(&vm->lock);
if (xe_vm_in_lr_mode(vm) && !rebind_worker)
- return NULL;
+ return 0;
xe_vm_assert_held(vm);
list_for_each_entry_safe(vma, next, &vm->rebind_list,
@@ -820,10 +816,11 @@ struct dma_fence *xe_vm_rebind(struct xe_vm *vm, bool rebind_worker)
xe_vm_populate_dummy_rebind(vm, vma, vma->tile_present);
fence = xe_vm_ops_execute(vm, &vm->dummy_ops.vops);
if (IS_ERR(fence))
- return fence;
+ return PTR_ERR(fence);
}
- return fence;
+ dma_fence_put(fence);
+ return 0;
}
static void xe_vma_free(struct xe_vma *vma)
diff --git a/drivers/gpu/drm/xe/xe_vm.h b/drivers/gpu/drm/xe/xe_vm.h
index 8201ecb8f05a..c849ad0d44b5 100644
--- a/drivers/gpu/drm/xe/xe_vm.h
+++ b/drivers/gpu/drm/xe/xe_vm.h
@@ -207,7 +207,7 @@ int __xe_vm_userptr_needs_repin(struct xe_vm *vm);
int xe_vm_userptr_check_repin(struct xe_vm *vm);
-struct dma_fence *xe_vm_rebind(struct xe_vm *vm, bool rebind_worker);
+int xe_vm_rebind(struct xe_vm *vm, bool rebind_worker);
int xe_vm_invalidate_vma(struct xe_vma *vma);
--
2.34.1
More information about the Intel-xe
mailing list