amdgpu_drm.h 31 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067
  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_AMDGPU_WAIT_FENCES 0x12
  50. #define DRM_AMDGPU_VM 0x13
  51. #define DRM_AMDGPU_FENCE_TO_HANDLE 0x14
  52. #define DRM_AMDGPU_SCHED 0x15
  53. #define DRM_IOCTL_AMDGPU_GEM_CREATE DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_CREATE, union drm_amdgpu_gem_create)
  54. #define DRM_IOCTL_AMDGPU_GEM_MMAP DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_MMAP, union drm_amdgpu_gem_mmap)
  55. #define DRM_IOCTL_AMDGPU_CTX DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_CTX, union drm_amdgpu_ctx)
  56. #define DRM_IOCTL_AMDGPU_BO_LIST DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_BO_LIST, union drm_amdgpu_bo_list)
  57. #define DRM_IOCTL_AMDGPU_CS DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_CS, union drm_amdgpu_cs)
  58. #define DRM_IOCTL_AMDGPU_INFO DRM_IOW(DRM_COMMAND_BASE + DRM_AMDGPU_INFO, struct drm_amdgpu_info)
  59. #define DRM_IOCTL_AMDGPU_GEM_METADATA DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_METADATA, struct drm_amdgpu_gem_metadata)
  60. #define DRM_IOCTL_AMDGPU_GEM_WAIT_IDLE DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_WAIT_IDLE, union drm_amdgpu_gem_wait_idle)
  61. #define DRM_IOCTL_AMDGPU_GEM_VA DRM_IOW(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_VA, struct drm_amdgpu_gem_va)
  62. #define DRM_IOCTL_AMDGPU_WAIT_CS DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_WAIT_CS, union drm_amdgpu_wait_cs)
  63. #define DRM_IOCTL_AMDGPU_GEM_OP DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_OP, struct drm_amdgpu_gem_op)
  64. #define DRM_IOCTL_AMDGPU_GEM_USERPTR DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_GEM_USERPTR, struct drm_amdgpu_gem_userptr)
  65. #define DRM_IOCTL_AMDGPU_WAIT_FENCES DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_WAIT_FENCES, union drm_amdgpu_wait_fences)
  66. #define DRM_IOCTL_AMDGPU_VM DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_VM, union drm_amdgpu_vm)
  67. #define DRM_IOCTL_AMDGPU_FENCE_TO_HANDLE DRM_IOWR(DRM_COMMAND_BASE + DRM_AMDGPU_FENCE_TO_HANDLE, union drm_amdgpu_fence_to_handle)
  68. #define DRM_IOCTL_AMDGPU_SCHED DRM_IOW(DRM_COMMAND_BASE + DRM_AMDGPU_SCHED, union drm_amdgpu_sched)
  69. /**
  70. * DOC: memory domains
  71. *
  72. * %AMDGPU_GEM_DOMAIN_CPU System memory that is not GPU accessible.
  73. * Memory in this pool could be swapped out to disk if there is pressure.
  74. *
  75. * %AMDGPU_GEM_DOMAIN_GTT GPU accessible system memory, mapped into the
  76. * GPU's virtual address space via gart. Gart memory linearizes non-contiguous
  77. * pages of system memory, allows GPU access system memory in a linezrized
  78. * fashion.
  79. *
  80. * %AMDGPU_GEM_DOMAIN_VRAM Local video memory. For APUs, it is memory
  81. * carved out by the BIOS.
  82. *
  83. * %AMDGPU_GEM_DOMAIN_GDS Global on-chip data storage used to share data
  84. * across shader threads.
  85. *
  86. * %AMDGPU_GEM_DOMAIN_GWS Global wave sync, used to synchronize the
  87. * execution of all the waves on a device.
  88. *
  89. * %AMDGPU_GEM_DOMAIN_OA Ordered append, used by 3D or Compute engines
  90. * for appending data.
  91. */
  92. #define AMDGPU_GEM_DOMAIN_CPU 0x1
  93. #define AMDGPU_GEM_DOMAIN_GTT 0x2
  94. #define AMDGPU_GEM_DOMAIN_VRAM 0x4
  95. #define AMDGPU_GEM_DOMAIN_GDS 0x8
  96. #define AMDGPU_GEM_DOMAIN_GWS 0x10
  97. #define AMDGPU_GEM_DOMAIN_OA 0x20
  98. #define AMDGPU_GEM_DOMAIN_MASK (AMDGPU_GEM_DOMAIN_CPU | \
  99. AMDGPU_GEM_DOMAIN_GTT | \
  100. AMDGPU_GEM_DOMAIN_VRAM | \
  101. AMDGPU_GEM_DOMAIN_GDS | \
  102. AMDGPU_GEM_DOMAIN_GWS | \
  103. AMDGPU_GEM_DOMAIN_OA)
  104. /* Flag that CPU access will be required for the case of VRAM domain */
  105. #define AMDGPU_GEM_CREATE_CPU_ACCESS_REQUIRED (1 << 0)
  106. /* Flag that CPU access will not work, this VRAM domain is invisible */
  107. #define AMDGPU_GEM_CREATE_NO_CPU_ACCESS (1 << 1)
  108. /* Flag that USWC attributes should be used for GTT */
  109. #define AMDGPU_GEM_CREATE_CPU_GTT_USWC (1 << 2)
  110. /* Flag that the memory should be in VRAM and cleared */
  111. #define AMDGPU_GEM_CREATE_VRAM_CLEARED (1 << 3)
  112. /* Flag that create shadow bo(GTT) while allocating vram bo */
  113. #define AMDGPU_GEM_CREATE_SHADOW (1 << 4)
  114. /* Flag that allocating the BO should use linear VRAM */
  115. #define AMDGPU_GEM_CREATE_VRAM_CONTIGUOUS (1 << 5)
  116. /* Flag that BO is always valid in this VM */
  117. #define AMDGPU_GEM_CREATE_VM_ALWAYS_VALID (1 << 6)
  118. /* Flag that BO sharing will be explicitly synchronized */
  119. #define AMDGPU_GEM_CREATE_EXPLICIT_SYNC (1 << 7)
  120. /* Flag that indicates allocating MQD gart on GFX9, where the mtype
  121. * for the second page onward should be set to NC.
  122. */
  123. #define AMDGPU_GEM_CREATE_MQD_GFX9 (1 << 8)
  124. /* Flag that BO may contain sensitive data that must be wiped before
  125. * releasing the memory
  126. */
  127. #define AMDGPU_GEM_CREATE_VRAM_WIPE_ON_RELEASE (1 << 9)
  128. struct drm_amdgpu_gem_create_in {
  129. /** the requested memory size */
  130. __u64 bo_size;
  131. /** physical start_addr alignment in bytes for some HW requirements */
  132. __u64 alignment;
  133. /** the requested memory domains */
  134. __u64 domains;
  135. /** allocation flags */
  136. __u64 domain_flags;
  137. };
  138. struct drm_amdgpu_gem_create_out {
  139. /** returned GEM object handle */
  140. __u32 handle;
  141. __u32 _pad;
  142. };
  143. union drm_amdgpu_gem_create {
  144. struct drm_amdgpu_gem_create_in in;
  145. struct drm_amdgpu_gem_create_out out;
  146. };
  147. /** Opcode to create new residency list. */
  148. #define AMDGPU_BO_LIST_OP_CREATE 0
  149. /** Opcode to destroy previously created residency list */
  150. #define AMDGPU_BO_LIST_OP_DESTROY 1
  151. /** Opcode to update resource information in the list */
  152. #define AMDGPU_BO_LIST_OP_UPDATE 2
  153. struct drm_amdgpu_bo_list_in {
  154. /** Type of operation */
  155. __u32 operation;
  156. /** Handle of list or 0 if we want to create one */
  157. __u32 list_handle;
  158. /** Number of BOs in list */
  159. __u32 bo_number;
  160. /** Size of each element describing BO */
  161. __u32 bo_info_size;
  162. /** Pointer to array describing BOs */
  163. __u64 bo_info_ptr;
  164. };
  165. struct drm_amdgpu_bo_list_entry {
  166. /** Handle of BO */
  167. __u32 bo_handle;
  168. /** New (if specified) BO priority to be used during migration */
  169. __u32 bo_priority;
  170. };
  171. struct drm_amdgpu_bo_list_out {
  172. /** Handle of resource list */
  173. __u32 list_handle;
  174. __u32 _pad;
  175. };
  176. union drm_amdgpu_bo_list {
  177. struct drm_amdgpu_bo_list_in in;
  178. struct drm_amdgpu_bo_list_out out;
  179. };
  180. /* context related */
  181. #define AMDGPU_CTX_OP_ALLOC_CTX 1
  182. #define AMDGPU_CTX_OP_FREE_CTX 2
  183. #define AMDGPU_CTX_OP_QUERY_STATE 3
  184. #define AMDGPU_CTX_OP_QUERY_STATE2 4
  185. /* GPU reset status */
  186. #define AMDGPU_CTX_NO_RESET 0
  187. /* this the context caused it */
  188. #define AMDGPU_CTX_GUILTY_RESET 1
  189. /* some other context caused it */
  190. #define AMDGPU_CTX_INNOCENT_RESET 2
  191. /* unknown cause */
  192. #define AMDGPU_CTX_UNKNOWN_RESET 3
  193. /* indicate gpu reset occured after ctx created */
  194. #define AMDGPU_CTX_QUERY2_FLAGS_RESET (1<<0)
  195. /* indicate vram lost occured after ctx created */
  196. #define AMDGPU_CTX_QUERY2_FLAGS_VRAMLOST (1<<1)
  197. /* indicate some job from this context once cause gpu hang */
  198. #define AMDGPU_CTX_QUERY2_FLAGS_GUILTY (1<<2)
  199. /* indicate some errors are detected by RAS */
  200. #define AMDGPU_CTX_QUERY2_FLAGS_RAS_CE (1<<3)
  201. #define AMDGPU_CTX_QUERY2_FLAGS_RAS_UE (1<<4)
  202. /* Context priority level */
  203. #define AMDGPU_CTX_PRIORITY_UNSET -2048
  204. #define AMDGPU_CTX_PRIORITY_VERY_LOW -1023
  205. #define AMDGPU_CTX_PRIORITY_LOW -512
  206. #define AMDGPU_CTX_PRIORITY_NORMAL 0
  207. /*
  208. * When used in struct drm_amdgpu_ctx_in, a priority above NORMAL requires
  209. * CAP_SYS_NICE or DRM_MASTER
  210. */
  211. #define AMDGPU_CTX_PRIORITY_HIGH 512
  212. #define AMDGPU_CTX_PRIORITY_VERY_HIGH 1023
  213. struct drm_amdgpu_ctx_in {
  214. /** AMDGPU_CTX_OP_* */
  215. __u32 op;
  216. /** For future use, no flags defined so far */
  217. __u32 flags;
  218. __u32 ctx_id;
  219. /** AMDGPU_CTX_PRIORITY_* */
  220. __s32 priority;
  221. };
  222. union drm_amdgpu_ctx_out {
  223. struct {
  224. __u32 ctx_id;
  225. __u32 _pad;
  226. } alloc;
  227. struct {
  228. /** For future use, no flags defined so far */
  229. __u64 flags;
  230. /** Number of resets caused by this context so far. */
  231. __u32 hangs;
  232. /** Reset status since the last call of the ioctl. */
  233. __u32 reset_status;
  234. } state;
  235. };
  236. union drm_amdgpu_ctx {
  237. struct drm_amdgpu_ctx_in in;
  238. union drm_amdgpu_ctx_out out;
  239. };
  240. /* vm ioctl */
  241. #define AMDGPU_VM_OP_RESERVE_VMID 1
  242. #define AMDGPU_VM_OP_UNRESERVE_VMID 2
  243. struct drm_amdgpu_vm_in {
  244. /** AMDGPU_VM_OP_* */
  245. __u32 op;
  246. __u32 flags;
  247. };
  248. struct drm_amdgpu_vm_out {
  249. /** For future use, no flags defined so far */
  250. __u64 flags;
  251. };
  252. union drm_amdgpu_vm {
  253. struct drm_amdgpu_vm_in in;
  254. struct drm_amdgpu_vm_out out;
  255. };
  256. /* sched ioctl */
  257. #define AMDGPU_SCHED_OP_PROCESS_PRIORITY_OVERRIDE 1
  258. #define AMDGPU_SCHED_OP_CONTEXT_PRIORITY_OVERRIDE 2
  259. struct drm_amdgpu_sched_in {
  260. /* AMDGPU_SCHED_OP_* */
  261. __u32 op;
  262. __u32 fd;
  263. /** AMDGPU_CTX_PRIORITY_* */
  264. __s32 priority;
  265. __u32 ctx_id;
  266. };
  267. union drm_amdgpu_sched {
  268. struct drm_amdgpu_sched_in in;
  269. };
  270. /*
  271. * This is not a reliable API and you should expect it to fail for any
  272. * number of reasons and have fallback path that do not use userptr to
  273. * perform any operation.
  274. */
  275. #define AMDGPU_GEM_USERPTR_READONLY (1 << 0)
  276. #define AMDGPU_GEM_USERPTR_ANONONLY (1 << 1)
  277. #define AMDGPU_GEM_USERPTR_VALIDATE (1 << 2)
  278. #define AMDGPU_GEM_USERPTR_REGISTER (1 << 3)
  279. struct drm_amdgpu_gem_userptr {
  280. __u64 addr;
  281. __u64 size;
  282. /* AMDGPU_GEM_USERPTR_* */
  283. __u32 flags;
  284. /* Resulting GEM handle */
  285. __u32 handle;
  286. };
  287. /* SI-CI-VI: */
  288. /* same meaning as the GB_TILE_MODE and GL_MACRO_TILE_MODE fields */
  289. #define AMDGPU_TILING_ARRAY_MODE_SHIFT 0
  290. #define AMDGPU_TILING_ARRAY_MODE_MASK 0xf
  291. #define AMDGPU_TILING_PIPE_CONFIG_SHIFT 4
  292. #define AMDGPU_TILING_PIPE_CONFIG_MASK 0x1f
  293. #define AMDGPU_TILING_TILE_SPLIT_SHIFT 9
  294. #define AMDGPU_TILING_TILE_SPLIT_MASK 0x7
  295. #define AMDGPU_TILING_MICRO_TILE_MODE_SHIFT 12
  296. #define AMDGPU_TILING_MICRO_TILE_MODE_MASK 0x7
  297. #define AMDGPU_TILING_BANK_WIDTH_SHIFT 15
  298. #define AMDGPU_TILING_BANK_WIDTH_MASK 0x3
  299. #define AMDGPU_TILING_BANK_HEIGHT_SHIFT 17
  300. #define AMDGPU_TILING_BANK_HEIGHT_MASK 0x3
  301. #define AMDGPU_TILING_MACRO_TILE_ASPECT_SHIFT 19
  302. #define AMDGPU_TILING_MACRO_TILE_ASPECT_MASK 0x3
  303. #define AMDGPU_TILING_NUM_BANKS_SHIFT 21
  304. #define AMDGPU_TILING_NUM_BANKS_MASK 0x3
  305. /* GFX9 and later: */
  306. #define AMDGPU_TILING_SWIZZLE_MODE_SHIFT 0
  307. #define AMDGPU_TILING_SWIZZLE_MODE_MASK 0x1f
  308. #define AMDGPU_TILING_DCC_OFFSET_256B_SHIFT 5
  309. #define AMDGPU_TILING_DCC_OFFSET_256B_MASK 0xFFFFFF
  310. #define AMDGPU_TILING_DCC_PITCH_MAX_SHIFT 29
  311. #define AMDGPU_TILING_DCC_PITCH_MAX_MASK 0x3FFF
  312. #define AMDGPU_TILING_DCC_INDEPENDENT_64B_SHIFT 43
  313. #define AMDGPU_TILING_DCC_INDEPENDENT_64B_MASK 0x1
  314. /* Set/Get helpers for tiling flags. */
  315. #define AMDGPU_TILING_SET(field, value) \
  316. (((__u64)(value) & AMDGPU_TILING_##field##_MASK) << AMDGPU_TILING_##field##_SHIFT)
  317. #define AMDGPU_TILING_GET(value, field) \
  318. (((__u64)(value) >> AMDGPU_TILING_##field##_SHIFT) & AMDGPU_TILING_##field##_MASK)
  319. #define AMDGPU_GEM_METADATA_OP_SET_METADATA 1
  320. #define AMDGPU_GEM_METADATA_OP_GET_METADATA 2
  321. /** The same structure is shared for input/output */
  322. struct drm_amdgpu_gem_metadata {
  323. /** GEM Object handle */
  324. __u32 handle;
  325. /** Do we want get or set metadata */
  326. __u32 op;
  327. struct {
  328. /** For future use, no flags defined so far */
  329. __u64 flags;
  330. /** family specific tiling info */
  331. __u64 tiling_info;
  332. __u32 data_size_bytes;
  333. __u32 data[64];
  334. } data;
  335. };
  336. struct drm_amdgpu_gem_mmap_in {
  337. /** the GEM object handle */
  338. __u32 handle;
  339. __u32 _pad;
  340. };
  341. struct drm_amdgpu_gem_mmap_out {
  342. /** mmap offset from the vma offset manager */
  343. __u64 addr_ptr;
  344. };
  345. union drm_amdgpu_gem_mmap {
  346. struct drm_amdgpu_gem_mmap_in in;
  347. struct drm_amdgpu_gem_mmap_out out;
  348. };
  349. struct drm_amdgpu_gem_wait_idle_in {
  350. /** GEM object handle */
  351. __u32 handle;
  352. /** For future use, no flags defined so far */
  353. __u32 flags;
  354. /** Absolute timeout to wait */
  355. __u64 timeout;
  356. };
  357. struct drm_amdgpu_gem_wait_idle_out {
  358. /** BO status: 0 - BO is idle, 1 - BO is busy */
  359. __u32 status;
  360. /** Returned current memory domain */
  361. __u32 domain;
  362. };
  363. union drm_amdgpu_gem_wait_idle {
  364. struct drm_amdgpu_gem_wait_idle_in in;
  365. struct drm_amdgpu_gem_wait_idle_out out;
  366. };
  367. struct drm_amdgpu_wait_cs_in {
  368. /* Command submission handle
  369. * handle equals 0 means none to wait for
  370. * handle equals ~0ull means wait for the latest sequence number
  371. */
  372. __u64 handle;
  373. /** Absolute timeout to wait */
  374. __u64 timeout;
  375. __u32 ip_type;
  376. __u32 ip_instance;
  377. __u32 ring;
  378. __u32 ctx_id;
  379. };
  380. struct drm_amdgpu_wait_cs_out {
  381. /** CS status: 0 - CS completed, 1 - CS still busy */
  382. __u64 status;
  383. };
  384. union drm_amdgpu_wait_cs {
  385. struct drm_amdgpu_wait_cs_in in;
  386. struct drm_amdgpu_wait_cs_out out;
  387. };
  388. struct drm_amdgpu_fence {
  389. __u32 ctx_id;
  390. __u32 ip_type;
  391. __u32 ip_instance;
  392. __u32 ring;
  393. __u64 seq_no;
  394. };
  395. struct drm_amdgpu_wait_fences_in {
  396. /** This points to uint64_t * which points to fences */
  397. __u64 fences;
  398. __u32 fence_count;
  399. __u32 wait_all;
  400. __u64 timeout_ns;
  401. };
  402. struct drm_amdgpu_wait_fences_out {
  403. __u32 status;
  404. __u32 first_signaled;
  405. };
  406. union drm_amdgpu_wait_fences {
  407. struct drm_amdgpu_wait_fences_in in;
  408. struct drm_amdgpu_wait_fences_out out;
  409. };
  410. #define AMDGPU_GEM_OP_GET_GEM_CREATE_INFO 0
  411. #define AMDGPU_GEM_OP_SET_PLACEMENT 1
  412. /* Sets or returns a value associated with a buffer. */
  413. struct drm_amdgpu_gem_op {
  414. /** GEM object handle */
  415. __u32 handle;
  416. /** AMDGPU_GEM_OP_* */
  417. __u32 op;
  418. /** Input or return value */
  419. __u64 value;
  420. };
  421. #define AMDGPU_VA_OP_MAP 1
  422. #define AMDGPU_VA_OP_UNMAP 2
  423. #define AMDGPU_VA_OP_CLEAR 3
  424. #define AMDGPU_VA_OP_REPLACE 4
  425. /* Delay the page table update till the next CS */
  426. #define AMDGPU_VM_DELAY_UPDATE (1 << 0)
  427. /* Mapping flags */
  428. /* readable mapping */
  429. #define AMDGPU_VM_PAGE_READABLE (1 << 1)
  430. /* writable mapping */
  431. #define AMDGPU_VM_PAGE_WRITEABLE (1 << 2)
  432. /* executable mapping, new for VI */
  433. #define AMDGPU_VM_PAGE_EXECUTABLE (1 << 3)
  434. /* partially resident texture */
  435. #define AMDGPU_VM_PAGE_PRT (1 << 4)
  436. /* MTYPE flags use bit 5 to 8 */
  437. #define AMDGPU_VM_MTYPE_MASK (0xf << 5)
  438. /* Default MTYPE. Pre-AI must use this. Recommended for newer ASICs. */
  439. #define AMDGPU_VM_MTYPE_DEFAULT (0 << 5)
  440. /* Use NC MTYPE instead of default MTYPE */
  441. #define AMDGPU_VM_MTYPE_NC (1 << 5)
  442. /* Use WC MTYPE instead of default MTYPE */
  443. #define AMDGPU_VM_MTYPE_WC (2 << 5)
  444. /* Use CC MTYPE instead of default MTYPE */
  445. #define AMDGPU_VM_MTYPE_CC (3 << 5)
  446. /* Use UC MTYPE instead of default MTYPE */
  447. #define AMDGPU_VM_MTYPE_UC (4 << 5)
  448. struct drm_amdgpu_gem_va {
  449. /** GEM object handle */
  450. __u32 handle;
  451. __u32 _pad;
  452. /** AMDGPU_VA_OP_* */
  453. __u32 operation;
  454. /** AMDGPU_VM_PAGE_* */
  455. __u32 flags;
  456. /** va address to assign . Must be correctly aligned.*/
  457. __u64 va_address;
  458. /** Specify offset inside of BO to assign. Must be correctly aligned.*/
  459. __u64 offset_in_bo;
  460. /** Specify mapping size. Must be correctly aligned. */
  461. __u64 map_size;
  462. };
  463. #define AMDGPU_HW_IP_GFX 0
  464. #define AMDGPU_HW_IP_COMPUTE 1
  465. #define AMDGPU_HW_IP_DMA 2
  466. #define AMDGPU_HW_IP_UVD 3
  467. #define AMDGPU_HW_IP_VCE 4
  468. #define AMDGPU_HW_IP_UVD_ENC 5
  469. #define AMDGPU_HW_IP_VCN_DEC 6
  470. #define AMDGPU_HW_IP_VCN_ENC 7
  471. #define AMDGPU_HW_IP_VCN_JPEG 8
  472. #define AMDGPU_HW_IP_NUM 9
  473. #define AMDGPU_HW_IP_INSTANCE_MAX_COUNT 1
  474. #define AMDGPU_CHUNK_ID_IB 0x01
  475. #define AMDGPU_CHUNK_ID_FENCE 0x02
  476. #define AMDGPU_CHUNK_ID_DEPENDENCIES 0x03
  477. #define AMDGPU_CHUNK_ID_SYNCOBJ_IN 0x04
  478. #define AMDGPU_CHUNK_ID_SYNCOBJ_OUT 0x05
  479. #define AMDGPU_CHUNK_ID_BO_HANDLES 0x06
  480. #define AMDGPU_CHUNK_ID_SCHEDULED_DEPENDENCIES 0x07
  481. #define AMDGPU_CHUNK_ID_SYNCOBJ_TIMELINE_WAIT 0x08
  482. #define AMDGPU_CHUNK_ID_SYNCOBJ_TIMELINE_SIGNAL 0x09
  483. struct drm_amdgpu_cs_chunk {
  484. __u32 chunk_id;
  485. __u32 length_dw;
  486. __u64 chunk_data;
  487. };
  488. struct drm_amdgpu_cs_in {
  489. /** Rendering context id */
  490. __u32 ctx_id;
  491. /** Handle of resource list associated with CS */
  492. __u32 bo_list_handle;
  493. __u32 num_chunks;
  494. __u32 _pad;
  495. /** this points to __u64 * which point to cs chunks */
  496. __u64 chunks;
  497. };
  498. struct drm_amdgpu_cs_out {
  499. __u64 handle;
  500. };
  501. union drm_amdgpu_cs {
  502. struct drm_amdgpu_cs_in in;
  503. struct drm_amdgpu_cs_out out;
  504. };
  505. /* Specify flags to be used for IB */
  506. /* This IB should be submitted to CE */
  507. #define AMDGPU_IB_FLAG_CE (1<<0)
  508. /* Preamble flag, which means the IB could be dropped if no context switch */
  509. #define AMDGPU_IB_FLAG_PREAMBLE (1<<1)
  510. /* Preempt flag, IB should set Pre_enb bit if PREEMPT flag detected */
  511. #define AMDGPU_IB_FLAG_PREEMPT (1<<2)
  512. /* The IB fence should do the L2 writeback but not invalidate any shader
  513. * caches (L2/vL1/sL1/I$). */
  514. #define AMDGPU_IB_FLAG_TC_WB_NOT_INVALIDATE (1 << 3)
  515. /* Set GDS_COMPUTE_MAX_WAVE_ID = DEFAULT before PACKET3_INDIRECT_BUFFER.
  516. * This will reset wave ID counters for the IB.
  517. */
  518. #define AMDGPU_IB_FLAG_RESET_GDS_MAX_WAVE_ID (1 << 4)
  519. struct drm_amdgpu_cs_chunk_ib {
  520. __u32 _pad;
  521. /** AMDGPU_IB_FLAG_* */
  522. __u32 flags;
  523. /** Virtual address to begin IB execution */
  524. __u64 va_start;
  525. /** Size of submission */
  526. __u32 ib_bytes;
  527. /** HW IP to submit to */
  528. __u32 ip_type;
  529. /** HW IP index of the same type to submit to */
  530. __u32 ip_instance;
  531. /** Ring index to submit to */
  532. __u32 ring;
  533. };
  534. struct drm_amdgpu_cs_chunk_dep {
  535. __u32 ip_type;
  536. __u32 ip_instance;
  537. __u32 ring;
  538. __u32 ctx_id;
  539. __u64 handle;
  540. };
  541. struct drm_amdgpu_cs_chunk_fence {
  542. __u32 handle;
  543. __u32 offset;
  544. };
  545. struct drm_amdgpu_cs_chunk_sem {
  546. __u32 handle;
  547. };
  548. struct drm_amdgpu_cs_chunk_syncobj {
  549. __u32 handle;
  550. __u32 flags;
  551. __u64 point;
  552. };
  553. #define AMDGPU_FENCE_TO_HANDLE_GET_SYNCOBJ 0
  554. #define AMDGPU_FENCE_TO_HANDLE_GET_SYNCOBJ_FD 1
  555. #define AMDGPU_FENCE_TO_HANDLE_GET_SYNC_FILE_FD 2
  556. union drm_amdgpu_fence_to_handle {
  557. struct {
  558. struct drm_amdgpu_fence fence;
  559. __u32 what;
  560. __u32 pad;
  561. } in;
  562. struct {
  563. __u32 handle;
  564. } out;
  565. };
  566. struct drm_amdgpu_cs_chunk_data {
  567. union {
  568. struct drm_amdgpu_cs_chunk_ib ib_data;
  569. struct drm_amdgpu_cs_chunk_fence fence_data;
  570. };
  571. };
  572. /**
  573. * Query h/w info: Flag that this is integrated (a.h.a. fusion) GPU
  574. *
  575. */
  576. #define AMDGPU_IDS_FLAGS_FUSION 0x1
  577. #define AMDGPU_IDS_FLAGS_PREEMPTION 0x2
  578. /* indicate if acceleration can be working */
  579. #define AMDGPU_INFO_ACCEL_WORKING 0x00
  580. /* get the crtc_id from the mode object id? */
  581. #define AMDGPU_INFO_CRTC_FROM_ID 0x01
  582. /* query hw IP info */
  583. #define AMDGPU_INFO_HW_IP_INFO 0x02
  584. /* query hw IP instance count for the specified type */
  585. #define AMDGPU_INFO_HW_IP_COUNT 0x03
  586. /* timestamp for GL_ARB_timer_query */
  587. #define AMDGPU_INFO_TIMESTAMP 0x05
  588. /* Query the firmware version */
  589. #define AMDGPU_INFO_FW_VERSION 0x0e
  590. /* Subquery id: Query VCE firmware version */
  591. #define AMDGPU_INFO_FW_VCE 0x1
  592. /* Subquery id: Query UVD firmware version */
  593. #define AMDGPU_INFO_FW_UVD 0x2
  594. /* Subquery id: Query GMC firmware version */
  595. #define AMDGPU_INFO_FW_GMC 0x03
  596. /* Subquery id: Query GFX ME firmware version */
  597. #define AMDGPU_INFO_FW_GFX_ME 0x04
  598. /* Subquery id: Query GFX PFP firmware version */
  599. #define AMDGPU_INFO_FW_GFX_PFP 0x05
  600. /* Subquery id: Query GFX CE firmware version */
  601. #define AMDGPU_INFO_FW_GFX_CE 0x06
  602. /* Subquery id: Query GFX RLC firmware version */
  603. #define AMDGPU_INFO_FW_GFX_RLC 0x07
  604. /* Subquery id: Query GFX MEC firmware version */
  605. #define AMDGPU_INFO_FW_GFX_MEC 0x08
  606. /* Subquery id: Query SMC firmware version */
  607. #define AMDGPU_INFO_FW_SMC 0x0a
  608. /* Subquery id: Query SDMA firmware version */
  609. #define AMDGPU_INFO_FW_SDMA 0x0b
  610. /* Subquery id: Query PSP SOS firmware version */
  611. #define AMDGPU_INFO_FW_SOS 0x0c
  612. /* Subquery id: Query PSP ASD firmware version */
  613. #define AMDGPU_INFO_FW_ASD 0x0d
  614. /* Subquery id: Query VCN firmware version */
  615. #define AMDGPU_INFO_FW_VCN 0x0e
  616. /* Subquery id: Query GFX RLC SRLC firmware version */
  617. #define AMDGPU_INFO_FW_GFX_RLC_RESTORE_LIST_CNTL 0x0f
  618. /* Subquery id: Query GFX RLC SRLG firmware version */
  619. #define AMDGPU_INFO_FW_GFX_RLC_RESTORE_LIST_GPM_MEM 0x10
  620. /* Subquery id: Query GFX RLC SRLS firmware version */
  621. #define AMDGPU_INFO_FW_GFX_RLC_RESTORE_LIST_SRM_MEM 0x11
  622. /* Subquery id: Query DMCU firmware version */
  623. #define AMDGPU_INFO_FW_DMCU 0x12
  624. #define AMDGPU_INFO_FW_TA 0x13
  625. /* number of bytes moved for TTM migration */
  626. #define AMDGPU_INFO_NUM_BYTES_MOVED 0x0f
  627. /* the used VRAM size */
  628. #define AMDGPU_INFO_VRAM_USAGE 0x10
  629. /* the used GTT size */
  630. #define AMDGPU_INFO_GTT_USAGE 0x11
  631. /* Information about GDS, etc. resource configuration */
  632. #define AMDGPU_INFO_GDS_CONFIG 0x13
  633. /* Query information about VRAM and GTT domains */
  634. #define AMDGPU_INFO_VRAM_GTT 0x14
  635. /* Query information about register in MMR address space*/
  636. #define AMDGPU_INFO_READ_MMR_REG 0x15
  637. /* Query information about device: rev id, family, etc. */
  638. #define AMDGPU_INFO_DEV_INFO 0x16
  639. /* visible vram usage */
  640. #define AMDGPU_INFO_VIS_VRAM_USAGE 0x17
  641. /* number of TTM buffer evictions */
  642. #define AMDGPU_INFO_NUM_EVICTIONS 0x18
  643. /* Query memory about VRAM and GTT domains */
  644. #define AMDGPU_INFO_MEMORY 0x19
  645. /* Query vce clock table */
  646. #define AMDGPU_INFO_VCE_CLOCK_TABLE 0x1A
  647. /* Query vbios related information */
  648. #define AMDGPU_INFO_VBIOS 0x1B
  649. /* Subquery id: Query vbios size */
  650. #define AMDGPU_INFO_VBIOS_SIZE 0x1
  651. /* Subquery id: Query vbios image */
  652. #define AMDGPU_INFO_VBIOS_IMAGE 0x2
  653. /* Query UVD handles */
  654. #define AMDGPU_INFO_NUM_HANDLES 0x1C
  655. /* Query sensor related information */
  656. #define AMDGPU_INFO_SENSOR 0x1D
  657. /* Subquery id: Query GPU shader clock */
  658. #define AMDGPU_INFO_SENSOR_GFX_SCLK 0x1
  659. /* Subquery id: Query GPU memory clock */
  660. #define AMDGPU_INFO_SENSOR_GFX_MCLK 0x2
  661. /* Subquery id: Query GPU temperature */
  662. #define AMDGPU_INFO_SENSOR_GPU_TEMP 0x3
  663. /* Subquery id: Query GPU load */
  664. #define AMDGPU_INFO_SENSOR_GPU_LOAD 0x4
  665. /* Subquery id: Query average GPU power */
  666. #define AMDGPU_INFO_SENSOR_GPU_AVG_POWER 0x5
  667. /* Subquery id: Query northbridge voltage */
  668. #define AMDGPU_INFO_SENSOR_VDDNB 0x6
  669. /* Subquery id: Query graphics voltage */
  670. #define AMDGPU_INFO_SENSOR_VDDGFX 0x7
  671. /* Subquery id: Query GPU stable pstate shader clock */
  672. #define AMDGPU_INFO_SENSOR_STABLE_PSTATE_GFX_SCLK 0x8
  673. /* Subquery id: Query GPU stable pstate memory clock */
  674. #define AMDGPU_INFO_SENSOR_STABLE_PSTATE_GFX_MCLK 0x9
  675. /* Number of VRAM page faults on CPU access. */
  676. #define AMDGPU_INFO_NUM_VRAM_CPU_PAGE_FAULTS 0x1E
  677. #define AMDGPU_INFO_VRAM_LOST_COUNTER 0x1F
  678. /* query ras mask of enabled features*/
  679. #define AMDGPU_INFO_RAS_ENABLED_FEATURES 0x20
  680. /* RAS MASK: UMC (VRAM) */
  681. #define AMDGPU_INFO_RAS_ENABLED_UMC (1 << 0)
  682. /* RAS MASK: SDMA */
  683. #define AMDGPU_INFO_RAS_ENABLED_SDMA (1 << 1)
  684. /* RAS MASK: GFX */
  685. #define AMDGPU_INFO_RAS_ENABLED_GFX (1 << 2)
  686. /* RAS MASK: MMHUB */
  687. #define AMDGPU_INFO_RAS_ENABLED_MMHUB (1 << 3)
  688. /* RAS MASK: ATHUB */
  689. #define AMDGPU_INFO_RAS_ENABLED_ATHUB (1 << 4)
  690. /* RAS MASK: PCIE */
  691. #define AMDGPU_INFO_RAS_ENABLED_PCIE (1 << 5)
  692. /* RAS MASK: HDP */
  693. #define AMDGPU_INFO_RAS_ENABLED_HDP (1 << 6)
  694. /* RAS MASK: XGMI */
  695. #define AMDGPU_INFO_RAS_ENABLED_XGMI (1 << 7)
  696. /* RAS MASK: DF */
  697. #define AMDGPU_INFO_RAS_ENABLED_DF (1 << 8)
  698. /* RAS MASK: SMN */
  699. #define AMDGPU_INFO_RAS_ENABLED_SMN (1 << 9)
  700. /* RAS MASK: SEM */
  701. #define AMDGPU_INFO_RAS_ENABLED_SEM (1 << 10)
  702. /* RAS MASK: MP0 */
  703. #define AMDGPU_INFO_RAS_ENABLED_MP0 (1 << 11)
  704. /* RAS MASK: MP1 */
  705. #define AMDGPU_INFO_RAS_ENABLED_MP1 (1 << 12)
  706. /* RAS MASK: FUSE */
  707. #define AMDGPU_INFO_RAS_ENABLED_FUSE (1 << 13)
  708. #define AMDGPU_INFO_MMR_SE_INDEX_SHIFT 0
  709. #define AMDGPU_INFO_MMR_SE_INDEX_MASK 0xff
  710. #define AMDGPU_INFO_MMR_SH_INDEX_SHIFT 8
  711. #define AMDGPU_INFO_MMR_SH_INDEX_MASK 0xff
  712. struct drm_amdgpu_query_fw {
  713. /** AMDGPU_INFO_FW_* */
  714. __u32 fw_type;
  715. /**
  716. * Index of the IP if there are more IPs of
  717. * the same type.
  718. */
  719. __u32 ip_instance;
  720. /**
  721. * Index of the engine. Whether this is used depends
  722. * on the firmware type. (e.g. MEC, SDMA)
  723. */
  724. __u32 index;
  725. __u32 _pad;
  726. };
  727. /* Input structure for the INFO ioctl */
  728. struct drm_amdgpu_info {
  729. /* Where the return value will be stored */
  730. __u64 return_pointer;
  731. /* The size of the return value. Just like "size" in "snprintf",
  732. * it limits how many bytes the kernel can write. */
  733. __u32 return_size;
  734. /* The query request id. */
  735. __u32 query;
  736. union {
  737. struct {
  738. __u32 id;
  739. __u32 _pad;
  740. } mode_crtc;
  741. struct {
  742. /** AMDGPU_HW_IP_* */
  743. __u32 type;
  744. /**
  745. * Index of the IP if there are more IPs of the same
  746. * type. Ignored by AMDGPU_INFO_HW_IP_COUNT.
  747. */
  748. __u32 ip_instance;
  749. } query_hw_ip;
  750. struct {
  751. __u32 dword_offset;
  752. /** number of registers to read */
  753. __u32 count;
  754. __u32 instance;
  755. /** For future use, no flags defined so far */
  756. __u32 flags;
  757. } read_mmr_reg;
  758. struct drm_amdgpu_query_fw query_fw;
  759. struct {
  760. __u32 type;
  761. __u32 offset;
  762. } vbios_info;
  763. struct {
  764. __u32 type;
  765. } sensor_info;
  766. };
  767. };
  768. struct drm_amdgpu_info_gds {
  769. /** GDS GFX partition size */
  770. __u32 gds_gfx_partition_size;
  771. /** GDS compute partition size */
  772. __u32 compute_partition_size;
  773. /** total GDS memory size */
  774. __u32 gds_total_size;
  775. /** GWS size per GFX partition */
  776. __u32 gws_per_gfx_partition;
  777. /** GSW size per compute partition */
  778. __u32 gws_per_compute_partition;
  779. /** OA size per GFX partition */
  780. __u32 oa_per_gfx_partition;
  781. /** OA size per compute partition */
  782. __u32 oa_per_compute_partition;
  783. __u32 _pad;
  784. };
  785. struct drm_amdgpu_info_vram_gtt {
  786. __u64 vram_size;
  787. __u64 vram_cpu_accessible_size;
  788. __u64 gtt_size;
  789. };
  790. struct drm_amdgpu_heap_info {
  791. /** max. physical memory */
  792. __u64 total_heap_size;
  793. /** Theoretical max. available memory in the given heap */
  794. __u64 usable_heap_size;
  795. /**
  796. * Number of bytes allocated in the heap. This includes all processes
  797. * and private allocations in the kernel. It changes when new buffers
  798. * are allocated, freed, and moved. It cannot be larger than
  799. * heap_size.
  800. */
  801. __u64 heap_usage;
  802. /**
  803. * Theoretical possible max. size of buffer which
  804. * could be allocated in the given heap
  805. */
  806. __u64 max_allocation;
  807. };
  808. struct drm_amdgpu_memory_info {
  809. struct drm_amdgpu_heap_info vram;
  810. struct drm_amdgpu_heap_info cpu_accessible_vram;
  811. struct drm_amdgpu_heap_info gtt;
  812. };
  813. struct drm_amdgpu_info_firmware {
  814. __u32 ver;
  815. __u32 feature;
  816. };
  817. #define AMDGPU_VRAM_TYPE_UNKNOWN 0
  818. #define AMDGPU_VRAM_TYPE_GDDR1 1
  819. #define AMDGPU_VRAM_TYPE_DDR2 2
  820. #define AMDGPU_VRAM_TYPE_GDDR3 3
  821. #define AMDGPU_VRAM_TYPE_GDDR4 4
  822. #define AMDGPU_VRAM_TYPE_GDDR5 5
  823. #define AMDGPU_VRAM_TYPE_HBM 6
  824. #define AMDGPU_VRAM_TYPE_DDR3 7
  825. #define AMDGPU_VRAM_TYPE_DDR4 8
  826. #define AMDGPU_VRAM_TYPE_GDDR6 9
  827. struct drm_amdgpu_info_device {
  828. /** PCI Device ID */
  829. __u32 device_id;
  830. /** Internal chip revision: A0, A1, etc.) */
  831. __u32 chip_rev;
  832. __u32 external_rev;
  833. /** Revision id in PCI Config space */
  834. __u32 pci_rev;
  835. __u32 family;
  836. __u32 num_shader_engines;
  837. __u32 num_shader_arrays_per_engine;
  838. /* in KHz */
  839. __u32 gpu_counter_freq;
  840. __u64 max_engine_clock;
  841. __u64 max_memory_clock;
  842. /* cu information */
  843. __u32 cu_active_number;
  844. /* NOTE: cu_ao_mask is INVALID, DON'T use it */
  845. __u32 cu_ao_mask;
  846. __u32 cu_bitmap[4][4];
  847. /** Render backend pipe mask. One render backend is CB+DB. */
  848. __u32 enabled_rb_pipes_mask;
  849. __u32 num_rb_pipes;
  850. __u32 num_hw_gfx_contexts;
  851. __u32 _pad;
  852. __u64 ids_flags;
  853. /** Starting virtual address for UMDs. */
  854. __u64 virtual_address_offset;
  855. /** The maximum virtual address */
  856. __u64 virtual_address_max;
  857. /** Required alignment of virtual addresses. */
  858. __u32 virtual_address_alignment;
  859. /** Page table entry - fragment size */
  860. __u32 pte_fragment_size;
  861. __u32 gart_page_size;
  862. /** constant engine ram size*/
  863. __u32 ce_ram_size;
  864. /** video memory type info*/
  865. __u32 vram_type;
  866. /** video memory bit width*/
  867. __u32 vram_bit_width;
  868. /* vce harvesting instance */
  869. __u32 vce_harvest_config;
  870. /* gfx double offchip LDS buffers */
  871. __u32 gc_double_offchip_lds_buf;
  872. /* NGG Primitive Buffer */
  873. __u64 prim_buf_gpu_addr;
  874. /* NGG Position Buffer */
  875. __u64 pos_buf_gpu_addr;
  876. /* NGG Control Sideband */
  877. __u64 cntl_sb_buf_gpu_addr;
  878. /* NGG Parameter Cache */
  879. __u64 param_buf_gpu_addr;
  880. __u32 prim_buf_size;
  881. __u32 pos_buf_size;
  882. __u32 cntl_sb_buf_size;
  883. __u32 param_buf_size;
  884. /* wavefront size*/
  885. __u32 wave_front_size;
  886. /* shader visible vgprs*/
  887. __u32 num_shader_visible_vgprs;
  888. /* CU per shader array*/
  889. __u32 num_cu_per_sh;
  890. /* number of tcc blocks*/
  891. __u32 num_tcc_blocks;
  892. /* gs vgt table depth*/
  893. __u32 gs_vgt_table_depth;
  894. /* gs primitive buffer depth*/
  895. __u32 gs_prim_buffer_depth;
  896. /* max gs wavefront per vgt*/
  897. __u32 max_gs_waves_per_vgt;
  898. __u32 _pad1;
  899. /* always on cu bitmap */
  900. __u32 cu_ao_bitmap[4][4];
  901. /** Starting high virtual address for UMDs. */
  902. __u64 high_va_offset;
  903. /** The maximum high virtual address */
  904. __u64 high_va_max;
  905. /* gfx10 pa_sc_tile_steering_override */
  906. __u32 pa_sc_tile_steering_override;
  907. /* disabled TCCs */
  908. __u64 tcc_disabled_mask;
  909. };
  910. struct drm_amdgpu_info_hw_ip {
  911. /** Version of h/w IP */
  912. __u32 hw_ip_version_major;
  913. __u32 hw_ip_version_minor;
  914. /** Capabilities */
  915. __u64 capabilities_flags;
  916. /** command buffer address start alignment*/
  917. __u32 ib_start_alignment;
  918. /** command buffer size alignment*/
  919. __u32 ib_size_alignment;
  920. /** Bitmask of available rings. Bit 0 means ring 0, etc. */
  921. __u32 available_rings;
  922. __u32 _pad;
  923. };
  924. struct drm_amdgpu_info_num_handles {
  925. /** Max handles as supported by firmware for UVD */
  926. __u32 uvd_max_handles;
  927. /** Handles currently in use for UVD */
  928. __u32 uvd_used_handles;
  929. };
  930. #define AMDGPU_VCE_CLOCK_TABLE_ENTRIES 6
  931. struct drm_amdgpu_info_vce_clock_table_entry {
  932. /** System clock */
  933. __u32 sclk;
  934. /** Memory clock */
  935. __u32 mclk;
  936. /** VCE clock */
  937. __u32 eclk;
  938. __u32 pad;
  939. };
  940. struct drm_amdgpu_info_vce_clock_table {
  941. struct drm_amdgpu_info_vce_clock_table_entry entries[AMDGPU_VCE_CLOCK_TABLE_ENTRIES];
  942. __u32 num_valid_entries;
  943. __u32 pad;
  944. };
  945. /*
  946. * Supported GPU families
  947. */
  948. #define AMDGPU_FAMILY_UNKNOWN 0
  949. #define AMDGPU_FAMILY_SI 110 /* Hainan, Oland, Verde, Pitcairn, Tahiti */
  950. #define AMDGPU_FAMILY_CI 120 /* Bonaire, Hawaii */
  951. #define AMDGPU_FAMILY_KV 125 /* Kaveri, Kabini, Mullins */
  952. #define AMDGPU_FAMILY_VI 130 /* Iceland, Tonga */
  953. #define AMDGPU_FAMILY_CZ 135 /* Carrizo, Stoney */
  954. #define AMDGPU_FAMILY_AI 141 /* Vega10 */
  955. #define AMDGPU_FAMILY_RV 142 /* Raven */
  956. #define AMDGPU_FAMILY_NV 143 /* Navi10 */
  957. #if defined(__cplusplus)
  958. }
  959. #endif
  960. #endif