aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/1571-drm-amdkfd-Avoid-validating-PD-PT-BOs-when-updating-.patch
blob: a5bd31fb699e99ec3fafd38e87013f3f417cd82b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
From 63aa6282865d2794845d956e89779f24444704d7 Mon Sep 17 00:00:00 2001
From: Yong Zhao <yong.zhao@amd.com>
Date: Fri, 16 Dec 2016 18:41:33 -0500
Subject: [PATCH 1571/4131] drm/amdkfd: Avoid validating PD PT BOs when
 updating PTE

When update_gpuvm_pte() is called during memory eviction, PD PT BOs are
already validated, so we move the validation out of update_gpuvm_pte().

Change-Id: I732761215a404dedd28030dcb079be009904d0a0
Signed-off-by: Yong Zhao <yong.zhao@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
index 7624d37..27205a0 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
@@ -1014,12 +1014,6 @@ static int update_gpuvm_pte(struct amdgpu_device *adev,
 	bo_va = entry->bo_va;
 	vm = bo_va->vm;
 	bo = bo_va->bo;
-	/* Validate PT / PTs */
-	ret = validate_pt_pd_bos(vm);
-	if (ret != 0) {
-		pr_err("validate_pt_pd_bos failed\n");
-		return ret;
-	}
 
 	/* Update the page directory */
 	ret = amdgpu_vm_update_page_directory(adev, vm);
@@ -1064,6 +1058,15 @@ static int map_bo_to_gpuvm(struct amdgpu_device *adev,
 		return ret;
 	}
 
+	/* PT BOs may be created during amdgpu_vm_bo_map() call,
+	 * so we have to validate the newly created PT BOs.
+	 */
+	ret = validate_pt_pd_bos(entry->bo_va->vm);
+	if (ret != 0) {
+		pr_err("validate_pt_pd_bos() failed\n");
+		return ret;
+	}
+
 	ret = update_gpuvm_pte(adev, entry, sync);
 	if (ret != 0) {
 		pr_err("update_gpuvm_pte() failed\n");
@@ -1330,7 +1333,6 @@ int amdgpu_amdkfd_gpuvm_map_memory_to_gpu(
 		}
 	}
 
-
 	list_for_each_entry(entry, &mem->bo_va_list, bo_list) {
 		if (entry->bo_va->vm == vm && !entry->is_mapped) {
 			if (mem->evicted) {
-- 
2.7.4