drm/ttm: fix fence locking in ttm_buffer_object_transfer
[deliverable/linux.git] / drivers / gpu / drm / ttm / ttm_bo_util.c
index 2026060f03e0ef08969949fec0961c7d564db7cb..d73d6e3e17b2927c6215213e872e155a3badbfab 100644 (file)
@@ -43,7 +43,7 @@ void ttm_bo_free_old_node(struct ttm_buffer_object *bo)
 }
 
 int ttm_bo_move_ttm(struct ttm_buffer_object *bo,
-                   bool evict, bool no_wait_reserve,
+                   bool evict,
                    bool no_wait_gpu, struct ttm_mem_reg *new_mem)
 {
        struct ttm_tt *ttm = bo->ttm;
@@ -314,7 +314,7 @@ static int ttm_copy_ttm_io_page(struct ttm_tt *ttm, void *dst,
 }
 
 int ttm_bo_move_memcpy(struct ttm_buffer_object *bo,
-                      bool evict, bool no_wait_reserve, bool no_wait_gpu,
+                      bool evict, bool no_wait_gpu,
                       struct ttm_mem_reg *new_mem)
 {
        struct ttm_bo_device *bdev = bo->bdev;
@@ -611,8 +611,7 @@ EXPORT_SYMBOL(ttm_bo_kunmap);
 
 int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo,
                              void *sync_obj,
-                             void *sync_obj_arg,
-                             bool evict, bool no_wait_reserve,
+                             bool evict,
                              bool no_wait_gpu,
                              struct ttm_mem_reg *new_mem)
 {
@@ -630,7 +629,6 @@ int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo,
                bo->sync_obj = NULL;
        }
        bo->sync_obj = driver->sync_obj_ref(sync_obj);
-       bo->sync_obj_arg = sync_obj_arg;
        if (evict) {
                ret = ttm_bo_wait(bo, false, false, false);
                spin_unlock(&bdev->fence_lock);
@@ -656,11 +654,13 @@ int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo,
                 */
 
                set_bit(TTM_BO_PRIV_FLAG_MOVING, &bo->priv_flags);
+
+               /* ttm_buffer_object_transfer accesses bo->sync_obj */
+               ret = ttm_buffer_object_transfer(bo, &ghost_obj);
                spin_unlock(&bdev->fence_lock);
                if (tmp_obj)
                        driver->sync_obj_unref(&tmp_obj);
 
-               ret = ttm_buffer_object_transfer(bo, &ghost_obj);
                if (ret)
                        return ret;
 
This page took 0.026816 seconds and 5 git commands to generate.