History

drm/xe/uapi: Kill VM_MADVISE IOCTL

Remove unused IOCTL. Without any userspace using it we need to remove before we can be accepted upstream. At this point we are breaking the compatibility for good, so we don't need to break when we are in-tree. So, let's also use this breakage to sort out the IOCTL entries and fix all the small indentation and line issues.

Rodrigo Vivi committed 3 years ago

Commit ddfa2d61 parent 1a912c97 files · +18 −402Browse files

Unified · Split

7 files
  1. drivers/gpu/drm/xe/Makefile +0 −1
  2. drivers/gpu/drm/xe/xe_bo.c +1 −1
  3. drivers/gpu/drm/xe/xe_bo_types.h +3 −0
  4. drivers/gpu/drm/xe/xe_device.c +3 −5
  5. drivers/gpu/drm/xe/xe_vm_madvise.c +0 −299
  6. drivers/gpu/drm/xe/xe_vm_madvise.h +0 −15
  7. include/uapi/drm/xe_drm.h +11 −81
drivers/gpu/drm/xe/Makefile+0−1
@@ -115,7 +115,6 @@ xe-y += xe_bb.o \ · 114 unmodified lines
115 xe_uc_debugfs.o \115 xe_uc_debugfs.o \
116 xe_uc_fw.o \116 xe_uc_fw.o \
117 xe_vm.o \117 xe_vm.o \
118 xe_vm_madvise.o \
119 xe_wait_user_fence.o \118 xe_wait_user_fence.o \
120 xe_wa.o \119 xe_wa.o \
121 xe_wopcm.o120 xe_wopcm.o
drivers/gpu/drm/xe/xe_bo.c+1−1
@@ -1239,7 +1239,7 @@ struct xe_bo *__xe_bo_create_locked(struct xe_device *xe, struct xe_bo *bo, · 1238 unmodified lines
1239 bo->props.preferred_mem_class = XE_BO_PROPS_INVALID;1239 bo->props.preferred_mem_class = XE_BO_PROPS_INVALID;
1240 bo->props.preferred_gt = XE_BO_PROPS_INVALID;1240 bo->props.preferred_gt = XE_BO_PROPS_INVALID;
1241 bo->props.preferred_mem_type = XE_BO_PROPS_INVALID;1241 bo->props.preferred_mem_type = XE_BO_PROPS_INVALID;
1242 bo->ttm.priority = DRM_XE_VMA_PRIORITY_NORMAL;1242 bo->ttm.priority = XE_BO_PRIORITY_NORMAL;
1243 INIT_LIST_HEAD(&bo->pinned_link);1243 INIT_LIST_HEAD(&bo->pinned_link);
1244#ifdef CONFIG_PROC_FS1244#ifdef CONFIG_PROC_FS
1245 INIT_LIST_HEAD(&bo->client_link);1245 INIT_LIST_HEAD(&bo->client_link);
drivers/gpu/drm/xe/xe_bo_types.h+3−0
@@ -19,6 +19,9 @@ struct xe_vm; · 18 unmodified lines
19 19
20#define XE_BO_MAX_PLACEMENTS 320#define XE_BO_MAX_PLACEMENTS 3
21 21
22/* TODO: To be selected with VM_MADVISE */
23#define XE_BO_PRIORITY_NORMAL 1
24
22/** @xe_bo: XE buffer object */25/** @xe_bo: XE buffer object */
23struct xe_bo {26struct xe_bo {
24 /** @ttm: TTM base buffer object */27 /** @ttm: TTM base buffer object */
drivers/gpu/drm/xe/xe_device.c+3−5
@@ -36,7 +36,6 @@ · 35 unmodified lines
36#include "xe_ttm_stolen_mgr.h"36#include "xe_ttm_stolen_mgr.h"
37#include "xe_ttm_sys_mgr.h"37#include "xe_ttm_sys_mgr.h"
38#include "xe_vm.h"38#include "xe_vm.h"
39#include "xe_vm_madvise.h"
40#include "xe_wait_user_fence.h"39#include "xe_wait_user_fence.h"
41#include "xe_hwmon.h"40#include "xe_hwmon.h"
42 41
@@ -117,18 +116,17 @@ static const struct drm_ioctl_desc xe_ioctls[] = { · 74 unmodified lines
117 DRM_IOCTL_DEF_DRV(XE_VM_CREATE, xe_vm_create_ioctl, DRM_RENDER_ALLOW),116 DRM_IOCTL_DEF_DRV(XE_VM_CREATE, xe_vm_create_ioctl, DRM_RENDER_ALLOW),
118 DRM_IOCTL_DEF_DRV(XE_VM_DESTROY, xe_vm_destroy_ioctl, DRM_RENDER_ALLOW),117 DRM_IOCTL_DEF_DRV(XE_VM_DESTROY, xe_vm_destroy_ioctl, DRM_RENDER_ALLOW),
119 DRM_IOCTL_DEF_DRV(XE_VM_BIND, xe_vm_bind_ioctl, DRM_RENDER_ALLOW),118 DRM_IOCTL_DEF_DRV(XE_VM_BIND, xe_vm_bind_ioctl, DRM_RENDER_ALLOW),
119 DRM_IOCTL_DEF_DRV(XE_EXEC, xe_exec_ioctl, DRM_RENDER_ALLOW),
120 DRM_IOCTL_DEF_DRV(XE_EXEC_QUEUE_CREATE, xe_exec_queue_create_ioctl,120 DRM_IOCTL_DEF_DRV(XE_EXEC_QUEUE_CREATE, xe_exec_queue_create_ioctl,
121 DRM_RENDER_ALLOW),121 DRM_RENDER_ALLOW),
122 DRM_IOCTL_DEF_DRV(XE_EXEC_QUEUE_GET_PROPERTY, xe_exec_queue_get_property_ioctl,
123 DRM_RENDER_ALLOW),
124 DRM_IOCTL_DEF_DRV(XE_EXEC_QUEUE_DESTROY, xe_exec_queue_destroy_ioctl,122 DRM_IOCTL_DEF_DRV(XE_EXEC_QUEUE_DESTROY, xe_exec_queue_destroy_ioctl,
125 DRM_RENDER_ALLOW),123 DRM_RENDER_ALLOW),
126 DRM_IOCTL_DEF_DRV(XE_EXEC, xe_exec_ioctl, DRM_RENDER_ALLOW),
127 DRM_IOCTL_DEF_DRV(XE_EXEC_QUEUE_SET_PROPERTY, xe_exec_queue_set_property_ioctl,124 DRM_IOCTL_DEF_DRV(XE_EXEC_QUEUE_SET_PROPERTY, xe_exec_queue_set_property_ioctl,
128 DRM_RENDER_ALLOW),125 DRM_RENDER_ALLOW),
126 DRM_IOCTL_DEF_DRV(XE_EXEC_QUEUE_GET_PROPERTY, xe_exec_queue_get_property_ioctl,
127 DRM_RENDER_ALLOW),
129 DRM_IOCTL_DEF_DRV(XE_WAIT_USER_FENCE, xe_wait_user_fence_ioctl,128 DRM_IOCTL_DEF_DRV(XE_WAIT_USER_FENCE, xe_wait_user_fence_ioctl,
130 DRM_RENDER_ALLOW),129 DRM_RENDER_ALLOW),
131 DRM_IOCTL_DEF_DRV(XE_VM_MADVISE, xe_vm_madvise_ioctl, DRM_RENDER_ALLOW),
132};130};
133 131
134static const struct file_operations xe_driver_fops = {132static const struct file_operations xe_driver_fops = {
drivers/gpu/drm/xe/xe_vm_madvise.c+0−299
@@ -1,299 +0,0 @@
1// SPDX-License-Identifier: MIT
2/*
3 * Copyright © 2021 Intel Corporation
4 */
5
6#include "xe_vm_madvise.h"
7
8#include <linux/nospec.h>
9
10#include <drm/ttm/ttm_tt.h>
11#include <drm/xe_drm.h>
12
13#include "xe_bo.h"
14#include "xe_vm.h"
15
16static int madvise_preferred_mem_class(struct xe_device *xe, struct xe_vm *vm,
17 struct xe_vma **vmas, int num_vmas,
18 u64 value)
19{
20 int i, err;
21
22 if (XE_IOCTL_DBG(xe, value > XE_MEM_REGION_CLASS_VRAM))
23 return -EINVAL;
24
25 if (XE_IOCTL_DBG(xe, value == XE_MEM_REGION_CLASS_VRAM &&
26 !xe->info.is_dgfx))
27 return -EINVAL;
28
29 for (i = 0; i < num_vmas; ++i) {
30 struct xe_bo *bo;
31
32 bo = xe_vma_bo(vmas[i]);
33
34 err = xe_bo_lock(bo, true);
35 if (err)
36 return err;
37 bo->props.preferred_mem_class = value;
38 xe_bo_placement_for_flags(xe, bo, bo->flags);
39 xe_bo_unlock(bo);
40 }
41
42 return 0;
43}
44
45static int madvise_preferred_gt(struct xe_device *xe, struct xe_vm *vm,
46 struct xe_vma **vmas, int num_vmas, u64 value)
47{
48 int i, err;
49
50 if (XE_IOCTL_DBG(xe, value > xe->info.tile_count))
51 return -EINVAL;
52
53 for (i = 0; i < num_vmas; ++i) {
54 struct xe_bo *bo;
55
56 bo = xe_vma_bo(vmas[i]);
57
58 err = xe_bo_lock(bo, true);
59 if (err)
60 return err;
61 bo->props.preferred_gt = value;
62 xe_bo_placement_for_flags(xe, bo, bo->flags);
63 xe_bo_unlock(bo);
64 }
65
66 return 0;
67}
68
69static int madvise_preferred_mem_class_gt(struct xe_device *xe,
70 struct xe_vm *vm,
71 struct xe_vma **vmas, int num_vmas,
72 u64 value)
73{
74 int i, err;
75 u32 gt_id = upper_32_bits(value);
76 u32 mem_class = lower_32_bits(value);
77
78 if (XE_IOCTL_DBG(xe, mem_class > XE_MEM_REGION_CLASS_VRAM))
79 return -EINVAL;
80
81 if (XE_IOCTL_DBG(xe, mem_class == XE_MEM_REGION_CLASS_VRAM &&
82 !xe->info.is_dgfx))
83 return -EINVAL;
84
85 if (XE_IOCTL_DBG(xe, gt_id > xe->info.tile_count))
86 return -EINVAL;
87
88 for (i = 0; i < num_vmas; ++i) {
89 struct xe_bo *bo;
90
91 bo = xe_vma_bo(vmas[i]);
92
93 err = xe_bo_lock(bo, true);
94 if (err)
95 return err;
96 bo->props.preferred_mem_class = mem_class;
97 bo->props.preferred_gt = gt_id;
98 xe_bo_placement_for_flags(xe, bo, bo->flags);
99 xe_bo_unlock(bo);
100 }
101
102 return 0;
103}
104
105static int madvise_cpu_atomic(struct xe_device *xe, struct xe_vm *vm,
106 struct xe_vma **vmas, int num_vmas, u64 value)
107{
108 int i, err;
109
110 for (i = 0; i < num_vmas; ++i) {
111 struct xe_bo *bo;
112
113 bo = xe_vma_bo(vmas[i]);
114 if (XE_IOCTL_DBG(xe, !(bo->flags & XE_BO_CREATE_SYSTEM_BIT)))
115 return -EINVAL;
116
117 err = xe_bo_lock(bo, true);
118 if (err)
119 return err;
120 bo->props.cpu_atomic = !!value;
121
122 /*
123 * All future CPU accesses must be from system memory only, we
124 * just invalidate the CPU page tables which will trigger a
125 * migration on next access.
126 */
127 if (bo->props.cpu_atomic)
128 ttm_bo_unmap_virtual(&bo->ttm);
129 xe_bo_unlock(bo);
130 }
131
132 return 0;
133}
134
135static int madvise_device_atomic(struct xe_device *xe, struct xe_vm *vm,
136 struct xe_vma **vmas, int num_vmas, u64 value)
137{
138 int i, err;
139
140 for (i = 0; i < num_vmas; ++i) {
141 struct xe_bo *bo;
142
143 bo = xe_vma_bo(vmas[i]);
144 if (XE_IOCTL_DBG(xe, !(bo->flags & XE_BO_CREATE_VRAM0_BIT) &&
145 !(bo->flags & XE_BO_CREATE_VRAM1_BIT)))
146 return -EINVAL;
147
148 err = xe_bo_lock(bo, true);
149 if (err)
150 return err;
151 bo->props.device_atomic = !!value;
152 xe_bo_unlock(bo);
153 }
154
155 return 0;
156}
157
158static int madvise_priority(struct xe_device *xe, struct xe_vm *vm,
159 struct xe_vma **vmas, int num_vmas, u64 value)
160{
161 int i, err;
162
163 if (XE_IOCTL_DBG(xe, value > DRM_XE_VMA_PRIORITY_HIGH))
164 return -EINVAL;
165
166 if (XE_IOCTL_DBG(xe, value == DRM_XE_VMA_PRIORITY_HIGH &&
167 !capable(CAP_SYS_NICE)))
168 return -EPERM;
169
170 for (i = 0; i < num_vmas; ++i) {
171 struct xe_bo *bo;
172
173 bo = xe_vma_bo(vmas[i]);
174
175 err = xe_bo_lock(bo, true);
176 if (err)
177 return err;
178 bo->ttm.priority = value;
179 ttm_bo_move_to_lru_tail(&bo->ttm);
180 xe_bo_unlock(bo);
181 }
182
183 return 0;
184}
185
186static int madvise_pin(struct xe_device *xe, struct xe_vm *vm,
187 struct xe_vma **vmas, int num_vmas, u64 value)
188{
189 drm_warn(&xe->drm, "NIY");
190 return 0;
191}
192
193typedef int (*madvise_func)(struct xe_device *xe, struct xe_vm *vm,
194 struct xe_vma **vmas, int num_vmas, u64 value);
195
196static const madvise_func madvise_funcs[] = {
197 [DRM_XE_VM_MADVISE_PREFERRED_MEM_CLASS] = madvise_preferred_mem_class,
198 [DRM_XE_VM_MADVISE_PREFERRED_GT] = madvise_preferred_gt,
199 [DRM_XE_VM_MADVISE_PREFERRED_MEM_CLASS_GT] =
200 madvise_preferred_mem_class_gt,
201 [DRM_XE_VM_MADVISE_CPU_ATOMIC] = madvise_cpu_atomic,
202 [DRM_XE_VM_MADVISE_DEVICE_ATOMIC] = madvise_device_atomic,
203 [DRM_XE_VM_MADVISE_PRIORITY] = madvise_priority,
204 [DRM_XE_VM_MADVISE_PIN] = madvise_pin,
205};
206
207static struct xe_vma **
208get_vmas(struct xe_vm *vm, int *num_vmas, u64 addr, u64 range)
209{
210 struct xe_vma **vmas, **__vmas;
211 struct drm_gpuva *gpuva;
212 int max_vmas = 8;
213
214 lockdep_assert_held(&vm->lock);
215
216 vmas = kmalloc(max_vmas * sizeof(*vmas), GFP_KERNEL);
217 if (!vmas)
218 return NULL;
219
220 drm_gpuvm_for_each_va_range(gpuva, &vm->gpuvm, addr, addr + range) {
221 struct xe_vma *vma = gpuva_to_vma(gpuva);
222
223 if (xe_vma_is_userptr(vma))
224 continue;
225
226 if (*num_vmas == max_vmas) {
227 max_vmas <<= 1;
228 __vmas = krealloc(vmas, max_vmas * sizeof(*vmas),
229 GFP_KERNEL);
230 if (!__vmas)
231 return NULL;
232 vmas = __vmas;
233 }
234
235 vmas[*num_vmas] = vma;
236 *num_vmas += 1;
237 }
238
239 return vmas;
240}
241
242int xe_vm_madvise_ioctl(struct drm_device *dev, void *data,
243 struct drm_file *file)
244{
245 struct xe_device *xe = to_xe_device(dev);
246 struct xe_file *xef = to_xe_file(file);
247 struct drm_xe_vm_madvise *args = data;
248 struct xe_vm *vm;
249 struct xe_vma **vmas = NULL;
250 int num_vmas = 0, err = 0, idx;
251
252 if (XE_IOCTL_DBG(xe, args->extensions) ||
253 XE_IOCTL_DBG(xe, args->pad || args->pad2) ||
254 XE_IOCTL_DBG(xe, args->reserved[0] || args->reserved[1]))
255 return -EINVAL;
256
257 if (XE_IOCTL_DBG(xe, args->property > ARRAY_SIZE(madvise_funcs)))
258 return -EINVAL;
259
260 vm = xe_vm_lookup(xef, args->vm_id);
261 if (XE_IOCTL_DBG(xe, !vm))
262 return -EINVAL;
263
264 if (XE_IOCTL_DBG(xe, !xe_vm_in_fault_mode(vm))) {
265 err = -EINVAL;
266 goto put_vm;
267 }
268
269 down_read(&vm->lock);
270
271 if (XE_IOCTL_DBG(xe, xe_vm_is_closed_or_banned(vm))) {
272 err = -ENOENT;
273 goto unlock_vm;
274 }
275
276 vmas = get_vmas(vm, &num_vmas, args->addr, args->range);
277 if (XE_IOCTL_DBG(xe, err))
278 goto unlock_vm;
279
280 if (XE_IOCTL_DBG(xe, !vmas)) {
281 err = -ENOMEM;
282 goto unlock_vm;
283 }
284
285 if (XE_IOCTL_DBG(xe, !num_vmas)) {
286 err = -EINVAL;
287 goto unlock_vm;
288 }
289
290 idx = array_index_nospec(args->property, ARRAY_SIZE(madvise_funcs));
291 err = madvise_funcs[idx](xe, vm, vmas, num_vmas, args->value);
292
293unlock_vm:
294 up_read(&vm->lock);
295put_vm:
296 xe_vm_put(vm);
297 kfree(vmas);
298 return err;
299}
drivers/gpu/drm/xe/xe_vm_madvise.h+0−15
@@ -1,15 +0,0 @@
1/* SPDX-License-Identifier: MIT */
2/*
3 * Copyright © 2021 Intel Corporation
4 */
5
6#ifndef _XE_VM_MADVISE_H_
7#define _XE_VM_MADVISE_H_
8
9struct drm_device;
10struct drm_file;
11
12int xe_vm_madvise_ioctl(struct drm_device *dev, void *data,
13 struct drm_file *file);
14
15#endif
include/uapi/drm/xe_drm.h+11−81
@@ -103,28 +103,26 @@ struct xe_user_extension { · 102 unmodified lines
103#define DRM_XE_VM_CREATE 0x03103#define DRM_XE_VM_CREATE 0x03
104#define DRM_XE_VM_DESTROY 0x04104#define DRM_XE_VM_DESTROY 0x04
105#define DRM_XE_VM_BIND 0x05105#define DRM_XE_VM_BIND 0x05
106#define DRM_XE_EXEC_QUEUE_CREATE 0x06106#define DRM_XE_EXEC 0x06
107#define DRM_XE_EXEC_QUEUE_DESTROY 0x07107#define DRM_XE_EXEC_QUEUE_CREATE 0x07
108#define DRM_XE_EXEC 0x08108#define DRM_XE_EXEC_QUEUE_DESTROY 0x08
109#define DRM_XE_EXEC_QUEUE_SET_PROPERTY 0x09109#define DRM_XE_EXEC_QUEUE_SET_PROPERTY 0x09
110#define DRM_XE_WAIT_USER_FENCE 0x0a110#define DRM_XE_EXEC_QUEUE_GET_PROPERTY 0x0a
111#define DRM_XE_VM_MADVISE 0x0b111#define DRM_XE_WAIT_USER_FENCE 0x0b
112#define DRM_XE_EXEC_QUEUE_GET_PROPERTY 0x0c
113
114/* Must be kept compact -- no holes */112/* Must be kept compact -- no holes */
113
115#define DRM_IOCTL_XE_DEVICE_QUERY DRM_IOWR(DRM_COMMAND_BASE + DRM_XE_DEVICE_QUERY, struct drm_xe_device_query)114#define DRM_IOCTL_XE_DEVICE_QUERY DRM_IOWR(DRM_COMMAND_BASE + DRM_XE_DEVICE_QUERY, struct drm_xe_device_query)
116#define DRM_IOCTL_XE_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_XE_GEM_CREATE, struct drm_xe_gem_create)115#define DRM_IOCTL_XE_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_XE_GEM_CREATE, struct drm_xe_gem_create)
117#define DRM_IOCTL_XE_GEM_MMAP_OFFSET DRM_IOWR(DRM_COMMAND_BASE + DRM_XE_GEM_MMAP_OFFSET, struct drm_xe_gem_mmap_offset)116#define DRM_IOCTL_XE_GEM_MMAP_OFFSET DRM_IOWR(DRM_COMMAND_BASE + DRM_XE_GEM_MMAP_OFFSET, struct drm_xe_gem_mmap_offset)
118#define DRM_IOCTL_XE_VM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_XE_VM_CREATE, struct drm_xe_vm_create)117#define DRM_IOCTL_XE_VM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_XE_VM_CREATE, struct drm_xe_vm_create)
119#define DRM_IOCTL_XE_VM_DESTROY DRM_IOW(DRM_COMMAND_BASE + DRM_XE_VM_DESTROY, struct drm_xe_vm_destroy)118#define DRM_IOCTL_XE_VM_DESTROY DRM_IOW(DRM_COMMAND_BASE + DRM_XE_VM_DESTROY, struct drm_xe_vm_destroy)
120#define DRM_IOCTL_XE_VM_BIND DRM_IOW(DRM_COMMAND_BASE + DRM_XE_VM_BIND, struct drm_xe_vm_bind)119#define DRM_IOCTL_XE_VM_BIND DRM_IOW(DRM_COMMAND_BASE + DRM_XE_VM_BIND, struct drm_xe_vm_bind)
120#define DRM_IOCTL_XE_EXEC DRM_IOW(DRM_COMMAND_BASE + DRM_XE_EXEC, struct drm_xe_exec)
121#define DRM_IOCTL_XE_EXEC_QUEUE_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_XE_EXEC_QUEUE_CREATE, struct drm_xe_exec_queue_create)121#define DRM_IOCTL_XE_EXEC_QUEUE_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_XE_EXEC_QUEUE_CREATE, struct drm_xe_exec_queue_create)
122#define DRM_IOCTL_XE_EXEC_QUEUE_DESTROY DRM_IOW(DRM_COMMAND_BASE + DRM_XE_EXEC_QUEUE_DESTROY, struct drm_xe_exec_queue_destroy)
123#define DRM_IOCTL_XE_EXEC_QUEUE_SET_PROPERTY DRM_IOW(DRM_COMMAND_BASE + DRM_XE_EXEC_QUEUE_SET_PROPERTY, struct drm_xe_exec_queue_set_property)
122#define DRM_IOCTL_XE_EXEC_QUEUE_GET_PROPERTY DRM_IOWR(DRM_COMMAND_BASE + DRM_XE_EXEC_QUEUE_GET_PROPERTY, struct drm_xe_exec_queue_get_property)124#define DRM_IOCTL_XE_EXEC_QUEUE_GET_PROPERTY DRM_IOWR(DRM_COMMAND_BASE + DRM_XE_EXEC_QUEUE_GET_PROPERTY, struct drm_xe_exec_queue_get_property)
123#define DRM_IOCTL_XE_EXEC_QUEUE_DESTROY DRM_IOW(DRM_COMMAND_BASE + DRM_XE_EXEC_QUEUE_DESTROY, struct drm_xe_exec_queue_destroy)
124#define DRM_IOCTL_XE_EXEC DRM_IOW(DRM_COMMAND_BASE + DRM_XE_EXEC, struct drm_xe_exec)
125#define DRM_IOCTL_XE_EXEC_QUEUE_SET_PROPERTY DRM_IOW(DRM_COMMAND_BASE + DRM_XE_EXEC_QUEUE_SET_PROPERTY, struct drm_xe_exec_queue_set_property)
126#define DRM_IOCTL_XE_WAIT_USER_FENCE DRM_IOWR(DRM_COMMAND_BASE + DRM_XE_WAIT_USER_FENCE, struct drm_xe_wait_user_fence)125#define DRM_IOCTL_XE_WAIT_USER_FENCE DRM_IOWR(DRM_COMMAND_BASE + DRM_XE_WAIT_USER_FENCE, struct drm_xe_wait_user_fence)
127#define DRM_IOCTL_XE_VM_MADVISE DRM_IOW(DRM_COMMAND_BASE + DRM_XE_VM_MADVISE, struct drm_xe_vm_madvise)
128 126
129/** struct drm_xe_engine_class_instance - instance of an engine class */127/** struct drm_xe_engine_class_instance - instance of an engine class */
130struct drm_xe_engine_class_instance {128struct drm_xe_engine_class_instance {
@@ -978,74 +976,6 @@ struct drm_xe_wait_user_fence { · 847 unmodified lines
978 __u64 reserved[2];976 __u64 reserved[2];
979};977};
980 978
981struct drm_xe_vm_madvise {
982 /** @extensions: Pointer to the first extension struct, if any */
983 __u64 extensions;
984
985 /** @vm_id: The ID VM in which the VMA exists */
986 __u32 vm_id;
987
988 /** @pad: MBZ */
989 __u32 pad;
990
991 /** @range: Number of bytes in the VMA */
992 __u64 range;
993
994 /** @addr: Address of the VMA to operation on */
995 __u64 addr;
996
997 /*
998 * Setting the preferred location will trigger a migrate of the VMA
999 * backing store to new location if the backing store is already
1000 * allocated.
1001 *
1002 * For DRM_XE_VM_MADVISE_PREFERRED_MEM_CLASS usage, see enum
1003 * drm_xe_memory_class.
1004 */
1005#define DRM_XE_VM_MADVISE_PREFERRED_MEM_CLASS 0
1006#define DRM_XE_VM_MADVISE_PREFERRED_GT 1
1007 /*
1008 * In this case lower 32 bits are mem class, upper 32 are GT.
1009 * Combination provides a single IOCTL plus migrate VMA to preferred
1010 * location.
1011 */
1012#define DRM_XE_VM_MADVISE_PREFERRED_MEM_CLASS_GT 2
1013 /*
1014 * The CPU will do atomic memory operations to this VMA. Must be set on
1015 * some devices for atomics to behave correctly.
1016 */
1017#define DRM_XE_VM_MADVISE_CPU_ATOMIC 3
1018 /*
1019 * The device will do atomic memory operations to this VMA. Must be set
1020 * on some devices for atomics to behave correctly.
1021 */
1022#define DRM_XE_VM_MADVISE_DEVICE_ATOMIC 4
1023 /*
1024 * Priority WRT to eviction (moving from preferred memory location due
1025 * to memory pressure). The lower the priority, the more likely to be
1026 * evicted.
1027 */
1028#define DRM_XE_VM_MADVISE_PRIORITY 5
1029#define DRM_XE_VMA_PRIORITY_LOW 0
1030 /* Default */
1031#define DRM_XE_VMA_PRIORITY_NORMAL 1
1032 /* Must be user with elevated privileges */
1033#define DRM_XE_VMA_PRIORITY_HIGH 2
1034 /* Pin the VMA in memory, must be user with elevated privileges */
1035#define DRM_XE_VM_MADVISE_PIN 6
1036 /** @property: property to set */
1037 __u32 property;
1038
1039 /** @pad2: MBZ */
1040 __u32 pad2;
1041
1042 /** @value: property value */
1043 __u64 value;
1044
1045 /** @reserved: Reserved */
1046 __u64 reserved[2];
1047};
1048
1049/**979/**
1050 * DOC: XE PMU event config IDs980 * DOC: XE PMU event config IDs
1051 *981 *

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t