提交 a0a8e759 编写于 作者: C Christian König

drm/amdgpu: use new iterator in amdgpu_vm_prt_fini

No need to actually allocate an array of fences here.
Signed-off-by: NChristian König <christian.koenig@amd.com>
Reviewed-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20211005113742.1101-14-christian.koenig@amd.com
上级 c93ce6a6
...@@ -2090,30 +2090,14 @@ static void amdgpu_vm_free_mapping(struct amdgpu_device *adev, ...@@ -2090,30 +2090,14 @@ static void amdgpu_vm_free_mapping(struct amdgpu_device *adev,
static void amdgpu_vm_prt_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm) static void amdgpu_vm_prt_fini(struct amdgpu_device *adev, struct amdgpu_vm *vm)
{ {
struct dma_resv *resv = vm->root.bo->tbo.base.resv; struct dma_resv *resv = vm->root.bo->tbo.base.resv;
struct dma_fence *excl, **shared; struct dma_resv_iter cursor;
unsigned i, shared_count; struct dma_fence *fence;
int r;
r = dma_resv_get_fences(resv, &excl, &shared_count, &shared); dma_resv_for_each_fence(&cursor, resv, true, fence) {
if (r) { /* Add a callback for each fence in the reservation object */
/* Not enough memory to grab the fence list, as last resort
* block for all the fences to complete.
*/
dma_resv_wait_timeout(resv, true, false,
MAX_SCHEDULE_TIMEOUT);
return;
}
/* Add a callback for each fence in the reservation object */
amdgpu_vm_prt_get(adev);
amdgpu_vm_add_prt_cb(adev, excl);
for (i = 0; i < shared_count; ++i) {
amdgpu_vm_prt_get(adev); amdgpu_vm_prt_get(adev);
amdgpu_vm_add_prt_cb(adev, shared[i]); amdgpu_vm_add_prt_cb(adev, fence);
} }
kfree(shared);
} }
/** /**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册