drm/ttm: fix error handling if no BO can be swapped out v4

In case that all pre-allocated BOs are busy, just continue to populate
BOs since likely half of system memory in total is still free.

v4 (chk): fix code moved to VMWGFX as well

Signed-off-by: Shiwu Zhang <shiwu.zhang@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Christian König <christian.koenig@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20210422115757.3946-1-christian.koenig@amd.com

authored by Shiwu Zhang and committed by Christian König 2a269ba8 a4394b6d

+4 -2
+1 -1
drivers/gpu/drm/ttm/ttm_device.c
··· 112 112 { 113 113 struct ttm_global *glob = &ttm_glob; 114 114 struct ttm_device *bdev; 115 - int ret = -EBUSY; 115 + int ret = 0; 116 116 117 117 mutex_lock(&ttm_global_mutex); 118 118 list_for_each_entry(bdev, &glob->device_list, device_list) {
+2
drivers/gpu/drm/ttm/ttm_tt.c
··· 329 329 ttm_dma32_pages_limit) { 330 330 331 331 ret = ttm_global_swapout(ctx, GFP_KERNEL); 332 + if (ret == 0) 333 + break; 332 334 if (ret < 0) 333 335 goto error; 334 336 }
+1 -1
drivers/gpu/drm/vmwgfx/ttm_memory.c
··· 280 280 spin_unlock(&glob->lock); 281 281 ret = ttm_global_swapout(ctx, GFP_KERNEL); 282 282 spin_lock(&glob->lock); 283 - if (unlikely(ret < 0)) 283 + if (unlikely(ret <= 0)) 284 284 break; 285 285 } 286 286