kfd_pm4_headers_vi.h 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510
  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. */
  34. uint32_t type : 2; /* < packet identifier
  35. * It should be 3 for type 3 packets
  36. */
  37. };
  38. uint32_t u32All;
  39. };
  40. #endif /* PM4_MES_HEADER_DEFINED */
  41. /*--------------------MES_SET_RESOURCES--------------------*/
  42. #ifndef PM4_MES_SET_RESOURCES_DEFINED
  43. #define PM4_MES_SET_RESOURCES_DEFINED
  44. enum mes_set_resources_queue_type_enum {
  45. queue_type__mes_set_resources__kernel_interface_queue_kiq = 0,
  46. queue_type__mes_set_resources__hsa_interface_queue_hiq = 1,
  47. queue_type__mes_set_resources__hsa_debug_interface_queue = 4
  48. };
  49. struct pm4_mes_set_resources {
  50. union {
  51. union PM4_MES_TYPE_3_HEADER header; /* header */
  52. uint32_t ordinal1;
  53. };
  54. union {
  55. struct {
  56. uint32_t vmid_mask:16;
  57. uint32_t unmap_latency:8;
  58. uint32_t reserved1:5;
  59. enum mes_set_resources_queue_type_enum queue_type:3;
  60. } bitfields2;
  61. uint32_t ordinal2;
  62. };
  63. uint32_t queue_mask_lo;
  64. uint32_t queue_mask_hi;
  65. uint32_t gws_mask_lo;
  66. uint32_t gws_mask_hi;
  67. union {
  68. struct {
  69. uint32_t oac_mask:16;
  70. uint32_t reserved2:16;
  71. } bitfields7;
  72. uint32_t ordinal7;
  73. };
  74. union {
  75. struct {
  76. uint32_t gds_heap_base:6;
  77. uint32_t reserved3:5;
  78. uint32_t gds_heap_size:6;
  79. uint32_t reserved4:15;
  80. } bitfields8;
  81. uint32_t ordinal8;
  82. };
  83. };
  84. #endif
  85. /*--------------------MES_RUN_LIST--------------------*/
  86. #ifndef PM4_MES_RUN_LIST_DEFINED
  87. #define PM4_MES_RUN_LIST_DEFINED
  88. struct pm4_mes_runlist {
  89. union {
  90. union PM4_MES_TYPE_3_HEADER header; /* header */
  91. uint32_t ordinal1;
  92. };
  93. union {
  94. struct {
  95. uint32_t reserved1:2;
  96. uint32_t ib_base_lo:30;
  97. } bitfields2;
  98. uint32_t ordinal2;
  99. };
  100. union {
  101. struct {
  102. uint32_t ib_base_hi:16;
  103. uint32_t reserved2:16;
  104. } bitfields3;
  105. uint32_t ordinal3;
  106. };
  107. union {
  108. struct {
  109. uint32_t ib_size:20;
  110. uint32_t chain:1;
  111. uint32_t offload_polling:1;
  112. uint32_t reserved2:1;
  113. uint32_t valid:1;
  114. uint32_t process_cnt:4;
  115. uint32_t reserved3:4;
  116. } bitfields4;
  117. uint32_t ordinal4;
  118. };
  119. };
  120. #endif
  121. /*--------------------MES_MAP_PROCESS--------------------*/
  122. #ifndef PM4_MES_MAP_PROCESS_DEFINED
  123. #define PM4_MES_MAP_PROCESS_DEFINED
  124. struct pm4_mes_map_process {
  125. union {
  126. union PM4_MES_TYPE_3_HEADER header; /* header */
  127. uint32_t ordinal1;
  128. };
  129. union {
  130. struct {
  131. uint32_t pasid:16;
  132. uint32_t reserved1:8;
  133. uint32_t diq_enable:1;
  134. uint32_t process_quantum:7;
  135. } bitfields2;
  136. uint32_t ordinal2;
  137. };
  138. union {
  139. struct {
  140. uint32_t page_table_base:28;
  141. uint32_t reserved3:4;
  142. } bitfields3;
  143. uint32_t ordinal3;
  144. };
  145. uint32_t reserved;
  146. uint32_t sh_mem_bases;
  147. uint32_t sh_mem_config;
  148. uint32_t sh_mem_ape1_base;
  149. uint32_t sh_mem_ape1_limit;
  150. uint32_t sh_hidden_private_base_vmid;
  151. uint32_t reserved2;
  152. uint32_t reserved3;
  153. uint32_t gds_addr_lo;
  154. uint32_t gds_addr_hi;
  155. union {
  156. struct {
  157. uint32_t num_gws:6;
  158. uint32_t reserved4:2;
  159. uint32_t num_oac:4;
  160. uint32_t reserved5:4;
  161. uint32_t gds_size:6;
  162. uint32_t num_queues:10;
  163. } bitfields10;
  164. uint32_t ordinal10;
  165. };
  166. uint32_t completion_signal_lo;
  167. uint32_t completion_signal_hi;
  168. };
  169. #endif
  170. /*--------------------MES_MAP_QUEUES--------------------*/
  171. #ifndef PM4_MES_MAP_QUEUES_VI_DEFINED
  172. #define PM4_MES_MAP_QUEUES_VI_DEFINED
  173. enum mes_map_queues_queue_sel_vi_enum {
  174. queue_sel__mes_map_queues__map_to_specified_queue_slots_vi = 0,
  175. queue_sel__mes_map_queues__map_to_hws_determined_queue_slots_vi = 1
  176. };
  177. enum mes_map_queues_queue_type_vi_enum {
  178. queue_type__mes_map_queues__normal_compute_vi = 0,
  179. queue_type__mes_map_queues__debug_interface_queue_vi = 1,
  180. queue_type__mes_map_queues__normal_latency_static_queue_vi = 2,
  181. queue_type__mes_map_queues__low_latency_static_queue_vi = 3
  182. };
  183. enum mes_map_queues_alloc_format_vi_enum {
  184. alloc_format__mes_map_queues__one_per_pipe_vi = 0,
  185. alloc_format__mes_map_queues__all_on_one_pipe_vi = 1
  186. };
  187. enum mes_map_queues_engine_sel_vi_enum {
  188. engine_sel__mes_map_queues__compute_vi = 0,
  189. engine_sel__mes_map_queues__sdma0_vi = 2,
  190. engine_sel__mes_map_queues__sdma1_vi = 3
  191. };
  192. struct pm4_mes_map_queues {
  193. union {
  194. union PM4_MES_TYPE_3_HEADER header; /* header */
  195. uint32_t ordinal1;
  196. };
  197. union {
  198. struct {
  199. uint32_t reserved1:4;
  200. enum mes_map_queues_queue_sel_vi_enum queue_sel:2;
  201. uint32_t reserved2:15;
  202. enum mes_map_queues_queue_type_vi_enum queue_type:3;
  203. enum mes_map_queues_alloc_format_vi_enum alloc_format:2;
  204. enum mes_map_queues_engine_sel_vi_enum engine_sel:3;
  205. uint32_t num_queues:3;
  206. } bitfields2;
  207. uint32_t ordinal2;
  208. };
  209. union {
  210. struct {
  211. uint32_t reserved3:1;
  212. uint32_t check_disable:1;
  213. uint32_t doorbell_offset:21;
  214. uint32_t reserved4:3;
  215. uint32_t queue:6;
  216. } bitfields3;
  217. uint32_t ordinal3;
  218. };
  219. uint32_t mqd_addr_lo;
  220. uint32_t mqd_addr_hi;
  221. uint32_t wptr_addr_lo;
  222. uint32_t wptr_addr_hi;
  223. };
  224. #endif
  225. /*--------------------MES_QUERY_STATUS--------------------*/
  226. #ifndef PM4_MES_QUERY_STATUS_DEFINED
  227. #define PM4_MES_QUERY_STATUS_DEFINED
  228. enum mes_query_status_interrupt_sel_enum {
  229. interrupt_sel__mes_query_status__completion_status = 0,
  230. interrupt_sel__mes_query_status__process_status = 1,
  231. interrupt_sel__mes_query_status__queue_status = 2
  232. };
  233. enum mes_query_status_command_enum {
  234. command__mes_query_status__interrupt_only = 0,
  235. command__mes_query_status__fence_only_immediate = 1,
  236. command__mes_query_status__fence_only_after_write_ack = 2,
  237. command__mes_query_status__fence_wait_for_write_ack_send_interrupt = 3
  238. };
  239. enum mes_query_status_engine_sel_enum {
  240. engine_sel__mes_query_status__compute = 0,
  241. engine_sel__mes_query_status__sdma0_queue = 2,
  242. engine_sel__mes_query_status__sdma1_queue = 3
  243. };
  244. struct pm4_mes_query_status {
  245. union {
  246. union PM4_MES_TYPE_3_HEADER header; /* header */
  247. uint32_t ordinal1;
  248. };
  249. union {
  250. struct {
  251. uint32_t context_id:28;
  252. enum mes_query_status_interrupt_sel_enum
  253. interrupt_sel:2;
  254. enum mes_query_status_command_enum command:2;
  255. } bitfields2;
  256. uint32_t ordinal2;
  257. };
  258. union {
  259. struct {
  260. uint32_t pasid:16;
  261. uint32_t reserved1:16;
  262. } bitfields3a;
  263. struct {
  264. uint32_t reserved2:2;
  265. uint32_t doorbell_offset:21;
  266. uint32_t reserved3:2;
  267. enum mes_query_status_engine_sel_enum engine_sel:3;
  268. uint32_t reserved4:4;
  269. } bitfields3b;
  270. uint32_t ordinal3;
  271. };
  272. uint32_t addr_lo;
  273. uint32_t addr_hi;
  274. uint32_t data_lo;
  275. uint32_t data_hi;
  276. };
  277. #endif
  278. /*--------------------MES_UNMAP_QUEUES--------------------*/
  279. #ifndef PM4_MES_UNMAP_QUEUES_DEFINED
  280. #define PM4_MES_UNMAP_QUEUES_DEFINED
  281. enum mes_unmap_queues_action_enum {
  282. action__mes_unmap_queues__preempt_queues = 0,
  283. action__mes_unmap_queues__reset_queues = 1,
  284. action__mes_unmap_queues__disable_process_queues = 2,
  285. action__mes_unmap_queues__reserved = 3
  286. };
  287. enum mes_unmap_queues_queue_sel_enum {
  288. queue_sel__mes_unmap_queues__perform_request_on_specified_queues = 0,
  289. queue_sel__mes_unmap_queues__perform_request_on_pasid_queues = 1,
  290. queue_sel__mes_unmap_queues__unmap_all_queues = 2,
  291. queue_sel__mes_unmap_queues__unmap_all_non_static_queues = 3
  292. };
  293. enum mes_unmap_queues_engine_sel_enum {
  294. engine_sel__mes_unmap_queues__compute = 0,
  295. engine_sel__mes_unmap_queues__sdma0 = 2,
  296. engine_sel__mes_unmap_queues__sdmal = 3
  297. };
  298. struct pm4_mes_unmap_queues {
  299. union {
  300. union PM4_MES_TYPE_3_HEADER header; /* header */
  301. uint32_t ordinal1;
  302. };
  303. union {
  304. struct {
  305. enum mes_unmap_queues_action_enum action:2;
  306. uint32_t reserved1:2;
  307. enum mes_unmap_queues_queue_sel_enum queue_sel:2;
  308. uint32_t reserved2:20;
  309. enum mes_unmap_queues_engine_sel_enum engine_sel:3;
  310. uint32_t num_queues:3;
  311. } bitfields2;
  312. uint32_t ordinal2;
  313. };
  314. union {
  315. struct {
  316. uint32_t pasid:16;
  317. uint32_t reserved3:16;
  318. } bitfields3a;
  319. struct {
  320. uint32_t reserved4:2;
  321. uint32_t doorbell_offset0:21;
  322. uint32_t reserved5:9;
  323. } bitfields3b;
  324. uint32_t ordinal3;
  325. };
  326. union {
  327. struct {
  328. uint32_t reserved6:2;
  329. uint32_t doorbell_offset1:21;
  330. uint32_t reserved7:9;
  331. } bitfields4;
  332. uint32_t ordinal4;
  333. };
  334. union {
  335. struct {
  336. uint32_t reserved8:2;
  337. uint32_t doorbell_offset2:21;
  338. uint32_t reserved9:9;
  339. } bitfields5;
  340. uint32_t ordinal5;
  341. };
  342. union {
  343. struct {
  344. uint32_t reserved10:2;
  345. uint32_t doorbell_offset3:21;
  346. uint32_t reserved11:9;
  347. } bitfields6;
  348. uint32_t ordinal6;
  349. };
  350. };
  351. #endif
  352. #ifndef PM4_MEC_RELEASE_MEM_DEFINED
  353. #define PM4_MEC_RELEASE_MEM_DEFINED
  354. enum RELEASE_MEM_event_index_enum {
  355. event_index___release_mem__end_of_pipe = 5,
  356. event_index___release_mem__shader_done = 6
  357. };
  358. enum RELEASE_MEM_cache_policy_enum {
  359. cache_policy___release_mem__lru = 0,
  360. cache_policy___release_mem__stream = 1,
  361. cache_policy___release_mem__bypass = 2
  362. };
  363. enum RELEASE_MEM_dst_sel_enum {
  364. dst_sel___release_mem__memory_controller = 0,
  365. dst_sel___release_mem__tc_l2 = 1,
  366. dst_sel___release_mem__queue_write_pointer_register = 2,
  367. dst_sel___release_mem__queue_write_pointer_poll_mask_bit = 3
  368. };
  369. enum RELEASE_MEM_int_sel_enum {
  370. int_sel___release_mem__none = 0,
  371. int_sel___release_mem__send_interrupt_only = 1,
  372. int_sel___release_mem__send_interrupt_after_write_confirm = 2,
  373. int_sel___release_mem__send_data_after_write_confirm = 3
  374. };
  375. enum RELEASE_MEM_data_sel_enum {
  376. data_sel___release_mem__none = 0,
  377. data_sel___release_mem__send_32_bit_low = 1,
  378. data_sel___release_mem__send_64_bit_data = 2,
  379. data_sel___release_mem__send_gpu_clock_counter = 3,
  380. data_sel___release_mem__send_cp_perfcounter_hi_lo = 4,
  381. data_sel___release_mem__store_gds_data_to_memory = 5
  382. };
  383. struct pm4_mec_release_mem {
  384. union {
  385. union PM4_MES_TYPE_3_HEADER header; /*header */
  386. unsigned int ordinal1;
  387. };
  388. union {
  389. struct {
  390. unsigned int event_type:6;
  391. unsigned int reserved1:2;
  392. enum RELEASE_MEM_event_index_enum event_index:4;
  393. unsigned int tcl1_vol_action_ena:1;
  394. unsigned int tc_vol_action_ena:1;
  395. unsigned int reserved2:1;
  396. unsigned int tc_wb_action_ena:1;
  397. unsigned int tcl1_action_ena:1;
  398. unsigned int tc_action_ena:1;
  399. unsigned int reserved3:6;
  400. unsigned int atc:1;
  401. enum RELEASE_MEM_cache_policy_enum cache_policy:2;
  402. unsigned int reserved4:5;
  403. } bitfields2;
  404. unsigned int ordinal2;
  405. };
  406. union {
  407. struct {
  408. unsigned int reserved5:16;
  409. enum RELEASE_MEM_dst_sel_enum dst_sel:2;
  410. unsigned int reserved6:6;
  411. enum RELEASE_MEM_int_sel_enum int_sel:3;
  412. unsigned int reserved7:2;
  413. enum RELEASE_MEM_data_sel_enum data_sel:3;
  414. } bitfields3;
  415. unsigned int ordinal3;
  416. };
  417. union {
  418. struct {
  419. unsigned int reserved8:2;
  420. unsigned int address_lo_32b:30;
  421. } bitfields4;
  422. struct {
  423. unsigned int reserved9:3;
  424. unsigned int address_lo_64b:29;
  425. } bitfields5;
  426. unsigned int ordinal4;
  427. };
  428. unsigned int address_hi;
  429. unsigned int data_lo;
  430. unsigned int data_hi;
  431. };
  432. #endif
  433. enum {
  434. CACHE_FLUSH_AND_INV_TS_EVENT = 0x00000014
  435. };
  436. #endif