From: Dave Airlie Date: Wed, 23 Jun 2021 00:07:48 +0000 (+1000) Subject: Backmerge tag 'v5.13-rc7' into drm-next X-Git-Tag: accepted/tizen/unified/20230118.172025~6864^2~9 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f45fbbb6d5cff29ddfc708676ec1c2496eed3a07;p=platform%2Fkernel%2Flinux-rpi.git Backmerge tag 'v5.13-rc7' into drm-next Backmerge Linux 5.13-rc7 to make some pulls from later bases apply, and to bake in the conflicts so far. --- f45fbbb6d5cff29ddfc708676ec1c2496eed3a07 diff --cc drivers/gpu/drm/ttm/ttm_bo.c index db53fec,ebcffe7..1b950b4 --- a/drivers/gpu/drm/ttm/ttm_bo.c +++ b/drivers/gpu/drm/ttm/ttm_bo.c @@@ -1128,18 -1169,13 +1128,21 @@@ int ttm_bo_swapout(struct ttm_buffer_ob bool locked; int ret; - if (!ttm_bo_evict_swapout_allowable(bo, ctx, &locked, NULL)) + /* + * While the bo may already reside in SYSTEM placement, set + * SYSTEM as new placement to cover also the move further below. + * The driver may use the fact that we're moving from SYSTEM + * as an indication that we're about to swap out. + */ + memset(&place, 0, sizeof(place)); + place.mem_type = TTM_PL_SYSTEM; + if (!ttm_bo_evict_swapout_allowable(bo, ctx, &place, &locked, NULL)) return -EBUSY; - if (!ttm_bo_get_unless_zero(bo)) { + if (!bo->ttm || !ttm_tt_is_populated(bo->ttm) || + bo->ttm->page_flags & TTM_PAGE_FLAG_SG || + bo->ttm->page_flags & TTM_PAGE_FLAG_SWAPPED || + !ttm_bo_get_unless_zero(bo)) { if (locked) dma_resv_unlock(bo->base.resv); return -EBUSY;