kfd_pm4_headers.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. /* SPDX-License-Identifier: GPL-2.0 OR MIT */
  2. /*
  3. * Copyright 2014-2022 Advanced Micro Devices, Inc.
  4. *
  5. * Permission is hereby granted, free of charge, to any person obtaining a
  6. * copy of this software and associated documentation files (the "Software"),
  7. * to deal in the Software without restriction, including without limitation
  8. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  9. * and/or sell copies of the Software, and to permit persons to whom the
  10. * Software is furnished to do so, subject to the following conditions:
  11. *
  12. * The above copyright notice and this permission notice shall be included in
  13. * all copies or substantial portions of the Software.
  14. *
  15. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  18. * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
  19. * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  20. * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  21. * OTHER DEALINGS IN THE SOFTWARE.
  22. *
  23. */
  24. #ifndef KFD_PM4_HEADERS_H_
  25. #define KFD_PM4_HEADERS_H_
  26. #ifndef PM4_MES_HEADER_DEFINED
  27. #define PM4_MES_HEADER_DEFINED
  28. union PM4_MES_TYPE_3_HEADER {
  29. struct {
  30. /* reserved */
  31. uint32_t reserved1:8;
  32. /* IT opcode */
  33. uint32_t opcode:8;
  34. /* number of DWORDs - 1 in the information body */
  35. uint32_t count:14;
  36. /* packet identifier. It should be 3 for type 3 packets */
  37. uint32_t type:2;
  38. };
  39. uint32_t u32all;
  40. };
  41. #endif /* PM4_MES_HEADER_DEFINED */
  42. /*--------------------MES_MAP_PROCESS-------------------- */
  43. #ifndef PM4_MES_MAP_PROCESS_DEFINED
  44. #define PM4_MES_MAP_PROCESS_DEFINED
  45. struct pm4_map_process {
  46. union {
  47. union PM4_MES_TYPE_3_HEADER header; /* header */
  48. uint32_t ordinal1;
  49. };
  50. union {
  51. struct {
  52. uint32_t pasid:16;
  53. uint32_t reserved1:8;
  54. uint32_t diq_enable:1;
  55. uint32_t process_quantum:7;
  56. } bitfields2;
  57. uint32_t ordinal2;
  58. };
  59. union {
  60. struct {
  61. uint32_t page_table_base:28;
  62. uint32_t reserved3:4;
  63. } bitfields3;
  64. uint32_t ordinal3;
  65. };
  66. uint32_t sh_mem_bases;
  67. uint32_t sh_mem_ape1_base;
  68. uint32_t sh_mem_ape1_limit;
  69. uint32_t sh_mem_config;
  70. uint32_t gds_addr_lo;
  71. uint32_t gds_addr_hi;
  72. union {
  73. struct {
  74. uint32_t num_gws:6;
  75. uint32_t reserved4:2;
  76. uint32_t num_oac:4;
  77. uint32_t reserved5:4;
  78. uint32_t gds_size:6;
  79. uint32_t num_queues:10;
  80. } bitfields10;
  81. uint32_t ordinal10;
  82. };
  83. };
  84. #endif
  85. #ifndef PM4_MES_MAP_PROCESS_DEFINED_KV_SCRATCH
  86. #define PM4_MES_MAP_PROCESS_DEFINED_KV_SCRATCH
  87. struct pm4_map_process_scratch_kv {
  88. union {
  89. union PM4_MES_TYPE_3_HEADER header; /* header */
  90. uint32_t ordinal1;
  91. };
  92. union {
  93. struct {
  94. uint32_t pasid:16;
  95. uint32_t reserved1:8;
  96. uint32_t diq_enable:1;
  97. uint32_t process_quantum:7;
  98. } bitfields2;
  99. uint32_t ordinal2;
  100. };
  101. union {
  102. struct {
  103. uint32_t page_table_base:28;
  104. uint32_t reserved2:4;
  105. } bitfields3;
  106. uint32_t ordinal3;
  107. };
  108. uint32_t reserved3;
  109. uint32_t sh_mem_bases;
  110. uint32_t sh_mem_config;
  111. uint32_t sh_mem_ape1_base;
  112. uint32_t sh_mem_ape1_limit;
  113. uint32_t sh_hidden_private_base_vmid;
  114. uint32_t reserved4;
  115. uint32_t reserved5;
  116. uint32_t gds_addr_lo;
  117. uint32_t gds_addr_hi;
  118. union {
  119. struct {
  120. uint32_t num_gws:6;
  121. uint32_t reserved6:2;
  122. uint32_t num_oac:4;
  123. uint32_t reserved7:4;
  124. uint32_t gds_size:6;
  125. uint32_t num_queues:10;
  126. } bitfields14;
  127. uint32_t ordinal14;
  128. };
  129. uint32_t completion_signal_lo32;
  130. uint32_t completion_signal_hi32;
  131. };
  132. #endif
  133. enum {
  134. CACHE_FLUSH_AND_INV_TS_EVENT = 0x00000014
  135. };
  136. #endif /* KFD_PM4_HEADERS_H_ */