[PATCH 19/19] drm/amdgpu: add backup condition for vm

Chunming Zhou David1.Zhou at amd.com
Fri Aug 5 09:38:46 UTC 2016


Change-Id: I73aa32cda17cd1039232125afa4aad299b264705
Signed-off-by: Chunming Zhou <David1.Zhou at amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 30 ++++++++++++++++++------------
 1 file changed, 18 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
index 664f055..b279e04 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
@@ -723,9 +723,11 @@ int amdgpu_vm_update_page_directory(struct amdgpu_device *adev,
 {
 	int r;
 
-	r = amdgpu_vm_update_page_directory_or_shadow(adev, vm, true);
-	if (r)
-		return r;
+	if (amdgpu_need_backup(adev)) {
+		r = amdgpu_vm_update_page_directory_or_shadow(adev, vm, true);
+		if (r)
+			return r;
+	}
 	return amdgpu_vm_update_page_directory_or_shadow(adev, vm, false);
 }
 
@@ -1078,13 +1080,15 @@ static int amdgpu_vm_bo_update_mapping(struct amdgpu_device *adev,
 {
 	int r;
 
-	r = amdgpu_vm_bo_update_mapping_or_shadow(adev, exclusive, src,
-						  pages_addr, vm,
-						  start, last,
-						  flags, addr,
-						  fence, true);
-	if (r)
-		return r;
+	if (amdgpu_need_backup(adev)) {
+		r = amdgpu_vm_bo_update_mapping_or_shadow(adev, exclusive, src,
+							  pages_addr, vm,
+							  start, last,
+							  flags, addr,
+							  fence, true);
+		if (r)
+			return r;
+	}
 	return amdgpu_vm_bo_update_mapping_or_shadow(adev, exclusive, src,
 						     pages_addr, vm,
 						     start, last,
@@ -1450,7 +1454,8 @@ int amdgpu_vm_bo_map(struct amdgpu_device *adev,
 				     AMDGPU_GPU_PAGE_SIZE, true,
 				     AMDGPU_GEM_DOMAIN_VRAM,
 				     AMDGPU_GEM_CREATE_NO_CPU_ACCESS |
-				     AMDGPU_GEM_CREATE_SHADOW,
+				     (amdgpu_need_backup(adev) ?
+				      AMDGPU_GEM_CREATE_SHADOW : 0),
 				     NULL, resv, &pt);
 		if (r)
 			goto error_free;
@@ -1658,7 +1663,8 @@ int amdgpu_vm_init(struct amdgpu_device *adev, struct amdgpu_vm *vm)
 	r = amdgpu_bo_create(adev, pd_size, align, true,
 			     AMDGPU_GEM_DOMAIN_VRAM,
 			     AMDGPU_GEM_CREATE_NO_CPU_ACCESS |
-			     AMDGPU_GEM_CREATE_SHADOW,
+			     (amdgpu_need_backup(adev) ?
+			      AMDGPU_GEM_CREATE_SHADOW : 0),
 			     NULL, NULL, &vm->page_directory);
 	if (r)
 		goto error_free_sched_entity;
-- 
1.9.1



More information about the amd-gfx mailing list