summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/ttm/ttm_bo.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2020-09-17 12:54:24 +1000
committerDave Airlie <airlied@redhat.com>2020-09-18 06:14:00 +1000
commit0b988ca1c7c4c73983b4ea96ef7c2af2263c87eb (patch)
tree729ee7adfc399e41f03a768f1a1df8f036d7af88 /drivers/gpu/drm/ttm/ttm_bo.c
parent67d6a8b358eac488112a4775f77dc3dbf63bea88 (diff)
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
Diffstat (limited to 'drivers/gpu/drm/ttm/ttm_bo.c')
-rw-r--r--drivers/gpu/drm/ttm/ttm_bo.c20
1 files changed, 2 insertions, 18 deletions
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index 92d60585deb1..4741c73f6ea4 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -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);
}