2 * Copyright 2016 Advanced Micro Devices, Inc.
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:
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
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.
24 #ifndef F32_MES_PM4_PACKETS_H
25 #define F32_MES_PM4_PACKETS_H
27 #ifndef PM4_MES_HEADER_DEFINED
28 #define PM4_MES_HEADER_DEFINED
29 union PM4_MES_TYPE_3_HEADER
{
31 uint32_t reserved1
: 8; /* < reserved */
32 uint32_t opcode
: 8; /* < IT opcode */
33 uint32_t count
: 14;/* < number of DWORDs - 1 in the
36 uint32_t type
: 2; /* < packet identifier.
37 * It should be 3 for type 3 packets
42 #endif /* PM4_MES_HEADER_DEFINED */
44 /*--------------------MES_SET_RESOURCES--------------------*/
46 #ifndef PM4_MES_SET_RESOURCES_DEFINED
47 #define PM4_MES_SET_RESOURCES_DEFINED
48 enum mes_set_resources_queue_type_enum
{
49 queue_type__mes_set_resources__kernel_interface_queue_kiq
= 0,
50 queue_type__mes_set_resources__hsa_interface_queue_hiq
= 1,
51 queue_type__mes_set_resources__hsa_debug_interface_queue
= 4
55 struct pm4_mes_set_resources
{
57 union PM4_MES_TYPE_3_HEADER header
; /* header */
63 uint32_t vmid_mask
:16;
64 uint32_t unmap_latency
:8;
66 enum mes_set_resources_queue_type_enum queue_type
:3;
71 uint32_t queue_mask_lo
;
72 uint32_t queue_mask_hi
;
79 uint32_t reserved2
:16;
86 uint32_t gds_heap_base
:10;
88 uint32_t gds_heap_size
:10;
89 uint32_t reserved4
:11;
97 /*--------------------MES_RUN_LIST--------------------*/
99 #ifndef PM4_MES_RUN_LIST_DEFINED
100 #define PM4_MES_RUN_LIST_DEFINED
102 struct pm4_mes_runlist
{
104 union PM4_MES_TYPE_3_HEADER header
; /* header */
110 uint32_t reserved1
:2;
111 uint32_t ib_base_lo
:30;
122 uint32_t offload_polling
:1;
123 uint32_t chained_runlist_idle_disable
:1;
125 uint32_t process_cnt
:4;
126 uint32_t reserved3
:4;
134 /*--------------------MES_MAP_PROCESS--------------------*/
136 #ifndef PM4_MES_MAP_PROCESS_DEFINED
137 #define PM4_MES_MAP_PROCESS_DEFINED
139 struct pm4_mes_map_process
{
141 union PM4_MES_TYPE_3_HEADER header
; /* header */
148 uint32_t reserved1
:8;
149 uint32_t diq_enable
:1;
150 uint32_t process_quantum
:7;
155 uint32_t vm_context_page_table_base_addr_lo32
;
157 uint32_t vm_context_page_table_base_addr_hi32
;
159 uint32_t sh_mem_bases
;
161 uint32_t sh_mem_config
;
163 uint32_t sq_shader_tba_lo
;
165 uint32_t sq_shader_tba_hi
;
167 uint32_t sq_shader_tma_lo
;
169 uint32_t sq_shader_tma_hi
;
173 uint32_t gds_addr_lo
;
175 uint32_t gds_addr_hi
;
180 uint32_t sdma_enable
:1;
182 uint32_t gds_size_hi
:4;
184 uint32_t num_queues
:10;
189 uint32_t completion_signal_lo
;
191 uint32_t completion_signal_hi
;
197 /*--------------------MES_MAP_PROCESS_VM--------------------*/
199 #ifndef PM4_MES_MAP_PROCESS_VM_DEFINED
200 #define PM4_MES_MAP_PROCESS_VM_DEFINED
202 struct PM4_MES_MAP_PROCESS_VM
{
204 union PM4_MES_TYPE_3_HEADER header
; /* header */
210 uint32_t vm_context_cntl
;
214 uint32_t vm_context_page_table_end_addr_lo32
;
216 uint32_t vm_context_page_table_end_addr_hi32
;
218 uint32_t vm_context_page_table_start_addr_lo32
;
220 uint32_t vm_context_page_table_start_addr_hi32
;
234 uint32_t completion_signal_lo32
;
236 uint32_t completion_signal_hi32
;
241 /*--------------------MES_MAP_QUEUES--------------------*/
243 #ifndef PM4_MES_MAP_QUEUES_VI_DEFINED
244 #define PM4_MES_MAP_QUEUES_VI_DEFINED
245 enum mes_map_queues_queue_sel_enum
{
246 queue_sel__mes_map_queues__map_to_specified_queue_slots_vi
= 0,
247 queue_sel__mes_map_queues__map_to_hws_determined_queue_slots_vi
= 1
250 enum mes_map_queues_queue_type_enum
{
251 queue_type__mes_map_queues__normal_compute_vi
= 0,
252 queue_type__mes_map_queues__debug_interface_queue_vi
= 1,
253 queue_type__mes_map_queues__normal_latency_static_queue_vi
= 2,
254 queue_type__mes_map_queues__low_latency_static_queue_vi
= 3
257 enum mes_map_queues_engine_sel_enum
{
258 engine_sel__mes_map_queues__compute_vi
= 0,
259 engine_sel__mes_map_queues__sdma0_vi
= 2,
260 engine_sel__mes_map_queues__sdma1_vi
= 3
263 enum mes_map_queues_extended_engine_sel_enum
{
264 extended_engine_sel__mes_map_queues__legacy_engine_sel
= 0,
265 extended_engine_sel__mes_map_queues__sdma0_to_7_sel
= 1
268 struct pm4_mes_map_queues
{
270 union PM4_MES_TYPE_3_HEADER header
; /* header */
276 uint32_t reserved1
:2;
277 enum mes_map_queues_extended_engine_sel_enum extended_engine_sel
:2;
278 enum mes_map_queues_queue_sel_enum queue_sel
:2;
279 uint32_t reserved5
:6;
280 uint32_t gws_control_queue
:1;
281 uint32_t reserved2
:8;
282 enum mes_map_queues_queue_type_enum queue_type
:3;
283 uint32_t reserved3
:2;
284 enum mes_map_queues_engine_sel_enum engine_sel
:3;
285 uint32_t num_queues
:3;
292 uint32_t reserved3
:1;
293 uint32_t check_disable
:1;
294 uint32_t doorbell_offset
:26;
295 uint32_t reserved4
:4;
300 uint32_t mqd_addr_lo
;
301 uint32_t mqd_addr_hi
;
302 uint32_t wptr_addr_lo
;
303 uint32_t wptr_addr_hi
;
307 /*--------------------MES_QUERY_STATUS--------------------*/
309 #ifndef PM4_MES_QUERY_STATUS_DEFINED
310 #define PM4_MES_QUERY_STATUS_DEFINED
311 enum mes_query_status_interrupt_sel_enum
{
312 interrupt_sel__mes_query_status__completion_status
= 0,
313 interrupt_sel__mes_query_status__process_status
= 1,
314 interrupt_sel__mes_query_status__queue_status
= 2
317 enum mes_query_status_command_enum
{
318 command__mes_query_status__interrupt_only
= 0,
319 command__mes_query_status__fence_only_immediate
= 1,
320 command__mes_query_status__fence_only_after_write_ack
= 2,
321 command__mes_query_status__fence_wait_for_write_ack_send_interrupt
= 3
324 enum mes_query_status_engine_sel_enum
{
325 engine_sel__mes_query_status__compute
= 0,
326 engine_sel__mes_query_status__sdma0_queue
= 2,
327 engine_sel__mes_query_status__sdma1_queue
= 3
330 struct pm4_mes_query_status
{
332 union PM4_MES_TYPE_3_HEADER header
; /* header */
338 uint32_t context_id
:28;
339 enum mes_query_status_interrupt_sel_enum interrupt_sel
:2;
340 enum mes_query_status_command_enum command
:2;
348 uint32_t reserved1
:16;
351 uint32_t reserved2
:2;
352 uint32_t doorbell_offset
:26;
353 enum mes_query_status_engine_sel_enum engine_sel
:3;
354 uint32_t reserved3
:1;
366 /*--------------------MES_UNMAP_QUEUES--------------------*/
368 #ifndef PM4_MES_UNMAP_QUEUES_DEFINED
369 #define PM4_MES_UNMAP_QUEUES_DEFINED
370 enum mes_unmap_queues_action_enum
{
371 action__mes_unmap_queues__preempt_queues
= 0,
372 action__mes_unmap_queues__reset_queues
= 1,
373 action__mes_unmap_queues__disable_process_queues
= 2,
374 action__mes_unmap_queues__reserved
= 3
377 enum mes_unmap_queues_queue_sel_enum
{
378 queue_sel__mes_unmap_queues__perform_request_on_specified_queues
= 0,
379 queue_sel__mes_unmap_queues__perform_request_on_pasid_queues
= 1,
380 queue_sel__mes_unmap_queues__unmap_all_queues
= 2,
381 queue_sel__mes_unmap_queues__unmap_all_non_static_queues
= 3
384 enum mes_unmap_queues_engine_sel_enum
{
385 engine_sel__mes_unmap_queues__compute
= 0,
386 engine_sel__mes_unmap_queues__sdma0
= 2,
387 engine_sel__mes_unmap_queues__sdmal
= 3
390 enum mes_unmap_queues_extended_engine_sel_enum
{
391 extended_engine_sel__mes_unmap_queues__legacy_engine_sel
= 0,
392 extended_engine_sel__mes_unmap_queues__sdma0_to_7_sel
= 1
395 struct pm4_mes_unmap_queues
{
397 union PM4_MES_TYPE_3_HEADER header
; /* header */
403 enum mes_unmap_queues_action_enum action
:2;
404 enum mes_unmap_queues_extended_engine_sel_enum extended_engine_sel
:2;
405 enum mes_unmap_queues_queue_sel_enum queue_sel
:2;
406 uint32_t reserved2
:20;
407 enum mes_unmap_queues_engine_sel_enum engine_sel
:3;
408 uint32_t num_queues
:3;
416 uint32_t reserved3
:16;
419 uint32_t reserved4
:2;
420 uint32_t doorbell_offset0
:26;
428 uint32_t reserved6
:2;
429 uint32_t doorbell_offset1
:26;
430 uint32_t reserved7
:4;
437 uint32_t reserved8
:2;
438 uint32_t doorbell_offset2
:26;
439 uint32_t reserved9
:4;
446 uint32_t reserved10
:2;
447 uint32_t doorbell_offset3
:26;
448 uint32_t reserved11
:4;
455 #ifndef PM4_MEC_RELEASE_MEM_DEFINED
456 #define PM4_MEC_RELEASE_MEM_DEFINED
458 enum mec_release_mem_event_index_enum
{
459 event_index__mec_release_mem__end_of_pipe
= 5,
460 event_index__mec_release_mem__shader_done
= 6
463 enum mec_release_mem_cache_policy_enum
{
464 cache_policy__mec_release_mem__lru
= 0,
465 cache_policy__mec_release_mem__stream
= 1
468 enum mec_release_mem_pq_exe_status_enum
{
469 pq_exe_status__mec_release_mem__default
= 0,
470 pq_exe_status__mec_release_mem__phase_update
= 1
473 enum mec_release_mem_dst_sel_enum
{
474 dst_sel__mec_release_mem__memory_controller
= 0,
475 dst_sel__mec_release_mem__tc_l2
= 1,
476 dst_sel__mec_release_mem__queue_write_pointer_register
= 2,
477 dst_sel__mec_release_mem__queue_write_pointer_poll_mask_bit
= 3
480 enum mec_release_mem_int_sel_enum
{
481 int_sel__mec_release_mem__none
= 0,
482 int_sel__mec_release_mem__send_interrupt_only
= 1,
483 int_sel__mec_release_mem__send_interrupt_after_write_confirm
= 2,
484 int_sel__mec_release_mem__send_data_after_write_confirm
= 3,
485 int_sel__mec_release_mem__unconditionally_send_int_ctxid
= 4,
486 int_sel__mec_release_mem__conditionally_send_int_ctxid_based_on_32_bit_compare
= 5,
487 int_sel__mec_release_mem__conditionally_send_int_ctxid_based_on_64_bit_compare
= 6
490 enum mec_release_mem_data_sel_enum
{
491 data_sel__mec_release_mem__none
= 0,
492 data_sel__mec_release_mem__send_32_bit_low
= 1,
493 data_sel__mec_release_mem__send_64_bit_data
= 2,
494 data_sel__mec_release_mem__send_gpu_clock_counter
= 3,
495 data_sel__mec_release_mem__send_cp_perfcounter_hi_lo
= 4,
496 data_sel__mec_release_mem__store_gds_data_to_memory
= 5
499 struct pm4_mec_release_mem
{
501 union PM4_MES_TYPE_3_HEADER header
; /*header */
502 unsigned int ordinal1
;
507 unsigned int event_type
:6;
508 unsigned int reserved1
:2;
509 enum mec_release_mem_event_index_enum event_index
:4;
510 unsigned int tcl1_vol_action_ena
:1;
511 unsigned int tc_vol_action_ena
:1;
512 unsigned int reserved2
:1;
513 unsigned int tc_wb_action_ena
:1;
514 unsigned int tcl1_action_ena
:1;
515 unsigned int tc_action_ena
:1;
516 uint32_t reserved3
:1;
517 uint32_t tc_nc_action_ena
:1;
518 uint32_t tc_wc_action_ena
:1;
519 uint32_t tc_md_action_ena
:1;
520 uint32_t reserved4
:3;
521 enum mec_release_mem_cache_policy_enum cache_policy
:2;
522 uint32_t reserved5
:2;
523 enum mec_release_mem_pq_exe_status_enum pq_exe_status
:1;
524 uint32_t reserved6
:2;
526 unsigned int ordinal2
;
531 uint32_t reserved7
:16;
532 enum mec_release_mem_dst_sel_enum dst_sel
:2;
533 uint32_t reserved8
:6;
534 enum mec_release_mem_int_sel_enum int_sel
:3;
535 uint32_t reserved9
:2;
536 enum mec_release_mem_data_sel_enum data_sel
:3;
538 unsigned int ordinal3
;
543 uint32_t reserved10
:2;
544 unsigned int address_lo_32b
:30;
547 uint32_t reserved11
:3;
548 uint32_t address_lo_64b
:29;
551 unsigned int ordinal4
;
562 uint32_t cmp_data_lo
;
564 uint32_t dw_offset
:16;
565 uint32_t num_dwords
:16;
573 uint32_t cmp_data_hi
;
586 CACHE_FLUSH_AND_INV_TS_EVENT
= 0x00000014