kfd_pm4_headers_vi.h 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398
  1. /*
  2. * Copyright 2014 Advanced Micro Devices, Inc.
  3. *
  4. * Permission is hereby granted, free of charge, to any person obtaining a
  5. * copy of this software and associated documentation files (the "Software"),
  6. * to deal in the Software without restriction, including without limitation
  7. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  8. * and/or sell copies of the Software, and to permit persons to whom the
  9. * Software is furnished to do so, subject to the following conditions:
  10. *
  11. * The above copyright notice and this permission notice shall be included in
  12. * all copies or substantial portions of the Software.
  13. *
  14. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  17. * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
  18. * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  19. * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  20. * OTHER DEALINGS IN THE SOFTWARE.
  21. *
  22. */
  23. #ifndef F32_MES_PM4_PACKETS_H
  24. #define F32_MES_PM4_PACKETS_H
  25. #ifndef PM4_MES_HEADER_DEFINED
  26. #define PM4_MES_HEADER_DEFINED
  27. union PM4_MES_TYPE_3_HEADER {
  28. struct {
  29. uint32_t reserved1 : 8; /* < reserved */
  30. uint32_t opcode : 8; /* < IT opcode */
  31. uint32_t count : 14;/* < number of DWORDs - 1 in the
  32. information body. */
  33. uint32_t type : 2; /* < packet identifier.
  34. It should be 3 for type 3 packets */
  35. };
  36. uint32_t u32All;
  37. };
  38. #endif /* PM4_MES_HEADER_DEFINED */
  39. /*--------------------MES_SET_RESOURCES--------------------*/
  40. #ifndef PM4_MES_SET_RESOURCES_DEFINED
  41. #define PM4_MES_SET_RESOURCES_DEFINED
  42. enum mes_set_resources_queue_type_enum {
  43. queue_type__mes_set_resources__kernel_interface_queue_kiq = 0,
  44. queue_type__mes_set_resources__hsa_interface_queue_hiq = 1,
  45. queue_type__mes_set_resources__hsa_debug_interface_queue = 4
  46. };
  47. struct pm4_mes_set_resources {
  48. union {
  49. union PM4_MES_TYPE_3_HEADER header; /* header */
  50. uint32_t ordinal1;
  51. };
  52. union {
  53. struct {
  54. uint32_t vmid_mask:16;
  55. uint32_t unmap_latency:8;
  56. uint32_t reserved1:5;
  57. enum mes_set_resources_queue_type_enum queue_type:3;
  58. } bitfields2;
  59. uint32_t ordinal2;
  60. };
  61. uint32_t queue_mask_lo;
  62. uint32_t queue_mask_hi;
  63. uint32_t gws_mask_lo;
  64. uint32_t gws_mask_hi;
  65. union {
  66. struct {
  67. uint32_t oac_mask:16;
  68. uint32_t reserved2:16;
  69. } bitfields7;
  70. uint32_t ordinal7;
  71. };
  72. union {
  73. struct {
  74. uint32_t gds_heap_base:6;
  75. uint32_t reserved3:5;
  76. uint32_t gds_heap_size:6;
  77. uint32_t reserved4:15;
  78. } bitfields8;
  79. uint32_t ordinal8;
  80. };
  81. };
  82. #endif
  83. /*--------------------MES_RUN_LIST--------------------*/
  84. #ifndef PM4_MES_RUN_LIST_DEFINED
  85. #define PM4_MES_RUN_LIST_DEFINED
  86. struct pm4_mes_runlist {
  87. union {
  88. union PM4_MES_TYPE_3_HEADER header; /* header */
  89. uint32_t ordinal1;
  90. };
  91. union {
  92. struct {
  93. uint32_t reserved1:2;
  94. uint32_t ib_base_lo:30;
  95. } bitfields2;
  96. uint32_t ordinal2;
  97. };
  98. union {
  99. struct {
  100. uint32_t ib_base_hi:16;
  101. uint32_t reserved2:16;
  102. } bitfields3;
  103. uint32_t ordinal3;
  104. };
  105. union {
  106. struct {
  107. uint32_t ib_size:20;
  108. uint32_t chain:1;
  109. uint32_t offload_polling:1;
  110. uint32_t reserved3:1;
  111. uint32_t valid:1;
  112. uint32_t reserved4:8;
  113. } bitfields4;
  114. uint32_t ordinal4;
  115. };
  116. };
  117. #endif
  118. /*--------------------MES_MAP_PROCESS--------------------*/
  119. #ifndef PM4_MES_MAP_PROCESS_DEFINED
  120. #define PM4_MES_MAP_PROCESS_DEFINED
  121. struct pm4_mes_map_process {
  122. union {
  123. union PM4_MES_TYPE_3_HEADER header; /* header */
  124. uint32_t ordinal1;
  125. };
  126. union {
  127. struct {
  128. uint32_t pasid:16;
  129. uint32_t reserved1:8;
  130. uint32_t diq_enable:1;
  131. uint32_t process_quantum:7;
  132. } bitfields2;
  133. uint32_t ordinal2;
  134. };
  135. union {
  136. struct {
  137. uint32_t page_table_base:28;
  138. uint32_t reserved2:4;
  139. } bitfields3;
  140. uint32_t ordinal3;
  141. };
  142. uint32_t sh_mem_bases;
  143. uint32_t sh_mem_ape1_base;
  144. uint32_t sh_mem_ape1_limit;
  145. uint32_t sh_mem_config;
  146. uint32_t gds_addr_lo;
  147. uint32_t gds_addr_hi;
  148. union {
  149. struct {
  150. uint32_t num_gws:6;
  151. uint32_t reserved3:2;
  152. uint32_t num_oac:4;
  153. uint32_t reserved4:4;
  154. uint32_t gds_size:6;
  155. uint32_t num_queues:10;
  156. } bitfields10;
  157. uint32_t ordinal10;
  158. };
  159. };
  160. #endif
  161. /*--------------------MES_MAP_QUEUES--------------------*/
  162. #ifndef PM4_MES_MAP_QUEUES_VI_DEFINED
  163. #define PM4_MES_MAP_QUEUES_VI_DEFINED
  164. enum mes_map_queues_queue_sel_vi_enum {
  165. queue_sel__mes_map_queues__map_to_specified_queue_slots_vi = 0,
  166. queue_sel__mes_map_queues__map_to_hws_determined_queue_slots_vi = 1
  167. };
  168. enum mes_map_queues_queue_type_vi_enum {
  169. queue_type__mes_map_queues__normal_compute_vi = 0,
  170. queue_type__mes_map_queues__debug_interface_queue_vi = 1,
  171. queue_type__mes_map_queues__normal_latency_static_queue_vi = 2,
  172. queue_type__mes_map_queues__low_latency_static_queue_vi = 3
  173. };
  174. enum mes_map_queues_alloc_format_vi_enum {
  175. alloc_format__mes_map_queues__one_per_pipe_vi = 0,
  176. alloc_format__mes_map_queues__all_on_one_pipe_vi = 1
  177. };
  178. enum mes_map_queues_engine_sel_vi_enum {
  179. engine_sel__mes_map_queues__compute_vi = 0,
  180. engine_sel__mes_map_queues__sdma0_vi = 2,
  181. engine_sel__mes_map_queues__sdma1_vi = 3
  182. };
  183. struct pm4_mes_map_queues {
  184. union {
  185. union PM4_MES_TYPE_3_HEADER header; /* header */
  186. uint32_t ordinal1;
  187. };
  188. union {
  189. struct {
  190. uint32_t reserved1:4;
  191. enum mes_map_queues_queue_sel_vi_enum queue_sel:2;
  192. uint32_t reserved2:15;
  193. enum mes_map_queues_queue_type_vi_enum queue_type:3;
  194. enum mes_map_queues_alloc_format_vi_enum alloc_format:2;
  195. enum mes_map_queues_engine_sel_vi_enum engine_sel:3;
  196. uint32_t num_queues:3;
  197. } bitfields2;
  198. uint32_t ordinal2;
  199. };
  200. union {
  201. struct {
  202. uint32_t reserved3:1;
  203. uint32_t check_disable:1;
  204. uint32_t doorbell_offset:21;
  205. uint32_t reserved4:3;
  206. uint32_t queue:6;
  207. } bitfields3;
  208. uint32_t ordinal3;
  209. };
  210. uint32_t mqd_addr_lo;
  211. uint32_t mqd_addr_hi;
  212. uint32_t wptr_addr_lo;
  213. uint32_t wptr_addr_hi;
  214. };
  215. #endif
  216. /*--------------------MES_QUERY_STATUS--------------------*/
  217. #ifndef PM4_MES_QUERY_STATUS_DEFINED
  218. #define PM4_MES_QUERY_STATUS_DEFINED
  219. enum mes_query_status_interrupt_sel_enum {
  220. interrupt_sel__mes_query_status__completion_status = 0,
  221. interrupt_sel__mes_query_status__process_status = 1,
  222. interrupt_sel__mes_query_status__queue_status = 2
  223. };
  224. enum mes_query_status_command_enum {
  225. command__mes_query_status__interrupt_only = 0,
  226. command__mes_query_status__fence_only_immediate = 1,
  227. command__mes_query_status__fence_only_after_write_ack = 2,
  228. command__mes_query_status__fence_wait_for_write_ack_send_interrupt = 3
  229. };
  230. enum mes_query_status_engine_sel_enum {
  231. engine_sel__mes_query_status__compute = 0,
  232. engine_sel__mes_query_status__sdma0_queue = 2,
  233. engine_sel__mes_query_status__sdma1_queue = 3
  234. };
  235. struct pm4_mes_query_status {
  236. union {
  237. union PM4_MES_TYPE_3_HEADER header; /* header */
  238. uint32_t ordinal1;
  239. };
  240. union {
  241. struct {
  242. uint32_t context_id:28;
  243. enum mes_query_status_interrupt_sel_enum
  244. interrupt_sel:2;
  245. enum mes_query_status_command_enum command:2;
  246. } bitfields2;
  247. uint32_t ordinal2;
  248. };
  249. union {
  250. struct {
  251. uint32_t pasid:16;
  252. uint32_t reserved1:16;
  253. } bitfields3a;
  254. struct {
  255. uint32_t reserved2:2;
  256. uint32_t doorbell_offset:21;
  257. uint32_t reserved3:2;
  258. enum mes_query_status_engine_sel_enum engine_sel:3;
  259. uint32_t reserved4:4;
  260. } bitfields3b;
  261. uint32_t ordinal3;
  262. };
  263. uint32_t addr_lo;
  264. uint32_t addr_hi;
  265. uint32_t data_lo;
  266. uint32_t data_hi;
  267. };
  268. #endif
  269. /*--------------------MES_UNMAP_QUEUES--------------------*/
  270. #ifndef PM4_MES_UNMAP_QUEUES_DEFINED
  271. #define PM4_MES_UNMAP_QUEUES_DEFINED
  272. enum mes_unmap_queues_action_enum {
  273. action__mes_unmap_queues__preempt_queues = 0,
  274. action__mes_unmap_queues__reset_queues = 1,
  275. action__mes_unmap_queues__disable_process_queues = 2,
  276. action__mes_unmap_queues__reserved = 3
  277. };
  278. enum mes_unmap_queues_queue_sel_enum {
  279. queue_sel__mes_unmap_queues__perform_request_on_specified_queues = 0,
  280. queue_sel__mes_unmap_queues__perform_request_on_pasid_queues = 1,
  281. queue_sel__mes_unmap_queues__unmap_all_queues = 2,
  282. queue_sel__mes_unmap_queues__unmap_all_non_static_queues = 3
  283. };
  284. enum mes_unmap_queues_engine_sel_enum {
  285. engine_sel__mes_unmap_queues__compute = 0,
  286. engine_sel__mes_unmap_queues__sdma0 = 2,
  287. engine_sel__mes_unmap_queues__sdmal = 3
  288. };
  289. struct PM4_MES_UNMAP_QUEUES {
  290. union {
  291. union PM4_MES_TYPE_3_HEADER header; /* header */
  292. uint32_t ordinal1;
  293. };
  294. union {
  295. struct {
  296. enum mes_unmap_queues_action_enum action:2;
  297. uint32_t reserved1:2;
  298. enum mes_unmap_queues_queue_sel_enum queue_sel:2;
  299. uint32_t reserved2:20;
  300. enum mes_unmap_queues_engine_sel_enum engine_sel:3;
  301. uint32_t num_queues:3;
  302. } bitfields2;
  303. uint32_t ordinal2;
  304. };
  305. union {
  306. struct {
  307. uint32_t pasid:16;
  308. uint32_t reserved3:16;
  309. } bitfields3a;
  310. struct {
  311. uint32_t reserved4:2;
  312. uint32_t doorbell_offset0:21;
  313. uint32_t reserved5:9;
  314. } bitfields3b;
  315. uint32_t ordinal3;
  316. };
  317. union {
  318. struct {
  319. uint32_t reserved6:2;
  320. uint32_t doorbell_offset1:21;
  321. uint32_t reserved7:9;
  322. } bitfields4;
  323. uint32_t ordinal4;
  324. };
  325. union {
  326. struct {
  327. uint32_t reserved8:2;
  328. uint32_t doorbell_offset2:21;
  329. uint32_t reserved9:9;
  330. } bitfields5;
  331. uint32_t ordinal5;
  332. };
  333. union {
  334. struct {
  335. uint32_t reserved10:2;
  336. uint32_t doorbell_offset3:21;
  337. uint32_t reserved11:9;
  338. } bitfields6;
  339. uint32_t ordinal6;
  340. };
  341. };
  342. #endif
  343. #endif