Debian Codegraph @

include/drm-uapi/amdgpu_drm.h

raw
1 /* amdgpu_drm.h -- Public header for the amdgpu driver -*- linux-c -*-
2 *
3 * Copyright 2000 Precision Insight, Inc., Cedar Park, Texas.
4 * Copyright 2000 VA Linux Systems, Inc., Fremont, California.
5 * Copyright 2002 Tungsten Graphics, Inc., Cedar Park, Texas.
6 * Copyright 2014 Advanced Micro Devices, Inc.
7 *
8 * Permission is hereby granted, free of charge, to any person obtaining a
9 * copy of this software and associated documentation files (the "Software"),
10 * to deal in the Software without restriction, including without limitation
11 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
12 * and/or sell copies of the Software, and to permit persons to whom the
13 * Software is furnished to do so, subject to the following conditions:
14 *
15 * The above copyright notice and this permission notice shall be included in
16 * all copies or substantial portions of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
21 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
22 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
23 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
24 * OTHER DEALINGS IN THE SOFTWARE.
25 *
26 * Authors:
27 * Kevin E. Martin <[email protected]>
28 * Gareth Hughes <[email protected]>
29 * Keith Whitwell <[email protected]>
30 */
31
32 #ifndef __AMDGPU_DRM_H__
33 #define __AMDGPU_DRM_H__
34
35 #include "drm.h"
36
37 #if defined(__cplusplus)
38 extern "C" {
39 #endif
40
41 #define DRM_AMDGPU_GEM_CREATE 0x00
42 #define DRM_AMDGPU_GEM_MMAP 0x01
43 #define DRM_AMDGPU_CTX 0x02
44 #define DRM_AMDGPU_BO_LIST 0x03
45 #define DRM_AMDGPU_CS 0x04
46 #define DRM_AMDGPU_INFO 0x05
47 #define DRM_AMDGPU_GEM_METADATA 0x06
48 #define DRM_AMDGPU_GEM_WAIT_IDLE 0x07
49 #define DRM_AMDGPU_GEM_VA 0x08
50 #define DRM_AMDGPU_WAIT_CS 0x09
51 #define DRM_AMDGPU_GEM_OP 0x10
52 #define DRM_AMDGPU_GEM_USERPTR 0x11
53 #define DRM_AMDGPU_WAIT_FENCES 0x12
54 #define DRM_AMDGPU_VM 0x13
55 #define DRM_AMDGPU_FENCE_TO_HANDLE 0x14
56 #define DRM_AMDGPU_SCHED 0x15
57 #define DRM_AMDGPU_USERQ 0x16
58 #define DRM_AMDGPU_USERQ_SIGNAL 0x17
59 #define DRM_AMDGPU_USERQ_WAIT 0x18
60
61 #define DRM_IOCTL_AMDGPU_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_CREATE, union drm_amdgpu_gem_create)
62 #define DRM_IOCTL_AMDGPU_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_MMAP, union drm_amdgpu_gem_mmap)
63 #define DRM_IOCTL_AMDGPU_CTX DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_CTX, union drm_amdgpu_ctx)
64 #define DRM_IOCTL_AMDGPU_BO_LIST DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_BO_LIST, union drm_amdgpu_bo_list)
65 #define DRM_IOCTL_AMDGPU_CS DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_CS, union drm_amdgpu_cs)
66 #define DRM_IOCTL_AMDGPU_INFO DRM_IOW(DRM_COMMAND_BASE + DRM_AMDGPU_INFO, struct drm_amdgpu_info)
67 #define DRM_IOCTL_AMDGPU_GEM_METADATA DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_METADATA, struct drm_amdgpu_gem_metadata)
68 #define DRM_IOCTL_AMDGPU_GEM_WAIT_IDLE DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_WAIT_IDLE, union drm_amdgpu_gem_wait_idle)
69 #define DRM_IOCTL_AMDGPU_GEM_VA DRM_IOW(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_VA, struct drm_amdgpu_gem_va)
70 #define DRM_IOCTL_AMDGPU_WAIT_CS DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_WAIT_CS, union drm_amdgpu_wait_cs)
71 #define DRM_IOCTL_AMDGPU_GEM_OP DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_OP, struct drm_amdgpu_gem_op)
72 #define DRM_IOCTL_AMDGPU_GEM_USERPTR DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_USERPTR, struct drm_amdgpu_gem_userptr)
73 #define DRM_IOCTL_AMDGPU_WAIT_FENCES DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_WAIT_FENCES, union drm_amdgpu_wait_fences)
74 #define DRM_IOCTL_AMDGPU_VM DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_VM, union drm_amdgpu_vm)
75 #define DRM_IOCTL_AMDGPU_FENCE_TO_HANDLE DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_FENCE_TO_HANDLE, union drm_amdgpu_fence_to_handle)
76 #define DRM_IOCTL_AMDGPU_SCHED DRM_IOW(DRM_COMMAND_BASE + DRM_AMDGPU_SCHED, union drm_amdgpu_sched)
77 #define DRM_IOCTL_AMDGPU_USERQ DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_USERQ, union drm_amdgpu_userq)
78 #define DRM_IOCTL_AMDGPU_USERQ_SIGNAL DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_USERQ_SIGNAL, struct drm_amdgpu_userq_signal)
79 #define DRM_IOCTL_AMDGPU_USERQ_WAIT DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_USERQ_WAIT, struct drm_amdgpu_userq_wait)
80
81 /**
82 * DOC: memory domains
83 *
84 * %AMDGPU_GEM_DOMAIN_CPU System memory that is not GPU accessible.
85 * Memory in this pool could be swapped out to disk if there is pressure.
86 *
87 * %AMDGPU_GEM_DOMAIN_GTT GPU accessible system memory, mapped into the
88 * GPU's virtual address space via gart. Gart memory linearizes non-contiguous
89 * pages of system memory, allows GPU access system memory in a linearized
90 * fashion.
91 *
92 * %AMDGPU_GEM_DOMAIN_VRAM Local video memory. For APUs, it is memory
93 * carved out by the BIOS.
94 *
95 * %AMDGPU_GEM_DOMAIN_GDS Global on-chip data storage used to share data
96 * across shader threads.
97 *
98 * %AMDGPU_GEM_DOMAIN_GWS Global wave sync, used to synchronize the
99 * execution of all the waves on a device.
100 *
101 * %AMDGPU_GEM_DOMAIN_OA Ordered append, used by 3D or Compute engines
102 * for appending data.
103 *
104 * %AMDGPU_GEM_DOMAIN_DOORBELL Doorbell. It is an MMIO region for
105 * signalling user mode queues.
106 */
107 #define AMDGPU_GEM_DOMAIN_CPU 0x1
108 #define AMDGPU_GEM_DOMAIN_GTT 0x2
109 #define AMDGPU_GEM_DOMAIN_VRAM 0x4
110 #define AMDGPU_GEM_DOMAIN_GDS 0x8
111 #define AMDGPU_GEM_DOMAIN_GWS 0x10
112 #define AMDGPU_GEM_DOMAIN_OA 0x20
113 #define AMDGPU_GEM_DOMAIN_DOORBELL 0x40
114 #define AMDGPU_GEM_DOMAIN_MASK (AMDGPU_GEM_DOMAIN_CPU | \
115 AMDGPU_GEM_DOMAIN_GTT | \
116 AMDGPU_GEM_DOMAIN_VRAM | \
117 AMDGPU_GEM_DOMAIN_GDS | \
118 AMDGPU_GEM_DOMAIN_GWS | \
119 AMDGPU_GEM_DOMAIN_OA | \
120 AMDGPU_GEM_DOMAIN_DOORBELL)
121
122 /* Flag that CPU access will be required for the case of VRAM domain */
123 #define AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED (1 << 0)
124 /* Flag that CPU access will not work, this VRAM domain is invisible */
125 #define AMDGPU_GEM_CREATE_NO_CPU_ACCESS (1 << 1)
126 /* Flag that USWC attributes should be used for GTT */
127 #define AMDGPU_GEM_CREATE_CPU_GTT_USWC (1 << 2)
128 /* Flag that the memory should be in VRAM and cleared */
129 #define AMDGPU_GEM_CREATE_VRAM_CLEARED (1 << 3)
130 /* Flag that allocating the BO should use linear VRAM */
131 #define AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS (1 << 5)
132 /* Flag that BO is always valid in this VM */
133 #define AMDGPU_GEM_CREATE_VM_ALWAYS_VALID (1 << 6)
134 /* Flag that BO sharing will be explicitly synchronized */
135 #define AMDGPU_GEM_CREATE_EXPLICIT_SYNC (1 << 7)
136 /* Flag that indicates allocating MQD gart on GFX9, where the mtype
137 * for the second page onward should be set to NC. It should never
138 * be used by user space applications.
139 */
140 #define AMDGPU_GEM_CREATE_CP_MQD_GFX9 (1 << 8)
141 /* Flag that BO may contain sensitive data that must be wiped before
142 * releasing the memory
143 */
144 #define AMDGPU_GEM_CREATE_VRAM_WIPE_ON_RELEASE (1 << 9)
145 /* Flag that BO will be encrypted and that the TMZ bit should be
146 * set in the PTEs when mapping this buffer via GPUVM or
147 * accessing it with various hw blocks
148 */
149 #define AMDGPU_GEM_CREATE_ENCRYPTED (1 << 10)
150 /* Flag that BO will be used only in preemptible context, which does
151 * not require GTT memory accounting
152 */
153 #define AMDGPU_GEM_CREATE_PREEMPTIBLE (1 << 11)
154 /* Flag that BO can be discarded under memory pressure without keeping the
155 * content.
156 */
157 #define AMDGPU_GEM_CREATE_DISCARDABLE (1 << 12)
158 /* Flag that BO is shared coherently between multiple devices or CPU threads.
159 * May depend on GPU instructions to flush caches to system scope explicitly.
160 *
161 * This influences the choice of MTYPE in the PTEs on GFXv9 and later GPUs and
162 * may override the MTYPE selected in AMDGPU_VA_OP_MAP.
163 */
164 #define AMDGPU_GEM_CREATE_COHERENT (1 << 13)
165 /* Flag that BO should not be cached by GPU. Coherent without having to flush
166 * GPU caches explicitly
167 *
168 * This influences the choice of MTYPE in the PTEs on GFXv9 and later GPUs and
169 * may override the MTYPE selected in AMDGPU_VA_OP_MAP.
170 */
171 #define AMDGPU_GEM_CREATE_UNCACHED (1 << 14)
172 /* Flag that BO should be coherent across devices when using device-level
173 * atomics. May depend on GPU instructions to flush caches to device scope
174 * explicitly, promoting them to system scope automatically.
175 *
176 * This influences the choice of MTYPE in the PTEs on GFXv9 and later GPUs and
177 * may override the MTYPE selected in AMDGPU_VA_OP_MAP.
178 */
179 #define AMDGPU_GEM_CREATE_EXT_COHERENT (1 << 15)
180 /* Set PTE.D and recompress during GTT->VRAM moves according to TILING flags. */
181 #define AMDGPU_GEM_CREATE_GFX12_DCC (1 << 16)
182
183 struct drm_amdgpu_gem_create_in {
184 /** the requested memory size */
185 __u64 bo_size;
186 /** physical start_addr alignment in bytes for some HW requirements */
187 __u64 alignment;
188 /** the requested memory domains */
189 __u64 domains;
190 /** allocation flags */
191 __u64 domain_flags;
192 };
193
194 struct drm_amdgpu_gem_create_out {
195 /** returned GEM object handle */
196 __u32 handle;
197 __u32 _pad;
198 };
199
200 union drm_amdgpu_gem_create {
201 struct drm_amdgpu_gem_create_in in;
202 struct drm_amdgpu_gem_create_out out;
203 };
204
205 /** Opcode to create new residency list. */
206 #define AMDGPU_BO_LIST_OP_CREATE 0
207 /** Opcode to destroy previously created residency list */
208 #define AMDGPU_BO_LIST_OP_DESTROY 1
209 /** Opcode to update resource information in the list */
210 #define AMDGPU_BO_LIST_OP_UPDATE 2
211
212 struct drm_amdgpu_bo_list_in {
213 /** Type of operation */
214 __u32 operation;
215 /** Handle of list or 0 if we want to create one */
216 __u32 list_handle;
217 /** Number of BOs in list */
218 __u32 bo_number;
219 /** Size of each element describing BO */
220 __u32 bo_info_size;
221 /** Pointer to array describing BOs */
222 __u64 bo_info_ptr;
223 };
224
225 struct drm_amdgpu_bo_list_entry {
226 /** Handle of BO */
227 __u32 bo_handle;
228 /** New (if specified) BO priority to be used during migration */
229 __u32 bo_priority;
230 };
231
232 struct drm_amdgpu_bo_list_out {
233 /** Handle of resource list */
234 __u32 list_handle;
235 __u32 _pad;
236 };
237
238 union drm_amdgpu_bo_list {
239 struct drm_amdgpu_bo_list_in in;
240 struct drm_amdgpu_bo_list_out out;
241 };
242
243 /* context related */
244 #define AMDGPU_CTX_OP_ALLOC_CTX 1
245 #define AMDGPU_CTX_OP_FREE_CTX 2
246 #define AMDGPU_CTX_OP_QUERY_STATE 3
247 #define AMDGPU_CTX_OP_QUERY_STATE2 4
248 #define AMDGPU_CTX_OP_GET_STABLE_PSTATE 5
249 #define AMDGPU_CTX_OP_SET_STABLE_PSTATE 6
250
251 /* GPU reset status */
252 #define AMDGPU_CTX_NO_RESET 0
253 /* this the context caused it */
254 #define AMDGPU_CTX_GUILTY_RESET 1
255 /* some other context caused it */
256 #define AMDGPU_CTX_INNOCENT_RESET 2
257 /* unknown cause */
258 #define AMDGPU_CTX_UNKNOWN_RESET 3
259
260 /* indicate gpu reset occurred after ctx created */
261 #define AMDGPU_CTX_QUERY2_FLAGS_RESET (1<<0)
262 /* indicate vram lost occurred after ctx created */
263 #define AMDGPU_CTX_QUERY2_FLAGS_VRAMLOST (1<<1)
264 /* indicate some job from this context once cause gpu hang */
265 #define AMDGPU_CTX_QUERY2_FLAGS_GUILTY (1<<2)
266 /* indicate some errors are detected by RAS */
267 #define AMDGPU_CTX_QUERY2_FLAGS_RAS_CE (1<<3)
268 #define AMDGPU_CTX_QUERY2_FLAGS_RAS_UE (1<<4)
269 /* indicate that the reset hasn't completed yet */
270 #define AMDGPU_CTX_QUERY2_FLAGS_RESET_IN_PROGRESS (1<<5)
271
272 /* Context priority level */
273 #define AMDGPU_CTX_PRIORITY_UNSET -2048
274 #define AMDGPU_CTX_PRIORITY_VERY_LOW -1023
275 #define AMDGPU_CTX_PRIORITY_LOW -512
276 #define AMDGPU_CTX_PRIORITY_NORMAL 0
277 /*
278 * When used in struct drm_amdgpu_ctx_in, a priority above NORMAL requires
279 * CAP_SYS_NICE or DRM_MASTER
280 */
281 #define AMDGPU_CTX_PRIORITY_HIGH 512
282 #define AMDGPU_CTX_PRIORITY_VERY_HIGH 1023
283
284 /* select a stable profiling pstate for perfmon tools */
285 #define AMDGPU_CTX_STABLE_PSTATE_FLAGS_MASK 0xf
286 #define AMDGPU_CTX_STABLE_PSTATE_NONE 0
287 #define AMDGPU_CTX_STABLE_PSTATE_STANDARD 1
288 #define AMDGPU_CTX_STABLE_PSTATE_MIN_SCLK 2
289 #define AMDGPU_CTX_STABLE_PSTATE_MIN_MCLK 3
290 #define AMDGPU_CTX_STABLE_PSTATE_PEAK 4
291
292 struct drm_amdgpu_ctx_in {
293 /** AMDGPU_CTX_OP_* */
294 __u32 op;
295 /** Flags */
296 __u32 flags;
297 __u32 ctx_id;
298 /** AMDGPU_CTX_PRIORITY_* */
299 __s32 priority;
300 };
301
302 union drm_amdgpu_ctx_out {
303 struct {
304 __u32 ctx_id;
305 __u32 _pad;
306 } alloc;
307
308 struct {
309 /** For future use, no flags defined so far */
310 __u64 flags;
311 /** Number of resets caused by this context so far. */
312 __u32 hangs;
313 /** Reset status since the last call of the ioctl. */
314 __u32 reset_status;
315 } state;
316
317 struct {
318 __u32 flags;
319 __u32 _pad;
320 } pstate;
321 };
322
323 union drm_amdgpu_ctx {
324 struct drm_amdgpu_ctx_in in;
325 union drm_amdgpu_ctx_out out;
326 };
327
328 /* user queue IOCTL operations */
329 #define AMDGPU_USERQ_OP_CREATE 1
330 #define AMDGPU_USERQ_OP_FREE 2
331
332 /* queue priority levels */
333 #define AMDGPU_USERQ_CREATE_FLAGS_QUEUE_PRIORITY_MASK 0x3
334 #define AMDGPU_USERQ_CREATE_FLAGS_QUEUE_PRIORITY_SHIFT 0
335 #define AMDGPU_USERQ_CREATE_FLAGS_QUEUE_PRIORITY_NORMAL_LOW 0
336 #define AMDGPU_USERQ_CREATE_FLAGS_QUEUE_PRIORITY_LOW 1
337 #define AMDGPU_USERQ_CREATE_FLAGS_QUEUE_PRIORITY_NORMAL_HIGH 2
338 #define AMDGPU_USERQ_CREATE_FLAGS_QUEUE_PRIORITY_HIGH 3 /* admin only */
339 /* for queues that need access to protected content */
340 #define AMDGPU_USERQ_CREATE_FLAGS_QUEUE_SECURE (1 << 2)
341
342 /*
343 * This structure is a container to pass input configuration
344 * info for all supported userqueue related operations.
345 * For operation AMDGPU_USERQ_OP_CREATE: user is expected
346 * to set all fields, excep the parameter 'queue_id'.
347 * For operation AMDGPU_USERQ_OP_FREE: the only input parameter expected
348 * to be set is 'queue_id', eveything else is ignored.
349 */
350 struct drm_amdgpu_userq_in {
351 /** AMDGPU_USERQ_OP_* */
352 __u32 op;
353 /** Queue id passed for operation USERQ_OP_FREE */
354 __u32 queue_id;
355 /** the target GPU engine to execute workload (AMDGPU_HW_IP_*) */
356 __u32 ip_type;
357 /**
358 * @doorbell_handle: the handle of doorbell GEM object
359 * associated to this userqueue client.
360 */
361 __u32 doorbell_handle;
362 /**
363 * @doorbell_offset: 32-bit offset of the doorbell in the doorbell bo.
364 * Kernel will generate absolute doorbell offset using doorbell_handle
365 * and doorbell_offset in the doorbell bo.
366 */
367 __u32 doorbell_offset;
368 __u32 flags;
369 /**
370 * @queue_va: Virtual address of the GPU memory which holds the queue
371 * object. The queue holds the workload packets.
372 */
373 __u64 queue_va;
374 /**
375 * @queue_size: Size of the queue in bytes, this needs to be 256-byte
376 * aligned.
377 */
378 __u64 queue_size;
379 /**
380 * @rptr_va : Virtual address of the GPU memory which holds the ring RPTR.
381 * This object must be at least 8 byte in size and aligned to 8-byte offset.
382 */
383 __u64 rptr_va;
384 /**
385 * @wptr_va : Virtual address of the GPU memory which holds the ring WPTR.
386 * This object must be at least 8 byte in size and aligned to 8-byte offset.
387 *
388 * Queue, RPTR and WPTR can come from the same object, as long as the size
389 * and alignment related requirements are met.
390 */
391 __u64 wptr_va;
392 /**
393 * @mqd: MQD (memory queue descriptor) is a set of parameters which allow
394 * the GPU to uniquely define and identify a usermode queue.
395 *
396 * MQD data can be of different size for different GPU IP/engine and
397 * their respective versions/revisions, so this points to a __u64 *
398 * which holds IP specific MQD of this usermode queue.
399 */
400 __u64 mqd;
401 /**
402 * @size: size of MQD data in bytes, it must match the MQD structure
403 * size of the respective engine/revision defined in UAPI for ex, for
404 * gfx11 workloads, size = sizeof(drm_amdgpu_userq_mqd_gfx11).
405 */
406 __u64 mqd_size;
407 };
408
409 /* The structure to carry output of userqueue ops */
410 struct drm_amdgpu_userq_out {
411 /**
412 * For operation AMDGPU_USERQ_OP_CREATE: This field contains a unique
413 * queue ID to represent the newly created userqueue in the system, otherwise
414 * it should be ignored.
415 */
416 __u32 queue_id;
417 __u32 _pad;
418 };
419
420 union drm_amdgpu_userq {
421 struct drm_amdgpu_userq_in in;
422 struct drm_amdgpu_userq_out out;
423 };
424
425 /* GFX V11 IP specific MQD parameters */
426 struct drm_amdgpu_userq_mqd_gfx11 {
427 /**
428 * @shadow_va: Virtual address of the GPU memory to hold the shadow buffer.
429 * Use AMDGPU_INFO_IOCTL to find the exact size of the object.
430 */
431 __u64 shadow_va;
432 /**
433 * @csa_va: Virtual address of the GPU memory to hold the CSA buffer.
434 * Use AMDGPU_INFO_IOCTL to find the exact size of the object.
435 */
436 __u64 csa_va;
437 };
438
439 /* GFX V11 SDMA IP specific MQD parameters */
440 struct drm_amdgpu_userq_mqd_sdma_gfx11 {
441 /**
442 * @csa_va: Virtual address of the GPU memory to hold the CSA buffer.
443 * This must be a from a separate GPU object, and use AMDGPU_INFO IOCTL
444 * to get the size.
445 */
446 __u64 csa_va;
447 };
448
449 /* GFX V11 Compute IP specific MQD parameters */
450 struct drm_amdgpu_userq_mqd_compute_gfx11 {
451 /**
452 * @eop_va: Virtual address of the GPU memory to hold the EOP buffer.
453 * This must be a from a separate GPU object, and use AMDGPU_INFO IOCTL
454 * to get the size.
455 */
456 __u64 eop_va;
457 };
458
459 /* userq signal/wait ioctl */
460 struct drm_amdgpu_userq_signal {
461 /**
462 * @queue_id: Queue handle used by the userq fence creation function
463 * to retrieve the WPTR.
464 */
465 __u32 queue_id;
466 __u32 pad;
467 /**
468 * @syncobj_handles: The list of syncobj handles submitted by the user queue
469 * job to be signaled.
470 */
471 __u64 syncobj_handles;
472 /**
473 * @num_syncobj_handles: A count that represents the number of syncobj handles in
474 * @syncobj_handles.
475 */
476 __u64 num_syncobj_handles;
477 /**
478 * @bo_read_handles: The list of BO handles that the submitted user queue job
479 * is using for read only. This will update BO fences in the kernel.
480 */
481 __u64 bo_read_handles;
482 /**
483 * @bo_write_handles: The list of BO handles that the submitted user queue job
484 * is using for write only. This will update BO fences in the kernel.
485 */
486 __u64 bo_write_handles;
487 /**
488 * @num_bo_read_handles: A count that represents the number of read BO handles in
489 * @bo_read_handles.
490 */
491 __u32 num_bo_read_handles;
492 /**
493 * @num_bo_write_handles: A count that represents the number of write BO handles in
494 * @bo_write_handles.
495 */
496 __u32 num_bo_write_handles;
497
498 };
499
500 struct drm_amdgpu_userq_fence_info {
501 /**
502 * @va: A gpu address allocated for each queue which stores the
503 * read pointer (RPTR) value.
504 */
505 __u64 va;
506 /**
507 * @value: A 64 bit value represents the write pointer (WPTR) of the
508 * queue commands which compared with the RPTR value to signal the
509 * fences.
510 */
511 __u64 value;
512 };
513
514 struct drm_amdgpu_userq_wait {
515 /**
516 * @waitq_id: Queue handle used by the userq wait IOCTL to retrieve the
517 * wait queue and maintain the fence driver references in it.
518 */
519 __u32 waitq_id;
520 __u32 pad;
521 /**
522 * @syncobj_handles: The list of syncobj handles submitted by the user queue
523 * job to get the va/value pairs.
524 */
525 __u64 syncobj_handles;
526 /**
527 * @syncobj_timeline_handles: The list of timeline syncobj handles submitted by
528 * the user queue job to get the va/value pairs at given @syncobj_timeline_points.
529 */
530 __u64 syncobj_timeline_handles;
531 /**
532 * @syncobj_timeline_points: The list of timeline syncobj points submitted by the
533 * user queue job for the corresponding @syncobj_timeline_handles.
534 */
535 __u64 syncobj_timeline_points;
536 /**
537 * @bo_read_handles: The list of read BO handles submitted by the user queue
538 * job to get the va/value pairs.
539 */
540 __u64 bo_read_handles;
541 /**
542 * @bo_write_handles: The list of write BO handles submitted by the user queue
543 * job to get the va/value pairs.
544 */
545 __u64 bo_write_handles;
546 /**
547 * @num_syncobj_timeline_handles: A count that represents the number of timeline
548 * syncobj handles in @syncobj_timeline_handles.
549 */
550 __u16 num_syncobj_timeline_handles;
551 /**
552 * @num_fences: This field can be used both as input and output. As input it defines
553 * the maximum number of fences that can be returned and as output it will specify
554 * how many fences were actually returned from the ioctl.
555 */
556 __u16 num_fences;
557 /**
558 * @num_syncobj_handles: A count that represents the number of syncobj handles in
559 * @syncobj_handles.
560 */
561 __u32 num_syncobj_handles;
562 /**
563 * @num_bo_read_handles: A count that represents the number of read BO handles in
564 * @bo_read_handles.
565 */
566 __u32 num_bo_read_handles;
567 /**
568 * @num_bo_write_handles: A count that represents the number of write BO handles in
569 * @bo_write_handles.
570 */
571 __u32 num_bo_write_handles;
572 /**
573 * @out_fences: The field is a return value from the ioctl containing the list of
574 * address/value pairs to wait for.
575 */
576 __u64 out_fences;
577 };
578
579 /* vm ioctl */
580 #define AMDGPU_VM_OP_RESERVE_VMID 1
581 #define AMDGPU_VM_OP_UNRESERVE_VMID 2
582
583 struct drm_amdgpu_vm_in {
584 /** AMDGPU_VM_OP_* */
585 __u32 op;
586 __u32 flags;
587 };
588
589 struct drm_amdgpu_vm_out {
590 /** For future use, no flags defined so far */
591 __u64 flags;
592 };
593
594 union drm_amdgpu_vm {
595 struct drm_amdgpu_vm_in in;
596 struct drm_amdgpu_vm_out out;
597 };
598
599 /* sched ioctl */
600 #define AMDGPU_SCHED_OP_PROCESS_PRIORITY_OVERRIDE 1
601 #define AMDGPU_SCHED_OP_CONTEXT_PRIORITY_OVERRIDE 2
602
603 struct drm_amdgpu_sched_in {
604 /* AMDGPU_SCHED_OP_* */
605 __u32 op;
606 __u32 fd;
607 /** AMDGPU_CTX_PRIORITY_* */
608 __s32 priority;
609 __u32 ctx_id;
610 };
611
612 union drm_amdgpu_sched {
613 struct drm_amdgpu_sched_in in;
614 };
615
616 /*
617 * This is not a reliable API and you should expect it to fail for any
618 * number of reasons and have fallback path that do not use userptr to
619 * perform any operation.
620 */
621 #define AMDGPU_GEM_USERPTR_READONLY (1 << 0)
622 #define AMDGPU_GEM_USERPTR_ANONONLY (1 << 1)
623 #define AMDGPU_GEM_USERPTR_VALIDATE (1 << 2)
624 #define AMDGPU_GEM_USERPTR_REGISTER (1 << 3)
625
626 struct drm_amdgpu_gem_userptr {
627 __u64 addr;
628 __u64 size;
629 /* AMDGPU_GEM_USERPTR_* */
630 __u32 flags;
631 /* Resulting GEM handle */
632 __u32 handle;
633 };
634
635 /* SI-CI-VI: */
636 /* same meaning as the GB_TILE_MODE and GL_MACRO_TILE_MODE fields */
637 #define AMDGPU_TILING_ARRAY_MODE_SHIFT 0
638 #define AMDGPU_TILING_ARRAY_MODE_MASK 0xf
639 #define AMDGPU_TILING_PIPE_CONFIG_SHIFT 4
640 #define AMDGPU_TILING_PIPE_CONFIG_MASK 0x1f
641 #define AMDGPU_TILING_TILE_SPLIT_SHIFT 9
642 #define AMDGPU_TILING_TILE_SPLIT_MASK 0x7
643 #define AMDGPU_TILING_MICRO_TILE_MODE_SHIFT 12
644 #define AMDGPU_TILING_MICRO_TILE_MODE_MASK 0x7
645 #define AMDGPU_TILING_BANK_WIDTH_SHIFT 15
646 #define AMDGPU_TILING_BANK_WIDTH_MASK 0x3
647 #define AMDGPU_TILING_BANK_HEIGHT_SHIFT 17
648 #define AMDGPU_TILING_BANK_HEIGHT_MASK 0x3
649 #define AMDGPU_TILING_MACRO_TILE_ASPECT_SHIFT 19
650 #define AMDGPU_TILING_MACRO_TILE_ASPECT_MASK 0x3
651 #define AMDGPU_TILING_NUM_BANKS_SHIFT 21
652 #define AMDGPU_TILING_NUM_BANKS_MASK 0x3
653
654 /* GFX9 - GFX11: */
655 #define AMDGPU_TILING_SWIZZLE_MODE_SHIFT 0
656 #define AMDGPU_TILING_SWIZZLE_MODE_MASK 0x1f
657 #define AMDGPU_TILING_DCC_OFFSET_256B_SHIFT 5
658 #define AMDGPU_TILING_DCC_OFFSET_256B_MASK 0xFFFFFF
659 #define AMDGPU_TILING_DCC_PITCH_MAX_SHIFT 29
660 #define AMDGPU_TILING_DCC_PITCH_MAX_MASK 0x3FFF
661 #define AMDGPU_TILING_DCC_INDEPENDENT_64B_SHIFT 43
662 #define AMDGPU_TILING_DCC_INDEPENDENT_64B_MASK 0x1
663 #define AMDGPU_TILING_DCC_INDEPENDENT_128B_SHIFT 44
664 #define AMDGPU_TILING_DCC_INDEPENDENT_128B_MASK 0x1
665 #define AMDGPU_TILING_SCANOUT_SHIFT 63
666 #define AMDGPU_TILING_SCANOUT_MASK 0x1
667
668 /* GFX12 and later: */
669 #define AMDGPU_TILING_GFX12_SWIZZLE_MODE_SHIFT 0
670 #define AMDGPU_TILING_GFX12_SWIZZLE_MODE_MASK 0x7
671 /* These are DCC recompression settings for memory management: */
672 #define AMDGPU_TILING_GFX12_DCC_MAX_COMPRESSED_BLOCK_SHIFT 3
673 #define AMDGPU_TILING_GFX12_DCC_MAX_COMPRESSED_BLOCK_MASK 0x3 /* 0:64B, 1:128B, 2:256B */
674 #define AMDGPU_TILING_GFX12_DCC_NUMBER_TYPE_SHIFT 5
675 #define AMDGPU_TILING_GFX12_DCC_NUMBER_TYPE_MASK 0x7 /* CB_COLOR0_INFO.NUMBER_TYPE */
676 #define AMDGPU_TILING_GFX12_DCC_DATA_FORMAT_SHIFT 8
677 #define AMDGPU_TILING_GFX12_DCC_DATA_FORMAT_MASK 0x3f /* [0:4]:CB_COLOR0_INFO.FORMAT, [5]:MM */
678 /* When clearing the buffer or moving it from VRAM to GTT, don't compress and set DCC metadata
679 * to uncompressed. Set when parts of an allocation bypass DCC and read raw data. */
680 #define AMDGPU_TILING_GFX12_DCC_WRITE_COMPRESS_DISABLE_SHIFT 14
681 #define AMDGPU_TILING_GFX12_DCC_WRITE_COMPRESS_DISABLE_MASK 0x1
682 /* bit gap */
683 #define AMDGPU_TILING_GFX12_SCANOUT_SHIFT 63
684 #define AMDGPU_TILING_GFX12_SCANOUT_MASK 0x1
685
686 /* Set/Get helpers for tiling flags. */
687 #define AMDGPU_TILING_SET(field, value) \
688 (((__u64)(value) & AMDGPU_TILING_##field##_MASK) << AMDGPU_TILING_##field##_SHIFT)
689 #define AMDGPU_TILING_GET(value, field) \
690 (((__u64)(value) >> AMDGPU_TILING_##field##_SHIFT) & AMDGPU_TILING_##field##_MASK)
691
692 #define AMDGPU_GEM_METADATA_OP_SET_METADATA 1
693 #define AMDGPU_GEM_METADATA_OP_GET_METADATA 2
694
695 /** The same structure is shared for input/output */
696 struct drm_amdgpu_gem_metadata {
697 /** GEM Object handle */
698 __u32 handle;
699 /** Do we want get or set metadata */
700 __u32 op;
701 struct {
702 /** For future use, no flags defined so far */
703 __u64 flags;
704 /** family specific tiling info */
705 __u64 tiling_info;
706 __u32 data_size_bytes;
707 __u32 data[64];
708 } data;
709 };
710
711 struct drm_amdgpu_gem_mmap_in {
712 /** the GEM object handle */
713 __u32 handle;
714 __u32 _pad;
715 };
716
717 struct drm_amdgpu_gem_mmap_out {
718 /** mmap offset from the vma offset manager */
719 __u64 addr_ptr;
720 };
721
722 union drm_amdgpu_gem_mmap {
723 struct drm_amdgpu_gem_mmap_in in;
724 struct drm_amdgpu_gem_mmap_out out;
725 };
726
727 struct drm_amdgpu_gem_wait_idle_in {
728 /** GEM object handle */
729 __u32 handle;
730 /** For future use, no flags defined so far */
731 __u32 flags;
732 /** Absolute timeout to wait */
733 __u64 timeout;
734 };
735
736 struct drm_amdgpu_gem_wait_idle_out {
737 /** BO status: 0 - BO is idle, 1 - BO is busy */
738 __u32 status;
739 /** Returned current memory domain */
740 __u32 domain;
741 };
742
743 union drm_amdgpu_gem_wait_idle {
744 struct drm_amdgpu_gem_wait_idle_in in;
745 struct drm_amdgpu_gem_wait_idle_out out;
746 };
747
748 struct drm_amdgpu_wait_cs_in {
749 /* Command submission handle
750 * handle equals 0 means none to wait for
751 * handle equals ~0ull means wait for the latest sequence number
752 */
753 __u64 handle;
754 /** Absolute timeout to wait */
755 __u64 timeout;
756 __u32 ip_type;
757 __u32 ip_instance;
758 __u32 ring;
759 __u32 ctx_id;
760 };
761
762 struct drm_amdgpu_wait_cs_out {
763 /** CS status: 0 - CS completed, 1 - CS still busy */
764 __u64 status;
765 };
766
767 union drm_amdgpu_wait_cs {
768 struct drm_amdgpu_wait_cs_in in;
769 struct drm_amdgpu_wait_cs_out out;
770 };
771
772 struct drm_amdgpu_fence {
773 __u32 ctx_id;
774 __u32 ip_type;
775 __u32 ip_instance;
776 __u32 ring;
777 __u64 seq_no;
778 };
779
780 struct drm_amdgpu_wait_fences_in {
781 /** This points to uint64_t * which points to fences */
782 __u64 fences;
783 __u32 fence_count;
784 __u32 wait_all;
785 __u64 timeout_ns;
786 };
787
788 struct drm_amdgpu_wait_fences_out {
789 __u32 status;
790 __u32 first_signaled;
791 };
792
793 union drm_amdgpu_wait_fences {
794 struct drm_amdgpu_wait_fences_in in;
795 struct drm_amdgpu_wait_fences_out out;
796 };
797
798 #define AMDGPU_GEM_OP_GET_GEM_CREATE_INFO 0
799 #define AMDGPU_GEM_OP_SET_PLACEMENT 1
800
801 /* Sets or returns a value associated with a buffer. */
802 struct drm_amdgpu_gem_op {
803 /** GEM object handle */
804 __u32 handle;
805 /** AMDGPU_GEM_OP_* */
806 __u32 op;
807 /** Input or return value */
808 __u64 value;
809 };
810
811 #define AMDGPU_VA_OP_MAP 1
812 #define AMDGPU_VA_OP_UNMAP 2
813 #define AMDGPU_VA_OP_CLEAR 3
814 #define AMDGPU_VA_OP_REPLACE 4
815
816 /* Delay the page table update till the next CS */
817 #define AMDGPU_VM_DELAY_UPDATE (1 << 0)
818
819 /* Mapping flags */
820 /* readable mapping */
821 #define AMDGPU_VM_PAGE_READABLE (1 << 1)
822 /* writable mapping */
823 #define AMDGPU_VM_PAGE_WRITEABLE (1 << 2)
824 /* executable mapping, new for VI */
825 #define AMDGPU_VM_PAGE_EXECUTABLE (1 << 3)
826 /* partially resident texture */
827 #define AMDGPU_VM_PAGE_PRT (1 << 4)
828 /* MTYPE flags use bit 5 to 8 */
829 #define AMDGPU_VM_MTYPE_MASK (0xf << 5)
830 /* Default MTYPE. Pre-AI must use this. Recommended for newer ASICs. */
831 #define AMDGPU_VM_MTYPE_DEFAULT (0 << 5)
832 /* Use Non Coherent MTYPE instead of default MTYPE */
833 #define AMDGPU_VM_MTYPE_NC (1 << 5)
834 /* Use Write Combine MTYPE instead of default MTYPE */
835 #define AMDGPU_VM_MTYPE_WC (2 << 5)
836 /* Use Cache Coherent MTYPE instead of default MTYPE */
837 #define AMDGPU_VM_MTYPE_CC (3 << 5)
838 /* Use UnCached MTYPE instead of default MTYPE */
839 #define AMDGPU_VM_MTYPE_UC (4 << 5)
840 /* Use Read Write MTYPE instead of default MTYPE */
841 #define AMDGPU_VM_MTYPE_RW (5 << 5)
842 /* don't allocate MALL */
843 #define AMDGPU_VM_PAGE_NOALLOC (1 << 9)
844
845 struct drm_amdgpu_gem_va {
846 /** GEM object handle */
847 __u32 handle;
848 __u32 _pad;
849 /** AMDGPU_VA_OP_* */
850 __u32 operation;
851 /** AMDGPU_VM_PAGE_* */
852 __u32 flags;
853 /** va address to assign . Must be correctly aligned.*/
854 __u64 va_address;
855 /** Specify offset inside of BO to assign. Must be correctly aligned.*/
856 __u64 offset_in_bo;
857 /** Specify mapping size. Must be correctly aligned. */
858 __u64 map_size;
859 /**
860 * vm_timeline_point is a sequence number used to add new timeline point.
861 */
862 __u64 vm_timeline_point;
863 /**
864 * The vm page table update fence is installed in given vm_timeline_syncobj_out
865 * at vm_timeline_point.
866 */
867 __u32 vm_timeline_syncobj_out;
868 /** the number of syncobj handles in @input_fence_syncobj_handles */
869 __u32 num_syncobj_handles;
870 /** Array of sync object handle to wait for given input fences */
871 __u64 input_fence_syncobj_handles;
872 };
873
874 #define AMDGPU_HW_IP_GFX 0
875 #define AMDGPU_HW_IP_COMPUTE 1
876 #define AMDGPU_HW_IP_DMA 2
877 #define AMDGPU_HW_IP_UVD 3
878 #define AMDGPU_HW_IP_VCE 4
879 #define AMDGPU_HW_IP_UVD_ENC 5
880 #define AMDGPU_HW_IP_VCN_DEC 6
881 /*
882 * From VCN4, AMDGPU_HW_IP_VCN_ENC is re-used to support
883 * both encoding and decoding jobs.
884 */
885 #define AMDGPU_HW_IP_VCN_ENC 7
886 #define AMDGPU_HW_IP_VCN_JPEG 8
887 #define AMDGPU_HW_IP_VPE 9
888 #define AMDGPU_HW_IP_NUM 10
889
890 #define AMDGPU_HW_IP_INSTANCE_MAX_COUNT 1
891
892 #define AMDGPU_CHUNK_ID_IB 0x01
893 #define AMDGPU_CHUNK_ID_FENCE 0x02
894 #define AMDGPU_CHUNK_ID_DEPENDENCIES 0x03
895 #define AMDGPU_CHUNK_ID_SYNCOBJ_IN 0x04
896 #define AMDGPU_CHUNK_ID_SYNCOBJ_OUT 0x05
897 #define AMDGPU_CHUNK_ID_BO_HANDLES 0x06
898 #define AMDGPU_CHUNK_ID_SCHEDULED_DEPENDENCIES 0x07
899 #define AMDGPU_CHUNK_ID_SYNCOBJ_TIMELINE_WAIT 0x08
900 #define AMDGPU_CHUNK_ID_SYNCOBJ_TIMELINE_SIGNAL 0x09
901 #define AMDGPU_CHUNK_ID_CP_GFX_SHADOW 0x0a
902
903 struct drm_amdgpu_cs_chunk {
904 __u32 chunk_id;
905 __u32 length_dw;
906 __u64 chunk_data;
907 };
908
909 struct drm_amdgpu_cs_in {
910 /** Rendering context id */
911 __u32 ctx_id;
912 /** Handle of resource list associated with CS */
913 __u32 bo_list_handle;
914 __u32 num_chunks;
915 __u32 flags;
916 /** this points to __u64 * which point to cs chunks */
917 __u64 chunks;
918 };
919
920 struct drm_amdgpu_cs_out {
921 __u64 handle;
922 };
923
924 union drm_amdgpu_cs {
925 struct drm_amdgpu_cs_in in;
926 struct drm_amdgpu_cs_out out;
927 };
928
929 /* Specify flags to be used for IB */
930
931 /* This IB should be submitted to CE */
932 #define AMDGPU_IB_FLAG_CE (1<<0)
933
934 /* Preamble flag, which means the IB could be dropped if no context switch */
935 #define AMDGPU_IB_FLAG_PREAMBLE (1<<1)
936
937 /* Preempt flag, IB should set Pre_enb bit if PREEMPT flag detected */
938 #define AMDGPU_IB_FLAG_PREEMPT (1<<2)
939
940 /* The IB fence should do the L2 writeback but not invalidate any shader
941 * caches (L2/vL1/sL1/I$). */
942 #define AMDGPU_IB_FLAG_TC_WB_NOT_INVALIDATE (1 << 3)
943
944 /* Set GDS_COMPUTE_MAX_WAVE_ID = DEFAULT before PACKET3_INDIRECT_BUFFER.
945 * This will reset wave ID counters for the IB.
946 */
947 #define AMDGPU_IB_FLAG_RESET_GDS_MAX_WAVE_ID (1 << 4)
948
949 /* Flag the IB as secure (TMZ)
950 */
951 #define AMDGPU_IB_FLAGS_SECURE (1 << 5)
952
953 /* Tell KMD to flush and invalidate caches
954 */
955 #define AMDGPU_IB_FLAG_EMIT_MEM_SYNC (1 << 6)
956
957 struct drm_amdgpu_cs_chunk_ib {
958 __u32 _pad;
959 /** AMDGPU_IB_FLAG_* */
960 __u32 flags;
961 /** Virtual address to begin IB execution */
962 __u64 va_start;
963 /** Size of submission */
964 __u32 ib_bytes;
965 /** HW IP to submit to */
966 __u32 ip_type;
967 /** HW IP index of the same type to submit to */
968 __u32 ip_instance;
969 /** Ring index to submit to */
970 __u32 ring;
971 };
972
973 struct drm_amdgpu_cs_chunk_dep {
974 __u32 ip_type;
975 __u32 ip_instance;
976 __u32 ring;
977 __u32 ctx_id;
978 __u64 handle;
979 };
980
981 struct drm_amdgpu_cs_chunk_fence {
982 __u32 handle;
983 __u32 offset;
984 };
985
986 struct drm_amdgpu_cs_chunk_sem {
987 __u32 handle;
988 };
989
990 struct drm_amdgpu_cs_chunk_syncobj {
991 __u32 handle;
992 __u32 flags;
993 __u64 point;
994 };
995
996 #define AMDGPU_FENCE_TO_HANDLE_GET_SYNCOBJ 0
997 #define AMDGPU_FENCE_TO_HANDLE_GET_SYNCOBJ_FD 1
998 #define AMDGPU_FENCE_TO_HANDLE_GET_SYNC_FILE_FD 2
999
1000 union drm_amdgpu_fence_to_handle {
1001 struct {
1002 struct drm_amdgpu_fence fence;
1003 __u32 what;
1004 __u32 pad;
1005 } in;
1006 struct {
1007 __u32 handle;
1008 } out;
1009 };
1010
1011 struct drm_amdgpu_cs_chunk_data {
1012 union {
1013 struct drm_amdgpu_cs_chunk_ib ib_data;
1014 struct drm_amdgpu_cs_chunk_fence fence_data;
1015 };
1016 };
1017
1018 #define AMDGPU_CS_CHUNK_CP_GFX_SHADOW_FLAGS_INIT_SHADOW 0x1
1019
1020 struct drm_amdgpu_cs_chunk_cp_gfx_shadow {
1021 __u64 shadow_va;
1022 __u64 csa_va;
1023 __u64 gds_va;
1024 __u64 flags;
1025 };
1026
1027 /*
1028 * Query h/w info: Flag that this is integrated (a.h.a. fusion) GPU
1029 *
1030 */
1031 #define AMDGPU_IDS_FLAGS_FUSION 0x1
1032 #define AMDGPU_IDS_FLAGS_PREEMPTION 0x2
1033 #define AMDGPU_IDS_FLAGS_TMZ 0x4
1034 #define AMDGPU_IDS_FLAGS_CONFORMANT_TRUNC_COORD 0x8
1035
1036 /*
1037 * Query h/w info: Flag identifying VF/PF/PT mode
1038 *
1039 */
1040 #define AMDGPU_IDS_FLAGS_MODE_MASK 0x300
1041 #define AMDGPU_IDS_FLAGS_MODE_SHIFT 0x8
1042 #define AMDGPU_IDS_FLAGS_MODE_PF 0x0
1043 #define AMDGPU_IDS_FLAGS_MODE_VF 0x1
1044 #define AMDGPU_IDS_FLAGS_MODE_PT 0x2
1045
1046 /* indicate if acceleration can be working */
1047 #define AMDGPU_INFO_ACCEL_WORKING 0x00
1048 /* get the crtc_id from the mode object id? */
1049 #define AMDGPU_INFO_CRTC_FROM_ID 0x01
1050 /* query hw IP info */
1051 #define AMDGPU_INFO_HW_IP_INFO 0x02
1052 /* query hw IP instance count for the specified type */
1053 #define AMDGPU_INFO_HW_IP_COUNT 0x03
1054 /* timestamp for GL_ARB_timer_query */
1055 #define AMDGPU_INFO_TIMESTAMP 0x05
1056 /* Query the firmware version */
1057 #define AMDGPU_INFO_FW_VERSION 0x0e
1058 /* Subquery id: Query VCE firmware version */
1059 #define AMDGPU_INFO_FW_VCE 0x1
1060 /* Subquery id: Query UVD firmware version */
1061 #define AMDGPU_INFO_FW_UVD 0x2
1062 /* Subquery id: Query GMC firmware version */
1063 #define AMDGPU_INFO_FW_GMC 0x03
1064 /* Subquery id: Query GFX ME firmware version */
1065 #define AMDGPU_INFO_FW_GFX_ME 0x04
1066 /* Subquery id: Query GFX PFP firmware version */
1067 #define AMDGPU_INFO_FW_GFX_PFP 0x05
1068 /* Subquery id: Query GFX CE firmware version */
1069 #define AMDGPU_INFO_FW_GFX_CE 0x06
1070 /* Subquery id: Query GFX RLC firmware version */
1071 #define AMDGPU_INFO_FW_GFX_RLC 0x07
1072 /* Subquery id: Query GFX MEC firmware version */
1073 #define AMDGPU_INFO_FW_GFX_MEC 0x08
1074 /* Subquery id: Query SMC firmware version */
1075 #define AMDGPU_INFO_FW_SMC 0x0a
1076 /* Subquery id: Query SDMA firmware version */
1077 #define AMDGPU_INFO_FW_SDMA 0x0b
1078 /* Subquery id: Query PSP SOS firmware version */
1079 #define AMDGPU_INFO_FW_SOS 0x0c
1080 /* Subquery id: Query PSP ASD firmware version */
1081 #define AMDGPU_INFO_FW_ASD 0x0d
1082 /* Subquery id: Query VCN firmware version */
1083 #define AMDGPU_INFO_FW_VCN 0x0e
1084 /* Subquery id: Query GFX RLC SRLC firmware version */
1085 #define AMDGPU_INFO_FW_GFX_RLC_RESTORE_LIST_CNTL 0x0f
1086 /* Subquery id: Query GFX RLC SRLG firmware version */
1087 #define AMDGPU_INFO_FW_GFX_RLC_RESTORE_LIST_GPM_MEM 0x10
1088 /* Subquery id: Query GFX RLC SRLS firmware version */
1089 #define AMDGPU_INFO_FW_GFX_RLC_RESTORE_LIST_SRM_MEM 0x11
1090 /* Subquery id: Query DMCU firmware version */
1091 #define AMDGPU_INFO_FW_DMCU 0x12
1092 #define AMDGPU_INFO_FW_TA 0x13
1093 /* Subquery id: Query DMCUB firmware version */
1094 #define AMDGPU_INFO_FW_DMCUB 0x14
1095 /* Subquery id: Query TOC firmware version */
1096 #define AMDGPU_INFO_FW_TOC 0x15
1097 /* Subquery id: Query CAP firmware version */
1098 #define AMDGPU_INFO_FW_CAP 0x16
1099 /* Subquery id: Query GFX RLCP firmware version */
1100 #define AMDGPU_INFO_FW_GFX_RLCP 0x17
1101 /* Subquery id: Query GFX RLCV firmware version */
1102 #define AMDGPU_INFO_FW_GFX_RLCV 0x18
1103 /* Subquery id: Query MES_KIQ firmware version */
1104 #define AMDGPU_INFO_FW_MES_KIQ 0x19
1105 /* Subquery id: Query MES firmware version */
1106 #define AMDGPU_INFO_FW_MES 0x1a
1107 /* Subquery id: Query IMU firmware version */
1108 #define AMDGPU_INFO_FW_IMU 0x1b
1109 /* Subquery id: Query VPE firmware version */
1110 #define AMDGPU_INFO_FW_VPE 0x1c
1111
1112 /* number of bytes moved for TTM migration */
1113 #define AMDGPU_INFO_NUM_BYTES_MOVED 0x0f
1114 /* the used VRAM size */
1115 #define AMDGPU_INFO_VRAM_USAGE 0x10
1116 /* the used GTT size */
1117 #define AMDGPU_INFO_GTT_USAGE 0x11
1118 /* Information about GDS, etc. resource configuration */
1119 #define AMDGPU_INFO_GDS_CONFIG 0x13
1120 /* Query information about VRAM and GTT domains */
1121 #define AMDGPU_INFO_VRAM_GTT 0x14
1122 /* Query information about register in MMR address space*/
1123 #define AMDGPU_INFO_READ_MMR_REG 0x15
1124 /* Query information about device: rev id, family, etc. */
1125 #define AMDGPU_INFO_DEV_INFO 0x16
1126 /* visible vram usage */
1127 #define AMDGPU_INFO_VIS_VRAM_USAGE 0x17
1128 /* number of TTM buffer evictions */
1129 #define AMDGPU_INFO_NUM_EVICTIONS 0x18
1130 /* Query memory about VRAM and GTT domains */
1131 #define AMDGPU_INFO_MEMORY 0x19
1132 /* Query vce clock table */
1133 #define AMDGPU_INFO_VCE_CLOCK_TABLE 0x1A
1134 /* Query vbios related information */
1135 #define AMDGPU_INFO_VBIOS 0x1B
1136 /* Subquery id: Query vbios size */
1137 #define AMDGPU_INFO_VBIOS_SIZE 0x1
1138 /* Subquery id: Query vbios image */
1139 #define AMDGPU_INFO_VBIOS_IMAGE 0x2
1140 /* Subquery id: Query vbios info */
1141 #define AMDGPU_INFO_VBIOS_INFO 0x3
1142 /* Query UVD handles */
1143 #define AMDGPU_INFO_NUM_HANDLES 0x1C
1144 /* Query sensor related information */
1145 #define AMDGPU_INFO_SENSOR 0x1D
1146 /* Subquery id: Query GPU shader clock */
1147 #define AMDGPU_INFO_SENSOR_GFX_SCLK 0x1
1148 /* Subquery id: Query GPU memory clock */
1149 #define AMDGPU_INFO_SENSOR_GFX_MCLK 0x2
1150 /* Subquery id: Query GPU temperature */
1151 #define AMDGPU_INFO_SENSOR_GPU_TEMP 0x3
1152 /* Subquery id: Query GPU load */
1153 #define AMDGPU_INFO_SENSOR_GPU_LOAD 0x4
1154 /* Subquery id: Query average GPU power */
1155 #define AMDGPU_INFO_SENSOR_GPU_AVG_POWER 0x5
1156 /* Subquery id: Query northbridge voltage */
1157 #define AMDGPU_INFO_SENSOR_VDDNB 0x6
1158 /* Subquery id: Query graphics voltage */
1159 #define AMDGPU_INFO_SENSOR_VDDGFX 0x7
1160 /* Subquery id: Query GPU stable pstate shader clock */
1161 #define AMDGPU_INFO_SENSOR_STABLE_PSTATE_GFX_SCLK 0x8
1162 /* Subquery id: Query GPU stable pstate memory clock */
1163 #define AMDGPU_INFO_SENSOR_STABLE_PSTATE_GFX_MCLK 0x9
1164 /* Subquery id: Query GPU peak pstate shader clock */
1165 #define AMDGPU_INFO_SENSOR_PEAK_PSTATE_GFX_SCLK 0xa
1166 /* Subquery id: Query GPU peak pstate memory clock */
1167 #define AMDGPU_INFO_SENSOR_PEAK_PSTATE_GFX_MCLK 0xb
1168 /* Subquery id: Query input GPU power */
1169 #define AMDGPU_INFO_SENSOR_GPU_INPUT_POWER 0xc
1170 /* Number of VRAM page faults on CPU access. */
1171 #define AMDGPU_INFO_NUM_VRAM_CPU_PAGE_FAULTS 0x1E
1172 #define AMDGPU_INFO_VRAM_LOST_COUNTER 0x1F
1173 /* query ras mask of enabled features*/
1174 #define AMDGPU_INFO_RAS_ENABLED_FEATURES 0x20
1175 /* RAS MASK: UMC (VRAM) */
1176 #define AMDGPU_INFO_RAS_ENABLED_UMC (1 << 0)
1177 /* RAS MASK: SDMA */
1178 #define AMDGPU_INFO_RAS_ENABLED_SDMA (1 << 1)
1179 /* RAS MASK: GFX */
1180 #define AMDGPU_INFO_RAS_ENABLED_GFX (1 << 2)
1181 /* RAS MASK: MMHUB */
1182 #define AMDGPU_INFO_RAS_ENABLED_MMHUB (1 << 3)
1183 /* RAS MASK: ATHUB */
1184 #define AMDGPU_INFO_RAS_ENABLED_ATHUB (1 << 4)
1185 /* RAS MASK: PCIE */
1186 #define AMDGPU_INFO_RAS_ENABLED_PCIE (1 << 5)
1187 /* RAS MASK: HDP */
1188 #define AMDGPU_INFO_RAS_ENABLED_HDP (1 << 6)
1189 /* RAS MASK: XGMI */
1190 #define AMDGPU_INFO_RAS_ENABLED_XGMI (1 << 7)
1191 /* RAS MASK: DF */
1192 #define AMDGPU_INFO_RAS_ENABLED_DF (1 << 8)
1193 /* RAS MASK: SMN */
1194 #define AMDGPU_INFO_RAS_ENABLED_SMN (1 << 9)
1195 /* RAS MASK: SEM */
1196 #define AMDGPU_INFO_RAS_ENABLED_SEM (1 << 10)
1197 /* RAS MASK: MP0 */
1198 #define AMDGPU_INFO_RAS_ENABLED_MP0 (1 << 11)
1199 /* RAS MASK: MP1 */
1200 #define AMDGPU_INFO_RAS_ENABLED_MP1 (1 << 12)
1201 /* RAS MASK: FUSE */
1202 #define AMDGPU_INFO_RAS_ENABLED_FUSE (1 << 13)
1203 /* query video encode/decode caps */
1204 #define AMDGPU_INFO_VIDEO_CAPS 0x21
1205 /* Subquery id: Decode */
1206 #define AMDGPU_INFO_VIDEO_CAPS_DECODE 0
1207 /* Subquery id: Encode */
1208 #define AMDGPU_INFO_VIDEO_CAPS_ENCODE 1
1209 /* Query the max number of IBs per gang per submission */
1210 #define AMDGPU_INFO_MAX_IBS 0x22
1211 /* query last page fault info */
1212 #define AMDGPU_INFO_GPUVM_FAULT 0x23
1213 /* query FW object size and alignment */
1214 #define AMDGPU_INFO_UQ_FW_AREAS 0x24
1215
1216 #define AMDGPU_INFO_MMR_SE_INDEX_SHIFT 0
1217 #define AMDGPU_INFO_MMR_SE_INDEX_MASK 0xff
1218 #define AMDGPU_INFO_MMR_SH_INDEX_SHIFT 8
1219 #define AMDGPU_INFO_MMR_SH_INDEX_MASK 0xff
1220
1221 struct drm_amdgpu_query_fw {
1222 /** AMDGPU_INFO_FW_* */
1223 __u32 fw_type;
1224 /**
1225 * Index of the IP if there are more IPs of
1226 * the same type.
1227 */
1228 __u32 ip_instance;
1229 /**
1230 * Index of the engine. Whether this is used depends
1231 * on the firmware type. (e.g. MEC, SDMA)
1232 */
1233 __u32 index;
1234 __u32 _pad;
1235 };
1236
1237 /* Input structure for the INFO ioctl */
1238 struct drm_amdgpu_info {
1239 /* Where the return value will be stored */
1240 __u64 return_pointer;
1241 /* The size of the return value. Just like "size" in "snprintf",
1242 * it limits how many bytes the kernel can write. */
1243 __u32 return_size;
1244 /* The query request id. */
1245 __u32 query;
1246
1247 union {
1248 struct {
1249 __u32 id;
1250 __u32 _pad;
1251 } mode_crtc;
1252
1253 struct {
1254 /** AMDGPU_HW_IP_* */
1255 __u32 type;
1256 /**
1257 * Index of the IP if there are more IPs of the same
1258 * type. Ignored by AMDGPU_INFO_HW_IP_COUNT.
1259 */
1260 __u32 ip_instance;
1261 } query_hw_ip;
1262
1263 struct {
1264 __u32 dword_offset;
1265 /** number of registers to read */
1266 __u32 count;
1267 __u32 instance;
1268 /** For future use, no flags defined so far */
1269 __u32 flags;
1270 } read_mmr_reg;
1271
1272 struct drm_amdgpu_query_fw query_fw;
1273
1274 struct {
1275 __u32 type;
1276 __u32 offset;
1277 } vbios_info;
1278
1279 struct {
1280 __u32 type;
1281 } sensor_info;
1282
1283 struct {
1284 __u32 type;
1285 } video_cap;
1286 };
1287 };
1288
1289 struct drm_amdgpu_info_gds {
1290 /** GDS GFX partition size */
1291 __u32 gds_gfx_partition_size;
1292 /** GDS compute partition size */
1293 __u32 compute_partition_size;
1294 /** total GDS memory size */
1295 __u32 gds_total_size;
1296 /** GWS size per GFX partition */
1297 __u32 gws_per_gfx_partition;
1298 /** GSW size per compute partition */
1299 __u32 gws_per_compute_partition;
1300 /** OA size per GFX partition */
1301 __u32 oa_per_gfx_partition;
1302 /** OA size per compute partition */
1303 __u32 oa_per_compute_partition;
1304 __u32 _pad;
1305 };
1306
1307 struct drm_amdgpu_info_vram_gtt {
1308 __u64 vram_size;
1309 __u64 vram_cpu_accessible_size;
1310 __u64 gtt_size;
1311 };
1312
1313 struct drm_amdgpu_heap_info {
1314 /** max. physical memory */
1315 __u64 total_heap_size;
1316
1317 /** Theoretical max. available memory in the given heap */
1318 __u64 usable_heap_size;
1319
1320 /**
1321 * Number of bytes allocated in the heap. This includes all processes
1322 * and private allocations in the kernel. It changes when new buffers
1323 * are allocated, freed, and moved. It cannot be larger than
1324 * heap_size.
1325 */
1326 __u64 heap_usage;
1327
1328 /**
1329 * Theoretical possible max. size of buffer which
1330 * could be allocated in the given heap
1331 */
1332 __u64 max_allocation;
1333 };
1334
1335 struct drm_amdgpu_memory_info {
1336 struct drm_amdgpu_heap_info vram;
1337 struct drm_amdgpu_heap_info cpu_accessible_vram;
1338 struct drm_amdgpu_heap_info gtt;
1339 };
1340
1341 struct drm_amdgpu_info_firmware {
1342 __u32 ver;
1343 __u32 feature;
1344 };
1345
1346 struct drm_amdgpu_info_vbios {
1347 __u8 name[64];
1348 __u8 vbios_pn[64];
1349 __u32 version;
1350 __u32 pad;
1351 __u8 vbios_ver_str[32];
1352 __u8 date[32];
1353 };
1354
1355 #define AMDGPU_VRAM_TYPE_UNKNOWN 0
1356 #define AMDGPU_VRAM_TYPE_GDDR1 1
1357 #define AMDGPU_VRAM_TYPE_DDR2 2
1358 #define AMDGPU_VRAM_TYPE_GDDR3 3
1359 #define AMDGPU_VRAM_TYPE_GDDR4 4
1360 #define AMDGPU_VRAM_TYPE_GDDR5 5
1361 #define AMDGPU_VRAM_TYPE_HBM 6
1362 #define AMDGPU_VRAM_TYPE_DDR3 7
1363 #define AMDGPU_VRAM_TYPE_DDR4 8
1364 #define AMDGPU_VRAM_TYPE_GDDR6 9
1365 #define AMDGPU_VRAM_TYPE_DDR5 10
1366 #define AMDGPU_VRAM_TYPE_LPDDR4 11
1367 #define AMDGPU_VRAM_TYPE_LPDDR5 12
1368 #define AMDGPU_VRAM_TYPE_HBM3E 13
1369 #define AMDGPU_VRAM_TYPE_HBM4 14
1370
1371 struct drm_amdgpu_info_device {
1372 /** PCI Device ID */
1373 __u32 device_id;
1374 /** Internal chip revision: A0, A1, etc.) */
1375 __u32 chip_rev;
1376 __u32 external_rev;
1377 /** Revision id in PCI Config space */
1378 __u32 pci_rev;
1379 __u32 family;
1380 __u32 num_shader_engines;
1381 __u32 num_shader_arrays_per_engine;
1382 /* in KHz */
1383 __u32 gpu_counter_freq;
1384 __u64 max_engine_clock;
1385 __u64 max_memory_clock;
1386 /* cu information */
1387 __u32 cu_active_number;
1388 /* NOTE: cu_ao_mask is INVALID, DON'T use it */
1389 __u32 cu_ao_mask;
1390 __u32 cu_bitmap[4][4];
1391 /** Render backend pipe mask. One render backend is CB+DB. */
1392 __u32 enabled_rb_pipes_mask;
1393 __u32 num_rb_pipes;
1394 __u32 num_hw_gfx_contexts;
1395 /* PCIe version (the smaller of the GPU and the CPU/motherboard) */
1396 __u32 pcie_gen;
1397 __u64 ids_flags;
1398 /** Starting virtual address for UMDs. */
1399 __u64 virtual_address_offset;
1400 /** The maximum virtual address */
1401 __u64 virtual_address_max;
1402 /** Required alignment of virtual addresses. */
1403 __u32 virtual_address_alignment;
1404 /** Page table entry - fragment size */
1405 __u32 pte_fragment_size;
1406 __u32 gart_page_size;
1407 /** constant engine ram size*/
1408 __u32 ce_ram_size;
1409 /** video memory type info*/
1410 __u32 vram_type;
1411 /** video memory bit width*/
1412 __u32 vram_bit_width;
1413 /* vce harvesting instance */
1414 __u32 vce_harvest_config;
1415 /* gfx double offchip LDS buffers */
1416 __u32 gc_double_offchip_lds_buf;
1417 /* NGG Primitive Buffer */
1418 __u64 prim_buf_gpu_addr;
1419 /* NGG Position Buffer */
1420 __u64 pos_buf_gpu_addr;
1421 /* NGG Control Sideband */
1422 __u64 cntl_sb_buf_gpu_addr;
1423 /* NGG Parameter Cache */
1424 __u64 param_buf_gpu_addr;
1425 __u32 prim_buf_size;
1426 __u32 pos_buf_size;
1427 __u32 cntl_sb_buf_size;
1428 __u32 param_buf_size;
1429 /* wavefront size*/
1430 __u32 wave_front_size;
1431 /* shader visible vgprs*/
1432 __u32 num_shader_visible_vgprs;
1433 /* CU per shader array*/
1434 __u32 num_cu_per_sh;
1435 /* number of tcc blocks*/
1436 __u32 num_tcc_blocks;
1437 /* gs vgt table depth*/
1438 __u32 gs_vgt_table_depth;
1439 /* gs primitive buffer depth*/
1440 __u32 gs_prim_buffer_depth;
1441 /* max gs wavefront per vgt*/
1442 __u32 max_gs_waves_per_vgt;
1443 /* PCIe number of lanes (the smaller of the GPU and the CPU/motherboard) */
1444 __u32 pcie_num_lanes;
1445 /* always on cu bitmap */
1446 __u32 cu_ao_bitmap[4][4];
1447 /** Starting high virtual address for UMDs. */
1448 __u64 high_va_offset;
1449 /** The maximum high virtual address */
1450 __u64 high_va_max;
1451 /* gfx10 pa_sc_tile_steering_override */
1452 __u32 pa_sc_tile_steering_override;
1453 /* disabled TCCs */
1454 __u64 tcc_disabled_mask;
1455 __u64 min_engine_clock;
1456 __u64 min_memory_clock;
1457 /* The following fields are only set on gfx11+, older chips set 0. */
1458 __u32 tcp_cache_size; /* AKA GL0, VMEM cache */
1459 __u32 num_sqc_per_wgp;
1460 __u32 sqc_data_cache_size; /* AKA SMEM cache */
1461 __u32 sqc_inst_cache_size;
1462 __u32 gl1c_cache_size;
1463 __u32 gl2c_cache_size;
1464 __u64 mall_size; /* AKA infinity cache */
1465 /* high 32 bits of the rb pipes mask */
1466 __u32 enabled_rb_pipes_mask_hi;
1467 /* shadow area size for gfx11 */
1468 __u32 shadow_size;
1469 /* shadow area base virtual alignment for gfx11 */
1470 __u32 shadow_alignment;
1471 /* context save area size for gfx11 */
1472 __u32 csa_size;
1473 /* context save area base virtual alignment for gfx11 */
1474 __u32 csa_alignment;
1475 /* Userq IP mask (1 << AMDGPU_HW_IP_*) */
1476 __u32 userq_ip_mask;
1477 __u32 pad;
1478 };
1479
1480 struct drm_amdgpu_info_hw_ip {
1481 /** Version of h/w IP */
1482 __u32 hw_ip_version_major;
1483 __u32 hw_ip_version_minor;
1484 /** Capabilities */
1485 __u64 capabilities_flags;
1486 /** command buffer address start alignment*/
1487 __u32 ib_start_alignment;
1488 /** command buffer size alignment*/
1489 __u32 ib_size_alignment;
1490 /** Bitmask of available rings. Bit 0 means ring 0, etc. */
1491 __u32 available_rings;
1492 /** version info: bits 23:16 major, 15:8 minor, 7:0 revision */
1493 __u32 ip_discovery_version;
1494 };
1495
1496 struct drm_amdgpu_info_num_handles {
1497 /** Max handles as supported by firmware for UVD */
1498 __u32 uvd_max_handles;
1499 /** Handles currently in use for UVD */
1500 __u32 uvd_used_handles;
1501 };
1502
1503 #define AMDGPU_VCE_CLOCK_TABLE_ENTRIES 6
1504
1505 struct drm_amdgpu_info_vce_clock_table_entry {
1506 /** System clock */
1507 __u32 sclk;
1508 /** Memory clock */
1509 __u32 mclk;
1510 /** VCE clock */
1511 __u32 eclk;
1512 __u32 pad;
1513 };
1514
1515 struct drm_amdgpu_info_vce_clock_table {
1516 struct drm_amdgpu_info_vce_clock_table_entry entries[AMDGPU_VCE_CLOCK_TABLE_ENTRIES];
1517 __u32 num_valid_entries;
1518 __u32 pad;
1519 };
1520
1521 /* query video encode/decode caps */
1522 #define AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG2 0
1523 #define AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4 1
1524 #define AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VC1 2
1525 #define AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_MPEG4_AVC 3
1526 #define AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_HEVC 4
1527 #define AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_JPEG 5
1528 #define AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_VP9 6
1529 #define AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_AV1 7
1530 #define AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_COUNT 8
1531
1532 struct drm_amdgpu_info_video_codec_info {
1533 __u32 valid;
1534 __u32 max_width;
1535 __u32 max_height;
1536 __u32 max_pixels_per_frame;
1537 __u32 max_level;
1538 __u32 pad;
1539 };
1540
1541 struct drm_amdgpu_info_video_caps {
1542 struct drm_amdgpu_info_video_codec_info codec_info[AMDGPU_INFO_VIDEO_CAPS_CODEC_IDX_COUNT];
1543 };
1544
1545 #define AMDGPU_VMHUB_TYPE_MASK 0xff
1546 #define AMDGPU_VMHUB_TYPE_SHIFT 0
1547 #define AMDGPU_VMHUB_TYPE_GFX 0
1548 #define AMDGPU_VMHUB_TYPE_MM0 1
1549 #define AMDGPU_VMHUB_TYPE_MM1 2
1550 #define AMDGPU_VMHUB_IDX_MASK 0xff00
1551 #define AMDGPU_VMHUB_IDX_SHIFT 8
1552
1553 struct drm_amdgpu_info_gpuvm_fault {
1554 __u64 addr;
1555 __u32 status;
1556 __u32 vmhub;
1557 };
1558
1559 struct drm_amdgpu_info_uq_metadata_gfx {
1560 /* shadow area size for gfx11 */
1561 __u32 shadow_size;
1562 /* shadow area base virtual alignment for gfx11 */
1563 __u32 shadow_alignment;
1564 /* context save area size for gfx11 */
1565 __u32 csa_size;
1566 /* context save area base virtual alignment for gfx11 */
1567 __u32 csa_alignment;
1568 };
1569
1570 struct drm_amdgpu_info_uq_metadata_compute {
1571 /* EOP size for gfx11 */
1572 __u32 eop_size;
1573 /* EOP base virtual alignment for gfx11 */
1574 __u32 eop_alignment;
1575 };
1576
1577 struct drm_amdgpu_info_uq_metadata_sdma {
1578 /* context save area size for sdma6 */
1579 __u32 csa_size;
1580 /* context save area base virtual alignment for sdma6 */
1581 __u32 csa_alignment;
1582 };
1583
1584 struct drm_amdgpu_info_uq_metadata {
1585 union {
1586 struct drm_amdgpu_info_uq_metadata_gfx gfx;
1587 struct drm_amdgpu_info_uq_metadata_compute compute;
1588 struct drm_amdgpu_info_uq_metadata_sdma sdma;
1589 };
1590 };
1591
1592 /*
1593 * Supported GPU families
1594 */
1595 #define AMDGPU_FAMILY_UNKNOWN 0
1596 #define AMDGPU_FAMILY_SI 110 /* Hainan, Oland, Verde, Pitcairn, Tahiti */
1597 #define AMDGPU_FAMILY_CI 120 /* Bonaire, Hawaii */
1598 #define AMDGPU_FAMILY_KV 125 /* Kaveri, Kabini, Mullins */
1599 #define AMDGPU_FAMILY_VI 130 /* Iceland, Tonga */
1600 #define AMDGPU_FAMILY_CZ 135 /* Carrizo, Stoney */
1601 #define AMDGPU_FAMILY_AI 141 /* Vega10 */
1602 #define AMDGPU_FAMILY_RV 142 /* Raven */
1603 #define AMDGPU_FAMILY_NV 143 /* Navi10 */
1604 #define AMDGPU_FAMILY_VGH 144 /* Van Gogh */
1605 #define AMDGPU_FAMILY_GC_11_0_0 145 /* GC 11.0.0 */
1606 #define AMDGPU_FAMILY_YC 146 /* Yellow Carp */
1607 #define AMDGPU_FAMILY_GC_11_0_1 148 /* GC 11.0.1 */
1608 #define AMDGPU_FAMILY_GC_10_3_6 149 /* GC 10.3.6 */
1609 #define AMDGPU_FAMILY_GC_10_3_7 151 /* GC 10.3.7 */
1610 #define AMDGPU_FAMILY_GC_11_5_0 150 /* GC 11.5.0 */
1611 #define AMDGPU_FAMILY_GC_12_0_0 152 /* GC 12.0.0 */
1612
1613 #if defined(__cplusplus)
1614 }
1615 #endif
1616
1617 #endif