Skip to content

Commit 4b8edc3

Browse files
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: Christian König <[email protected]> Reviewed-by: Daniel Vetter <[email protected]> Link: https://patchwork.freedesktop.org/patch/378237/
1 parent e69acf1 commit 4b8edc3

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

drivers/gpu/drm/nouveau/nouveau_bo.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1505,8 +1505,6 @@ nouveau_ttm_io_mem_reserve(struct ttm_bo_device *bdev, struct ttm_mem_reg *reg)
15051505
if (ret != 1) {
15061506
if (WARN_ON(ret == 0))
15071507
return -EINVAL;
1508-
if (ret == -ENOSPC)
1509-
return -EAGAIN;
15101508
return ret;
15111509
}
15121510

drivers/gpu/drm/ttm/ttm_bo_util.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ static int ttm_mem_io_evict(struct ttm_mem_type_manager *man)
116116
struct ttm_buffer_object *bo;
117117

118118
if (!man->use_io_reserve_lru || list_empty(&man->io_reserve_lru))
119-
return -EAGAIN;
119+
return -ENOSPC;
120120

121121
bo = list_first_entry(&man->io_reserve_lru,
122122
struct ttm_buffer_object,
@@ -143,7 +143,7 @@ int ttm_mem_io_reserve(struct ttm_bo_device *bdev,
143143
mem->bus.io_reserved_count++ == 0) {
144144
retry:
145145
ret = bdev->driver->io_mem_reserve(bdev, mem);
146-
if (ret == -EAGAIN) {
146+
if (ret == -ENOSPC) {
147147
ret = ttm_mem_io_evict(man);
148148
if (ret == 0)
149149
goto retry;

0 commit comments

Comments
 (0)