drm/ttm: wait for BO idle in ttm_bo_move_memcpy
authorChristian König <christian.koenig@amd.com>
Mon, 6 Jun 2016 08:17:54 +0000 (10:17 +0200)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 7 Jul 2016 18:54:35 +0000 (14:54 -0400)
When we want to pipeline accelerated moves we need to wait in the fallback path.

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
drivers/gpu/drm/nouveau/nouveau_bo.c
drivers/gpu/drm/qxl/qxl_ttm.c
drivers/gpu/drm/radeon/radeon_ttm.c
drivers/gpu/drm/ttm/ttm_bo.c
drivers/gpu/drm/ttm/ttm_bo_util.c
include/drm/ttm/ttm_bo_driver.h

index 0a6a6320b40eb60bfbbdcad83b64e574e84fae85..9b244c5a62956cf56338946b6b3172fa6ed0e2ac 100644 (file)
@@ -433,7 +433,8 @@ static int amdgpu_bo_move(struct ttm_buffer_object *bo,
 
        if (r) {
 memcpy:
-               r = ttm_bo_move_memcpy(bo, evict, no_wait_gpu, new_mem);
+               r = ttm_bo_move_memcpy(bo, evict, interruptible,
+                                      no_wait_gpu, new_mem);
                if (r) {
                        return r;
                }
index a43f3095693b8556c0b5514e4e12b14c24c80ed1..4fb1bf9b81b3366c891ea636163eb07335ba6ec3 100644 (file)
@@ -1328,7 +1328,7 @@ nouveau_bo_move(struct ttm_buffer_object *bo, bool evict, bool intr,
        /* Fallback to software copy. */
        ret = ttm_bo_wait(bo, intr, no_wait_gpu);
        if (ret == 0)
-               ret = ttm_bo_move_memcpy(bo, evict, no_wait_gpu, new_mem);
+               ret = ttm_bo_move_memcpy(bo, evict, intr, no_wait_gpu, new_mem);
 
 out:
        if (drm->device.info.family < NV_DEVICE_INFO_V0_TESLA) {
index 89e8be944330a2e9958fb340070f7072ab0051a9..d50c9679e631a8e8fc226c382cdb9f88fee64fc9 100644 (file)
@@ -361,7 +361,8 @@ static int qxl_bo_move(struct ttm_buffer_object *bo,
                qxl_move_null(bo, new_mem);
                return 0;
        }
-       return ttm_bo_move_memcpy(bo, evict, no_wait_gpu, new_mem);
+       return ttm_bo_move_memcpy(bo, evict, interruptible,
+                                 no_wait_gpu, new_mem);
 }
 
 static void qxl_bo_move_notify(struct ttm_buffer_object *bo,
index 1cc4870b3de8ba69c0a6379d1ae342d8b823c543..20ca22dc681366403094c6e3de29b26edb61e0f1 100644 (file)
@@ -445,7 +445,8 @@ static int radeon_bo_move(struct ttm_buffer_object *bo,
 
        if (r) {
 memcpy:
-               r = ttm_bo_move_memcpy(bo, evict, no_wait_gpu, new_mem);
+               r = ttm_bo_move_memcpy(bo, evict, interruptible,
+                                      no_wait_gpu, new_mem);
                if (r) {
                        return r;
                }
index 43a29555032e38c0d8a9f85aad24f8a704898480..041fb3b8b2aa08ab830831740d1a94bb7fbaeb15 100644 (file)
@@ -359,7 +359,8 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo,
                ret = bdev->driver->move(bo, evict, interruptible,
                                         no_wait_gpu, mem);
        else
-               ret = ttm_bo_move_memcpy(bo, evict, no_wait_gpu, mem);
+               ret = ttm_bo_move_memcpy(bo, evict, interruptible,
+                                        no_wait_gpu, mem);
 
        if (ret) {
                if (bdev->driver->move_notify) {
index 0f4bcb0d594b53f8e5e617b0a9923c06c00365eb..434f2394ad2c1d029ca6ea041602c660446a504e 100644 (file)
@@ -320,7 +320,8 @@ 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_gpu,
+                      bool evict, bool interruptible,
+                      bool no_wait_gpu,
                       struct ttm_mem_reg *new_mem)
 {
        struct ttm_bo_device *bdev = bo->bdev;
@@ -336,6 +337,10 @@ int ttm_bo_move_memcpy(struct ttm_buffer_object *bo,
        unsigned long add = 0;
        int dir;
 
+       ret = ttm_bo_wait(bo, interruptible, no_wait_gpu);
+       if (ret)
+               return ret;
+
        ret = ttm_mem_reg_ioremap(bdev, old_mem, &old_iomap);
        if (ret)
                return ret;
index da6ee17d7c0b1f14d46fe2ce9c29c31d9fe5f86a..0d1d9d78c650669469adc864008073aa64c49dd9 100644 (file)
@@ -970,6 +970,7 @@ extern int ttm_bo_move_ttm(struct ttm_buffer_object *bo,
  *
  * @bo: A pointer to a struct ttm_buffer_object.
  * @evict: 1: This is an eviction. Don't try to pipeline.
+ * @interruptible: Sleep interruptible if waiting.
  * @no_wait_gpu: Return immediately if the GPU is busy.
  * @new_mem: struct ttm_mem_reg indicating where to move.
  *
@@ -984,7 +985,8 @@ extern int ttm_bo_move_ttm(struct ttm_buffer_object *bo,
  */
 
 extern int ttm_bo_move_memcpy(struct ttm_buffer_object *bo,
-                             bool evict, bool no_wait_gpu,
+                             bool evict, bool interruptible,
+                             bool no_wait_gpu,
                              struct ttm_mem_reg *new_mem);
 
 /**