Commit 3e98d829 authored by Roger He's avatar Roger He Committed by Alex Deucher

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: default avatarRoger He <Hongbo.He@amd.com>
Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 4985c9fc
...@@ -505,7 +505,7 @@ static int amdgpu_move_vram_ram(struct ttm_buffer_object *bo, bool evict, ...@@ -505,7 +505,7 @@ static int amdgpu_move_vram_ram(struct ttm_buffer_object *bo, bool evict,
if (unlikely(r)) { if (unlikely(r)) {
goto out_cleanup; goto out_cleanup;
} }
r = ttm_bo_move_ttm(bo, ctx->interruptible, ctx->no_wait_gpu, new_mem); r = ttm_bo_move_ttm(bo, ctx, new_mem);
out_cleanup: out_cleanup:
ttm_bo_mem_put(bo, &tmp_mem); ttm_bo_mem_put(bo, &tmp_mem);
return r; return r;
...@@ -536,7 +536,7 @@ static int amdgpu_move_ram_vram(struct ttm_buffer_object *bo, bool evict, ...@@ -536,7 +536,7 @@ static int amdgpu_move_ram_vram(struct ttm_buffer_object *bo, bool evict,
if (unlikely(r)) { if (unlikely(r)) {
return r; return r;
} }
r = ttm_bo_move_ttm(bo, ctx->interruptible, ctx->no_wait_gpu, &tmp_mem); r = ttm_bo_move_ttm(bo, ctx, &tmp_mem);
if (unlikely(r)) { if (unlikely(r)) {
goto out_cleanup; goto out_cleanup;
} }
...@@ -597,8 +597,7 @@ static int amdgpu_bo_move(struct ttm_buffer_object *bo, bool evict, ...@@ -597,8 +597,7 @@ static int amdgpu_bo_move(struct ttm_buffer_object *bo, bool evict,
if (r) { if (r) {
memcpy: memcpy:
r = ttm_bo_move_memcpy(bo, ctx->interruptible, r = ttm_bo_move_memcpy(bo, ctx, new_mem);
ctx->no_wait_gpu, new_mem);
if (r) { if (r) {
return r; return r;
} }
......
...@@ -1226,7 +1226,7 @@ nouveau_bo_move_flipd(struct ttm_buffer_object *bo, bool evict, bool intr, ...@@ -1226,7 +1226,7 @@ nouveau_bo_move_flipd(struct ttm_buffer_object *bo, bool evict, bool intr,
if (ret) if (ret)
goto out; goto out;
ret = ttm_bo_move_ttm(bo, intr, no_wait_gpu, new_reg); ret = ttm_bo_move_ttm(bo, &ctx, new_reg);
out: out:
ttm_bo_mem_put(bo, &tmp_reg); ttm_bo_mem_put(bo, &tmp_reg);
return ret; return ret;
...@@ -1255,7 +1255,7 @@ nouveau_bo_move_flips(struct ttm_buffer_object *bo, bool evict, bool intr, ...@@ -1255,7 +1255,7 @@ nouveau_bo_move_flips(struct ttm_buffer_object *bo, bool evict, bool intr,
if (ret) if (ret)
return ret; return ret;
ret = ttm_bo_move_ttm(bo, intr, no_wait_gpu, &tmp_reg); ret = ttm_bo_move_ttm(bo, &ctx, &tmp_reg);
if (ret) if (ret)
goto out; goto out;
...@@ -1380,8 +1380,7 @@ nouveau_bo_move(struct ttm_buffer_object *bo, bool evict, ...@@ -1380,8 +1380,7 @@ nouveau_bo_move(struct ttm_buffer_object *bo, bool evict,
/* Fallback to software copy. */ /* Fallback to software copy. */
ret = ttm_bo_wait(bo, ctx->interruptible, ctx->no_wait_gpu); ret = ttm_bo_wait(bo, ctx->interruptible, ctx->no_wait_gpu);
if (ret == 0) if (ret == 0)
ret = ttm_bo_move_memcpy(bo, ctx->interruptible, ret = ttm_bo_move_memcpy(bo, ctx, new_reg);
ctx->no_wait_gpu, new_reg);
out: out:
if (drm->client.device.info.family < NV_DEVICE_INFO_V0_TESLA) { if (drm->client.device.info.family < NV_DEVICE_INFO_V0_TESLA) {
......
...@@ -357,8 +357,7 @@ static int qxl_bo_move(struct ttm_buffer_object *bo, bool evict, ...@@ -357,8 +357,7 @@ static int qxl_bo_move(struct ttm_buffer_object *bo, bool evict,
qxl_move_null(bo, new_mem); qxl_move_null(bo, new_mem);
return 0; return 0;
} }
return ttm_bo_move_memcpy(bo, ctx->interruptible, ctx->no_wait_gpu, return ttm_bo_move_memcpy(bo, ctx, new_mem);
new_mem);
} }
static void qxl_bo_move_notify(struct ttm_buffer_object *bo, static void qxl_bo_move_notify(struct ttm_buffer_object *bo,
......
...@@ -347,7 +347,7 @@ static int radeon_move_vram_ram(struct ttm_buffer_object *bo, ...@@ -347,7 +347,7 @@ static int radeon_move_vram_ram(struct ttm_buffer_object *bo,
if (unlikely(r)) { if (unlikely(r)) {
goto out_cleanup; goto out_cleanup;
} }
r = ttm_bo_move_ttm(bo, interruptible, no_wait_gpu, new_mem); r = ttm_bo_move_ttm(bo, &ctx, new_mem);
out_cleanup: out_cleanup:
ttm_bo_mem_put(bo, &tmp_mem); ttm_bo_mem_put(bo, &tmp_mem);
return r; return r;
...@@ -380,7 +380,7 @@ static int radeon_move_ram_vram(struct ttm_buffer_object *bo, ...@@ -380,7 +380,7 @@ static int radeon_move_ram_vram(struct ttm_buffer_object *bo,
if (unlikely(r)) { if (unlikely(r)) {
return r; return r;
} }
r = ttm_bo_move_ttm(bo, interruptible, no_wait_gpu, &tmp_mem); r = ttm_bo_move_ttm(bo, &ctx, &tmp_mem);
if (unlikely(r)) { if (unlikely(r)) {
goto out_cleanup; goto out_cleanup;
} }
...@@ -445,8 +445,7 @@ static int radeon_bo_move(struct ttm_buffer_object *bo, bool evict, ...@@ -445,8 +445,7 @@ static int radeon_bo_move(struct ttm_buffer_object *bo, bool evict,
if (r) { if (r) {
memcpy: memcpy:
r = ttm_bo_move_memcpy(bo, ctx->interruptible, r = ttm_bo_move_memcpy(bo, ctx, new_mem);
ctx->no_wait_gpu, new_mem);
if (r) { if (r) {
return r; return r;
} }
......
...@@ -324,13 +324,11 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo, ...@@ -324,13 +324,11 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo,
if (!(old_man->flags & TTM_MEMTYPE_FLAG_FIXED) && if (!(old_man->flags & TTM_MEMTYPE_FLAG_FIXED) &&
!(new_man->flags & TTM_MEMTYPE_FLAG_FIXED)) !(new_man->flags & TTM_MEMTYPE_FLAG_FIXED))
ret = ttm_bo_move_ttm(bo, ctx->interruptible, ret = ttm_bo_move_ttm(bo, ctx, mem);
ctx->no_wait_gpu, mem);
else if (bdev->driver->move) else if (bdev->driver->move)
ret = bdev->driver->move(bo, evict, ctx, mem); ret = bdev->driver->move(bo, evict, ctx, mem);
else else
ret = ttm_bo_move_memcpy(bo, ctx->interruptible, ret = ttm_bo_move_memcpy(bo, ctx, mem);
ctx->no_wait_gpu, mem);
if (ret) { if (ret) {
if (bdev->driver->move_notify) { if (bdev->driver->move_notify) {
......
...@@ -45,7 +45,7 @@ void ttm_bo_free_old_node(struct ttm_buffer_object *bo) ...@@ -45,7 +45,7 @@ void ttm_bo_free_old_node(struct ttm_buffer_object *bo)
} }
int ttm_bo_move_ttm(struct ttm_buffer_object *bo, int ttm_bo_move_ttm(struct ttm_buffer_object *bo,
bool interruptible, bool no_wait_gpu, struct ttm_operation_ctx *ctx,
struct ttm_mem_reg *new_mem) struct ttm_mem_reg *new_mem)
{ {
struct ttm_tt *ttm = bo->ttm; struct ttm_tt *ttm = bo->ttm;
...@@ -53,7 +53,7 @@ int ttm_bo_move_ttm(struct ttm_buffer_object *bo, ...@@ -53,7 +53,7 @@ int ttm_bo_move_ttm(struct ttm_buffer_object *bo,
int ret; int ret;
if (old_mem->mem_type != TTM_PL_SYSTEM) { if (old_mem->mem_type != TTM_PL_SYSTEM) {
ret = ttm_bo_wait(bo, interruptible, no_wait_gpu); ret = ttm_bo_wait(bo, ctx->interruptible, ctx->no_wait_gpu);
if (unlikely(ret != 0)) { if (unlikely(ret != 0)) {
if (ret != -ERESTARTSYS) if (ret != -ERESTARTSYS)
...@@ -329,7 +329,7 @@ static int ttm_copy_ttm_io_page(struct ttm_tt *ttm, void *dst, ...@@ -329,7 +329,7 @@ static int ttm_copy_ttm_io_page(struct ttm_tt *ttm, void *dst,
} }
int ttm_bo_move_memcpy(struct ttm_buffer_object *bo, int ttm_bo_move_memcpy(struct ttm_buffer_object *bo,
bool interruptible, bool no_wait_gpu, struct ttm_operation_ctx *ctx,
struct ttm_mem_reg *new_mem) struct ttm_mem_reg *new_mem)
{ {
struct ttm_bo_device *bdev = bo->bdev; struct ttm_bo_device *bdev = bo->bdev;
...@@ -345,7 +345,7 @@ int ttm_bo_move_memcpy(struct ttm_buffer_object *bo, ...@@ -345,7 +345,7 @@ int ttm_bo_move_memcpy(struct ttm_buffer_object *bo,
unsigned long add = 0; unsigned long add = 0;
int dir; int dir;
ret = ttm_bo_wait(bo, interruptible, no_wait_gpu); ret = ttm_bo_wait(bo, ctx->interruptible, ctx->no_wait_gpu);
if (ret) if (ret)
return ret; return ret;
......
...@@ -976,7 +976,7 @@ void ttm_mem_io_free(struct ttm_bo_device *bdev, ...@@ -976,7 +976,7 @@ void ttm_mem_io_free(struct ttm_bo_device *bdev,
*/ */
int ttm_bo_move_ttm(struct ttm_buffer_object *bo, int ttm_bo_move_ttm(struct ttm_buffer_object *bo,
bool interruptible, bool no_wait_gpu, struct ttm_operation_ctx *ctx,
struct ttm_mem_reg *new_mem); struct ttm_mem_reg *new_mem);
/** /**
...@@ -998,7 +998,7 @@ int ttm_bo_move_ttm(struct ttm_buffer_object *bo, ...@@ -998,7 +998,7 @@ int ttm_bo_move_ttm(struct ttm_buffer_object *bo,
*/ */
int ttm_bo_move_memcpy(struct ttm_buffer_object *bo, int ttm_bo_move_memcpy(struct ttm_buffer_object *bo,
bool interruptible, bool no_wait_gpu, struct ttm_operation_ctx *ctx,
struct ttm_mem_reg *new_mem); struct ttm_mem_reg *new_mem);
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment