Commit 74a8b2c6 authored by Matthew Brost's avatar Matthew Brost Committed by Rodrigo Vivi

drm/xe: Propagate error from bind operations to async fence

If an bind operation fails we need to report it via the async fence.
Signed-off-by: default avatarMatthew Brost <matthew.brost@intel.com>
Signed-off-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
Reviewed-by: default avatarNiranjana Vishwanathapura <niranjana.vishwanathapura@intel.com>
parent 332dd011
...@@ -1641,6 +1641,7 @@ xe_vm_bind_vma(struct xe_vma *vma, struct xe_engine *e, ...@@ -1641,6 +1641,7 @@ xe_vm_bind_vma(struct xe_vma *vma, struct xe_engine *e,
struct async_op_fence { struct async_op_fence {
struct dma_fence fence; struct dma_fence fence;
struct dma_fence *wait_fence;
struct dma_fence_cb cb; struct dma_fence_cb cb;
struct xe_vm *vm; struct xe_vm *vm;
wait_queue_head_t wq; wait_queue_head_t wq;
...@@ -1668,8 +1669,10 @@ static void async_op_fence_cb(struct dma_fence *fence, struct dma_fence_cb *cb) ...@@ -1668,8 +1669,10 @@ static void async_op_fence_cb(struct dma_fence *fence, struct dma_fence_cb *cb)
struct async_op_fence *afence = struct async_op_fence *afence =
container_of(cb, struct async_op_fence, cb); container_of(cb, struct async_op_fence, cb);
afence->fence.error = afence->wait_fence->error;
dma_fence_signal(&afence->fence); dma_fence_signal(&afence->fence);
xe_vm_put(afence->vm); xe_vm_put(afence->vm);
dma_fence_put(afence->wait_fence);
dma_fence_put(&afence->fence); dma_fence_put(&afence->fence);
} }
...@@ -1685,13 +1688,17 @@ static void add_async_op_fence_cb(struct xe_vm *vm, ...@@ -1685,13 +1688,17 @@ static void add_async_op_fence_cb(struct xe_vm *vm,
wake_up_all(&afence->wq); wake_up_all(&afence->wq);
} }
afence->wait_fence = dma_fence_get(fence);
afence->vm = xe_vm_get(vm); afence->vm = xe_vm_get(vm);
dma_fence_get(&afence->fence); dma_fence_get(&afence->fence);
ret = dma_fence_add_callback(fence, &afence->cb, async_op_fence_cb); ret = dma_fence_add_callback(fence, &afence->cb, async_op_fence_cb);
if (ret == -ENOENT) if (ret == -ENOENT) {
afence->fence.error = afence->wait_fence->error;
dma_fence_signal(&afence->fence); dma_fence_signal(&afence->fence);
}
if (ret) { if (ret) {
xe_vm_put(vm); xe_vm_put(vm);
dma_fence_put(afence->wait_fence);
dma_fence_put(&afence->fence); dma_fence_put(&afence->fence);
} }
XE_WARN_ON(ret && ret != -ENOENT); XE_WARN_ON(ret && ret != -ENOENT);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment