Commit 97a875cb authored by Maarten Lankhorst's avatar Maarten Lankhorst Committed by Dave Airlie

drm/ttm: remove no_wait_reserve, v3

All items on the lru list are always reservable, so this is a stupid
thing to keep. Not only that, it is used in a way which would
guarantee deadlocks if it were ever to be set to block on reserve.

This is a lot of churn, but mostly because of the removal of the
argument which can be nested arbitrarily deeply in many places.

No change of code in this patch except removal of the no_wait_reserve
argument, the previous patch removed the use of no_wait_reserve.

v2:
 - Warn if -EBUSY is returned on reservation, all objects on the list
   should be reservable. Adjusted patch slightly due to conflicts.
v3:
 - Focus on no_wait_reserve removal only.
Signed-off-by: default avatarMaarten Lankhorst <maarten.lankhorst@canonical.com>
Reviewed-by: default avatarThomas Hellstrom <thellstrom@vmware.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent e7ab2019
...@@ -186,11 +186,11 @@ static void ast_ttm_io_mem_free(struct ttm_bo_device *bdev, struct ttm_mem_reg * ...@@ -186,11 +186,11 @@ static void ast_ttm_io_mem_free(struct ttm_bo_device *bdev, struct ttm_mem_reg *
static int ast_bo_move(struct ttm_buffer_object *bo, static int ast_bo_move(struct ttm_buffer_object *bo,
bool evict, bool interruptible, bool evict, bool interruptible,
bool no_wait_reserve, bool no_wait_gpu, bool no_wait_gpu,
struct ttm_mem_reg *new_mem) struct ttm_mem_reg *new_mem)
{ {
int r; int r;
r = ttm_bo_move_memcpy(bo, evict, no_wait_reserve, no_wait_gpu, new_mem); r = ttm_bo_move_memcpy(bo, evict, no_wait_gpu, new_mem);
return r; return r;
} }
...@@ -383,7 +383,7 @@ int ast_bo_pin(struct ast_bo *bo, u32 pl_flag, u64 *gpu_addr) ...@@ -383,7 +383,7 @@ int ast_bo_pin(struct ast_bo *bo, u32 pl_flag, u64 *gpu_addr)
ast_ttm_placement(bo, pl_flag); ast_ttm_placement(bo, pl_flag);
for (i = 0; i < bo->placement.num_placement; i++) for (i = 0; i < bo->placement.num_placement; i++)
bo->placements[i] |= TTM_PL_FLAG_NO_EVICT; bo->placements[i] |= TTM_PL_FLAG_NO_EVICT;
ret = ttm_bo_validate(&bo->bo, &bo->placement, false, false, false); ret = ttm_bo_validate(&bo->bo, &bo->placement, false, false);
if (ret) if (ret)
return ret; return ret;
...@@ -406,7 +406,7 @@ int ast_bo_unpin(struct ast_bo *bo) ...@@ -406,7 +406,7 @@ int ast_bo_unpin(struct ast_bo *bo)
for (i = 0; i < bo->placement.num_placement ; i++) for (i = 0; i < bo->placement.num_placement ; i++)
bo->placements[i] &= ~TTM_PL_FLAG_NO_EVICT; bo->placements[i] &= ~TTM_PL_FLAG_NO_EVICT;
ret = ttm_bo_validate(&bo->bo, &bo->placement, false, false, false); ret = ttm_bo_validate(&bo->bo, &bo->placement, false, false);
if (ret) if (ret)
return ret; return ret;
...@@ -431,7 +431,7 @@ int ast_bo_push_sysram(struct ast_bo *bo) ...@@ -431,7 +431,7 @@ int ast_bo_push_sysram(struct ast_bo *bo)
for (i = 0; i < bo->placement.num_placement ; i++) for (i = 0; i < bo->placement.num_placement ; i++)
bo->placements[i] |= TTM_PL_FLAG_NO_EVICT; bo->placements[i] |= TTM_PL_FLAG_NO_EVICT;
ret = ttm_bo_validate(&bo->bo, &bo->placement, false, false, false); ret = ttm_bo_validate(&bo->bo, &bo->placement, false, false);
if (ret) { if (ret) {
DRM_ERROR("pushing to VRAM failed\n"); DRM_ERROR("pushing to VRAM failed\n");
return ret; return ret;
......
...@@ -186,11 +186,11 @@ static void cirrus_ttm_io_mem_free(struct ttm_bo_device *bdev, struct ttm_mem_re ...@@ -186,11 +186,11 @@ static void cirrus_ttm_io_mem_free(struct ttm_bo_device *bdev, struct ttm_mem_re
static int cirrus_bo_move(struct ttm_buffer_object *bo, static int cirrus_bo_move(struct ttm_buffer_object *bo,
bool evict, bool interruptible, bool evict, bool interruptible,
bool no_wait_reserve, bool no_wait_gpu, bool no_wait_gpu,
struct ttm_mem_reg *new_mem) struct ttm_mem_reg *new_mem)
{ {
int r; int r;
r = ttm_bo_move_memcpy(bo, evict, no_wait_reserve, no_wait_gpu, new_mem); r = ttm_bo_move_memcpy(bo, evict, no_wait_gpu, new_mem);
return r; return r;
} }
...@@ -388,7 +388,7 @@ int cirrus_bo_pin(struct cirrus_bo *bo, u32 pl_flag, u64 *gpu_addr) ...@@ -388,7 +388,7 @@ int cirrus_bo_pin(struct cirrus_bo *bo, u32 pl_flag, u64 *gpu_addr)
cirrus_ttm_placement(bo, pl_flag); cirrus_ttm_placement(bo, pl_flag);
for (i = 0; i < bo->placement.num_placement; i++) for (i = 0; i < bo->placement.num_placement; i++)
bo->placements[i] |= TTM_PL_FLAG_NO_EVICT; bo->placements[i] |= TTM_PL_FLAG_NO_EVICT;
ret = ttm_bo_validate(&bo->bo, &bo->placement, false, false, false); ret = ttm_bo_validate(&bo->bo, &bo->placement, false, false);
if (ret) if (ret)
return ret; return ret;
...@@ -411,7 +411,7 @@ int cirrus_bo_unpin(struct cirrus_bo *bo) ...@@ -411,7 +411,7 @@ int cirrus_bo_unpin(struct cirrus_bo *bo)
for (i = 0; i < bo->placement.num_placement ; i++) for (i = 0; i < bo->placement.num_placement ; i++)
bo->placements[i] &= ~TTM_PL_FLAG_NO_EVICT; bo->placements[i] &= ~TTM_PL_FLAG_NO_EVICT;
ret = ttm_bo_validate(&bo->bo, &bo->placement, false, false, false); ret = ttm_bo_validate(&bo->bo, &bo->placement, false, false);
if (ret) if (ret)
return ret; return ret;
...@@ -436,7 +436,7 @@ int cirrus_bo_push_sysram(struct cirrus_bo *bo) ...@@ -436,7 +436,7 @@ int cirrus_bo_push_sysram(struct cirrus_bo *bo)
for (i = 0; i < bo->placement.num_placement ; i++) for (i = 0; i < bo->placement.num_placement ; i++)
bo->placements[i] |= TTM_PL_FLAG_NO_EVICT; bo->placements[i] |= TTM_PL_FLAG_NO_EVICT;
ret = ttm_bo_validate(&bo->bo, &bo->placement, false, false, false); ret = ttm_bo_validate(&bo->bo, &bo->placement, false, false);
if (ret) { if (ret) {
DRM_ERROR("pushing to VRAM failed\n"); DRM_ERROR("pushing to VRAM failed\n");
return ret; return ret;
......
...@@ -186,11 +186,11 @@ static void mgag200_ttm_io_mem_free(struct ttm_bo_device *bdev, struct ttm_mem_r ...@@ -186,11 +186,11 @@ static void mgag200_ttm_io_mem_free(struct ttm_bo_device *bdev, struct ttm_mem_r
static int mgag200_bo_move(struct ttm_buffer_object *bo, static int mgag200_bo_move(struct ttm_buffer_object *bo,
bool evict, bool interruptible, bool evict, bool interruptible,
bool no_wait_reserve, bool no_wait_gpu, bool no_wait_gpu,
struct ttm_mem_reg *new_mem) struct ttm_mem_reg *new_mem)
{ {
int r; int r;
r = ttm_bo_move_memcpy(bo, evict, no_wait_reserve, no_wait_gpu, new_mem); r = ttm_bo_move_memcpy(bo, evict, no_wait_gpu, new_mem);
return r; return r;
} }
...@@ -382,7 +382,7 @@ int mgag200_bo_pin(struct mgag200_bo *bo, u32 pl_flag, u64 *gpu_addr) ...@@ -382,7 +382,7 @@ int mgag200_bo_pin(struct mgag200_bo *bo, u32 pl_flag, u64 *gpu_addr)
mgag200_ttm_placement(bo, pl_flag); mgag200_ttm_placement(bo, pl_flag);
for (i = 0; i < bo->placement.num_placement; i++) for (i = 0; i < bo->placement.num_placement; i++)
bo->placements[i] |= TTM_PL_FLAG_NO_EVICT; bo->placements[i] |= TTM_PL_FLAG_NO_EVICT;
ret = ttm_bo_validate(&bo->bo, &bo->placement, false, false, false); ret = ttm_bo_validate(&bo->bo, &bo->placement, false, false);
if (ret) if (ret)
return ret; return ret;
...@@ -405,7 +405,7 @@ int mgag200_bo_unpin(struct mgag200_bo *bo) ...@@ -405,7 +405,7 @@ int mgag200_bo_unpin(struct mgag200_bo *bo)
for (i = 0; i < bo->placement.num_placement ; i++) for (i = 0; i < bo->placement.num_placement ; i++)
bo->placements[i] &= ~TTM_PL_FLAG_NO_EVICT; bo->placements[i] &= ~TTM_PL_FLAG_NO_EVICT;
ret = ttm_bo_validate(&bo->bo, &bo->placement, false, false, false); ret = ttm_bo_validate(&bo->bo, &bo->placement, false, false);
if (ret) if (ret)
return ret; return ret;
...@@ -430,7 +430,7 @@ int mgag200_bo_push_sysram(struct mgag200_bo *bo) ...@@ -430,7 +430,7 @@ int mgag200_bo_push_sysram(struct mgag200_bo *bo)
for (i = 0; i < bo->placement.num_placement ; i++) for (i = 0; i < bo->placement.num_placement ; i++)
bo->placements[i] |= TTM_PL_FLAG_NO_EVICT; bo->placements[i] |= TTM_PL_FLAG_NO_EVICT;
ret = ttm_bo_validate(&bo->bo, &bo->placement, false, false, false); ret = ttm_bo_validate(&bo->bo, &bo->placement, false, false);
if (ret) { if (ret) {
DRM_ERROR("pushing to VRAM failed\n"); DRM_ERROR("pushing to VRAM failed\n");
return ret; return ret;
......
...@@ -315,7 +315,7 @@ nouveau_bo_pin(struct nouveau_bo *nvbo, uint32_t memtype) ...@@ -315,7 +315,7 @@ nouveau_bo_pin(struct nouveau_bo *nvbo, uint32_t memtype)
nouveau_bo_placement_set(nvbo, memtype, 0); nouveau_bo_placement_set(nvbo, memtype, 0);
ret = nouveau_bo_validate(nvbo, false, false, false); ret = nouveau_bo_validate(nvbo, false, false);
if (ret == 0) { if (ret == 0) {
switch (bo->mem.mem_type) { switch (bo->mem.mem_type) {
case TTM_PL_VRAM: case TTM_PL_VRAM:
...@@ -351,7 +351,7 @@ nouveau_bo_unpin(struct nouveau_bo *nvbo) ...@@ -351,7 +351,7 @@ nouveau_bo_unpin(struct nouveau_bo *nvbo)
nouveau_bo_placement_set(nvbo, bo->mem.placement, 0); nouveau_bo_placement_set(nvbo, bo->mem.placement, 0);
ret = nouveau_bo_validate(nvbo, false, false, false); ret = nouveau_bo_validate(nvbo, false, false);
if (ret == 0) { if (ret == 0) {
switch (bo->mem.mem_type) { switch (bo->mem.mem_type) {
case TTM_PL_VRAM: case TTM_PL_VRAM:
...@@ -392,12 +392,12 @@ nouveau_bo_unmap(struct nouveau_bo *nvbo) ...@@ -392,12 +392,12 @@ nouveau_bo_unmap(struct nouveau_bo *nvbo)
int int
nouveau_bo_validate(struct nouveau_bo *nvbo, bool interruptible, nouveau_bo_validate(struct nouveau_bo *nvbo, bool interruptible,
bool no_wait_reserve, bool no_wait_gpu) bool no_wait_gpu)
{ {
int ret; int ret;
ret = ttm_bo_validate(&nvbo->bo, &nvbo->placement, interruptible, ret = ttm_bo_validate(&nvbo->bo, &nvbo->placement,
no_wait_reserve, no_wait_gpu); interruptible, no_wait_gpu);
if (ret) if (ret)
return ret; return ret;
...@@ -556,8 +556,7 @@ nouveau_bo_evict_flags(struct ttm_buffer_object *bo, struct ttm_placement *pl) ...@@ -556,8 +556,7 @@ nouveau_bo_evict_flags(struct ttm_buffer_object *bo, struct ttm_placement *pl)
static int static int
nouveau_bo_move_accel_cleanup(struct nouveau_channel *chan, nouveau_bo_move_accel_cleanup(struct nouveau_channel *chan,
struct nouveau_bo *nvbo, bool evict, struct nouveau_bo *nvbo, bool evict,
bool no_wait_reserve, bool no_wait_gpu, bool no_wait_gpu, struct ttm_mem_reg *new_mem)
struct ttm_mem_reg *new_mem)
{ {
struct nouveau_fence *fence = NULL; struct nouveau_fence *fence = NULL;
int ret; int ret;
...@@ -567,7 +566,7 @@ nouveau_bo_move_accel_cleanup(struct nouveau_channel *chan, ...@@ -567,7 +566,7 @@ nouveau_bo_move_accel_cleanup(struct nouveau_channel *chan,
return ret; return ret;
ret = ttm_bo_move_accel_cleanup(&nvbo->bo, fence, evict, ret = ttm_bo_move_accel_cleanup(&nvbo->bo, fence, evict,
no_wait_reserve, no_wait_gpu, new_mem); no_wait_gpu, new_mem);
nouveau_fence_unref(&fence); nouveau_fence_unref(&fence);
return ret; return ret;
} }
...@@ -965,8 +964,7 @@ nouveau_vma_getmap(struct nouveau_channel *chan, struct nouveau_bo *nvbo, ...@@ -965,8 +964,7 @@ nouveau_vma_getmap(struct nouveau_channel *chan, struct nouveau_bo *nvbo,
static int static int
nouveau_bo_move_m2mf(struct ttm_buffer_object *bo, int evict, bool intr, nouveau_bo_move_m2mf(struct ttm_buffer_object *bo, int evict, bool intr,
bool no_wait_reserve, bool no_wait_gpu, bool no_wait_gpu, struct ttm_mem_reg *new_mem)
struct ttm_mem_reg *new_mem)
{ {
struct nouveau_drm *drm = nouveau_bdev(bo->bdev); struct nouveau_drm *drm = nouveau_bdev(bo->bdev);
struct nouveau_channel *chan = chan = drm->channel; struct nouveau_channel *chan = chan = drm->channel;
...@@ -995,7 +993,6 @@ nouveau_bo_move_m2mf(struct ttm_buffer_object *bo, int evict, bool intr, ...@@ -995,7 +993,6 @@ nouveau_bo_move_m2mf(struct ttm_buffer_object *bo, int evict, bool intr,
ret = drm->ttm.move(chan, bo, &bo->mem, new_mem); ret = drm->ttm.move(chan, bo, &bo->mem, new_mem);
if (ret == 0) { if (ret == 0) {
ret = nouveau_bo_move_accel_cleanup(chan, nvbo, evict, ret = nouveau_bo_move_accel_cleanup(chan, nvbo, evict,
no_wait_reserve,
no_wait_gpu, new_mem); no_wait_gpu, new_mem);
} }
...@@ -1064,8 +1061,7 @@ nouveau_bo_move_init(struct nouveau_drm *drm) ...@@ -1064,8 +1061,7 @@ nouveau_bo_move_init(struct nouveau_drm *drm)
static int static int
nouveau_bo_move_flipd(struct ttm_buffer_object *bo, bool evict, bool intr, nouveau_bo_move_flipd(struct ttm_buffer_object *bo, bool evict, bool intr,
bool no_wait_reserve, bool no_wait_gpu, bool no_wait_gpu, struct ttm_mem_reg *new_mem)
struct ttm_mem_reg *new_mem)
{ {
u32 placement_memtype = TTM_PL_FLAG_TT | TTM_PL_MASK_CACHING; u32 placement_memtype = TTM_PL_FLAG_TT | TTM_PL_MASK_CACHING;
struct ttm_placement placement; struct ttm_placement placement;
...@@ -1078,7 +1074,7 @@ nouveau_bo_move_flipd(struct ttm_buffer_object *bo, bool evict, bool intr, ...@@ -1078,7 +1074,7 @@ nouveau_bo_move_flipd(struct ttm_buffer_object *bo, bool evict, bool intr,
tmp_mem = *new_mem; tmp_mem = *new_mem;
tmp_mem.mm_node = NULL; tmp_mem.mm_node = NULL;
ret = ttm_bo_mem_space(bo, &placement, &tmp_mem, intr, no_wait_reserve, no_wait_gpu); ret = ttm_bo_mem_space(bo, &placement, &tmp_mem, intr, no_wait_gpu);
if (ret) if (ret)
return ret; return ret;
...@@ -1086,11 +1082,11 @@ nouveau_bo_move_flipd(struct ttm_buffer_object *bo, bool evict, bool intr, ...@@ -1086,11 +1082,11 @@ nouveau_bo_move_flipd(struct ttm_buffer_object *bo, bool evict, bool intr,
if (ret) if (ret)
goto out; goto out;
ret = nouveau_bo_move_m2mf(bo, true, intr, no_wait_reserve, no_wait_gpu, &tmp_mem); ret = nouveau_bo_move_m2mf(bo, true, intr, no_wait_gpu, &tmp_mem);
if (ret) if (ret)
goto out; goto out;
ret = ttm_bo_move_ttm(bo, true, no_wait_reserve, no_wait_gpu, new_mem); ret = ttm_bo_move_ttm(bo, true, no_wait_gpu, new_mem);
out: out:
ttm_bo_mem_put(bo, &tmp_mem); ttm_bo_mem_put(bo, &tmp_mem);
return ret; return ret;
...@@ -1098,8 +1094,7 @@ nouveau_bo_move_flipd(struct ttm_buffer_object *bo, bool evict, bool intr, ...@@ -1098,8 +1094,7 @@ nouveau_bo_move_flipd(struct ttm_buffer_object *bo, bool evict, bool intr,
static int static int
nouveau_bo_move_flips(struct ttm_buffer_object *bo, bool evict, bool intr, nouveau_bo_move_flips(struct ttm_buffer_object *bo, bool evict, bool intr,
bool no_wait_reserve, bool no_wait_gpu, bool no_wait_gpu, struct ttm_mem_reg *new_mem)
struct ttm_mem_reg *new_mem)
{ {
u32 placement_memtype = TTM_PL_FLAG_TT | TTM_PL_MASK_CACHING; u32 placement_memtype = TTM_PL_FLAG_TT | TTM_PL_MASK_CACHING;
struct ttm_placement placement; struct ttm_placement placement;
...@@ -1112,15 +1107,15 @@ nouveau_bo_move_flips(struct ttm_buffer_object *bo, bool evict, bool intr, ...@@ -1112,15 +1107,15 @@ nouveau_bo_move_flips(struct ttm_buffer_object *bo, bool evict, bool intr,
tmp_mem = *new_mem; tmp_mem = *new_mem;
tmp_mem.mm_node = NULL; tmp_mem.mm_node = NULL;
ret = ttm_bo_mem_space(bo, &placement, &tmp_mem, intr, no_wait_reserve, no_wait_gpu); ret = ttm_bo_mem_space(bo, &placement, &tmp_mem, intr, no_wait_gpu);
if (ret) if (ret)
return ret; return ret;
ret = ttm_bo_move_ttm(bo, true, no_wait_reserve, no_wait_gpu, &tmp_mem); ret = ttm_bo_move_ttm(bo, true, no_wait_gpu, &tmp_mem);
if (ret) if (ret)
goto out; goto out;
ret = nouveau_bo_move_m2mf(bo, true, intr, no_wait_reserve, no_wait_gpu, new_mem); ret = nouveau_bo_move_m2mf(bo, true, intr, no_wait_gpu, new_mem);
if (ret) if (ret)
goto out; goto out;
...@@ -1195,8 +1190,7 @@ nouveau_bo_vm_cleanup(struct ttm_buffer_object *bo, ...@@ -1195,8 +1190,7 @@ nouveau_bo_vm_cleanup(struct ttm_buffer_object *bo,
static int static int
nouveau_bo_move(struct ttm_buffer_object *bo, bool evict, bool intr, nouveau_bo_move(struct ttm_buffer_object *bo, bool evict, bool intr,
bool no_wait_reserve, bool no_wait_gpu, bool no_wait_gpu, struct ttm_mem_reg *new_mem)
struct ttm_mem_reg *new_mem)
{ {
struct nouveau_drm *drm = nouveau_bdev(bo->bdev); struct nouveau_drm *drm = nouveau_bdev(bo->bdev);
struct nouveau_bo *nvbo = nouveau_bo(bo); struct nouveau_bo *nvbo = nouveau_bo(bo);
...@@ -1220,23 +1214,26 @@ nouveau_bo_move(struct ttm_buffer_object *bo, bool evict, bool intr, ...@@ -1220,23 +1214,26 @@ nouveau_bo_move(struct ttm_buffer_object *bo, bool evict, bool intr,
/* CPU copy if we have no accelerated method available */ /* CPU copy if we have no accelerated method available */
if (!drm->ttm.move) { if (!drm->ttm.move) {
ret = ttm_bo_move_memcpy(bo, evict, no_wait_reserve, no_wait_gpu, new_mem); ret = ttm_bo_move_memcpy(bo, evict, no_wait_gpu, new_mem);
goto out; goto out;
} }
/* Hardware assisted copy. */ /* Hardware assisted copy. */
if (new_mem->mem_type == TTM_PL_SYSTEM) if (new_mem->mem_type == TTM_PL_SYSTEM)
ret = nouveau_bo_move_flipd(bo, evict, intr, no_wait_reserve, no_wait_gpu, new_mem); ret = nouveau_bo_move_flipd(bo, evict, intr,
no_wait_gpu, new_mem);
else if (old_mem->mem_type == TTM_PL_SYSTEM) else if (old_mem->mem_type == TTM_PL_SYSTEM)
ret = nouveau_bo_move_flips(bo, evict, intr, no_wait_reserve, no_wait_gpu, new_mem); ret = nouveau_bo_move_flips(bo, evict, intr,
no_wait_gpu, new_mem);
else else
ret = nouveau_bo_move_m2mf(bo, evict, intr, no_wait_reserve, no_wait_gpu, new_mem); ret = nouveau_bo_move_m2mf(bo, evict, intr,
no_wait_gpu, new_mem);
if (!ret) if (!ret)
goto out; goto out;
/* Fallback to software copy. */ /* Fallback to software copy. */
ret = ttm_bo_move_memcpy(bo, evict, no_wait_reserve, no_wait_gpu, new_mem); ret = ttm_bo_move_memcpy(bo, evict, no_wait_gpu, new_mem);
out: out:
if (nv_device(drm->device)->card_type < NV_50) { if (nv_device(drm->device)->card_type < NV_50) {
...@@ -1343,7 +1340,7 @@ nouveau_ttm_fault_reserve_notify(struct ttm_buffer_object *bo) ...@@ -1343,7 +1340,7 @@ nouveau_ttm_fault_reserve_notify(struct ttm_buffer_object *bo)
nvbo->placement.fpfn = 0; nvbo->placement.fpfn = 0;
nvbo->placement.lpfn = mappable; nvbo->placement.lpfn = mappable;
nouveau_bo_placement_set(nvbo, TTM_PL_FLAG_VRAM, 0); nouveau_bo_placement_set(nvbo, TTM_PL_FLAG_VRAM, 0);
return nouveau_bo_validate(nvbo, false, true, false); return nouveau_bo_validate(nvbo, false, false);
} }
static int static int
......
...@@ -76,7 +76,7 @@ u32 nouveau_bo_rd32(struct nouveau_bo *, unsigned index); ...@@ -76,7 +76,7 @@ u32 nouveau_bo_rd32(struct nouveau_bo *, unsigned index);
void nouveau_bo_wr32(struct nouveau_bo *, unsigned index, u32 val); void nouveau_bo_wr32(struct nouveau_bo *, unsigned index, u32 val);
void nouveau_bo_fence(struct nouveau_bo *, struct nouveau_fence *); void nouveau_bo_fence(struct nouveau_bo *, struct nouveau_fence *);
int nouveau_bo_validate(struct nouveau_bo *, bool interruptible, int nouveau_bo_validate(struct nouveau_bo *, bool interruptible,
bool no_wait_reserve, bool no_wait_gpu); bool no_wait_gpu);
struct nouveau_vma * struct nouveau_vma *
nouveau_bo_vma_find(struct nouveau_bo *, struct nouveau_vm *); nouveau_bo_vma_find(struct nouveau_bo *, struct nouveau_vm *);
......
...@@ -433,7 +433,7 @@ validate_list(struct nouveau_channel *chan, struct list_head *list, ...@@ -433,7 +433,7 @@ validate_list(struct nouveau_channel *chan, struct list_head *list,
return ret; return ret;
} }
ret = nouveau_bo_validate(nvbo, true, false, false); ret = nouveau_bo_validate(nvbo, true, false);
if (unlikely(ret)) { if (unlikely(ret)) {
if (ret != -ERESTARTSYS) if (ret != -ERESTARTSYS)
NV_ERROR(drm, "fail ttm_validate\n"); NV_ERROR(drm, "fail ttm_validate\n");
......
...@@ -250,7 +250,7 @@ int radeon_bo_pin_restricted(struct radeon_bo *bo, u32 domain, u64 max_offset, ...@@ -250,7 +250,7 @@ int radeon_bo_pin_restricted(struct radeon_bo *bo, u32 domain, u64 max_offset,
} }
for (i = 0; i < bo->placement.num_placement; i++) for (i = 0; i < bo->placement.num_placement; i++)
bo->placements[i] |= TTM_PL_FLAG_NO_EVICT; bo->placements[i] |= TTM_PL_FLAG_NO_EVICT;
r = ttm_bo_validate(&bo->tbo, &bo->placement, false, false, false); r = ttm_bo_validate(&bo->tbo, &bo->placement, false, false);
if (likely(r == 0)) { if (likely(r == 0)) {
bo->pin_count = 1; bo->pin_count = 1;
if (gpu_addr != NULL) if (gpu_addr != NULL)
...@@ -279,7 +279,7 @@ int radeon_bo_unpin(struct radeon_bo *bo) ...@@ -279,7 +279,7 @@ int radeon_bo_unpin(struct radeon_bo *bo)
return 0; return 0;
for (i = 0; i < bo->placement.num_placement; i++) for (i = 0; i < bo->placement.num_placement; i++)
bo->placements[i] &= ~TTM_PL_FLAG_NO_EVICT; bo->placements[i] &= ~TTM_PL_FLAG_NO_EVICT;
r = ttm_bo_validate(&bo->tbo, &bo->placement, false, false, false); r = ttm_bo_validate(&bo->tbo, &bo->placement, false, false);
if (unlikely(r != 0)) if (unlikely(r != 0))
dev_err(bo->rdev->dev, "%p validate failed for unpin\n", bo); dev_err(bo->rdev->dev, "%p validate failed for unpin\n", bo);
return r; return r;
...@@ -365,7 +365,7 @@ int radeon_bo_list_validate(struct list_head *head) ...@@ -365,7 +365,7 @@ int radeon_bo_list_validate(struct list_head *head)
retry: retry:
radeon_ttm_placement_from_domain(bo, domain); radeon_ttm_placement_from_domain(bo, domain);
r = ttm_bo_validate(&bo->tbo, &bo->placement, r = ttm_bo_validate(&bo->tbo, &bo->placement,
true, false, false); true, false);
if (unlikely(r)) { if (unlikely(r)) {
if (r != -ERESTARTSYS && domain == RADEON_GEM_DOMAIN_VRAM) { if (r != -ERESTARTSYS && domain == RADEON_GEM_DOMAIN_VRAM) {
domain |= RADEON_GEM_DOMAIN_GTT; domain |= RADEON_GEM_DOMAIN_GTT;
...@@ -585,7 +585,7 @@ int radeon_bo_fault_reserve_notify(struct ttm_buffer_object *bo) ...@@ -585,7 +585,7 @@ int radeon_bo_fault_reserve_notify(struct ttm_buffer_object *bo)
/* hurrah the memory is not visible ! */ /* hurrah the memory is not visible ! */
radeon_ttm_placement_from_domain(rbo, RADEON_GEM_DOMAIN_VRAM); radeon_ttm_placement_from_domain(rbo, RADEON_GEM_DOMAIN_VRAM);
rbo->placement.lpfn = rdev->mc.visible_vram_size >> PAGE_SHIFT; rbo->placement.lpfn = rdev->mc.visible_vram_size >> PAGE_SHIFT;
r = ttm_bo_validate(bo, &rbo->placement, false, true, false); r = ttm_bo_validate(bo, &rbo->placement, false, false);
if (unlikely(r != 0)) if (unlikely(r != 0))
return r; return r;
offset = bo->mem.start << PAGE_SHIFT; offset = bo->mem.start << PAGE_SHIFT;
......
...@@ -216,7 +216,7 @@ static void radeon_move_null(struct ttm_buffer_object *bo, ...@@ -216,7 +216,7 @@ static void radeon_move_null(struct ttm_buffer_object *bo,
} }
static int radeon_move_blit(struct ttm_buffer_object *bo, static int radeon_move_blit(struct ttm_buffer_object *bo,
bool evict, int no_wait_reserve, bool no_wait_gpu, bool evict, bool no_wait_gpu,
struct ttm_mem_reg *new_mem, struct ttm_mem_reg *new_mem,
struct ttm_mem_reg *old_mem) struct ttm_mem_reg *old_mem)
{ {
...@@ -266,14 +266,14 @@ static int radeon_move_blit(struct ttm_buffer_object *bo, ...@@ -266,14 +266,14 @@ static int radeon_move_blit(struct ttm_buffer_object *bo,
&fence); &fence);
/* FIXME: handle copy error */ /* FIXME: handle copy error */
r = ttm_bo_move_accel_cleanup(bo, (void *)fence, r = ttm_bo_move_accel_cleanup(bo, (void *)fence,
evict, no_wait_reserve, no_wait_gpu, new_mem); evict, no_wait_gpu, new_mem);
radeon_fence_unref(&fence); radeon_fence_unref(&fence);
return r; return r;
} }
static int radeon_move_vram_ram(struct ttm_buffer_object *bo, static int radeon_move_vram_ram(struct ttm_buffer_object *bo,
bool evict, bool interruptible, bool evict, bool interruptible,
bool no_wait_reserve, bool no_wait_gpu, bool no_wait_gpu,
struct ttm_mem_reg *new_mem) struct ttm_mem_reg *new_mem)
{ {
struct radeon_device *rdev; struct radeon_device *rdev;
...@@ -294,7 +294,7 @@ static int radeon_move_vram_ram(struct ttm_buffer_object *bo, ...@@ -294,7 +294,7 @@ static int radeon_move_vram_ram(struct ttm_buffer_object *bo,
placement.busy_placement = &placements; placement.busy_placement = &placements;
placements = TTM_PL_MASK_CACHING | TTM_PL_FLAG_TT; placements = TTM_PL_MASK_CACHING | TTM_PL_FLAG_TT;
r = ttm_bo_mem_space(bo, &placement, &tmp_mem, r = ttm_bo_mem_space(bo, &placement, &tmp_mem,
interruptible, no_wait_reserve, no_wait_gpu); interruptible, no_wait_gpu);
if (unlikely(r)) { if (unlikely(r)) {
return r; return r;
} }
...@@ -308,11 +308,11 @@ static int radeon_move_vram_ram(struct ttm_buffer_object *bo, ...@@ -308,11 +308,11 @@ static int radeon_move_vram_ram(struct ttm_buffer_object *bo,
if (unlikely(r)) { if (unlikely(r)) {
goto out_cleanup; goto out_cleanup;
} }
r = radeon_move_blit(bo, true, no_wait_reserve, no_wait_gpu, &tmp_mem, old_mem); r = radeon_move_blit(bo, true, no_wait_gpu, &tmp_mem, old_mem);
if (unlikely(r)) { if (unlikely(r)) {
goto out_cleanup; goto out_cleanup;
} }
r = ttm_bo_move_ttm(bo, true, no_wait_reserve, no_wait_gpu, new_mem); r = ttm_bo_move_ttm(bo, true, no_wait_gpu, new_mem);
out_cleanup: out_cleanup:
ttm_bo_mem_put(bo, &tmp_mem); ttm_bo_mem_put(bo, &tmp_mem);
return r; return r;
...@@ -320,7 +320,7 @@ static int radeon_move_vram_ram(struct ttm_buffer_object *bo, ...@@ -320,7 +320,7 @@ static int radeon_move_vram_ram(struct ttm_buffer_object *bo,
static int radeon_move_ram_vram(struct ttm_buffer_object *bo, static int radeon_move_ram_vram(struct ttm_buffer_object *bo,
bool evict, bool interruptible, bool evict, bool interruptible,
bool no_wait_reserve, bool no_wait_gpu, bool no_wait_gpu,
struct ttm_mem_reg *new_mem) struct ttm_mem_reg *new_mem)
{ {
struct radeon_device *rdev; struct radeon_device *rdev;
...@@ -340,15 +340,16 @@ static int radeon_move_ram_vram(struct ttm_buffer_object *bo, ...@@ -340,15 +340,16 @@ static int radeon_move_ram_vram(struct ttm_buffer_object *bo,
placement.num_busy_placement = 1; placement.num_busy_placement = 1;
placement.busy_placement = &placements; placement.busy_placement = &placements;
placements = TTM_PL_MASK_CACHING | TTM_PL_FLAG_TT; placements = TTM_PL_MASK_CACHING | TTM_PL_FLAG_TT;
r = ttm_bo_mem_space(bo, &placement, &tmp_mem, interruptible, no_wait_reserve, no_wait_gpu); r = ttm_bo_mem_space(bo, &placement, &tmp_mem,
interruptible, no_wait_gpu);
if (unlikely(r)) { if (unlikely(r)) {
return r; return r;
} }
r = ttm_bo_move_ttm(bo, true, no_wait_reserve, no_wait_gpu, &tmp_mem); r = ttm_bo_move_ttm(bo, true, no_wait_gpu, &tmp_mem);
if (unlikely(r)) { if (unlikely(r)) {
goto out_cleanup; goto out_cleanup;
} }
r = radeon_move_blit(bo, true, no_wait_reserve, no_wait_gpu, new_mem, old_mem); r = radeon_move_blit(bo, true, no_wait_gpu, new_mem, old_mem);
if (unlikely(r)) { if (unlikely(r)) {
goto out_cleanup; goto out_cleanup;
} }
...@@ -359,7 +360,7 @@ static int radeon_move_ram_vram(struct ttm_buffer_object *bo, ...@@ -359,7 +360,7 @@ static int radeon_move_ram_vram(struct ttm_buffer_object *bo,
static int radeon_bo_move(struct ttm_buffer_object *bo, static int radeon_bo_move(struct ttm_buffer_object *bo,
bool evict, bool interruptible, bool evict, bool interruptible,
bool no_wait_reserve, bool no_wait_gpu, bool no_wait_gpu,
struct ttm_mem_reg *new_mem) struct ttm_mem_reg *new_mem)
{ {
struct radeon_device *rdev; struct radeon_device *rdev;
...@@ -388,18 +389,18 @@ static int radeon_bo_move(struct ttm_buffer_object *bo, ...@@ -388,18 +389,18 @@ static int radeon_bo_move(struct ttm_buffer_object *bo,
if (old_mem->mem_type == TTM_PL_VRAM && if (old_mem->mem_type == TTM_PL_VRAM &&
new_mem->mem_type == TTM_PL_SYSTEM) { new_mem->mem_type == TTM_PL_SYSTEM) {
r = radeon_move_vram_ram(bo, evict, interruptible, r = radeon_move_vram_ram(bo, evict, interruptible,
no_wait_reserve, no_wait_gpu, new_mem); no_wait_gpu, new_mem);
} else if (old_mem->mem_type == TTM_PL_SYSTEM && } else if (old_mem->mem_type == TTM_PL_SYSTEM &&
new_mem->mem_type == TTM_PL_VRAM) { new_mem->mem_type == TTM_PL_VRAM) {
r = radeon_move_ram_vram(bo, evict, interruptible, r = radeon_move_ram_vram(bo, evict, interruptible,
no_wait_reserve, no_wait_gpu, new_mem); no_wait_gpu, new_mem);
} else { } else {
r = radeon_move_blit(bo, evict, no_wait_reserve, no_wait_gpu, new_mem, old_mem); r = radeon_move_blit(bo, evict, no_wait_gpu, new_mem, old_mem);
} }
if (r) { if (r) {
memcpy: memcpy:
r = ttm_bo_move_memcpy(bo, evict, no_wait_reserve, no_wait_gpu, new_mem); r = ttm_bo_move_memcpy(bo, evict, no_wait_gpu, new_mem);
} }
return r; return r;
} }
......
...@@ -366,7 +366,7 @@ static int ttm_bo_add_ttm(struct ttm_buffer_object *bo, bool zero_alloc) ...@@ -366,7 +366,7 @@ static int ttm_bo_add_ttm(struct ttm_buffer_object *bo, bool zero_alloc)
static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo, static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo,
struct ttm_mem_reg *mem, struct ttm_mem_reg *mem,
bool evict, bool interruptible, bool evict, bool interruptible,
bool no_wait_reserve, bool no_wait_gpu) bool no_wait_gpu)
{ {
struct ttm_bo_device *bdev = bo->bdev; struct ttm_bo_device *bdev = bo->bdev;
bool old_is_pci = ttm_mem_reg_is_pci(bdev, &bo->mem); bool old_is_pci = ttm_mem_reg_is_pci(bdev, &bo->mem);
...@@ -420,12 +420,12 @@ static int ttm_bo_handle_move_mem(struct ttm_buffer_object *bo, ...@@ -420,12 +420,12 @@ 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, evict, no_wait_reserve, no_wait_gpu, mem); ret = ttm_bo_move_ttm(bo, evict, no_wait_gpu, mem);
else if (bdev->driver->move) else if (bdev->driver->move)
ret = bdev->driver->move(bo, evict, interruptible, ret = bdev->driver->move(bo, evict, interruptible,
no_wait_reserve, no_wait_gpu, mem); no_wait_gpu, mem);
else else
ret = ttm_bo_move_memcpy(bo, evict, no_wait_reserve, no_wait_gpu, mem); ret = ttm_bo_move_memcpy(bo, evict, no_wait_gpu, mem);
if (ret) { if (ret) {
if (bdev->driver->move_notify) { if (bdev->driver->move_notify) {
...@@ -749,7 +749,7 @@ void ttm_bo_unlock_delayed_workqueue(struct ttm_bo_device *bdev, int resched) ...@@ -749,7 +749,7 @@ void ttm_bo_unlock_delayed_workqueue(struct ttm_bo_device *bdev, int resched)
EXPORT_SYMBOL(ttm_bo_unlock_delayed_workqueue); EXPORT_SYMBOL(ttm_bo_unlock_delayed_workqueue);
static int ttm_bo_evict(struct ttm_buffer_object *bo, bool interruptible, static int ttm_bo_evict(struct ttm_buffer_object *bo, bool interruptible,
bool no_wait_reserve, bool no_wait_gpu) bool no_wait_gpu)
{ {
struct ttm_bo_device *bdev = bo->bdev; struct ttm_bo_device *bdev = bo->bdev;
struct ttm_mem_reg evict_mem; struct ttm_mem_reg evict_mem;
...@@ -780,7 +780,7 @@ static int ttm_bo_evict(struct ttm_buffer_object *bo, bool interruptible, ...@@ -780,7 +780,7 @@ static int ttm_bo_evict(struct ttm_buffer_object *bo, bool interruptible,
placement.num_busy_placement = 0; placement.num_busy_placement = 0;
bdev->driver->evict_flags(bo, &placement); bdev->driver->evict_flags(bo, &placement);
ret = ttm_bo_mem_space(bo, &placement, &evict_mem, interruptible, ret = ttm_bo_mem_space(bo, &placement, &evict_mem, interruptible,
no_wait_reserve, no_wait_gpu); no_wait_gpu);
if (ret) { if (ret) {
if (ret != -ERESTARTSYS) { if (ret != -ERESTARTSYS) {
pr_err("Failed to find memory space for buffer 0x%p eviction\n", pr_err("Failed to find memory space for buffer 0x%p eviction\n",
...@@ -791,7 +791,7 @@ static int ttm_bo_evict(struct ttm_buffer_object *bo, bool interruptible, ...@@ -791,7 +791,7 @@ static int ttm_bo_evict(struct ttm_buffer_object *bo, bool interruptible,
} }
ret = ttm_bo_handle_move_mem(bo, &evict_mem, true, interruptible, ret = ttm_bo_handle_move_mem(bo, &evict_mem, true, interruptible,
no_wait_reserve, no_wait_gpu); no_wait_gpu);
if (ret) { if (ret) {
if (ret != -ERESTARTSYS) if (ret != -ERESTARTSYS)
pr_err("Buffer eviction failed\n"); pr_err("Buffer eviction failed\n");
...@@ -805,7 +805,7 @@ static int ttm_bo_evict(struct ttm_buffer_object *bo, bool interruptible, ...@@ -805,7 +805,7 @@ static int ttm_bo_evict(struct ttm_buffer_object *bo, bool interruptible,
static int ttm_mem_evict_first(struct ttm_bo_device *bdev, static int ttm_mem_evict_first(struct ttm_bo_device *bdev,
uint32_t mem_type, uint32_t mem_type,
bool interruptible, bool no_wait_reserve, bool interruptible,
bool no_wait_gpu) bool no_wait_gpu)
{ {
struct ttm_bo_global *glob = bdev->glob; struct ttm_bo_global *glob = bdev->glob;
...@@ -841,7 +841,7 @@ static int ttm_mem_evict_first(struct ttm_bo_device *bdev, ...@@ -841,7 +841,7 @@ static int ttm_mem_evict_first(struct ttm_bo_device *bdev,
ttm_bo_list_ref_sub(bo, put_count, true); ttm_bo_list_ref_sub(bo, put_count, true);
ret = ttm_bo_evict(bo, interruptible, no_wait_reserve, no_wait_gpu); ret = ttm_bo_evict(bo, interruptible, no_wait_gpu);
ttm_bo_unreserve(bo); ttm_bo_unreserve(bo);
kref_put(&bo->list_kref, ttm_bo_release_list); kref_put(&bo->list_kref, ttm_bo_release_list);
...@@ -866,7 +866,6 @@ static int ttm_bo_mem_force_space(struct ttm_buffer_object *bo, ...@@ -866,7 +866,6 @@ static int ttm_bo_mem_force_space(struct ttm_buffer_object *bo,
struct ttm_placement *placement, struct ttm_placement *placement,
struct ttm_mem_reg *mem, struct ttm_mem_reg *mem,
bool interruptible, bool interruptible,
bool no_wait_reserve,
bool no_wait_gpu) bool no_wait_gpu)
{ {
struct ttm_bo_device *bdev = bo->bdev; struct ttm_bo_device *bdev = bo->bdev;
...@@ -879,8 +878,8 @@ static int ttm_bo_mem_force_space(struct ttm_buffer_object *bo, ...@@ -879,8 +878,8 @@ static int ttm_bo_mem_force_space(struct ttm_buffer_object *bo,
return ret; return ret;
if (mem->mm_node) if (mem->mm_node)
break; break;
ret = ttm_mem_evict_first(bdev, mem_type, interruptible, ret = ttm_mem_evict_first(bdev, mem_type,
no_wait_reserve, no_wait_gpu); interruptible, no_wait_gpu);
if (unlikely(ret != 0)) if (unlikely(ret != 0))
return ret; return ret;
} while (1); } while (1);
...@@ -945,7 +944,7 @@ static bool ttm_bo_mt_compatible(struct ttm_mem_type_manager *man, ...@@ -945,7 +944,7 @@ static bool ttm_bo_mt_compatible(struct ttm_mem_type_manager *man,
int ttm_bo_mem_space(struct ttm_buffer_object *bo, int ttm_bo_mem_space(struct ttm_buffer_object *bo,
struct ttm_placement *placement, struct ttm_placement *placement,
struct ttm_mem_reg *mem, struct ttm_mem_reg *mem,
bool interruptible, bool no_wait_reserve, bool interruptible,
bool no_wait_gpu) bool no_wait_gpu)
{ {
struct ttm_bo_device *bdev = bo->bdev; struct ttm_bo_device *bdev = bo->bdev;
...@@ -1036,7 +1035,7 @@ int ttm_bo_mem_space(struct ttm_buffer_object *bo, ...@@ -1036,7 +1035,7 @@ int ttm_bo_mem_space(struct ttm_buffer_object *bo,
} }
ret = ttm_bo_mem_force_space(bo, mem_type, placement, mem, ret = ttm_bo_mem_force_space(bo, mem_type, placement, mem,
interruptible, no_wait_reserve, no_wait_gpu); interruptible, no_wait_gpu);
if (ret == 0 && mem->mm_node) { if (ret == 0 && mem->mm_node) {
mem->placement = cur_flags; mem->placement = cur_flags;
return 0; return 0;
...@@ -1051,7 +1050,7 @@ EXPORT_SYMBOL(ttm_bo_mem_space); ...@@ -1051,7 +1050,7 @@ EXPORT_SYMBOL(ttm_bo_mem_space);
int ttm_bo_move_buffer(struct ttm_buffer_object *bo, int ttm_bo_move_buffer(struct ttm_buffer_object *bo,
struct ttm_placement *placement, struct ttm_placement *placement,
bool interruptible, bool no_wait_reserve, bool interruptible,
bool no_wait_gpu) bool no_wait_gpu)
{ {
int ret = 0; int ret = 0;
...@@ -1078,10 +1077,12 @@ int ttm_bo_move_buffer(struct ttm_buffer_object *bo, ...@@ -1078,10 +1077,12 @@ int ttm_bo_move_buffer(struct ttm_buffer_object *bo,
/* /*
* Determine where to move the buffer. * Determine where to move the buffer.
*/ */
ret = ttm_bo_mem_space(bo, placement, &mem, interruptible, no_wait_reserve, no_wait_gpu); ret = ttm_bo_mem_space(bo, placement, &mem,
interruptible, no_wait_gpu);
if (ret) if (ret)
goto out_unlock; goto out_unlock;
ret = ttm_bo_handle_move_mem(bo, &mem, false, interruptible, no_wait_reserve, no_wait_gpu); ret = ttm_bo_handle_move_mem(bo, &mem, false,
interruptible, no_wait_gpu);
out_unlock: out_unlock:
if (ret && mem.mm_node) if (ret && mem.mm_node)
ttm_bo_mem_put(bo, &mem); ttm_bo_mem_put(bo, &mem);
...@@ -1110,7 +1111,7 @@ static int ttm_bo_mem_compat(struct ttm_placement *placement, ...@@ -1110,7 +1111,7 @@ static int ttm_bo_mem_compat(struct ttm_placement *placement,
int ttm_bo_validate(struct ttm_buffer_object *bo, int ttm_bo_validate(struct ttm_buffer_object *bo,
struct ttm_placement *placement, struct ttm_placement *placement,
bool interruptible, bool no_wait_reserve, bool interruptible,
bool no_wait_gpu) bool no_wait_gpu)
{ {
int ret; int ret;
...@@ -1126,7 +1127,8 @@ int ttm_bo_validate(struct ttm_buffer_object *bo, ...@@ -1126,7 +1127,8 @@ int ttm_bo_validate(struct ttm_buffer_object *bo,
*/ */
ret = ttm_bo_mem_compat(placement, &bo->mem); ret = ttm_bo_mem_compat(placement, &bo->mem);
if (ret < 0) { if (ret < 0) {
ret = ttm_bo_move_buffer(bo, placement, interruptible, no_wait_reserve, no_wait_gpu); ret = ttm_bo_move_buffer(bo, placement, interruptible,
no_wait_gpu);
if (ret) if (ret)
return ret; return ret;
} else { } else {
...@@ -1239,7 +1241,7 @@ int ttm_bo_init(struct ttm_bo_device *bdev, ...@@ -1239,7 +1241,7 @@ int ttm_bo_init(struct ttm_bo_device *bdev,
goto out_err; goto out_err;
} }
ret = ttm_bo_validate(bo, placement, interruptible, false, false); ret = ttm_bo_validate(bo, placement, interruptible, false);
if (ret) if (ret)
goto out_err; goto out_err;
...@@ -1325,7 +1327,7 @@ static int ttm_bo_force_list_clean(struct ttm_bo_device *bdev, ...@@ -1325,7 +1327,7 @@ static int ttm_bo_force_list_clean(struct ttm_bo_device *bdev,
spin_lock(&glob->lru_lock); spin_lock(&glob->lru_lock);
while (!list_empty(&man->lru)) { while (!list_empty(&man->lru)) {
spin_unlock(&glob->lru_lock); spin_unlock(&glob->lru_lock);
ret = ttm_mem_evict_first(bdev, mem_type, false, false, false); ret = ttm_mem_evict_first(bdev, mem_type, false, false);
if (ret) { if (ret) {
if (allow_errors) { if (allow_errors) {
return ret; return ret;
...@@ -1837,7 +1839,7 @@ static int ttm_bo_swapout(struct ttm_mem_shrink *shrink) ...@@ -1837,7 +1839,7 @@ static int ttm_bo_swapout(struct ttm_mem_shrink *shrink)
evict_mem.mem_type = TTM_PL_SYSTEM; evict_mem.mem_type = TTM_PL_SYSTEM;
ret = ttm_bo_handle_move_mem(bo, &evict_mem, true, ret = ttm_bo_handle_move_mem(bo, &evict_mem, true,
false, false, false); false, false);
if (unlikely(ret != 0)) if (unlikely(ret != 0))
goto out; goto out;
} }
......
...@@ -43,7 +43,7 @@ void ttm_bo_free_old_node(struct ttm_buffer_object *bo) ...@@ -43,7 +43,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 evict, bool no_wait_reserve, bool evict,
bool no_wait_gpu, struct ttm_mem_reg *new_mem) bool no_wait_gpu, struct ttm_mem_reg *new_mem)
{ {
struct ttm_tt *ttm = bo->ttm; struct ttm_tt *ttm = bo->ttm;
...@@ -314,7 +314,7 @@ static int ttm_copy_ttm_io_page(struct ttm_tt *ttm, void *dst, ...@@ -314,7 +314,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 evict, bool no_wait_reserve, bool no_wait_gpu, bool evict, bool no_wait_gpu,
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;
...@@ -611,7 +611,7 @@ EXPORT_SYMBOL(ttm_bo_kunmap); ...@@ -611,7 +611,7 @@ EXPORT_SYMBOL(ttm_bo_kunmap);
int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo, int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo,
void *sync_obj, void *sync_obj,
bool evict, bool no_wait_reserve, bool evict,
bool no_wait_gpu, bool no_wait_gpu,
struct ttm_mem_reg *new_mem) struct ttm_mem_reg *new_mem)
{ {
......
...@@ -66,7 +66,7 @@ int vmw_dmabuf_to_placement(struct vmw_private *dev_priv, ...@@ -66,7 +66,7 @@ int vmw_dmabuf_to_placement(struct vmw_private *dev_priv,
if (unlikely(ret != 0)) if (unlikely(ret != 0))
goto err; goto err;
ret = ttm_bo_validate(bo, placement, interruptible, false, false); ret = ttm_bo_validate(bo, placement, interruptible, false);
ttm_bo_unreserve(bo); ttm_bo_unreserve(bo);
...@@ -123,7 +123,7 @@ int vmw_dmabuf_to_vram_or_gmr(struct vmw_private *dev_priv, ...@@ -123,7 +123,7 @@ int vmw_dmabuf_to_vram_or_gmr(struct vmw_private *dev_priv,
else else
placement = &vmw_vram_gmr_placement; placement = &vmw_vram_gmr_placement;
ret = ttm_bo_validate(bo, placement, interruptible, false, false); ret = ttm_bo_validate(bo, placement, interruptible, false);
if (likely(ret == 0) || ret == -ERESTARTSYS) if (likely(ret == 0) || ret == -ERESTARTSYS)
goto err_unreserve; goto err_unreserve;
...@@ -138,7 +138,7 @@ int vmw_dmabuf_to_vram_or_gmr(struct vmw_private *dev_priv, ...@@ -138,7 +138,7 @@ int vmw_dmabuf_to_vram_or_gmr(struct vmw_private *dev_priv,
else else
placement = &vmw_vram_placement; placement = &vmw_vram_placement;
ret = ttm_bo_validate(bo, placement, interruptible, false, false); ret = ttm_bo_validate(bo, placement, interruptible, false);
err_unreserve: err_unreserve:
ttm_bo_unreserve(bo); ttm_bo_unreserve(bo);
...@@ -223,10 +223,9 @@ int vmw_dmabuf_to_start_of_vram(struct vmw_private *dev_priv, ...@@ -223,10 +223,9 @@ int vmw_dmabuf_to_start_of_vram(struct vmw_private *dev_priv,
if (bo->mem.mem_type == TTM_PL_VRAM && if (bo->mem.mem_type == TTM_PL_VRAM &&
bo->mem.start < bo->num_pages && bo->mem.start < bo->num_pages &&
bo->mem.start > 0) bo->mem.start > 0)
(void) ttm_bo_validate(bo, &vmw_sys_placement, false, (void) ttm_bo_validate(bo, &vmw_sys_placement, false, false);
false, false);
ret = ttm_bo_validate(bo, &placement, interruptible, false, false); ret = ttm_bo_validate(bo, &placement, interruptible, false);
/* For some reason we didn't up at the start of vram */ /* For some reason we didn't up at the start of vram */
WARN_ON(ret == 0 && bo->offset != 0); WARN_ON(ret == 0 && bo->offset != 0);
...@@ -315,7 +314,7 @@ void vmw_bo_pin(struct ttm_buffer_object *bo, bool pin) ...@@ -315,7 +314,7 @@ void vmw_bo_pin(struct ttm_buffer_object *bo, bool pin)
placement.num_placement = 1; placement.num_placement = 1;
placement.placement = &pl_flags; placement.placement = &pl_flags;
ret = ttm_bo_validate(bo, &placement, false, true, true); ret = ttm_bo_validate(bo, &placement, false, true);
BUG_ON(ret != 0 || bo->mem.mem_type != old_mem_type); BUG_ON(ret != 0 || bo->mem.mem_type != old_mem_type);
} }
...@@ -1245,7 +1245,7 @@ static int vmw_validate_single_buffer(struct vmw_private *dev_priv, ...@@ -1245,7 +1245,7 @@ static int vmw_validate_single_buffer(struct vmw_private *dev_priv,
* used as a GMR, this will return -ENOMEM. * used as a GMR, this will return -ENOMEM.
*/ */
ret = ttm_bo_validate(bo, &vmw_vram_gmr_placement, true, false, false); ret = ttm_bo_validate(bo, &vmw_vram_gmr_placement, true, false);
if (likely(ret == 0 || ret == -ERESTARTSYS)) if (likely(ret == 0 || ret == -ERESTARTSYS))
return ret; return ret;
...@@ -1255,7 +1255,7 @@ static int vmw_validate_single_buffer(struct vmw_private *dev_priv, ...@@ -1255,7 +1255,7 @@ static int vmw_validate_single_buffer(struct vmw_private *dev_priv,
*/ */
DRM_INFO("Falling through to VRAM.\n"); DRM_INFO("Falling through to VRAM.\n");
ret = ttm_bo_validate(bo, &vmw_vram_placement, true, false, false); ret = ttm_bo_validate(bo, &vmw_vram_placement, true, false);
return ret; return ret;
} }
......
...@@ -1018,7 +1018,7 @@ int vmw_resource_check_buffer(struct vmw_resource *res, ...@@ -1018,7 +1018,7 @@ int vmw_resource_check_buffer(struct vmw_resource *res,
backup_dirty = res->backup_dirty; backup_dirty = res->backup_dirty;
ret = ttm_bo_validate(&res->backup->base, ret = ttm_bo_validate(&res->backup->base,
res->func->backup_placement, res->func->backup_placement,
true, false, false); true, false);
if (unlikely(ret != 0)) if (unlikely(ret != 0))
goto out_no_validate; goto out_no_validate;
......
...@@ -337,7 +337,6 @@ extern int ttm_bo_wait(struct ttm_buffer_object *bo, bool lazy, ...@@ -337,7 +337,6 @@ extern int ttm_bo_wait(struct ttm_buffer_object *bo, bool lazy,
* @bo: The buffer object. * @bo: The buffer object.
* @placement: Proposed placement for the buffer object. * @placement: Proposed placement for the buffer object.
* @interruptible: Sleep interruptible if sleeping. * @interruptible: Sleep interruptible if sleeping.
* @no_wait_reserve: Return immediately if other buffers are busy.
* @no_wait_gpu: Return immediately if the GPU is busy. * @no_wait_gpu: Return immediately if the GPU is busy.
* *
* Changes placement and caching policy of the buffer object * Changes placement and caching policy of the buffer object
...@@ -350,7 +349,7 @@ extern int ttm_bo_wait(struct ttm_buffer_object *bo, bool lazy, ...@@ -350,7 +349,7 @@ extern int ttm_bo_wait(struct ttm_buffer_object *bo, bool lazy,
*/ */
extern int ttm_bo_validate(struct ttm_buffer_object *bo, extern int ttm_bo_validate(struct ttm_buffer_object *bo,
struct ttm_placement *placement, struct ttm_placement *placement,
bool interruptible, bool no_wait_reserve, bool interruptible,
bool no_wait_gpu); bool no_wait_gpu);
/** /**
......
...@@ -394,7 +394,7 @@ struct ttm_bo_driver { ...@@ -394,7 +394,7 @@ struct ttm_bo_driver {
*/ */
int (*move) (struct ttm_buffer_object *bo, int (*move) (struct ttm_buffer_object *bo,
bool evict, bool interruptible, bool evict, bool interruptible,
bool no_wait_reserve, bool no_wait_gpu, bool no_wait_gpu,
struct ttm_mem_reg *new_mem); struct ttm_mem_reg *new_mem);
/** /**
...@@ -703,7 +703,6 @@ extern bool ttm_mem_reg_is_pci(struct ttm_bo_device *bdev, ...@@ -703,7 +703,6 @@ extern bool ttm_mem_reg_is_pci(struct ttm_bo_device *bdev,
* @proposed_placement: Proposed new placement for the buffer object. * @proposed_placement: Proposed new placement for the buffer object.
* @mem: A struct ttm_mem_reg. * @mem: A struct ttm_mem_reg.
* @interruptible: Sleep interruptible when sliping. * @interruptible: Sleep interruptible when sliping.
* @no_wait_reserve: Return immediately if other buffers are busy.
* @no_wait_gpu: Return immediately if the GPU is busy. * @no_wait_gpu: Return immediately if the GPU is busy.
* *
* Allocate memory space for the buffer object pointed to by @bo, using * Allocate memory space for the buffer object pointed to by @bo, using
...@@ -719,7 +718,7 @@ extern int ttm_bo_mem_space(struct ttm_buffer_object *bo, ...@@ -719,7 +718,7 @@ extern int ttm_bo_mem_space(struct ttm_buffer_object *bo,
struct ttm_placement *placement, struct ttm_placement *placement,
struct ttm_mem_reg *mem, struct ttm_mem_reg *mem,
bool interruptible, bool interruptible,
bool no_wait_reserve, bool no_wait_gpu); bool no_wait_gpu);
extern void ttm_bo_mem_put(struct ttm_buffer_object *bo, extern void ttm_bo_mem_put(struct ttm_buffer_object *bo,
struct ttm_mem_reg *mem); struct ttm_mem_reg *mem);
...@@ -901,7 +900,6 @@ extern int ttm_bo_wait_unreserved(struct ttm_buffer_object *bo, ...@@ -901,7 +900,6 @@ extern int ttm_bo_wait_unreserved(struct ttm_buffer_object *bo,
* *
* @bo: A pointer to a struct ttm_buffer_object. * @bo: A pointer to a struct ttm_buffer_object.
* @evict: 1: This is an eviction. Don't try to pipeline. * @evict: 1: This is an eviction. Don't try to pipeline.
* @no_wait_reserve: Return immediately if other buffers are busy.
* @no_wait_gpu: Return immediately if the GPU is busy. * @no_wait_gpu: Return immediately if the GPU is busy.
* @new_mem: struct ttm_mem_reg indicating where to move. * @new_mem: struct ttm_mem_reg indicating where to move.
* *
...@@ -916,15 +914,14 @@ extern int ttm_bo_wait_unreserved(struct ttm_buffer_object *bo, ...@@ -916,15 +914,14 @@ extern int ttm_bo_wait_unreserved(struct ttm_buffer_object *bo,
*/ */
extern int ttm_bo_move_ttm(struct ttm_buffer_object *bo, extern int ttm_bo_move_ttm(struct ttm_buffer_object *bo,
bool evict, bool no_wait_reserve, bool evict, bool no_wait_gpu,
bool no_wait_gpu, struct ttm_mem_reg *new_mem); struct ttm_mem_reg *new_mem);
/** /**
* ttm_bo_move_memcpy * ttm_bo_move_memcpy
* *
* @bo: A pointer to a struct ttm_buffer_object. * @bo: A pointer to a struct ttm_buffer_object.
* @evict: 1: This is an eviction. Don't try to pipeline. * @evict: 1: This is an eviction. Don't try to pipeline.
* @no_wait_reserve: Return immediately if other buffers are busy.
* @no_wait_gpu: Return immediately if the GPU is busy. * @no_wait_gpu: Return immediately if the GPU is busy.
* @new_mem: struct ttm_mem_reg indicating where to move. * @new_mem: struct ttm_mem_reg indicating where to move.
* *
...@@ -939,8 +936,8 @@ extern int ttm_bo_move_ttm(struct ttm_buffer_object *bo, ...@@ -939,8 +936,8 @@ extern int ttm_bo_move_ttm(struct ttm_buffer_object *bo,
*/ */
extern int ttm_bo_move_memcpy(struct ttm_buffer_object *bo, extern int ttm_bo_move_memcpy(struct ttm_buffer_object *bo,
bool evict, bool no_wait_reserve, bool evict, bool no_wait_gpu,
bool no_wait_gpu, struct ttm_mem_reg *new_mem); struct ttm_mem_reg *new_mem);
/** /**
* ttm_bo_free_old_node * ttm_bo_free_old_node
...@@ -957,7 +954,6 @@ extern void ttm_bo_free_old_node(struct ttm_buffer_object *bo); ...@@ -957,7 +954,6 @@ extern void ttm_bo_free_old_node(struct ttm_buffer_object *bo);
* @bo: A pointer to a struct ttm_buffer_object. * @bo: A pointer to a struct ttm_buffer_object.
* @sync_obj: A sync object that signals when moving is complete. * @sync_obj: A sync object that signals when moving is complete.
* @evict: This is an evict move. Don't return until the buffer is idle. * @evict: This is an evict move. Don't return until the buffer is idle.
* @no_wait_reserve: Return immediately if other buffers are busy.
* @no_wait_gpu: Return immediately if the GPU is busy. * @no_wait_gpu: Return immediately if the GPU is busy.
* @new_mem: struct ttm_mem_reg indicating where to move. * @new_mem: struct ttm_mem_reg indicating where to move.
* *
...@@ -971,8 +967,7 @@ extern void ttm_bo_free_old_node(struct ttm_buffer_object *bo); ...@@ -971,8 +967,7 @@ extern void ttm_bo_free_old_node(struct ttm_buffer_object *bo);
extern int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo, extern int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo,
void *sync_obj, void *sync_obj,
bool evict, bool no_wait_reserve, bool evict, bool no_wait_gpu,
bool no_wait_gpu,
struct ttm_mem_reg *new_mem); struct ttm_mem_reg *new_mem);
/** /**
* ttm_io_prot * ttm_io_prot
......
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