intel_guc_fwif.h 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  1. /*
  2. * Copyright © 2014 Intel Corporation
  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 (including the next
  12. * paragraph) shall be included in all copies or substantial portions of the
  13. * 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  20. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  21. * IN THE SOFTWARE.
  22. */
  23. #ifndef _INTEL_GUC_FWIF_H
  24. #define _INTEL_GUC_FWIF_H
  25. /*
  26. * This file is partially autogenerated, although currently with some manual
  27. * fixups afterwards. In future, it should be entirely autogenerated, in order
  28. * to ensure that the definitions herein remain in sync with those used by the
  29. * GuC's own firmware.
  30. *
  31. * EDITING THIS FILE IS THEREFORE NOT RECOMMENDED - YOUR CHANGES MAY BE LOST.
  32. */
  33. #define GFXCORE_FAMILY_GEN9 12
  34. #define GFXCORE_FAMILY_UNKNOWN 0x7fffffff
  35. #define GUC_CTX_PRIORITY_KMD_HIGH 0
  36. #define GUC_CTX_PRIORITY_HIGH 1
  37. #define GUC_CTX_PRIORITY_KMD_NORMAL 2
  38. #define GUC_CTX_PRIORITY_NORMAL 3
  39. #define GUC_MAX_GPU_CONTEXTS 1024
  40. #define GUC_INVALID_CTX_ID GUC_MAX_GPU_CONTEXTS
  41. /* Work queue item header definitions */
  42. #define WQ_STATUS_ACTIVE 1
  43. #define WQ_STATUS_SUSPENDED 2
  44. #define WQ_STATUS_CMD_ERROR 3
  45. #define WQ_STATUS_ENGINE_ID_NOT_USED 4
  46. #define WQ_STATUS_SUSPENDED_FROM_RESET 5
  47. #define WQ_TYPE_SHIFT 0
  48. #define WQ_TYPE_BATCH_BUF (0x1 << WQ_TYPE_SHIFT)
  49. #define WQ_TYPE_PSEUDO (0x2 << WQ_TYPE_SHIFT)
  50. #define WQ_TYPE_INORDER (0x3 << WQ_TYPE_SHIFT)
  51. #define WQ_TARGET_SHIFT 10
  52. #define WQ_LEN_SHIFT 16
  53. #define WQ_NO_WCFLUSH_WAIT (1 << 27)
  54. #define WQ_PRESENT_WORKLOAD (1 << 28)
  55. #define WQ_WORKLOAD_SHIFT 29
  56. #define WQ_WORKLOAD_GENERAL (0 << WQ_WORKLOAD_SHIFT)
  57. #define WQ_WORKLOAD_GPGPU (1 << WQ_WORKLOAD_SHIFT)
  58. #define WQ_WORKLOAD_TOUCH (2 << WQ_WORKLOAD_SHIFT)
  59. #define WQ_RING_TAIL_SHIFT 20
  60. #define WQ_RING_TAIL_MASK (0x7FF << WQ_RING_TAIL_SHIFT)
  61. #define GUC_DOORBELL_ENABLED 1
  62. #define GUC_DOORBELL_DISABLED 0
  63. #define GUC_CTX_DESC_ATTR_ACTIVE (1 << 0)
  64. #define GUC_CTX_DESC_ATTR_PENDING_DB (1 << 1)
  65. #define GUC_CTX_DESC_ATTR_KERNEL (1 << 2)
  66. #define GUC_CTX_DESC_ATTR_PREEMPT (1 << 3)
  67. #define GUC_CTX_DESC_ATTR_RESET (1 << 4)
  68. #define GUC_CTX_DESC_ATTR_WQLOCKED (1 << 5)
  69. #define GUC_CTX_DESC_ATTR_PCH (1 << 6)
  70. #define GUC_CTX_DESC_ATTR_TERMINATED (1 << 7)
  71. /* The guc control data is 10 DWORDs */
  72. #define GUC_CTL_CTXINFO 0
  73. #define GUC_CTL_CTXNUM_IN16_SHIFT 0
  74. #define GUC_CTL_BASE_ADDR_SHIFT 12
  75. #define GUC_CTL_ARAT_HIGH 1
  76. #define GUC_CTL_ARAT_LOW 2
  77. #define GUC_CTL_DEVICE_INFO 3
  78. #define GUC_CTL_GTTYPE_SHIFT 0
  79. #define GUC_CTL_COREFAMILY_SHIFT 7
  80. #define GUC_CTL_LOG_PARAMS 4
  81. #define GUC_LOG_VALID (1 << 0)
  82. #define GUC_LOG_NOTIFY_ON_HALF_FULL (1 << 1)
  83. #define GUC_LOG_ALLOC_IN_MEGABYTE (1 << 3)
  84. #define GUC_LOG_CRASH_PAGES 1
  85. #define GUC_LOG_CRASH_SHIFT 4
  86. #define GUC_LOG_DPC_PAGES 3
  87. #define GUC_LOG_DPC_SHIFT 6
  88. #define GUC_LOG_ISR_PAGES 3
  89. #define GUC_LOG_ISR_SHIFT 9
  90. #define GUC_LOG_BUF_ADDR_SHIFT 12
  91. #define GUC_CTL_PAGE_FAULT_CONTROL 5
  92. #define GUC_CTL_WA 6
  93. #define GUC_CTL_WA_UK_BY_DRIVER (1 << 3)
  94. #define GUC_CTL_FEATURE 7
  95. #define GUC_CTL_VCS2_ENABLED (1 << 0)
  96. #define GUC_CTL_KERNEL_SUBMISSIONS (1 << 1)
  97. #define GUC_CTL_FEATURE2 (1 << 2)
  98. #define GUC_CTL_POWER_GATING (1 << 3)
  99. #define GUC_CTL_DISABLE_SCHEDULER (1 << 4)
  100. #define GUC_CTL_PREEMPTION_LOG (1 << 5)
  101. #define GUC_CTL_ENABLE_SLPC (1 << 7)
  102. #define GUC_CTL_RESET_ON_PREMPT_FAILURE (1 << 8)
  103. #define GUC_CTL_DEBUG 8
  104. #define GUC_LOG_VERBOSITY_SHIFT 0
  105. #define GUC_LOG_VERBOSITY_LOW (0 << GUC_LOG_VERBOSITY_SHIFT)
  106. #define GUC_LOG_VERBOSITY_MED (1 << GUC_LOG_VERBOSITY_SHIFT)
  107. #define GUC_LOG_VERBOSITY_HIGH (2 << GUC_LOG_VERBOSITY_SHIFT)
  108. #define GUC_LOG_VERBOSITY_ULTRA (3 << GUC_LOG_VERBOSITY_SHIFT)
  109. /* Verbosity range-check limits, without the shift */
  110. #define GUC_LOG_VERBOSITY_MIN 0
  111. #define GUC_LOG_VERBOSITY_MAX 3
  112. #define GUC_CTL_RSRVD 9
  113. #define GUC_CTL_MAX_DWORDS (GUC_CTL_RSRVD + 1)
  114. struct guc_doorbell_info {
  115. u32 db_status;
  116. u32 cookie;
  117. u32 reserved[14];
  118. } __packed;
  119. union guc_doorbell_qw {
  120. struct {
  121. u32 db_status;
  122. u32 cookie;
  123. };
  124. u64 value_qw;
  125. } __packed;
  126. #define GUC_MAX_DOORBELLS 256
  127. #define GUC_INVALID_DOORBELL_ID (GUC_MAX_DOORBELLS)
  128. #define GUC_DB_SIZE (PAGE_SIZE)
  129. #define GUC_WQ_SIZE (PAGE_SIZE * 2)
  130. /* Work item for submitting workloads into work queue of GuC. */
  131. struct guc_wq_item {
  132. u32 header;
  133. u32 context_desc;
  134. u32 ring_tail;
  135. u32 fence_id;
  136. } __packed;
  137. struct guc_process_desc {
  138. u32 context_id;
  139. u64 db_base_addr;
  140. u32 head;
  141. u32 tail;
  142. u32 error_offset;
  143. u64 wq_base_addr;
  144. u32 wq_size_bytes;
  145. u32 wq_status;
  146. u32 engine_presence;
  147. u32 priority;
  148. u32 reserved[30];
  149. } __packed;
  150. /* engine id and context id is packed into guc_execlist_context.context_id*/
  151. #define GUC_ELC_CTXID_OFFSET 0
  152. #define GUC_ELC_ENGINE_OFFSET 29
  153. /* The execlist context including software and HW information */
  154. struct guc_execlist_context {
  155. u32 context_desc;
  156. u32 context_id;
  157. u32 ring_status;
  158. u32 ring_lcra;
  159. u32 ring_begin;
  160. u32 ring_end;
  161. u32 ring_next_free_location;
  162. u32 ring_current_tail_pointer_value;
  163. u8 engine_state_submit_value;
  164. u8 engine_state_wait_value;
  165. u16 pagefault_count;
  166. u16 engine_submit_queue_count;
  167. } __packed;
  168. /*Context descriptor for communicating between uKernel and Driver*/
  169. struct guc_context_desc {
  170. u32 sched_common_area;
  171. u32 context_id;
  172. u32 pas_id;
  173. u8 engines_used;
  174. u64 db_trigger_cpu;
  175. u32 db_trigger_uk;
  176. u64 db_trigger_phy;
  177. u16 db_id;
  178. struct guc_execlist_context lrc[I915_NUM_RINGS];
  179. u8 attribute;
  180. u32 priority;
  181. u32 wq_sampled_tail_offset;
  182. u32 wq_total_submit_enqueues;
  183. u32 process_desc;
  184. u32 wq_addr;
  185. u32 wq_size;
  186. u32 engine_presence;
  187. u8 engine_suspended;
  188. u8 reserved0[3];
  189. u64 reserved1[1];
  190. u64 desc_private;
  191. } __packed;
  192. #define GUC_FORCEWAKE_RENDER (1 << 0)
  193. #define GUC_FORCEWAKE_MEDIA (1 << 1)
  194. #define GUC_POWER_UNSPECIFIED 0
  195. #define GUC_POWER_D0 1
  196. #define GUC_POWER_D1 2
  197. #define GUC_POWER_D2 3
  198. #define GUC_POWER_D3 4
  199. /* This Action will be programmed in C180 - SOFT_SCRATCH_O_REG */
  200. enum host2guc_action {
  201. HOST2GUC_ACTION_DEFAULT = 0x0,
  202. HOST2GUC_ACTION_SAMPLE_FORCEWAKE = 0x6,
  203. HOST2GUC_ACTION_ALLOCATE_DOORBELL = 0x10,
  204. HOST2GUC_ACTION_DEALLOCATE_DOORBELL = 0x20,
  205. HOST2GUC_ACTION_ENTER_S_STATE = 0x501,
  206. HOST2GUC_ACTION_EXIT_S_STATE = 0x502,
  207. HOST2GUC_ACTION_SLPC_REQUEST = 0x3003,
  208. HOST2GUC_ACTION_LIMIT
  209. };
  210. /*
  211. * The GuC sends its response to a command by overwriting the
  212. * command in SS0. The response is distinguishable from a command
  213. * by the fact that all the MASK bits are set. The remaining bits
  214. * give more detail.
  215. */
  216. #define GUC2HOST_RESPONSE_MASK ((u32)0xF0000000)
  217. #define GUC2HOST_IS_RESPONSE(x) ((u32)(x) >= GUC2HOST_RESPONSE_MASK)
  218. #define GUC2HOST_STATUS(x) (GUC2HOST_RESPONSE_MASK | (x))
  219. /* GUC will return status back to SOFT_SCRATCH_O_REG */
  220. enum guc2host_status {
  221. GUC2HOST_STATUS_SUCCESS = GUC2HOST_STATUS(0x0),
  222. GUC2HOST_STATUS_ALLOCATE_DOORBELL_FAIL = GUC2HOST_STATUS(0x10),
  223. GUC2HOST_STATUS_DEALLOCATE_DOORBELL_FAIL = GUC2HOST_STATUS(0x20),
  224. GUC2HOST_STATUS_GENERIC_FAIL = GUC2HOST_STATUS(0x0000F000)
  225. };
  226. #endif