drm/ttm: use an operation ctx for ttm_tt_bind
authorRoger He <Hongbo.He@amd.com>
Thu, 21 Dec 2017 09:42:51 +0000 (17:42 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Thu, 28 Dec 2017 14:48:20 +0000 (09:48 -0500)
forward the operation context to ttm_tt_bind as well,
and the ultimate goal is swapout enablement for reserved BOs.

v2: use common term rather than amd specific

Reviewed-by: Thomas Hellström <thellstrom@vmware.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Reviewed-by: Chuming Zhou <david1.zhou@amd.com>
Signed-off-by: Roger He <Hongbo.He@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/radeon/radeon_ttm.c
drivers/gpu/drm/ttm/ttm_bo.c
drivers/gpu/drm/ttm/ttm_bo_util.c
drivers/gpu/drm/ttm/ttm_tt.c
include/drm/ttm/ttm_bo_driver.h

index 044f5b57e197a5e44076a195f19690c022d9feec..e4bb435e614b86cacd4f264526423d73e3d32ace 100644 (file)
@@ -497,7 +497,7 @@ static int amdgpu_move_vram_ram(struct ttm_buffer_object *bo, bool evict,
                goto out_cleanup;
        }
 
-       r = ttm_tt_bind(bo->ttm, &tmp_mem);
+       r = ttm_tt_bind(bo->ttm, &tmp_mem, ctx);
        if (unlikely(r)) {
                goto out_cleanup;
        }
index a7df632b88cf270cb9e65b0977d9dddd9782c587..ce328edee7a1bd3b3efd058613076ed1428baa1b 100644 (file)
@@ -1218,7 +1218,7 @@ nouveau_bo_move_flipd(struct ttm_buffer_object *bo, bool evict, bool intr,
        if (ret)
                return ret;
 
-       ret = ttm_tt_bind(bo->ttm, &tmp_reg);
+       ret = ttm_tt_bind(bo->ttm, &tmp_reg, &ctx);
        if (ret)
                goto out;
 
index afc5eedddd8fbff157a1b116652e401ec9c31770..a0a839bc39bf99011fd9660266e257b38d3c85f6 100644 (file)
@@ -339,7 +339,7 @@ static int radeon_move_vram_ram(struct ttm_buffer_object *bo,
                goto out_cleanup;
        }
 
-       r = ttm_tt_bind(bo->ttm, &tmp_mem);
+       r = ttm_tt_bind(bo->ttm, &tmp_mem, &ctx);
        if (unlikely(r)) {
                goto out_cleanup;
        }
index 4424bf2db8ad560fe4a8bbff4dd4a9d8f8927b9c..b3a71acad6a840464e4cd39339c84b1df43a78d2 100644 (file)
@@ -300,7 +300,7 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo,
                        goto out_err;
 
                if (mem->mem_type != TTM_PL_SYSTEM) {
-                       ret = ttm_tt_bind(bo->ttm, mem);
+                       ret = ttm_tt_bind(bo->ttm, mem, ctx);
                        if (ret)
                                goto out_err;
                }
index b7eb507aaf40f09e91c275acea74b54e65795da5..153de1bf0232fdeb22bbfe70e40d3f501d73b1cd 100644 (file)
@@ -73,7 +73,7 @@ int ttm_bo_move_ttm(struct ttm_buffer_object *bo,
                return ret;
 
        if (new_mem->mem_type != TTM_PL_SYSTEM) {
-               ret = ttm_tt_bind(ttm, new_mem);
+               ret = ttm_tt_bind(ttm, new_mem, ctx);
                if (unlikely(ret != 0))
                        return ret;
        }
index b48d7a011cb1ec89111bdbabc91b25cb88ae1e2a..5a046a3c543a135df78ca11c2834acad3cac0e75 100644 (file)
@@ -261,12 +261,9 @@ void ttm_tt_unbind(struct ttm_tt *ttm)
        }
 }
 
-int ttm_tt_bind(struct ttm_tt *ttm, struct ttm_mem_reg *bo_mem)
+int ttm_tt_bind(struct ttm_tt *ttm, struct ttm_mem_reg *bo_mem,
+               struct ttm_operation_ctx *ctx)
 {
-       struct ttm_operation_ctx ctx = {
-               .interruptible = false,
-               .no_wait_gpu = false
-       };
        int ret = 0;
 
        if (!ttm)
@@ -275,7 +272,7 @@ int ttm_tt_bind(struct ttm_tt *ttm, struct ttm_mem_reg *bo_mem)
        if (ttm->state == tt_bound)
                return 0;
 
-       ret = ttm->bdev->driver->ttm_tt_populate(ttm, &ctx);
+       ret = ttm->bdev->driver->ttm_tt_populate(ttm, ctx);
        if (ret)
                return ret;
 
index 84860ece77ebfaaf097f66ce9c70ec845c07ad3b..94064b126e8e2df874bc31807e13881514c3bb07 100644 (file)
@@ -650,7 +650,8 @@ void ttm_dma_tt_fini(struct ttm_dma_tt *ttm_dma);
  *
  * Bind the pages of @ttm to an aperture location identified by @bo_mem
  */
-int ttm_tt_bind(struct ttm_tt *ttm, struct ttm_mem_reg *bo_mem);
+int ttm_tt_bind(struct ttm_tt *ttm, struct ttm_mem_reg *bo_mem,
+               struct ttm_operation_ctx *ctx);
 
 /**
  * ttm_ttm_destroy: