drm/ttm: protect against reentrant bind in the drivers

This moves the generic tracking into the drivers and protects
against reentrancy in the drivers. It fixes up radeon and agp
to be able to query the bound status as that is required.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200917043040.146575-2-airlied@gmail.com
このコミットが含まれているのは:
Dave Airlie
2020-09-17 12:54:24 +10:00
コミット 0b988ca1c7
13個のファイルの変更91行の追加45行の削除

ファイルの表示

@@ -1626,27 +1626,11 @@ void ttm_bo_tt_destroy(struct ttm_buffer_object *bo)
int ttm_bo_tt_bind(struct ttm_buffer_object *bo, struct ttm_resource *mem)
{
int ret;
if (!bo->ttm)
return -EINVAL;
if (ttm_bo_tt_is_bound(bo))
return 0;
ret = bo->bdev->driver->ttm_tt_bind(bo->bdev, bo->ttm, mem);
if (unlikely(ret != 0))
return ret;
ttm_bo_tt_set_bound(bo);
return 0;
return bo->bdev->driver->ttm_tt_bind(bo->bdev, bo->ttm, mem);
}
EXPORT_SYMBOL(ttm_bo_tt_bind);
void ttm_bo_tt_unbind(struct ttm_buffer_object *bo)
{
if (ttm_bo_tt_is_bound(bo)) {
bo->bdev->driver->ttm_tt_unbind(bo->bdev, bo->ttm);
ttm_bo_tt_set_unbound(bo);
}
bo->bdev->driver->ttm_tt_unbind(bo->bdev, bo->ttm);
}