execlist.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. /*
  2. * Copyright(c) 2011-2016 Intel Corporation. All rights reserved.
  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 FROM,
  20. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  21. * SOFTWARE.
  22. *
  23. * Authors:
  24. * Zhiyuan Lv <zhiyuan.lv@intel.com>
  25. * Zhi Wang <zhi.a.wang@intel.com>
  26. *
  27. * Contributors:
  28. * Min He <min.he@intel.com>
  29. * Bing Niu <bing.niu@intel.com>
  30. * Ping Gao <ping.a.gao@intel.com>
  31. * Tina Zhang <tina.zhang@intel.com>
  32. *
  33. */
  34. #ifndef _GVT_EXECLIST_H_
  35. #define _GVT_EXECLIST_H_
  36. struct execlist_ctx_descriptor_format {
  37. union {
  38. u32 udw;
  39. u32 context_id;
  40. };
  41. union {
  42. u32 ldw;
  43. struct {
  44. u32 valid : 1;
  45. u32 force_pd_restore : 1;
  46. u32 force_restore : 1;
  47. u32 addressing_mode : 2;
  48. u32 llc_coherency : 1;
  49. u32 fault_handling : 2;
  50. u32 privilege_access : 1;
  51. u32 reserved : 3;
  52. u32 lrca : 20;
  53. };
  54. };
  55. };
  56. struct execlist_status_format {
  57. union {
  58. u32 ldw;
  59. struct {
  60. u32 current_execlist_pointer :1;
  61. u32 execlist_write_pointer :1;
  62. u32 execlist_queue_full :1;
  63. u32 execlist_1_valid :1;
  64. u32 execlist_0_valid :1;
  65. u32 last_ctx_switch_reason :9;
  66. u32 current_active_elm_status :2;
  67. u32 arbitration_enable :1;
  68. u32 execlist_1_active :1;
  69. u32 execlist_0_active :1;
  70. u32 reserved :13;
  71. };
  72. };
  73. union {
  74. u32 udw;
  75. u32 context_id;
  76. };
  77. };
  78. struct execlist_context_status_pointer_format {
  79. union {
  80. u32 dw;
  81. struct {
  82. u32 write_ptr :3;
  83. u32 reserved :5;
  84. u32 read_ptr :3;
  85. u32 reserved2 :5;
  86. u32 mask :16;
  87. };
  88. };
  89. };
  90. struct execlist_context_status_format {
  91. union {
  92. u32 ldw;
  93. struct {
  94. u32 idle_to_active :1;
  95. u32 preempted :1;
  96. u32 element_switch :1;
  97. u32 active_to_idle :1;
  98. u32 context_complete :1;
  99. u32 wait_on_sync_flip :1;
  100. u32 wait_on_vblank :1;
  101. u32 wait_on_semaphore :1;
  102. u32 wait_on_scanline :1;
  103. u32 reserved :2;
  104. u32 semaphore_wait_mode :1;
  105. u32 display_plane :3;
  106. u32 lite_restore :1;
  107. u32 reserved_2 :16;
  108. };
  109. };
  110. union {
  111. u32 udw;
  112. u32 context_id;
  113. };
  114. };
  115. struct execlist_mmio_pair {
  116. u32 addr;
  117. u32 val;
  118. };
  119. /* The first 52 dwords in register state context */
  120. struct execlist_ring_context {
  121. u32 nop1;
  122. u32 lri_cmd_1;
  123. struct execlist_mmio_pair ctx_ctrl;
  124. struct execlist_mmio_pair ring_header;
  125. struct execlist_mmio_pair ring_tail;
  126. struct execlist_mmio_pair rb_start;
  127. struct execlist_mmio_pair rb_ctrl;
  128. struct execlist_mmio_pair bb_cur_head_UDW;
  129. struct execlist_mmio_pair bb_cur_head_LDW;
  130. struct execlist_mmio_pair bb_state;
  131. struct execlist_mmio_pair second_bb_addr_UDW;
  132. struct execlist_mmio_pair second_bb_addr_LDW;
  133. struct execlist_mmio_pair second_bb_state;
  134. struct execlist_mmio_pair bb_per_ctx_ptr;
  135. struct execlist_mmio_pair rcs_indirect_ctx;
  136. struct execlist_mmio_pair rcs_indirect_ctx_offset;
  137. u32 nop2;
  138. u32 nop3;
  139. u32 nop4;
  140. u32 lri_cmd_2;
  141. struct execlist_mmio_pair ctx_timestamp;
  142. struct execlist_mmio_pair pdp3_UDW;
  143. struct execlist_mmio_pair pdp3_LDW;
  144. struct execlist_mmio_pair pdp2_UDW;
  145. struct execlist_mmio_pair pdp2_LDW;
  146. struct execlist_mmio_pair pdp1_UDW;
  147. struct execlist_mmio_pair pdp1_LDW;
  148. struct execlist_mmio_pair pdp0_UDW;
  149. struct execlist_mmio_pair pdp0_LDW;
  150. };
  151. struct intel_vgpu_elsp_dwords {
  152. u32 data[4];
  153. u32 index;
  154. };
  155. struct intel_vgpu_execlist_slot {
  156. struct execlist_ctx_descriptor_format ctx[2];
  157. u32 index;
  158. };
  159. struct intel_vgpu_execlist {
  160. struct intel_vgpu_execlist_slot slot[2];
  161. struct intel_vgpu_execlist_slot *running_slot;
  162. struct intel_vgpu_execlist_slot *pending_slot;
  163. struct execlist_ctx_descriptor_format *running_context;
  164. int ring_id;
  165. struct intel_vgpu *vgpu;
  166. struct intel_vgpu_elsp_dwords elsp_dwords;
  167. };
  168. void intel_vgpu_clean_execlist(struct intel_vgpu *vgpu);
  169. int intel_vgpu_init_execlist(struct intel_vgpu *vgpu);
  170. int intel_vgpu_submit_execlist(struct intel_vgpu *vgpu, int ring_id);
  171. void intel_vgpu_reset_execlist(struct intel_vgpu *vgpu,
  172. unsigned long engine_mask);
  173. #endif /*_GVT_EXECLIST_H_*/