From: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Date: Thu, 9 Feb 2017 22:28:24 +0000 (+0100)
Subject: drm/amdgpu: use amdgpu_gem_va_check() in amdgpu_gem_va_update_vm()
X-Git-Tag: baikal/aarch64/sdk6.1~17297^2~15^2~10
X-Git-Url: https://git.baikalelectronics.ru/sdk/?a=commitdiff_plain;h=8e929ab0df664d9454517ed4ef5ec124d9923986;p=kernel.git

drm/amdgpu: use amdgpu_gem_va_check() in amdgpu_gem_va_update_vm()

This removes code duplication.

Reviewed-by: Chunming Zhou <david1.zhou@amd.com>
Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
---

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
index ec7037a48b6eb..51d7594633846 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c
@@ -504,13 +504,7 @@ static void amdgpu_gem_va_update_vm(struct amdgpu_device *adev,
 	list_for_each_entry(entry, list, head) {
 		struct amdgpu_bo *bo =
 			container_of(entry->bo, struct amdgpu_bo, tbo);
-
-		/* if anything is swapped out don't swap it in here,
-		   just abort and wait for the next CS */
-		if (!amdgpu_bo_gpu_accessible(bo))
-			goto error;
-
-		if (bo->shadow && !amdgpu_bo_gpu_accessible(bo->shadow))
+		if (amdgpu_gem_va_check(NULL, bo))
 			goto error;
 	}