aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoger He <Hongbo.He@amd.com>2017-12-21 04:42:51 -0500
committerAlex Deucher <alexander.deucher@amd.com>2017-12-28 09:48:20 -0500
commit993baf15560d2e8153f715cec677e6576b35662e (patch)
tree309ebe3548d72e624cadc1f92061c552f926ef1e
parentd0cef9fa4411eb17dd350cced3336ca58f465ff1 (diff)
drm/ttm: use an operation ctx for ttm_tt_bind
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>
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c2
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_bo.c2
-rw-r--r--drivers/gpu/drm/radeon/radeon_ttm.c2
-rw-r--r--drivers/gpu/drm/ttm/ttm_bo.c2
-rw-r--r--drivers/gpu/drm/ttm/ttm_bo_util.c2
-rw-r--r--drivers/gpu/drm/ttm/ttm_tt.c9
-rw-r--r--include/drm/ttm/ttm_bo_driver.h3
7 files changed, 10 insertions, 12 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index 044f5b57e197..e4bb435e614b 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -497,7 +497,7 @@ static int amdgpu_move_vram_ram(struct ttm_buffer_object *bo, bool evict,
497 goto out_cleanup; 497 goto out_cleanup;
498 } 498 }
499 499
500 r = ttm_tt_bind(bo->ttm, &tmp_mem); 500 r = ttm_tt_bind(bo->ttm, &tmp_mem, ctx);
501 if (unlikely(r)) { 501 if (unlikely(r)) {
502 goto out_cleanup; 502 goto out_cleanup;
503 } 503 }
diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c
index a7df632b88cf..ce328edee7a1 100644
--- a/drivers/gpu/drm/nouveau/nouveau_bo.c
+++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
@@ -1218,7 +1218,7 @@ nouveau_bo_move_flipd(struct ttm_buffer_object *bo, bool evict, bool intr,
1218 if (ret) 1218 if (ret)
1219 return ret; 1219 return ret;
1220 1220
1221 ret = ttm_tt_bind(bo->ttm, &tmp_reg); 1221 ret = ttm_tt_bind(bo->ttm, &tmp_reg, &ctx);
1222 if (ret) 1222 if (ret)
1223 goto out; 1223 goto out;
1224 1224
diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c
index afc5eedddd8f..a0a839bc39bf 100644
--- a/drivers/gpu/drm/radeon/radeon_ttm.c
+++ b/drivers/gpu/drm/radeon/radeon_ttm.c
@@ -339,7 +339,7 @@ static int radeon_move_vram_ram(struct ttm_buffer_object *bo,
339 goto out_cleanup; 339 goto out_cleanup;
340 } 340 }
341 341
342 r = ttm_tt_bind(bo->ttm, &tmp_mem); 342 r = ttm_tt_bind(bo->ttm, &tmp_mem, &ctx);
343 if (unlikely(r)) { 343 if (unlikely(r)) {
344 goto out_cleanup; 344 goto out_cleanup;
345 } 345 }
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index 4424bf2db8ad..b3a71acad6a8 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -300,7 +300,7 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo,
300 goto out_err; 300 goto out_err;
301 301
302 if (mem->mem_type != TTM_PL_SYSTEM) { 302 if (mem->mem_type != TTM_PL_SYSTEM) {
303 ret = ttm_tt_bind(bo->ttm, mem); 303 ret = ttm_tt_bind(bo->ttm, mem, ctx);
304 if (ret) 304 if (ret)
305 goto out_err; 305 goto out_err;
306 } 306 }
diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c
index b7eb507aaf40..153de1bf0232 100644
--- a/drivers/gpu/drm/ttm/ttm_bo_util.c
+++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
@@ -73,7 +73,7 @@ int ttm_bo_move_ttm(struct ttm_buffer_object *bo,
73 return ret; 73 return ret;
74 74
75 if (new_mem->mem_type != TTM_PL_SYSTEM) { 75 if (new_mem->mem_type != TTM_PL_SYSTEM) {
76 ret = ttm_tt_bind(ttm, new_mem); 76 ret = ttm_tt_bind(ttm, new_mem, ctx);
77 if (unlikely(ret != 0)) 77 if (unlikely(ret != 0))
78 return ret; 78 return ret;
79 } 79 }
diff --git a/drivers/gpu/drm/ttm/ttm_tt.c b/drivers/gpu/drm/ttm/ttm_tt.c
index b48d7a011cb1..5a046a3c543a 100644
--- a/drivers/gpu/drm/ttm/ttm_tt.c
+++ b/drivers/gpu/drm/ttm/ttm_tt.c
@@ -261,12 +261,9 @@ void ttm_tt_unbind(struct ttm_tt *ttm)
261 } 261 }
262} 262}
263 263
264int ttm_tt_bind(struct ttm_tt *ttm, struct ttm_mem_reg *bo_mem) 264int ttm_tt_bind(struct ttm_tt *ttm, struct ttm_mem_reg *bo_mem,
265 struct ttm_operation_ctx *ctx)
265{ 266{
266 struct ttm_operation_ctx ctx = {
267 .interruptible = false,
268 .no_wait_gpu = false
269 };
270 int ret = 0; 267 int ret = 0;
271 268
272 if (!ttm) 269 if (!ttm)
@@ -275,7 +272,7 @@ int ttm_tt_bind(struct ttm_tt *ttm, struct ttm_mem_reg *bo_mem)
275 if (ttm->state == tt_bound) 272 if (ttm->state == tt_bound)
276 return 0; 273 return 0;
277 274
278 ret = ttm->bdev->driver->ttm_tt_populate(ttm, &ctx); 275 ret = ttm->bdev->driver->ttm_tt_populate(ttm, ctx);
279 if (ret) 276 if (ret)
280 return ret; 277 return ret;
281 278
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
index 84860ece77eb..94064b126e8e 100644
--- a/include/drm/ttm/ttm_bo_driver.h
+++ b/include/drm/ttm/ttm_bo_driver.h
@@ -650,7 +650,8 @@ void ttm_dma_tt_fini(struct ttm_dma_tt *ttm_dma);
650 * 650 *
651 * Bind the pages of @ttm to an aperture location identified by @bo_mem 651 * Bind the pages of @ttm to an aperture location identified by @bo_mem
652 */ 652 */
653int ttm_tt_bind(struct ttm_tt *ttm, struct ttm_mem_reg *bo_mem); 653int ttm_tt_bind(struct ttm_tt *ttm, struct ttm_mem_reg *bo_mem,
654 struct ttm_operation_ctx *ctx);
654 655
655/** 656/**
656 * ttm_ttm_destroy: 657 * ttm_ttm_destroy: