aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoger He <Hongbo.He@amd.com>2017-12-08 07:19:32 -0500
committerAlex Deucher <alexander.deucher@amd.com>2017-12-15 17:14:25 -0500
commit3e98d829ad0a59425f816c94447b4ac39a72f632 (patch)
tree0aa33f95f9b46838a8f169ec2c079709f0f0cb02
parent4985c9fc5f5231e93c4dcfd067d2c6a70e4fe6b8 (diff)
drm/ttm: use an ttm operation ctx for ttm_bo_move_xxx
include ttm_bo_move_memcpy and ttm_bo_move_ttm Signed-off-by: Roger He <Hongbo.He@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c7
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_bo.c7
-rw-r--r--drivers/gpu/drm/qxl/qxl_ttm.c3
-rw-r--r--drivers/gpu/drm/radeon/radeon_ttm.c7
-rw-r--r--drivers/gpu/drm/ttm/ttm_bo.c6
-rw-r--r--drivers/gpu/drm/ttm/ttm_bo_util.c8
-rw-r--r--include/drm/ttm/ttm_bo_driver.h4
7 files changed, 18 insertions, 24 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
index 7db9556b389b..c307a7d2cf16 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c
@@ -505,7 +505,7 @@ static int amdgpu_move_vram_ram(struct ttm_buffer_object *bo, bool evict,
505 if (unlikely(r)) { 505 if (unlikely(r)) {
506 goto out_cleanup; 506 goto out_cleanup;
507 } 507 }
508 r = ttm_bo_move_ttm(bo, ctx->interruptible, ctx->no_wait_gpu, new_mem); 508 r = ttm_bo_move_ttm(bo, ctx, new_mem);
509out_cleanup: 509out_cleanup:
510 ttm_bo_mem_put(bo, &tmp_mem); 510 ttm_bo_mem_put(bo, &tmp_mem);
511 return r; 511 return r;
@@ -536,7 +536,7 @@ static int amdgpu_move_ram_vram(struct ttm_buffer_object *bo, bool evict,
536 if (unlikely(r)) { 536 if (unlikely(r)) {
537 return r; 537 return r;
538 } 538 }
539 r = ttm_bo_move_ttm(bo, ctx->interruptible, ctx->no_wait_gpu, &tmp_mem); 539 r = ttm_bo_move_ttm(bo, ctx, &tmp_mem);
540 if (unlikely(r)) { 540 if (unlikely(r)) {
541 goto out_cleanup; 541 goto out_cleanup;
542 } 542 }
@@ -597,8 +597,7 @@ static int amdgpu_bo_move(struct ttm_buffer_object *bo, bool evict,
597 597
598 if (r) { 598 if (r) {
599memcpy: 599memcpy:
600 r = ttm_bo_move_memcpy(bo, ctx->interruptible, 600 r = ttm_bo_move_memcpy(bo, ctx, new_mem);
601 ctx->no_wait_gpu, new_mem);
602 if (r) { 601 if (r) {
603 return r; 602 return r;
604 } 603 }
diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c
index 949bf6b3feab..6b6fb2080ac3 100644
--- a/drivers/gpu/drm/nouveau/nouveau_bo.c
+++ b/drivers/gpu/drm/nouveau/nouveau_bo.c
@@ -1226,7 +1226,7 @@ nouveau_bo_move_flipd(struct ttm_buffer_object *bo, bool evict, bool intr,
1226 if (ret) 1226 if (ret)
1227 goto out; 1227 goto out;
1228 1228
1229 ret = ttm_bo_move_ttm(bo, intr, no_wait_gpu, new_reg); 1229 ret = ttm_bo_move_ttm(bo, &ctx, new_reg);
1230out: 1230out:
1231 ttm_bo_mem_put(bo, &tmp_reg); 1231 ttm_bo_mem_put(bo, &tmp_reg);
1232 return ret; 1232 return ret;
@@ -1255,7 +1255,7 @@ nouveau_bo_move_flips(struct ttm_buffer_object *bo, bool evict, bool intr,
1255 if (ret) 1255 if (ret)
1256 return ret; 1256 return ret;
1257 1257
1258 ret = ttm_bo_move_ttm(bo, intr, no_wait_gpu, &tmp_reg); 1258 ret = ttm_bo_move_ttm(bo, &ctx, &tmp_reg);
1259 if (ret) 1259 if (ret)
1260 goto out; 1260 goto out;
1261 1261
@@ -1380,8 +1380,7 @@ nouveau_bo_move(struct ttm_buffer_object *bo, bool evict,
1380 /* Fallback to software copy. */ 1380 /* Fallback to software copy. */
1381 ret = ttm_bo_wait(bo, ctx->interruptible, ctx->no_wait_gpu); 1381 ret = ttm_bo_wait(bo, ctx->interruptible, ctx->no_wait_gpu);
1382 if (ret == 0) 1382 if (ret == 0)
1383 ret = ttm_bo_move_memcpy(bo, ctx->interruptible, 1383 ret = ttm_bo_move_memcpy(bo, ctx, new_reg);
1384 ctx->no_wait_gpu, new_reg);
1385 1384
1386out: 1385out:
1387 if (drm->client.device.info.family < NV_DEVICE_INFO_V0_TESLA) { 1386 if (drm->client.device.info.family < NV_DEVICE_INFO_V0_TESLA) {
diff --git a/drivers/gpu/drm/qxl/qxl_ttm.c b/drivers/gpu/drm/qxl/qxl_ttm.c
index d866f329e7d8..78ce118d9157 100644
--- a/drivers/gpu/drm/qxl/qxl_ttm.c
+++ b/drivers/gpu/drm/qxl/qxl_ttm.c
@@ -357,8 +357,7 @@ static int qxl_bo_move(struct ttm_buffer_object *bo, bool evict,
357 qxl_move_null(bo, new_mem); 357 qxl_move_null(bo, new_mem);
358 return 0; 358 return 0;
359 } 359 }
360 return ttm_bo_move_memcpy(bo, ctx->interruptible, ctx->no_wait_gpu, 360 return ttm_bo_move_memcpy(bo, ctx, new_mem);
361 new_mem);
362} 361}
363 362
364static void qxl_bo_move_notify(struct ttm_buffer_object *bo, 363static void qxl_bo_move_notify(struct ttm_buffer_object *bo,
diff --git a/drivers/gpu/drm/radeon/radeon_ttm.c b/drivers/gpu/drm/radeon/radeon_ttm.c
index 98e30d71d9e0..557fd7915973 100644
--- a/drivers/gpu/drm/radeon/radeon_ttm.c
+++ b/drivers/gpu/drm/radeon/radeon_ttm.c
@@ -347,7 +347,7 @@ static int radeon_move_vram_ram(struct ttm_buffer_object *bo,
347 if (unlikely(r)) { 347 if (unlikely(r)) {
348 goto out_cleanup; 348 goto out_cleanup;
349 } 349 }
350 r = ttm_bo_move_ttm(bo, interruptible, no_wait_gpu, new_mem); 350 r = ttm_bo_move_ttm(bo, &ctx, new_mem);
351out_cleanup: 351out_cleanup:
352 ttm_bo_mem_put(bo, &tmp_mem); 352 ttm_bo_mem_put(bo, &tmp_mem);
353 return r; 353 return r;
@@ -380,7 +380,7 @@ static int radeon_move_ram_vram(struct ttm_buffer_object *bo,
380 if (unlikely(r)) { 380 if (unlikely(r)) {
381 return r; 381 return r;
382 } 382 }
383 r = ttm_bo_move_ttm(bo, interruptible, no_wait_gpu, &tmp_mem); 383 r = ttm_bo_move_ttm(bo, &ctx, &tmp_mem);
384 if (unlikely(r)) { 384 if (unlikely(r)) {
385 goto out_cleanup; 385 goto out_cleanup;
386 } 386 }
@@ -445,8 +445,7 @@ static int radeon_bo_move(struct ttm_buffer_object *bo, bool evict,
445 445
446 if (r) { 446 if (r) {
447memcpy: 447memcpy:
448 r = ttm_bo_move_memcpy(bo, ctx->interruptible, 448 r = ttm_bo_move_memcpy(bo, ctx, new_mem);
449 ctx->no_wait_gpu, new_mem);
450 if (r) { 449 if (r) {
451 return r; 450 return r;
452 } 451 }
diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index 17f64c836bf9..ba5b48617bba 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -324,13 +324,11 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo,
324 324
325 if (!(old_man->flags & TTM_MEMTYPE_FLAG_FIXED) && 325 if (!(old_man->flags & TTM_MEMTYPE_FLAG_FIXED) &&
326 !(new_man->flags & TTM_MEMTYPE_FLAG_FIXED)) 326 !(new_man->flags & TTM_MEMTYPE_FLAG_FIXED))
327 ret = ttm_bo_move_ttm(bo, ctx->interruptible, 327 ret = ttm_bo_move_ttm(bo, ctx, mem);
328 ctx->no_wait_gpu, mem);
329 else if (bdev->driver->move) 328 else if (bdev->driver->move)
330 ret = bdev->driver->move(bo, evict, ctx, mem); 329 ret = bdev->driver->move(bo, evict, ctx, mem);
331 else 330 else
332 ret = ttm_bo_move_memcpy(bo, ctx->interruptible, 331 ret = ttm_bo_move_memcpy(bo, ctx, mem);
333 ctx->no_wait_gpu, mem);
334 332
335 if (ret) { 333 if (ret) {
336 if (bdev->driver->move_notify) { 334 if (bdev->driver->move_notify) {
diff --git a/drivers/gpu/drm/ttm/ttm_bo_util.c b/drivers/gpu/drm/ttm/ttm_bo_util.c
index e7a519f1849b..9237099a7c49 100644
--- a/drivers/gpu/drm/ttm/ttm_bo_util.c
+++ b/drivers/gpu/drm/ttm/ttm_bo_util.c
@@ -45,7 +45,7 @@ void ttm_bo_free_old_node(struct ttm_buffer_object *bo)
45} 45}
46 46
47int ttm_bo_move_ttm(struct ttm_buffer_object *bo, 47int ttm_bo_move_ttm(struct ttm_buffer_object *bo,
48 bool interruptible, bool no_wait_gpu, 48 struct ttm_operation_ctx *ctx,
49 struct ttm_mem_reg *new_mem) 49 struct ttm_mem_reg *new_mem)
50{ 50{
51 struct ttm_tt *ttm = bo->ttm; 51 struct ttm_tt *ttm = bo->ttm;
@@ -53,7 +53,7 @@ int ttm_bo_move_ttm(struct ttm_buffer_object *bo,
53 int ret; 53 int ret;
54 54
55 if (old_mem->mem_type != TTM_PL_SYSTEM) { 55 if (old_mem->mem_type != TTM_PL_SYSTEM) {
56 ret = ttm_bo_wait(bo, interruptible, no_wait_gpu); 56 ret = ttm_bo_wait(bo, ctx->interruptible, ctx->no_wait_gpu);
57 57
58 if (unlikely(ret != 0)) { 58 if (unlikely(ret != 0)) {
59 if (ret != -ERESTARTSYS) 59 if (ret != -ERESTARTSYS)
@@ -329,7 +329,7 @@ static int ttm_copy_ttm_io_page(struct ttm_tt *ttm, void *dst,
329} 329}
330 330
331int ttm_bo_move_memcpy(struct ttm_buffer_object *bo, 331int ttm_bo_move_memcpy(struct ttm_buffer_object *bo,
332 bool interruptible, bool no_wait_gpu, 332 struct ttm_operation_ctx *ctx,
333 struct ttm_mem_reg *new_mem) 333 struct ttm_mem_reg *new_mem)
334{ 334{
335 struct ttm_bo_device *bdev = bo->bdev; 335 struct ttm_bo_device *bdev = bo->bdev;
@@ -345,7 +345,7 @@ int ttm_bo_move_memcpy(struct ttm_buffer_object *bo,
345 unsigned long add = 0; 345 unsigned long add = 0;
346 int dir; 346 int dir;
347 347
348 ret = ttm_bo_wait(bo, interruptible, no_wait_gpu); 348 ret = ttm_bo_wait(bo, ctx->interruptible, ctx->no_wait_gpu);
349 if (ret) 349 if (ret)
350 return ret; 350 return ret;
351 351
diff --git a/include/drm/ttm/ttm_bo_driver.h b/include/drm/ttm/ttm_bo_driver.h
index 6996d884c508..5115718ca607 100644
--- a/include/drm/ttm/ttm_bo_driver.h
+++ b/include/drm/ttm/ttm_bo_driver.h
@@ -976,7 +976,7 @@ void ttm_mem_io_free(struct ttm_bo_device *bdev,
976 */ 976 */
977 977
978int ttm_bo_move_ttm(struct ttm_buffer_object *bo, 978int ttm_bo_move_ttm(struct ttm_buffer_object *bo,
979 bool interruptible, bool no_wait_gpu, 979 struct ttm_operation_ctx *ctx,
980 struct ttm_mem_reg *new_mem); 980 struct ttm_mem_reg *new_mem);
981 981
982/** 982/**
@@ -998,7 +998,7 @@ int ttm_bo_move_ttm(struct ttm_buffer_object *bo,
998 */ 998 */
999 999
1000int ttm_bo_move_memcpy(struct ttm_buffer_object *bo, 1000int ttm_bo_move_memcpy(struct ttm_buffer_object *bo,
1001 bool interruptible, bool no_wait_gpu, 1001 struct ttm_operation_ctx *ctx,
1002 struct ttm_mem_reg *new_mem); 1002 struct ttm_mem_reg *new_mem);
1003 1003
1004/** 1004/**