blob: a82c0601a294126cc4b73a7bb6342f3eaca3a8f3 [file] [log] [blame]
Alex Deucher81629cb2015-04-20 16:42:01 -04001/* 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 <martin@valinux.com>
28 * Gareth Hughes <gareth@valinux.com>
29 * Keith Whitwell <keith@tungstengraphics.com>
30 */
31
32#ifndef __AMDGPU_DRM_H__
33#define __AMDGPU_DRM_H__
34
35#include <drm/drm.h>
36
37#define DRM_AMDGPU_GEM_CREATE 0x00
38#define DRM_AMDGPU_GEM_MMAP 0x01
39#define DRM_AMDGPU_CTX 0x02
40#define DRM_AMDGPU_BO_LIST 0x03
41#define DRM_AMDGPU_CS 0x04
42#define DRM_AMDGPU_INFO 0x05
43#define DRM_AMDGPU_GEM_METADATA 0x06
44#define DRM_AMDGPU_GEM_WAIT_IDLE 0x07
45#define DRM_AMDGPU_GEM_VA 0x08
46#define DRM_AMDGPU_WAIT_CS 0x09
47#define DRM_AMDGPU_GEM_OP 0x10
48#define DRM_AMDGPU_GEM_USERPTR 0x11
49
50#define DRM_IOCTL_AMDGPU_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_CREATE, union drm_amdgpu_gem_create)
51#define DRM_IOCTL_AMDGPU_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_MMAP, union drm_amdgpu_gem_mmap)
52#define DRM_IOCTL_AMDGPU_CTX DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_CTX, union drm_amdgpu_ctx)
53#define DRM_IOCTL_AMDGPU_BO_LIST DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_BO_LIST, union drm_amdgpu_bo_list)
54#define DRM_IOCTL_AMDGPU_CS DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_CS, union drm_amdgpu_cs)
55#define DRM_IOCTL_AMDGPU_INFO DRM_IOW(DRM_COMMAND_BASE + DRM_AMDGPU_INFO, struct drm_amdgpu_info)
56#define DRM_IOCTL_AMDGPU_GEM_METADATA DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_METADATA, struct drm_amdgpu_gem_metadata)
57#define DRM_IOCTL_AMDGPU_GEM_WAIT_IDLE DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_WAIT_IDLE, union drm_amdgpu_gem_wait_idle)
Christian König34b5f6a2015-06-08 15:03:00 +020058#define DRM_IOCTL_AMDGPU_GEM_VA DRM_IOW(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_VA, struct drm_amdgpu_gem_va)
Alex Deucher81629cb2015-04-20 16:42:01 -040059#define DRM_IOCTL_AMDGPU_WAIT_CS DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_WAIT_CS, union drm_amdgpu_wait_cs)
60#define DRM_IOCTL_AMDGPU_GEM_OP DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_OP, struct drm_amdgpu_gem_op)
61#define DRM_IOCTL_AMDGPU_GEM_USERPTR DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_USERPTR, struct drm_amdgpu_gem_userptr)
62
63#define AMDGPU_GEM_DOMAIN_CPU 0x1
64#define AMDGPU_GEM_DOMAIN_GTT 0x2
65#define AMDGPU_GEM_DOMAIN_VRAM 0x4
66#define AMDGPU_GEM_DOMAIN_GDS 0x8
67#define AMDGPU_GEM_DOMAIN_GWS 0x10
68#define AMDGPU_GEM_DOMAIN_OA 0x20
69
Alex Deucher81629cb2015-04-20 16:42:01 -040070/* Flag that CPU access will be required for the case of VRAM domain */
71#define AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED (1 << 0)
72/* Flag that CPU access will not work, this VRAM domain is invisible */
73#define AMDGPU_GEM_CREATE_NO_CPU_ACCESS (1 << 1)
Alex Deucher81629cb2015-04-20 16:42:01 -040074/* Flag that USWC attributes should be used for GTT */
Jammy Zhou88671282015-05-06 18:44:29 +080075#define AMDGPU_GEM_CREATE_CPU_GTT_USWC (1 << 2)
Alex Deucher81629cb2015-04-20 16:42:01 -040076
Alex Deucher81629cb2015-04-20 16:42:01 -040077struct drm_amdgpu_gem_create_in {
78 /** the requested memory size */
79 uint64_t bo_size;
80 /** physical start_addr alignment in bytes for some HW requirements */
81 uint64_t alignment;
82 /** the requested memory domains */
83 uint64_t domains;
84 /** allocation flags */
85 uint64_t domain_flags;
86};
87
88struct drm_amdgpu_gem_create_out {
89 /** returned GEM object handle */
90 uint32_t handle;
91 uint32_t _pad;
92};
93
94union drm_amdgpu_gem_create {
95 struct drm_amdgpu_gem_create_in in;
96 struct drm_amdgpu_gem_create_out out;
97};
98
99/** Opcode to create new residency list. */
100#define AMDGPU_BO_LIST_OP_CREATE 0
101/** Opcode to destroy previously created residency list */
102#define AMDGPU_BO_LIST_OP_DESTROY 1
103/** Opcode to update resource information in the list */
104#define AMDGPU_BO_LIST_OP_UPDATE 2
105
106struct drm_amdgpu_bo_list_in {
107 /** Type of operation */
108 uint32_t operation;
109 /** Handle of list or 0 if we want to create one */
110 uint32_t list_handle;
111 /** Number of BOs in list */
112 uint32_t bo_number;
113 /** Size of each element describing BO */
114 uint32_t bo_info_size;
115 /** Pointer to array describing BOs */
116 uint64_t bo_info_ptr;
117};
118
119struct drm_amdgpu_bo_list_entry {
120 /** Handle of BO */
121 uint32_t bo_handle;
122 /** New (if specified) BO priority to be used during migration */
123 uint32_t bo_priority;
124};
125
126struct drm_amdgpu_bo_list_out {
127 /** Handle of resource list */
128 uint32_t list_handle;
129 uint32_t _pad;
130};
131
132union drm_amdgpu_bo_list {
133 struct drm_amdgpu_bo_list_in in;
134 struct drm_amdgpu_bo_list_out out;
135};
136
137/* context related */
138#define AMDGPU_CTX_OP_ALLOC_CTX 1
139#define AMDGPU_CTX_OP_FREE_CTX 2
140#define AMDGPU_CTX_OP_QUERY_STATE 3
141
Marek Olšákd94aed52015-05-05 21:13:49 +0200142/* GPU reset status */
143#define AMDGPU_CTX_NO_RESET 0
144#define AMDGPU_CTX_GUILTY_RESET 1 /* this the context caused it */
145#define AMDGPU_CTX_INNOCENT_RESET 2 /* some other context caused it */
146#define AMDGPU_CTX_UNKNOWN_RESET 3 /* unknown cause */
147
Alex Deucher81629cb2015-04-20 16:42:01 -0400148struct drm_amdgpu_ctx_in {
149 uint32_t op;
150 uint32_t flags;
151 uint32_t ctx_id;
152 uint32_t _pad;
153};
154
155union drm_amdgpu_ctx_out {
156 struct {
157 uint32_t ctx_id;
158 uint32_t _pad;
159 } alloc;
160
161 struct {
162 uint64_t flags;
Marek Olšákd94aed52015-05-05 21:13:49 +0200163 /** Number of resets caused by this context so far. */
164 uint32_t hangs;
165 /** Reset status since the last call of the ioctl. */
166 uint32_t reset_status;
Alex Deucher81629cb2015-04-20 16:42:01 -0400167 } state;
168};
169
170union drm_amdgpu_ctx {
171 struct drm_amdgpu_ctx_in in;
172 union drm_amdgpu_ctx_out out;
173};
174
175/*
176 * This is not a reliable API and you should expect it to fail for any
177 * number of reasons and have fallback path that do not use userptr to
178 * perform any operation.
179 */
180#define AMDGPU_GEM_USERPTR_READONLY (1 << 0)
181#define AMDGPU_GEM_USERPTR_ANONONLY (1 << 1)
182#define AMDGPU_GEM_USERPTR_VALIDATE (1 << 2)
183#define AMDGPU_GEM_USERPTR_REGISTER (1 << 3)
184
185struct drm_amdgpu_gem_userptr {
186 uint64_t addr;
187 uint64_t size;
188 uint32_t flags;
189 uint32_t handle;
190};
191
Marek Olšákfbd76d52015-05-14 23:48:26 +0200192/* same meaning as the GB_TILE_MODE and GL_MACRO_TILE_MODE fields */
193#define AMDGPU_TILING_ARRAY_MODE_SHIFT 0
194#define AMDGPU_TILING_ARRAY_MODE_MASK 0xf
195#define AMDGPU_TILING_PIPE_CONFIG_SHIFT 4
196#define AMDGPU_TILING_PIPE_CONFIG_MASK 0x1f
197#define AMDGPU_TILING_TILE_SPLIT_SHIFT 9
198#define AMDGPU_TILING_TILE_SPLIT_MASK 0x7
199#define AMDGPU_TILING_MICRO_TILE_MODE_SHIFT 12
200#define AMDGPU_TILING_MICRO_TILE_MODE_MASK 0x7
201#define AMDGPU_TILING_BANK_WIDTH_SHIFT 15
202#define AMDGPU_TILING_BANK_WIDTH_MASK 0x3
203#define AMDGPU_TILING_BANK_HEIGHT_SHIFT 17
204#define AMDGPU_TILING_BANK_HEIGHT_MASK 0x3
205#define AMDGPU_TILING_MACRO_TILE_ASPECT_SHIFT 19
206#define AMDGPU_TILING_MACRO_TILE_ASPECT_MASK 0x3
207#define AMDGPU_TILING_NUM_BANKS_SHIFT 21
208#define AMDGPU_TILING_NUM_BANKS_MASK 0x3
209
210#define AMDGPU_TILING_SET(field, value) \
211 (((value) & AMDGPU_TILING_##field##_MASK) << AMDGPU_TILING_##field##_SHIFT)
212#define AMDGPU_TILING_GET(value, field) \
213 (((value) >> AMDGPU_TILING_##field##_SHIFT) & AMDGPU_TILING_##field##_MASK)
Alex Deucher81629cb2015-04-20 16:42:01 -0400214
215#define AMDGPU_GEM_METADATA_OP_SET_METADATA 1
216#define AMDGPU_GEM_METADATA_OP_GET_METADATA 2
217
218/** The same structure is shared for input/output */
219struct drm_amdgpu_gem_metadata {
220 uint32_t handle; /* GEM Object handle */
221 uint32_t op; /** Do we want get or set metadata */
222 struct {
223 uint64_t flags;
224 uint64_t tiling_info; /* family specific tiling info */
225 uint32_t data_size_bytes;
226 uint32_t data[64];
227 } data;
228};
229
230struct drm_amdgpu_gem_mmap_in {
231 uint32_t handle; /** the GEM object handle */
232 uint32_t _pad;
233};
234
235struct drm_amdgpu_gem_mmap_out {
236 uint64_t addr_ptr; /** mmap offset from the vma offset manager */
237};
238
239union drm_amdgpu_gem_mmap {
240 struct drm_amdgpu_gem_mmap_in in;
241 struct drm_amdgpu_gem_mmap_out out;
242};
243
244struct drm_amdgpu_gem_wait_idle_in {
245 uint32_t handle; /* GEM object handle */
246 uint32_t flags;
247 uint64_t timeout; /* Timeout to wait. If 0 then returned immediately with the status */
248};
249
250struct drm_amdgpu_gem_wait_idle_out {
251 uint32_t status; /* BO status: 0 - BO is idle, 1 - BO is busy */
252 uint32_t domain; /* Returned current memory domain */
253};
254
255union drm_amdgpu_gem_wait_idle {
256 struct drm_amdgpu_gem_wait_idle_in in;
257 struct drm_amdgpu_gem_wait_idle_out out;
258};
259
260struct drm_amdgpu_wait_cs_in {
261 uint64_t handle;
262 uint64_t timeout;
263 uint32_t ip_type;
264 uint32_t ip_instance;
265 uint32_t ring;
Jammy Zhou66b3cf22015-05-08 17:29:40 +0800266 uint32_t ctx_id;
Alex Deucher81629cb2015-04-20 16:42:01 -0400267};
268
269struct drm_amdgpu_wait_cs_out {
270 uint64_t status;
271};
272
273union drm_amdgpu_wait_cs {
274 struct drm_amdgpu_wait_cs_in in;
275 struct drm_amdgpu_wait_cs_out out;
276};
277
278/* Sets or returns a value associated with a buffer. */
279struct drm_amdgpu_gem_op {
280 uint32_t handle; /* buffer */
281 uint32_t op; /* AMDGPU_GEM_OP_* */
282 uint64_t value; /* input or return value */
283};
284
Marek Olšákd8f65a22015-05-27 14:30:38 +0200285#define AMDGPU_GEM_OP_GET_GEM_CREATE_INFO 0
286#define AMDGPU_GEM_OP_SET_PLACEMENT 1
Alex Deucher81629cb2015-04-20 16:42:01 -0400287
288#define AMDGPU_VA_OP_MAP 1
289#define AMDGPU_VA_OP_UNMAP 2
290
Alex Deucher81629cb2015-04-20 16:42:01 -0400291/* Mapping flags */
292/* readable mapping */
293#define AMDGPU_VM_PAGE_READABLE (1 << 1)
294/* writable mapping */
295#define AMDGPU_VM_PAGE_WRITEABLE (1 << 2)
296/* executable mapping, new for VI */
297#define AMDGPU_VM_PAGE_EXECUTABLE (1 << 3)
298
Christian König34b5f6a2015-06-08 15:03:00 +0200299struct drm_amdgpu_gem_va {
Alex Deucher81629cb2015-04-20 16:42:01 -0400300 /* GEM object handle */
301 uint32_t handle;
302 uint32_t _pad;
303 /* map or unmap*/
304 uint32_t operation;
305 /* specify mapping flags */
306 uint32_t flags;
307 /* va address to assign . Must be correctly aligned.*/
308 uint64_t va_address;
309 /* Specify offset inside of BO to assign. Must be correctly aligned.*/
310 uint64_t offset_in_bo;
311 /* Specify mapping size. If 0 and offset is 0 then map the whole BO.*/
312 /* Must be correctly aligned. */
313 uint64_t map_size;
314};
315
Alex Deucher81629cb2015-04-20 16:42:01 -0400316#define AMDGPU_HW_IP_GFX 0
317#define AMDGPU_HW_IP_COMPUTE 1
318#define AMDGPU_HW_IP_DMA 2
319#define AMDGPU_HW_IP_UVD 3
320#define AMDGPU_HW_IP_VCE 4
321#define AMDGPU_HW_IP_NUM 5
322
323#define AMDGPU_HW_IP_INSTANCE_MAX_COUNT 1
324
325#define AMDGPU_CHUNK_ID_IB 0x01
326#define AMDGPU_CHUNK_ID_FENCE 0x02
327struct drm_amdgpu_cs_chunk {
328 uint32_t chunk_id;
329 uint32_t length_dw;
330 uint64_t chunk_data;
331};
332
333struct drm_amdgpu_cs_in {
334 /** Rendering context id */
335 uint32_t ctx_id;
336 /** Handle of resource list associated with CS */
337 uint32_t bo_list_handle;
338 uint32_t num_chunks;
339 uint32_t _pad;
340 /* this points to uint64_t * which point to cs chunks */
341 uint64_t chunks;
342};
343
344struct drm_amdgpu_cs_out {
345 uint64_t handle;
346};
347
348union drm_amdgpu_cs {
349 struct drm_amdgpu_cs_in in;
350 struct drm_amdgpu_cs_out out;
351};
352
353/* Specify flags to be used for IB */
354
355/* This IB should be submitted to CE */
356#define AMDGPU_IB_FLAG_CE (1<<0)
357
Jammy Zhouaa2bdb242015-05-11 23:49:34 +0800358/* CE Preamble */
Jammy Zhoucab6d572015-06-06 04:49:22 +0800359#define AMDGPU_IB_FLAG_PREAMBLE (1<<1)
Jammy Zhouaa2bdb242015-05-11 23:49:34 +0800360
Alex Deucher81629cb2015-04-20 16:42:01 -0400361struct drm_amdgpu_cs_chunk_ib {
Marek Olšák3ccec532015-06-02 17:44:49 +0200362 uint32_t _pad;
Alex Deucher81629cb2015-04-20 16:42:01 -0400363 uint32_t flags; /* IB Flags */
364 uint64_t va_start; /* Virtual address to begin IB execution */
365 uint32_t ib_bytes; /* Size of submission */
366 uint32_t ip_type; /* HW IP to submit to */
367 uint32_t ip_instance; /* HW IP index of the same type to submit to */
368 uint32_t ring; /* Ring index to submit to */
369};
370
371struct drm_amdgpu_cs_chunk_fence {
372 uint32_t handle;
373 uint32_t offset;
374};
375
376struct drm_amdgpu_cs_chunk_data {
377 union {
378 struct drm_amdgpu_cs_chunk_ib ib_data;
379 struct drm_amdgpu_cs_chunk_fence fence_data;
380 };
381};
382
383/**
384 * Query h/w info: Flag that this is integrated (a.h.a. fusion) GPU
385 *
386 */
387#define AMDGPU_IDS_FLAGS_FUSION 0x1
388
389/* indicate if acceleration can be working */
390#define AMDGPU_INFO_ACCEL_WORKING 0x00
391/* get the crtc_id from the mode object id? */
392#define AMDGPU_INFO_CRTC_FROM_ID 0x01
393/* query hw IP info */
394#define AMDGPU_INFO_HW_IP_INFO 0x02
395/* query hw IP instance count for the specified type */
396#define AMDGPU_INFO_HW_IP_COUNT 0x03
397/* timestamp for GL_ARB_timer_query */
398#define AMDGPU_INFO_TIMESTAMP 0x05
399/* Query the firmware version */
400#define AMDGPU_INFO_FW_VERSION 0x0e
401 /* Subquery id: Query VCE firmware version */
402 #define AMDGPU_INFO_FW_VCE 0x1
403 /* Subquery id: Query UVD firmware version */
404 #define AMDGPU_INFO_FW_UVD 0x2
405 /* Subquery id: Query GMC firmware version */
406 #define AMDGPU_INFO_FW_GMC 0x03
407 /* Subquery id: Query GFX ME firmware version */
408 #define AMDGPU_INFO_FW_GFX_ME 0x04
409 /* Subquery id: Query GFX PFP firmware version */
410 #define AMDGPU_INFO_FW_GFX_PFP 0x05
411 /* Subquery id: Query GFX CE firmware version */
412 #define AMDGPU_INFO_FW_GFX_CE 0x06
413 /* Subquery id: Query GFX RLC firmware version */
414 #define AMDGPU_INFO_FW_GFX_RLC 0x07
415 /* Subquery id: Query GFX MEC firmware version */
416 #define AMDGPU_INFO_FW_GFX_MEC 0x08
417 /* Subquery id: Query SMC firmware version */
418 #define AMDGPU_INFO_FW_SMC 0x0a
419 /* Subquery id: Query SDMA firmware version */
420 #define AMDGPU_INFO_FW_SDMA 0x0b
421/* number of bytes moved for TTM migration */
422#define AMDGPU_INFO_NUM_BYTES_MOVED 0x0f
423/* the used VRAM size */
424#define AMDGPU_INFO_VRAM_USAGE 0x10
425/* the used GTT size */
426#define AMDGPU_INFO_GTT_USAGE 0x11
427/* Information about GDS, etc. resource configuration */
428#define AMDGPU_INFO_GDS_CONFIG 0x13
429/* Query information about VRAM and GTT domains */
430#define AMDGPU_INFO_VRAM_GTT 0x14
431/* Query information about register in MMR address space*/
432#define AMDGPU_INFO_READ_MMR_REG 0x15
433/* Query information about device: rev id, family, etc. */
434#define AMDGPU_INFO_DEV_INFO 0x16
435/* visible vram usage */
436#define AMDGPU_INFO_VIS_VRAM_USAGE 0x17
437
438#define AMDGPU_INFO_MMR_SE_INDEX_SHIFT 0
439#define AMDGPU_INFO_MMR_SE_INDEX_MASK 0xff
440#define AMDGPU_INFO_MMR_SH_INDEX_SHIFT 8
441#define AMDGPU_INFO_MMR_SH_INDEX_MASK 0xff
442
443/* Input structure for the INFO ioctl */
444struct drm_amdgpu_info {
445 /* Where the return value will be stored */
446 uint64_t return_pointer;
447 /* The size of the return value. Just like "size" in "snprintf",
448 * it limits how many bytes the kernel can write. */
449 uint32_t return_size;
450 /* The query request id. */
451 uint32_t query;
452
453 union {
454 struct {
455 uint32_t id;
456 uint32_t _pad;
457 } mode_crtc;
458
459 struct {
460 /** AMDGPU_HW_IP_* */
461 uint32_t type;
462 /**
463 * Index of the IP if there are more IPs of the same type.
464 * Ignored by AMDGPU_INFO_HW_IP_COUNT.
465 */
466 uint32_t ip_instance;
467 } query_hw_ip;
468
469 struct {
470 uint32_t dword_offset;
471 uint32_t count; /* number of registers to read */
472 uint32_t instance;
473 uint32_t flags;
474 } read_mmr_reg;
475
476 struct {
477 /** AMDGPU_INFO_FW_* */
478 uint32_t fw_type;
479 /** Index of the IP if there are more IPs of the same type. */
480 uint32_t ip_instance;
481 /**
482 * Index of the engine. Whether this is used depends
483 * on the firmware type. (e.g. MEC, SDMA)
484 */
485 uint32_t index;
486 uint32_t _pad;
487 } query_fw;
488 };
489};
490
491struct drm_amdgpu_info_gds {
492 /** GDS GFX partition size */
493 uint32_t gds_gfx_partition_size;
494 /** GDS compute partition size */
495 uint32_t compute_partition_size;
496 /** total GDS memory size */
497 uint32_t gds_total_size;
498 /** GWS size per GFX partition */
499 uint32_t gws_per_gfx_partition;
500 /** GSW size per compute partition */
501 uint32_t gws_per_compute_partition;
502 /** OA size per GFX partition */
503 uint32_t oa_per_gfx_partition;
504 /** OA size per compute partition */
505 uint32_t oa_per_compute_partition;
506 uint32_t _pad;
507};
508
509struct drm_amdgpu_info_vram_gtt {
510 uint64_t vram_size;
511 uint64_t vram_cpu_accessible_size;
512 uint64_t gtt_size;
513};
514
515struct drm_amdgpu_info_firmware {
516 uint32_t ver;
517 uint32_t feature;
518};
519
Ken Wang81c59f52015-06-03 21:02:01 +0800520#define AMDGPU_VRAM_TYPE_UNKNOWN 0
521#define AMDGPU_VRAM_TYPE_GDDR1 1
522#define AMDGPU_VRAM_TYPE_DDR2 2
523#define AMDGPU_VRAM_TYPE_GDDR3 3
524#define AMDGPU_VRAM_TYPE_GDDR4 4
525#define AMDGPU_VRAM_TYPE_GDDR5 5
526#define AMDGPU_VRAM_TYPE_HBM 6
527#define AMDGPU_VRAM_TYPE_DDR3 7
528
Alex Deucher81629cb2015-04-20 16:42:01 -0400529struct drm_amdgpu_info_device {
530 /** PCI Device ID */
531 uint32_t device_id;
532 /** Internal chip revision: A0, A1, etc.) */
533 uint32_t chip_rev;
534 uint32_t external_rev;
535 /** Revision id in PCI Config space */
536 uint32_t pci_rev;
537 uint32_t family;
538 uint32_t num_shader_engines;
539 uint32_t num_shader_arrays_per_engine;
540 uint32_t gpu_counter_freq; /* in KHz */
541 uint64_t max_engine_clock; /* in KHz */
Ken Wang32bf7102015-06-03 17:36:54 +0800542 uint64_t max_memory_clock; /* in KHz */
Alex Deucher81629cb2015-04-20 16:42:01 -0400543 /* cu information */
544 uint32_t cu_active_number;
545 uint32_t cu_ao_mask;
546 uint32_t cu_bitmap[4][4];
547 /** Render backend pipe mask. One render backend is CB+DB. */
548 uint32_t enabled_rb_pipes_mask;
549 uint32_t num_rb_pipes;
550 uint32_t num_hw_gfx_contexts;
551 uint32_t _pad;
552 uint64_t ids_flags;
553 /** Starting virtual address for UMDs. */
554 uint64_t virtual_address_offset;
Jammy Zhou02b70c82015-05-12 22:46:45 +0800555 /** The maximum virtual address */
556 uint64_t virtual_address_max;
Alex Deucher81629cb2015-04-20 16:42:01 -0400557 /** Required alignment of virtual addresses. */
558 uint32_t virtual_address_alignment;
559 /** Page table entry - fragment size */
560 uint32_t pte_fragment_size;
561 uint32_t gart_page_size;
Ken Wanga101a892015-06-03 17:47:54 +0800562 /** constant engine ram size*/
563 uint32_t ce_ram_size;
Jammy Zhoucab6d572015-06-06 04:49:22 +0800564 /** video memory type info*/
Ken Wang81c59f52015-06-03 21:02:01 +0800565 uint32_t vram_type;
566 /** video memory bit width*/
567 uint32_t vram_bit_width;
Alex Deucher81629cb2015-04-20 16:42:01 -0400568};
569
570struct drm_amdgpu_info_hw_ip {
571 /** Version of h/w IP */
572 uint32_t hw_ip_version_major;
573 uint32_t hw_ip_version_minor;
574 /** Capabilities */
575 uint64_t capabilities_flags;
Ken Wang71062f42015-06-04 21:26:57 +0800576 /** command buffer address start alignment*/
577 uint32_t ib_start_alignment;
578 /** command buffer size alignment*/
579 uint32_t ib_size_alignment;
Alex Deucher81629cb2015-04-20 16:42:01 -0400580 /** Bitmask of available rings. Bit 0 means ring 0, etc. */
581 uint32_t available_rings;
582 uint32_t _pad;
583};
584
585/*
586 * Supported GPU families
587 */
588#define AMDGPU_FAMILY_UNKNOWN 0
589#define AMDGPU_FAMILY_CI 120 /* Bonaire, Hawaii */
590#define AMDGPU_FAMILY_KV 125 /* Kaveri, Kabini, Mullins */
591#define AMDGPU_FAMILY_VI 130 /* Iceland, Tonga */
592#define AMDGPU_FAMILY_CZ 135 /* Carrizo */
593
594#endif