Commit 4b8edc39 authored by Christian König's avatar Christian König

drm/ttm: cleanup io_mem interface with nouveau

Nouveau is the only user of this functionality and evicting io space
on -EAGAIN is really a misuse of the return code.

Instead switch to using -ENOSPC here which makes much more sense and
simplifies the code.

This could unbreak something as we now cleanly return EAGAIN, but the
chance for this are rather low.
Signed-off-by: default avatarChristian König <christian.koenig@amd.com>
Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/378237/
parent e69acf18
...@@ -1505,8 +1505,6 @@ nouveau_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_mem_reg *reg) ...@@ -1505,8 +1505,6 @@ nouveau_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_mem_reg *reg)
if (ret != 1) { if (ret != 1) {
if (WARN_ON(ret == 0)) if (WARN_ON(ret == 0))
return -EINVAL; return -EINVAL;
if (ret == -ENOSPC)
return -EAGAIN;
return ret; return ret;
} }
......
...@@ -116,7 +116,7 @@ static int ttm_mem_io_evict(struct ttm_mem_type_manager *man) ...@@ -116,7 +116,7 @@ static int ttm_mem_io_evict(struct ttm_mem_type_manager *man)
struct ttm_buffer_object *bo; struct ttm_buffer_object *bo;
if (!man->use_io_reserve_lru || list_empty(&man->io_reserve_lru)) if (!man->use_io_reserve_lru || list_empty(&man->io_reserve_lru))
return -EAGAIN; return -ENOSPC;
bo = list_first_entry(&man->io_reserve_lru, bo = list_first_entry(&man->io_reserve_lru,
struct ttm_buffer_object, struct ttm_buffer_object,
...@@ -143,7 +143,7 @@ int ttm_mem_io_reserve(struct ttm_bo_device *bdev, ...@@ -143,7 +143,7 @@ int ttm_mem_io_reserve(struct ttm_bo_device *bdev,
mem->bus.io_reserved_count++ == 0) { mem->bus.io_reserved_count++ == 0) {
retry: retry:
ret = bdev->driver->io_mem_reserve(bdev, mem); ret = bdev->driver->io_mem_reserve(bdev, mem);
if (ret == -EAGAIN) { if (ret == -ENOSPC) {
ret = ttm_mem_io_evict(man); ret = ttm_mem_io_evict(man);
if (ret == 0) if (ret == 0)
goto retry; goto retry;
......
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