amdgpu_drm.h 18 KB

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