aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-kernel/linux/linux-yocto-4.14.71/1281-drm-amdkfd-Remove-deprecated-memory-management-APIs.patch
blob: a0e37d91ffa11b851426324349ccef6b4d8445fa (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
From dffcd243d20d32925bccb23911945fdbf4b9eea2 Mon Sep 17 00:00:00 2001
From: Felix Kuehling <Felix.Kuehling@amd.com>
Date: Tue, 2 May 2017 15:53:56 -0400
Subject: [PATCH 1281/4131] drm/amdkfd: Remove deprecated memory management
 APIs

Change-Id: I3b8b24a1a8b35f12dd23b71e623e5ece8ffba98d
Signed-off-by: Felix Kuehling <Felix.Kuehling@amd.com>
---
 drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 144 -------------------------------
 1 file changed, 144 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
index 521a8d2..0c4ea11 100644
--- a/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
+++ b/drivers/gpu/drm/amd/amdkfd/kfd_chardev.c
@@ -48,9 +48,6 @@
 static long kfd_ioctl(struct file *, unsigned int, unsigned long);
 static int kfd_open(struct inode *, struct file *);
 static int kfd_mmap(struct file *, struct vm_area_struct *);
-static uint32_t kfd_convert_user_mem_alloction_flags(
-		struct kfd_dev *dev,
-		uint32_t userspace_flags);
 static bool kfd_is_large_bar(struct kfd_dev *dev);
 
 static const char kfd_dev_name[] = "kfd";
@@ -1193,74 +1190,6 @@ bool kfd_is_large_bar(struct kfd_dev *dev)
 	return false;
 }
 
-/* TODO: Remove this once the Thunk has transitioned to
- * AMDKFD_IOC_ALLOC_MEMORY_OF_GPU */
-static uint32_t kfd_convert_user_mem_alloction_flags(
-		struct kfd_dev *dev,
-		uint32_t userspace_flags)
-{
-	uint32_t kernel_allocation_flags;
-
-	kernel_allocation_flags = 0;
-
-	/* Allocate VRAM bo */
-	if ((userspace_flags & KFD_IOC_ALLOC_MEM_FLAGS_DGPU_DEVICE) ||
-		(userspace_flags & KFD_IOC_ALLOC_MEM_FLAGS_APU_DEVICE)) {
-		kernel_allocation_flags = ALLOC_MEM_FLAGS_VRAM;
-		if ((userspace_flags & KFD_IOC_ALLOC_MEM_FLAGS_DGPU_DEVICE) &&
-				kfd_is_large_bar(dev))
-			kernel_allocation_flags |= ALLOC_MEM_FLAGS_PUBLIC;
-		goto out;
-	}
-	/*
-	 * Since currently user space library doesn't uses scratch
-	 * allocation flag I route it to VRAM
-	 */
-	if ((userspace_flags & KFD_IOC_ALLOC_MEM_FLAGS_DGPU_SCRATCH) ||
-		(userspace_flags & KFD_IOC_ALLOC_MEM_FLAGS_APU_SCRATCH)) {
-		kernel_allocation_flags = ALLOC_MEM_FLAGS_VRAM;
-		goto out;
-	}
-	/*
-	 * The current usage for *_HOST allocation flags are for GTT memory
-	 * Need to verify if we're node zero or we want to allocate bo on
-	 * public domain for P2P buffers.
-	 */
-	if (userspace_flags & KFD_IOC_ALLOC_MEM_FLAGS_DGPU_HOST) {
-		kernel_allocation_flags = ALLOC_MEM_FLAGS_GTT;
-		goto out;
-	}
-	/* Allocate userptr BO */
-	if (userspace_flags & KFD_IOC_ALLOC_MEM_FLAGS_USERPTR_OLD) {
-		kernel_allocation_flags = ALLOC_MEM_FLAGS_USERPTR;
-		goto out;
-	}
-	/* Allocate doorbell BO */
-	if (userspace_flags & KFD_IOC_ALLOC_MEM_FLAGS_DOORBELL_OLD) {
-		kernel_allocation_flags = ALLOC_MEM_FLAGS_DOORBELL;
-		goto out;
-	}
-
-out:
-	if (userspace_flags & KFD_IOC_ALLOC_MEM_FLAGS_DGPU_AQL_QUEUE_MEM)
-		kernel_allocation_flags |= ALLOC_MEM_FLAGS_AQL_QUEUE_MEM;
-	if (userspace_flags & KFD_IOC_ALLOC_MEM_FLAGS_COHERENT_OLD)
-		kernel_allocation_flags |= ALLOC_MEM_FLAGS_COHERENT;
-	/* Current HW doesn't support non paged memory */
-	kernel_allocation_flags |= ALLOC_MEM_FLAGS_NONPAGED;
-	/*
-	 *  Set by default execute access as this buffer might be allocated
-	 * for CP's ring buffer
-	 */
-	kernel_allocation_flags |= ALLOC_MEM_FLAGS_EXECUTE_ACCESS;
-	kernel_allocation_flags |= ALLOC_MEM_FLAGS_NO_SUBSTITUTE;
-
-	pr_debug("amdkfd: user allocation flags 0x%x kernel allocation flags: 0x%x\n",
-			userspace_flags, kernel_allocation_flags);
-
-	return kernel_allocation_flags;
-}
-
 static int kfd_ioctl_alloc_memory_of_gpu(struct file *filep,
 					struct kfd_process *p, void *data)
 {
@@ -1325,40 +1254,6 @@ static int kfd_ioctl_alloc_memory_of_gpu(struct file *filep,
 	return 0;
 }
 
-/* TODO: Remove this once the Thunk has transitioned to
- * AMDKFD_IOC_ALLOC_MEMORY_OF_GPU */
-static int kfd_ioctl_alloc_memory_of_gpu_new(struct file *filep,
-					struct kfd_process *p, void *data)
-{
-	struct kfd_ioctl_alloc_memory_of_gpu_new_args *new_args = data;
-	struct kfd_ioctl_alloc_memory_of_gpu_args args;
-	struct kfd_dev *dev;
-	uint32_t flags;
-	int ret;
-
-	dev = kfd_device_by_id(new_args->gpu_id);
-	if (dev == NULL)
-		return -EINVAL;
-	/* New ioctl flags match kfd2kgd API */
-	flags = kfd_convert_user_mem_alloction_flags(dev, new_args->flags);
-
-	/* copy input arguments, adjusting the ABI */
-	args.va_addr = new_args->va_addr;
-	args.size = new_args->size;
-	args.handle = new_args->handle;
-	args.mmap_offset = new_args->mmap_offset;
-	args.gpu_id = new_args->gpu_id;
-	args.flags = flags;
-
-	ret = kfd_ioctl_alloc_memory_of_gpu(filep, p, &args);
-
-	/* copy output arguments */
-	new_args->handle = args.handle;
-	new_args->mmap_offset = args.mmap_offset;
-
-	return ret;
-}
-
 static int kfd_ioctl_free_memory_of_gpu(struct file *filep,
 					struct kfd_process *p, void *data)
 {
@@ -1520,21 +1415,6 @@ static int kfd_ioctl_map_memory_to_gpu(struct file *filep,
 	return err;
 }
 
-/* TODO: Remove this once the Thunk has transitioned to
- * AMDKFD_IOC_MAP_MEMORY_TO_GPU */
-static int kfd_ioctl_map_memory_to_gpu_new(struct file *filep,
-					struct kfd_process *p, void *data)
-{
-	struct kfd_ioctl_map_memory_to_gpu_new_args *new_args = data;
-	struct kfd_ioctl_map_memory_to_gpu_args args;
-
-	args.handle = new_args->handle;
-	args.device_ids_array_ptr = (uint64_t)new_args->device_ids_array;
-	args.device_ids_array_size = new_args->device_ids_array_size;
-
-	return kfd_ioctl_map_memory_to_gpu(filep, p, &args);
-}
-
 int kfd_unmap_memory_from_gpu(void *mem, struct kfd_process_device *pdd)
 {
 	int err;
@@ -1635,21 +1515,6 @@ static int kfd_ioctl_unmap_memory_from_gpu(struct file *filep,
 	return err;
 }
 
-/* TODO: Remove this once the Thunk has transitioned to
- * AMDKFD_IOC_UNMAP_MEMORY_FROM_GPU */
-static int kfd_ioctl_unmap_memory_from_gpu_new(struct file *filep,
-					struct kfd_process *p, void *data)
-{
-	struct kfd_ioctl_unmap_memory_from_gpu_new_args *new_args = data;
-	struct kfd_ioctl_unmap_memory_from_gpu_args args;
-
-	args.handle = new_args->handle;
-	args.device_ids_array_ptr = (uint64_t)new_args->device_ids_array;
-	args.device_ids_array_size = new_args->device_ids_array_size;
-
-	return kfd_ioctl_unmap_memory_from_gpu(filep, p, &args);
-}
-
 static int kfd_ioctl_open_graphic_handle(struct file *filep,
 					struct kfd_process *p,
 					void *data)
@@ -2217,15 +2082,6 @@ static const struct amdkfd_ioctl_desc amdkfd_ioctls[] = {
 	AMDKFD_IOCTL_DEF(AMDKFD_IOC_SET_TRAP_HANDLER,
 			kfd_ioctl_set_trap_handler, 0),
 
-	AMDKFD_IOCTL_DEF(AMDKFD_IOC_ALLOC_MEMORY_OF_GPU_NEW,
-				kfd_ioctl_alloc_memory_of_gpu_new, 0),
-
-	AMDKFD_IOCTL_DEF(AMDKFD_IOC_MAP_MEMORY_TO_GPU_NEW,
-				kfd_ioctl_map_memory_to_gpu_new, 0),
-
-	AMDKFD_IOCTL_DEF(AMDKFD_IOC_UNMAP_MEMORY_FROM_GPU_NEW,
-				kfd_ioctl_unmap_memory_from_gpu_new, 0),
-
 	AMDKFD_IOCTL_DEF(AMDKFD_IOC_GET_PROCESS_APERTURES_NEW,
 				kfd_ioctl_get_process_apertures_new, 0),
 
-- 
2.7.4