aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/1423-drm-amdgpu-Remove-useless-parameters.patch
blob: e3adaf5f7860dd4e833ccb424dec51baace96db0 (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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
From 03a011e7c2218c4f08adbe7bbdebb52cea28e2dd Mon Sep 17 00:00:00 2001
From: Yong Zhao <yong.zhao@amd.com>
Date: Wed, 27 Apr 2016 20:25:10 -0400
Subject: [PATCH 1423/4131] drm/amdgpu: Remove useless parameters

Change-Id: I503aeafa584664e461ce63c88ea1710d8e5c4771
Signed-off-by: Yong Zhao <yong.zhao@amd.com>

 Conflicts:
	drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 55 ++++++++----------------
 1 file changed, 18 insertions(+), 37 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
index dc62b44..dac2a30 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c
@@ -147,16 +147,10 @@ static void remove_bo_from_vm(struct amdgpu_device *adev,
 }
 
 
-static int try_pin_bo(struct amdgpu_bo *bo, bool resv, uint32_t domain)
+static int try_pin_bo(struct amdgpu_bo *bo, uint32_t domain)
 {
 	int ret = 0;
 
-	if (resv) {
-		ret = amdgpu_bo_reserve(bo, true);
-		if (ret != 0)
-			return ret;
-	}
-
 	if (!amdgpu_ttm_tt_get_usermm(bo->tbo.ttm)) {
 		ret = amdgpu_bo_pin(bo, domain, NULL);
 		if (ret != 0)
@@ -185,22 +179,13 @@ static int try_pin_bo(struct amdgpu_bo *bo, bool resv, uint32_t domain)
 	}
 
 error:
-	if (resv)
-		amdgpu_bo_unreserve(bo);
-
 	return ret;
 }
 
-static int unpin_bo(struct amdgpu_bo *bo, bool resv)
+static int unpin_bo(struct amdgpu_bo *bo)
 {
 	int ret = 0;
 
-	if (resv) {
-		ret = amdgpu_bo_reserve(bo, true);
-		if (ret != 0)
-			return ret;
-	}
-
 	amdgpu_bo_kunmap(bo);
 
 	if (!amdgpu_ttm_tt_get_usermm(bo->tbo.ttm)) {
@@ -217,14 +202,11 @@ static int unpin_bo(struct amdgpu_bo *bo, bool resv)
 	}
 
 error:
-	if (resv)
-		amdgpu_bo_unreserve(bo);
-
 	return ret;
 }
 
 
-static int try_pin_pts(struct amdgpu_bo_va *bo_va, bool resv)
+static int try_pin_pts(struct amdgpu_bo_va *bo_va)
 {
 	int ret;
 	uint64_t pt_idx, start, last, failed;
@@ -240,7 +222,7 @@ static int try_pin_pts(struct amdgpu_bo_va *bo_va, bool resv)
 
 		/* walk over the address space and pin the page tables BOs*/
 		for (pt_idx = start; pt_idx <= last; pt_idx++) {
-			ret = try_pin_bo(vm->page_tables[pt_idx].bo, resv,
+			ret = try_pin_bo(vm->page_tables[pt_idx].bo,
 					AMDGPU_GEM_DOMAIN_VRAM);
 			if (ret != 0) {
 				failed = pt_idx;
@@ -257,7 +239,7 @@ static int try_pin_pts(struct amdgpu_bo_va *bo_va, bool resv)
 
 		/* walk over the address space and pin the page tables BOs*/
 		for (pt_idx = start; pt_idx <= last; pt_idx++) {
-			ret = try_pin_bo(vm->page_tables[pt_idx].bo, resv,
+			ret = try_pin_bo(vm->page_tables[pt_idx].bo,
 					AMDGPU_GEM_DOMAIN_VRAM);
 			if (ret != 0) {
 				failed = pt_idx;
@@ -273,13 +255,12 @@ static int try_pin_pts(struct amdgpu_bo_va *bo_va, bool resv)
 	/* Unpin all already pinned BOs*/
 	if (failed > 0) {
 		for (pt_idx = start; pt_idx <= failed - 1; pt_idx++)
-			unpin_bo(vm->page_tables[pt_idx].bo, resv);
+			unpin_bo(vm->page_tables[pt_idx].bo);
 	}
 	return ret;
 }
 
-static void unpin_pts(struct amdgpu_bo_va *bo_va, struct amdgpu_vm *vm,
-			bool resv)
+static void unpin_pts(struct amdgpu_bo_va *bo_va, struct amdgpu_vm *vm)
 {
 	uint64_t pt_idx, start, last;
 	struct amdgpu_bo_va_mapping *mapping;
@@ -292,7 +273,7 @@ static void unpin_pts(struct amdgpu_bo_va *bo_va, struct amdgpu_vm *vm,
 
 		/* walk over the address space and unpin the page tables BOs*/
 		for (pt_idx = start; pt_idx <= last; pt_idx++)
-			unpin_bo(vm->page_tables[pt_idx].bo, resv);
+			unpin_bo(vm->page_tables[pt_idx].bo);
 	}
 
 	list_for_each_entry(mapping, &bo_va->invalids, list) {
@@ -303,7 +284,7 @@ static void unpin_pts(struct amdgpu_bo_va *bo_va, struct amdgpu_vm *vm,
 
 		/* walk over the address space and unpin the page tables BOs*/
 		for (pt_idx = start; pt_idx <= last; pt_idx++)
-			unpin_bo(vm->page_tables[pt_idx].bo, resv);
+			unpin_bo(vm->page_tables[pt_idx].bo);
 	}
 }
 
@@ -635,14 +616,14 @@ static int map_bo_to_gpuvm(struct amdgpu_device *adev, struct amdgpu_bo *bo,
 	 * create a mapping of virtual to MC address
 	 */
 	/* Pin BO*/
-	ret = try_pin_bo(bo, false, domain);
+	ret = try_pin_bo(bo, domain);
 	if (ret != 0) {
 		pr_err("amdkfd: Failed to pin BO\n");
 		return ret;
 	}
 
 	/* Pin PTs */
-	ret = try_pin_pts(bo_va, false);
+	ret = try_pin_pts(bo_va);
 	if (ret != 0) {
 		pr_err("amdkfd: Failed to pin PTs\n");
 		goto err_failed_to_pin_pts;
@@ -650,7 +631,7 @@ static int map_bo_to_gpuvm(struct amdgpu_device *adev, struct amdgpu_bo *bo,
 
 	/* Pin the PD directory*/
 	vm = bo_va->vm;
-	ret = try_pin_bo(vm->page_directory, false, AMDGPU_GEM_DOMAIN_VRAM);
+	ret = try_pin_bo(vm->page_directory, AMDGPU_GEM_DOMAIN_VRAM);
 	if (ret != 0) {
 		pr_err("amdkfd: Failed to pin PD\n");
 		goto err_failed_to_pin_pd;
@@ -697,11 +678,11 @@ static int map_bo_to_gpuvm(struct amdgpu_device *adev, struct amdgpu_bo *bo,
 err_failed_to_update_pts:
 err_failed_vm_clear_freed:
 err_failed_to_update_pd:
-	unpin_bo(vm->page_directory, false);
+	unpin_bo(vm->page_directory);
 err_failed_to_pin_pd:
-	unpin_pts(bo_va, vm, false);
+	unpin_pts(bo_va, vm);
 err_failed_to_pin_pts:
-	unpin_bo(bo, false);
+	unpin_bo(bo);
 
 	return ret;
 }
@@ -1037,11 +1018,11 @@ static int unmap_bo_from_gpuvm(struct amdgpu_device *adev,
 	amdgpu_vm_clear_invalids(adev, vm, NULL);
 
 	/* Unpin the PD directory*/
-	unpin_bo(bo_va->vm->page_directory, false);
+	unpin_bo(bo_va->vm->page_directory);
 	/* Unpin PTs */
-	unpin_pts(bo_va, bo_va->vm, false);
+	unpin_pts(bo_va, bo_va->vm);
 	/* Unpin BO*/
-	unpin_bo(bo, false);
+	unpin_bo(bo);
 
 	return 0;
 }
-- 
2.7.4