From: Christian König <ckoenig.leichtzumerken@xxxxxxxxx> If a per VM BO ends up in a allowed domain it never moves back into the prefered domain. v2: move to refresh function, the validation order also keeps same as lru Change-Id: Ifb3e561785d3b464da28c439b271c26825224c5e Signed-off-by: Christian König <christian.koenig at amd.com> Reviewed-and-Tested-by: Chunming Zhou <david1.zhou at amd.com> --- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c index 8ad2bb705765..f28a94f3d687 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c @@ -1914,6 +1914,13 @@ void amdgpu_vm_refresh_lru(struct amdgpu_device *adev, struct amdgpu_vm *vm) if (bo_base->bo->shadow) ttm_bo_move_to_lru_tail(&bo_base->bo->shadow->tbo); spin_unlock(&glob->lru_lock); + /* If the BO prefers to be in VRAM, but currently isn't add it + * back to the evicted list so that it gets validated again on + * the next command submission. + */ + if (bo_base->bo->preferred_domains == AMDGPU_GEM_DOMAIN_VRAM && + bo_base->bo->tbo.mem.mem_type != TTM_PL_VRAM) + list_move_tail(&bo_base->vm_status, &vm->evicted); } spin_unlock(&vm->status_lock); } -- 2.14.1