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
:6;
88 uint32_t gds_heap_size
:6;
89 uint32_t reserved4
:15;
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 reserved2
: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 reserved7
:1;
181 uint32_t sdma_enable
:1;
183 uint32_t reserved8
:4;
185 uint32_t num_queues
:10;
190 uint32_t completion_signal_lo
;
192 uint32_t completion_signal_hi
;
198 /*--------------------MES_MAP_PROCESS_VM--------------------*/
200 #ifndef PM4_MES_MAP_PROCESS_VM_DEFINED
201 #define PM4_MES_MAP_PROCESS_VM_DEFINED
203 struct PM4_MES_MAP_PROCESS_VM
{
205 union PM4_MES_TYPE_3_HEADER header
; /* header */
211 uint32_t vm_context_cntl
;
215 uint32_t vm_context_page_table_end_addr_lo32
;
217 uint32_t vm_context_page_table_end_addr_hi32
;
219 uint32_t vm_context_page_table_start_addr_lo32
;
221 uint32_t vm_context_page_table_start_addr_hi32
;
235 uint32_t completion_signal_lo32
;
237 uint32_t completion_signal_hi32
;
242 /*--------------------MES_MAP_QUEUES--------------------*/
244 #ifndef PM4_MES_MAP_QUEUES_VI_DEFINED
245 #define PM4_MES_MAP_QUEUES_VI_DEFINED
246 enum mes_map_queues_queue_sel_enum
{
247 queue_sel__mes_map_queues__map_to_specified_queue_slots_vi
= 0,
248 queue_sel__mes_map_queues__map_to_hws_determined_queue_slots_vi
= 1
251 enum mes_map_queues_queue_type_enum
{
252 queue_type__mes_map_queues__normal_compute_vi
= 0,
253 queue_type__mes_map_queues__debug_interface_queue_vi
= 1,
254 queue_type__mes_map_queues__normal_latency_static_queue_vi
= 2,
255 queue_type__mes_map_queues__low_latency_static_queue_vi
= 3
258 enum mes_map_queues_alloc_format_enum
{
259 alloc_format__mes_map_queues__one_per_pipe_vi
= 0,
260 alloc_format__mes_map_queues__all_on_one_pipe_vi
= 1
263 enum mes_map_queues_engine_sel_enum
{
264 engine_sel__mes_map_queues__compute_vi
= 0,
265 engine_sel__mes_map_queues__sdma0_vi
= 2,
266 engine_sel__mes_map_queues__sdma1_vi
= 3
270 struct pm4_mes_map_queues
{
272 union PM4_MES_TYPE_3_HEADER header
; /* header */
278 uint32_t reserved1
:4;
279 enum mes_map_queues_queue_sel_enum queue_sel
:2;
280 uint32_t reserved2
:15;
281 enum mes_map_queues_queue_type_enum queue_type
:3;
282 enum mes_map_queues_alloc_format_enum alloc_format
:2;
283 enum mes_map_queues_engine_sel_enum engine_sel
:3;
284 uint32_t num_queues
:3;
291 uint32_t reserved3
:1;
292 uint32_t check_disable
:1;
293 uint32_t doorbell_offset
:26;
294 uint32_t reserved4
:4;
299 uint32_t mqd_addr_lo
;
300 uint32_t mqd_addr_hi
;
301 uint32_t wptr_addr_lo
;
302 uint32_t wptr_addr_hi
;
306 /*--------------------MES_QUERY_STATUS--------------------*/
308 #ifndef PM4_MES_QUERY_STATUS_DEFINED
309 #define PM4_MES_QUERY_STATUS_DEFINED
310 enum mes_query_status_interrupt_sel_enum
{
311 interrupt_sel__mes_query_status__completion_status
= 0,
312 interrupt_sel__mes_query_status__process_status
= 1,
313 interrupt_sel__mes_query_status__queue_status
= 2
316 enum mes_query_status_command_enum
{
317 command__mes_query_status__interrupt_only
= 0,
318 command__mes_query_status__fence_only_immediate
= 1,
319 command__mes_query_status__fence_only_after_write_ack
= 2,
320 command__mes_query_status__fence_wait_for_write_ack_send_interrupt
= 3
323 enum mes_query_status_engine_sel_enum
{
324 engine_sel__mes_query_status__compute
= 0,
325 engine_sel__mes_query_status__sdma0_queue
= 2,
326 engine_sel__mes_query_status__sdma1_queue
= 3
329 struct pm4_mes_query_status
{
331 union PM4_MES_TYPE_3_HEADER header
; /* header */
337 uint32_t context_id
:28;
338 enum mes_query_status_interrupt_sel_enum interrupt_sel
:2;
339 enum mes_query_status_command_enum command
:2;
347 uint32_t reserved1
:16;
350 uint32_t reserved2
:2;
351 uint32_t doorbell_offset
:26;
352 enum mes_query_status_engine_sel_enum engine_sel
:3;
353 uint32_t reserved3
:1;
365 /*--------------------MES_UNMAP_QUEUES--------------------*/
367 #ifndef PM4_MES_UNMAP_QUEUES_DEFINED
368 #define PM4_MES_UNMAP_QUEUES_DEFINED
369 enum mes_unmap_queues_action_enum
{
370 action__mes_unmap_queues__preempt_queues
= 0,
371 action__mes_unmap_queues__reset_queues
= 1,
372 action__mes_unmap_queues__disable_process_queues
= 2,
373 action__mes_unmap_queues__reserved
= 3
376 enum mes_unmap_queues_queue_sel_enum
{
377 queue_sel__mes_unmap_queues__perform_request_on_specified_queues
= 0,
378 queue_sel__mes_unmap_queues__perform_request_on_pasid_queues
= 1,
379 queue_sel__mes_unmap_queues__unmap_all_queues
= 2,
380 queue_sel__mes_unmap_queues__unmap_all_non_static_queues
= 3
383 enum mes_unmap_queues_engine_sel_enum
{
384 engine_sel__mes_unmap_queues__compute
= 0,
385 engine_sel__mes_unmap_queues__sdma0
= 2,
386 engine_sel__mes_unmap_queues__sdmal
= 3
389 struct pm4_mes_unmap_queues
{
391 union PM4_MES_TYPE_3_HEADER header
; /* header */
397 enum mes_unmap_queues_action_enum action
:2;
398 uint32_t reserved1
:2;
399 enum mes_unmap_queues_queue_sel_enum queue_sel
:2;
400 uint32_t reserved2
:20;
401 enum mes_unmap_queues_engine_sel_enum engine_sel
:3;
402 uint32_t num_queues
:3;
410 uint32_t reserved3
:16;
413 uint32_t reserved4
:2;
414 uint32_t doorbell_offset0
:26;
422 uint32_t reserved6
:2;
423 uint32_t doorbell_offset1
:26;
424 uint32_t reserved7
:4;
431 uint32_t reserved8
:2;
432 uint32_t doorbell_offset2
:26;
433 uint32_t reserved9
:4;
440 uint32_t reserved10
:2;
441 uint32_t doorbell_offset3
:26;
442 uint32_t reserved11
:4;
449 #ifndef PM4_MEC_RELEASE_MEM_DEFINED
450 #define PM4_MEC_RELEASE_MEM_DEFINED
452 enum mec_release_mem_event_index_enum
{
453 event_index__mec_release_mem__end_of_pipe
= 5,
454 event_index__mec_release_mem__shader_done
= 6
457 enum mec_release_mem_cache_policy_enum
{
458 cache_policy__mec_release_mem__lru
= 0,
459 cache_policy__mec_release_mem__stream
= 1
462 enum mec_release_mem_pq_exe_status_enum
{
463 pq_exe_status__mec_release_mem__default
= 0,
464 pq_exe_status__mec_release_mem__phase_update
= 1
467 enum mec_release_mem_dst_sel_enum
{
468 dst_sel__mec_release_mem__memory_controller
= 0,
469 dst_sel__mec_release_mem__tc_l2
= 1,
470 dst_sel__mec_release_mem__queue_write_pointer_register
= 2,
471 dst_sel__mec_release_mem__queue_write_pointer_poll_mask_bit
= 3
474 enum mec_release_mem_int_sel_enum
{
475 int_sel__mec_release_mem__none
= 0,
476 int_sel__mec_release_mem__send_interrupt_only
= 1,
477 int_sel__mec_release_mem__send_interrupt_after_write_confirm
= 2,
478 int_sel__mec_release_mem__send_data_after_write_confirm
= 3,
479 int_sel__mec_release_mem__unconditionally_send_int_ctxid
= 4,
480 int_sel__mec_release_mem__conditionally_send_int_ctxid_based_on_32_bit_compare
= 5,
481 int_sel__mec_release_mem__conditionally_send_int_ctxid_based_on_64_bit_compare
= 6
484 enum mec_release_mem_data_sel_enum
{
485 data_sel__mec_release_mem__none
= 0,
486 data_sel__mec_release_mem__send_32_bit_low
= 1,
487 data_sel__mec_release_mem__send_64_bit_data
= 2,
488 data_sel__mec_release_mem__send_gpu_clock_counter
= 3,
489 data_sel__mec_release_mem__send_cp_perfcounter_hi_lo
= 4,
490 data_sel__mec_release_mem__store_gds_data_to_memory
= 5
493 struct pm4_mec_release_mem
{
495 union PM4_MES_TYPE_3_HEADER header
; /*header */
496 unsigned int ordinal1
;
501 unsigned int event_type
:6;
502 unsigned int reserved1
:2;
503 enum mec_release_mem_event_index_enum event_index
:4;
504 unsigned int tcl1_vol_action_ena
:1;
505 unsigned int tc_vol_action_ena
:1;
506 unsigned int reserved2
:1;
507 unsigned int tc_wb_action_ena
:1;
508 unsigned int tcl1_action_ena
:1;
509 unsigned int tc_action_ena
:1;
510 uint32_t reserved3
:1;
511 uint32_t tc_nc_action_ena
:1;
512 uint32_t tc_wc_action_ena
:1;
513 uint32_t tc_md_action_ena
:1;
514 uint32_t reserved4
:3;
515 enum mec_release_mem_cache_policy_enum cache_policy
:2;
516 uint32_t reserved5
:2;
517 enum mec_release_mem_pq_exe_status_enum pq_exe_status
:1;
518 uint32_t reserved6
:2;
520 unsigned int ordinal2
;
525 uint32_t reserved7
:16;
526 enum mec_release_mem_dst_sel_enum dst_sel
:2;
527 uint32_t reserved8
:6;
528 enum mec_release_mem_int_sel_enum int_sel
:3;
529 uint32_t reserved9
:2;
530 enum mec_release_mem_data_sel_enum data_sel
:3;
532 unsigned int ordinal3
;
537 uint32_t reserved10
:2;
538 unsigned int address_lo_32b
:30;
541 uint32_t reserved11
:3;
542 uint32_t address_lo_64b
:29;
545 unsigned int ordinal4
;
556 uint32_t cmp_data_lo
;
558 uint32_t dw_offset
:16;
559 uint32_t num_dwords
:16;
567 uint32_t cmp_data_hi
;
580 CACHE_FLUSH_AND_INV_TS_EVENT
= 0x00000014