aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.14.71/1527-drm-amdkfd-Delete-obsolete-code.patch
blob: 312bc4b4fe9a1dd1cb5701b55902776b9d33499b (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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
From 9e8fcdc602e6783889530004f1996a950ee2a274 Mon Sep 17 00:00:00 2001
From: Yong Zhao <yong.zhao@amd.com>
Date: Tue, 4 Oct 2016 13:11:09 -0400
Subject: [PATCH 1527/4131] drm/amdkfd: Delete obsolete code

The code is never used at all, and sometimes distracts us.

Change-Id: I5687fa5fb3f6c8c3401f92346b0958fcda0fcff0
Signed-off-by: Yong Zhao <yong.zhao@amd.com>
---
 drivers/gpu/drm/amd/amdkfd/kfd_chardev.c        |  23 -----
 drivers/gpu/drm/amd/amdkfd/kfd_device.c         |  10 --
 drivers/gpu/drm/amd/amdkfd/kfd_module.c         |   2 -
 drivers/gpu/drm/amd/amdkfd/kfd_priv.h           |   8 --
 drivers/gpu/drm/amd/amdkfd/kfd_process.c        | 116 ------------------------
 drivers/gpu/drm/amd/include/kgd_kfd_interface.h |   2 -
 6 files changed, 161 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
index c3e54d9..5e206e4 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
@@ -47,7 +47,6 @@ static uint32_t kfd_convert_user_mem_alloction_flags(
 		uint32_t userspace_flags);
 static bool kfd_is_large_bar(struct kfd_dev *dev);
 
-static int kfd_evict(struct file *filep, struct kfd_process *p, void *data);
 static const char kfd_dev_name[] = "kfd";
 
 static const struct file_operations kfd_fops = {
@@ -1436,7 +1435,6 @@ static int kfd_ioctl_map_memory_to_gpu(struct file *filep,
 	long err = 0;
 	int i, num_dev;
 	uint32_t *devices_arr = NULL;
-	int bo_size;
 
 	dev = kfd_device_by_id(GET_GPU_ID(args->handle));
 	if (dev == NULL)
@@ -1507,11 +1505,6 @@ static int kfd_ioctl_map_memory_to_gpu(struct file *filep,
 			pr_err("amdkfd: failed to map\n");
 	}
 
-	bo_size = dev->kfd2kgd->return_bo_size(dev->kgd, mem);
-	down_write(&p->lock);
-	pdd->mapped_size += bo_size;
-	up_write(&p->lock);
-
 	if (args->device_ids_array_size > 0 && devices_arr)
 		kfree(devices_arr);
 
@@ -1547,7 +1540,6 @@ static int kfd_ioctl_unmap_memory_from_gpu(struct file *filep,
 	struct kfd_dev *dev, *peer;
 	long err = 0;
 	uint32_t *devices_arr = NULL, num_dev, i;
-	int bo_size;
 
 	dev = kfd_device_by_id(GET_GPU_ID(args->handle));
 	if (dev == NULL)
@@ -1617,11 +1609,6 @@ static int kfd_ioctl_unmap_memory_from_gpu(struct file *filep,
 		radeon_flush_tlb(dev, p->pasid);
 	}
 
-	bo_size = dev->kfd2kgd->return_bo_size(dev->kgd, mem);
-	down_write(&p->lock);
-	pdd->mapped_size -= bo_size;
-	up_write(&p->lock);
-
 	return 0;
 
 bind_process_to_device_failed:
@@ -1965,9 +1952,6 @@ static const struct amdkfd_ioctl_desc amdkfd_ioctls[] = {
 	AMDKFD_IOCTL_DEF(AMDKFD_IOC_GET_PROCESS_APERTURES_NEW,
 				kfd_ioctl_get_process_apertures_new, 0),
 
-	AMDKFD_IOCTL_DEF(AMDKFD_IOC_EVICT_MEMORY,
-				kfd_evict, 0),
-
 	AMDKFD_IOCTL_DEF(AMDKFD_IOC_GET_DMABUF_INFO,
 				kfd_ioctl_get_dmabuf_info, 0),
 
@@ -1980,13 +1964,6 @@ static const struct amdkfd_ioctl_desc amdkfd_ioctls[] = {
 
 #define AMDKFD_CORE_IOCTL_COUNT	ARRAY_SIZE(amdkfd_ioctls)
 
-static int kfd_evict(struct file *filep, struct kfd_process *p, void *data)
-{
-	struct kfd_ioctl_eviction_args *args = data;
-
-	return evict_size(p, args->size, args->type);
-
-}
 static long kfd_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
 {
 	struct kfd_process *process;
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device.c b/drivers/gpu/drm/amd/amdkfd/kfd_device.c
index 6acc5fc..ba48aca 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_device.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_device.c
@@ -616,16 +616,6 @@ void kgd2kfd_suspend(struct kfd_dev *kfd)
 	amd_iommu_free_device(kfd->pdev);
 }
 
-int kgd2kfd_evict_bo(struct kfd_dev *dev, void *mem)
-{
-	return evict_bo(dev, mem);
-}
-
-int kgd2kfd_restore(struct kfd_dev *kfd)
-{
-	return restore(kfd);
-}
-
 int kgd2kfd_resume(struct kfd_dev *kfd)
 {
 	BUG_ON(kfd == NULL);
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_module.c b/drivers/gpu/drm/amd/amdkfd/kfd_module.c
index 42c559b..0f6a389 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_module.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_module.c
@@ -43,8 +43,6 @@ static const struct kgd2kfd_calls kgd2kfd = {
 	.interrupt	= kgd2kfd_interrupt,
 	.suspend	= kgd2kfd_suspend,
 	.resume		= kgd2kfd_resume,
-	.evict_bo	= kgd2kfd_evict_bo,
-	.restore	= kgd2kfd_restore,
 	.quiesce_mm	= kgd2kfd_quiesce_mm,
 	.resume_mm	= kgd2kfd_resume_mm,
 	.schedule_evict_and_restore_process =
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
index 182d065..8254b0a 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_priv.h
@@ -596,9 +596,6 @@ struct kfd_process_device {
 	uint64_t scratch_limit;
 	uint64_t dgpu_base;
 	uint64_t dgpu_limit;
-	uint64_t mapped_size;
-	uint64_t last_eviction;
-	bool	 evicted;
 
 	uint64_t sh_hidden_private_base_vmid;
 
@@ -957,11 +954,6 @@ void kfd_signal_vm_fault_event(struct kfd_dev *dev, unsigned int pasid,
 void radeon_flush_tlb(struct kfd_dev *dev, uint32_t pasid);
 
 int dbgdev_wave_reset_wavefronts(struct kfd_dev *dev, struct kfd_process *p);
-int kgd2kfd_evict_bo(struct kfd_dev *dev, void *mem);
-int kgd2kfd_restore(struct kfd_dev *kfd);
-int evict_size(struct kfd_process *p, int size, int type);
-int evict_bo(struct kfd_dev *dev, void *mem);
-int restore(struct kfd_dev *kfd);
 
 #define KFD_SCRATCH_CZ_FW_VER 600
 #define KFD_SCRATCH_KV_FW_VER 413
diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process.c b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
index 54ed2a1..78a8cc9 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
@@ -38,7 +38,6 @@ struct mm_struct;
 #include "kfd_priv.h"
 #include "kfd_dbgmgr.h"
 
-static int evict_pdd(struct kfd_process_device *pdd);
 /*
  * List of struct kfd_process (field kfd_process).
  * Unique/indexed by mm_struct*
@@ -280,121 +279,6 @@ struct kfd_process *kfd_lookup_process_by_pid(struct pid *pid)
 	return p;
 }
 
-int evict_size(struct kfd_process *process, int size, int type)
-{
-	struct kfd_process_device *pdd, *temp_pdd = NULL;
-	struct kfd_process *p = process;
-	int temp = 0;
-
-	down_write(&p->lock);
-
-	if (type == EVICT_FIRST_PDD) {
-
-		list_for_each_entry(pdd, &p->per_device_data, per_device_list) {
-			pr_debug("Releasing pdd (topology id %d) for process (pasid %d) in workqueue\n",
-					pdd->dev->id, p->pasid);
-			if (pdd->mapped_size >= size) {
-				evict_pdd(pdd);
-				return 0;
-			}
-
-		}
-	} else if (type == EVICT_BIGGEST_PDD) {
-
-		list_for_each_entry(pdd, &p->per_device_data, per_device_list) {
-			pr_debug("Releasing pdd (topology id %d) for process (pasid %d) in workqueue\n",
-					pdd->dev->id, p->pasid);
-			if (pdd->mapped_size >= temp) {
-				temp = pdd->mapped_size;
-				temp_pdd = pdd;
-			}
-
-		}
-		if (temp_pdd->mapped_size > size) {
-			evict_pdd(temp_pdd);
-			return 0;
-		}
-
-	}
-	up_write(&p->lock);
-	return 0;
-
-}
-
-int evict_bo(struct kfd_dev *dev, void *mem)
-{
-	struct kfd_process_device *pdd;
-
-	pdd =  dev->kfd2kgd->get_pdd_from_buffer_object(dev->kgd,
-			((struct kgd_mem *)mem));
-
-	if (pdd)
-		evict_pdd(pdd);
-
-	return 0;
-}
-
-static int evict_pdd(struct kfd_process_device *pdd)
-{
-	void *mem;
-	int id;
-
-	/*process_evict_queues(struct device_queue_manager *dqm, pdd->qpd)*/
-	/*
-	* Remove all handles from idr and release appropriate
-	* local memory object
-	*/
-	idr_for_each_entry(&pdd->alloc_idr, mem, id) {
-		pdd->dev->kfd2kgd->unmap_memory_to_gpu(
-			pdd->dev->kgd, mem, pdd->vm);
-	}
-	pdd->last_eviction = jiffies;
-	pdd->mapped_size = 0;
-	pdd->evicted = true;
-
-	/*flush_tlb_all();*/
-
-	return 0;
-}
-
-int restore(struct kfd_dev *kfd)
-{
-	struct kfd_process *p = NULL;
-	/*  TODO still working on how to get the process */
-	struct kfd_process_device *pdd = kfd_get_process_device_data(kfd, p);
-	void *mem;
-	int id;
-
-	/* need to run on all processes*/
-	down_write(&p->lock);
-
-	list_for_each_entry(pdd, &p->per_device_data, per_device_list) {
-		pr_debug("Releasing pdd (topology id %d) for process (pasid %d) in workqueue\n",
-				pdd->dev->id, p->pasid);
-
-		/*
-		 * Remove all handles from idr and release appropriate
-		 * local memory object
-		 */
-		if (pdd->evicted) {
-			idr_for_each_entry(&pdd->alloc_idr, mem, id) {
-				pdd->dev->kfd2kgd->map_memory_to_gpu(
-						pdd->dev->kgd,
-						mem, pdd->vm);
-				pdd->last_eviction = 0;
-				pdd->mapped_size = 0;
-			}
-
-			/*process_restore_queues
-			 * (struct device_queue_manager *dqm, pdd->qpd)*/
-		} else {
-			pdd->evicted = false;
-		}
-	}
-	up_write(&p->lock);
-	return 0;
-}
-
 static void kfd_process_free_outstanding_kfd_bos(struct kfd_process *p)
 {
 	struct kfd_process_device *pdd, *peer_pdd;
diff --git a/drivers/gpu/drm/amd/include/kgd_kfd_interface.h b/drivers/gpu/drm/amd/include/kgd_kfd_interface.h
index d344496..fefbe9d 100644
--- a/drivers/gpu/drm/amd/include/kgd_kfd_interface.h
+++ b/drivers/gpu/drm/amd/include/kgd_kfd_interface.h
@@ -406,8 +406,6 @@ struct kgd2kfd_calls {
 	void (*interrupt)(struct kfd_dev *kfd, const void *ih_ring_entry);
 	void (*suspend)(struct kfd_dev *kfd);
 	int (*resume)(struct kfd_dev *kfd);
-	int (*evict_bo)(struct kfd_dev *dev, void *ptr);
-	int (*restore)(struct kfd_dev *kfd);
 	int (*quiesce_mm)(struct kfd_dev *kfd, struct mm_struct *mm);
 	int (*resume_mm)(struct kfd_dev *kfd, struct mm_struct *mm);
 	int (*schedule_evict_and_restore_process)(struct mm_struct *mm,
-- 
2.7.4