intel_ringbuffer.h 36 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _INTEL_RINGBUFFER_H_
  3. #define _INTEL_RINGBUFFER_H_
  4. #include <linux/hashtable.h>
  5. #include <linux/seqlock.h>
  6. #include "i915_gem_batch_pool.h"
  7. #include "i915_reg.h"
  8. #include "i915_pmu.h"
  9. #include "i915_request.h"
  10. #include "i915_selftest.h"
  11. #include "i915_timeline.h"
  12. #include "intel_gpu_commands.h"
  13. struct drm_printer;
  14. struct i915_sched_attr;
  15. #define I915_CMD_HASH_ORDER 9
  16. /* Early gen2 devices have a cacheline of just 32 bytes, using 64 is overkill,
  17. * but keeps the logic simple. Indeed, the whole purpose of this macro is just
  18. * to give some inclination as to some of the magic values used in the various
  19. * workarounds!
  20. */
  21. #define CACHELINE_BYTES 64
  22. #define CACHELINE_DWORDS (CACHELINE_BYTES / sizeof(uint32_t))
  23. struct intel_hw_status_page {
  24. struct i915_vma *vma;
  25. u32 *page_addr;
  26. u32 ggtt_offset;
  27. };
  28. #define I915_READ_TAIL(engine) I915_READ(RING_TAIL((engine)->mmio_base))
  29. #define I915_WRITE_TAIL(engine, val) I915_WRITE(RING_TAIL((engine)->mmio_base), val)
  30. #define I915_READ_START(engine) I915_READ(RING_START((engine)->mmio_base))
  31. #define I915_WRITE_START(engine, val) I915_WRITE(RING_START((engine)->mmio_base), val)
  32. #define I915_READ_HEAD(engine) I915_READ(RING_HEAD((engine)->mmio_base))
  33. #define I915_WRITE_HEAD(engine, val) I915_WRITE(RING_HEAD((engine)->mmio_base), val)
  34. #define I915_READ_CTL(engine) I915_READ(RING_CTL((engine)->mmio_base))
  35. #define I915_WRITE_CTL(engine, val) I915_WRITE(RING_CTL((engine)->mmio_base), val)
  36. #define I915_READ_IMR(engine) I915_READ(RING_IMR((engine)->mmio_base))
  37. #define I915_WRITE_IMR(engine, val) I915_WRITE(RING_IMR((engine)->mmio_base), val)
  38. #define I915_READ_MODE(engine) I915_READ(RING_MI_MODE((engine)->mmio_base))
  39. #define I915_WRITE_MODE(engine, val) I915_WRITE(RING_MI_MODE((engine)->mmio_base), val)
  40. /* seqno size is actually only a uint32, but since we plan to use MI_FLUSH_DW to
  41. * do the writes, and that must have qw aligned offsets, simply pretend it's 8b.
  42. */
  43. enum intel_engine_hangcheck_action {
  44. ENGINE_IDLE = 0,
  45. ENGINE_WAIT,
  46. ENGINE_ACTIVE_SEQNO,
  47. ENGINE_ACTIVE_HEAD,
  48. ENGINE_ACTIVE_SUBUNITS,
  49. ENGINE_WAIT_KICK,
  50. ENGINE_DEAD,
  51. };
  52. static inline const char *
  53. hangcheck_action_to_str(const enum intel_engine_hangcheck_action a)
  54. {
  55. switch (a) {
  56. case ENGINE_IDLE:
  57. return "idle";
  58. case ENGINE_WAIT:
  59. return "wait";
  60. case ENGINE_ACTIVE_SEQNO:
  61. return "active seqno";
  62. case ENGINE_ACTIVE_HEAD:
  63. return "active head";
  64. case ENGINE_ACTIVE_SUBUNITS:
  65. return "active subunits";
  66. case ENGINE_WAIT_KICK:
  67. return "wait kick";
  68. case ENGINE_DEAD:
  69. return "dead";
  70. }
  71. return "unknown";
  72. }
  73. #define I915_MAX_SLICES 3
  74. #define I915_MAX_SUBSLICES 8
  75. #define instdone_slice_mask(dev_priv__) \
  76. (INTEL_GEN(dev_priv__) == 7 ? \
  77. 1 : INTEL_INFO(dev_priv__)->sseu.slice_mask)
  78. #define instdone_subslice_mask(dev_priv__) \
  79. (INTEL_GEN(dev_priv__) == 7 ? \
  80. 1 : INTEL_INFO(dev_priv__)->sseu.subslice_mask[0])
  81. #define for_each_instdone_slice_subslice(dev_priv__, slice__, subslice__) \
  82. for ((slice__) = 0, (subslice__) = 0; \
  83. (slice__) < I915_MAX_SLICES; \
  84. (subslice__) = ((subslice__) + 1) < I915_MAX_SUBSLICES ? (subslice__) + 1 : 0, \
  85. (slice__) += ((subslice__) == 0)) \
  86. for_each_if((BIT(slice__) & instdone_slice_mask(dev_priv__)) && \
  87. (BIT(subslice__) & instdone_subslice_mask(dev_priv__)))
  88. struct intel_instdone {
  89. u32 instdone;
  90. /* The following exist only in the RCS engine */
  91. u32 slice_common;
  92. u32 sampler[I915_MAX_SLICES][I915_MAX_SUBSLICES];
  93. u32 row[I915_MAX_SLICES][I915_MAX_SUBSLICES];
  94. };
  95. struct intel_engine_hangcheck {
  96. u64 acthd;
  97. u32 seqno;
  98. enum intel_engine_hangcheck_action action;
  99. unsigned long action_timestamp;
  100. int deadlock;
  101. struct intel_instdone instdone;
  102. struct i915_request *active_request;
  103. bool stalled:1;
  104. bool wedged:1;
  105. };
  106. struct intel_ring {
  107. struct i915_vma *vma;
  108. void *vaddr;
  109. struct i915_timeline *timeline;
  110. struct list_head request_list;
  111. struct list_head active_link;
  112. u32 head;
  113. u32 tail;
  114. u32 emit;
  115. u32 space;
  116. u32 size;
  117. u32 effective_size;
  118. };
  119. struct i915_gem_context;
  120. struct drm_i915_reg_table;
  121. /*
  122. * we use a single page to load ctx workarounds so all of these
  123. * values are referred in terms of dwords
  124. *
  125. * struct i915_wa_ctx_bb:
  126. * offset: specifies batch starting position, also helpful in case
  127. * if we want to have multiple batches at different offsets based on
  128. * some criteria. It is not a requirement at the moment but provides
  129. * an option for future use.
  130. * size: size of the batch in DWORDS
  131. */
  132. struct i915_ctx_workarounds {
  133. struct i915_wa_ctx_bb {
  134. u32 offset;
  135. u32 size;
  136. } indirect_ctx, per_ctx;
  137. struct i915_vma *vma;
  138. };
  139. struct i915_request;
  140. #define I915_MAX_VCS 4
  141. #define I915_MAX_VECS 2
  142. /*
  143. * Engine IDs definitions.
  144. * Keep instances of the same type engine together.
  145. */
  146. enum intel_engine_id {
  147. RCS = 0,
  148. BCS,
  149. VCS,
  150. VCS2,
  151. VCS3,
  152. VCS4,
  153. #define _VCS(n) (VCS + (n))
  154. VECS,
  155. VECS2
  156. #define _VECS(n) (VECS + (n))
  157. };
  158. struct i915_priolist {
  159. struct rb_node node;
  160. struct list_head requests;
  161. int priority;
  162. };
  163. struct st_preempt_hang {
  164. struct completion completion;
  165. bool inject_hang;
  166. };
  167. /**
  168. * struct intel_engine_execlists - execlist submission queue and port state
  169. *
  170. * The struct intel_engine_execlists represents the combined logical state of
  171. * driver and the hardware state for execlist mode of submission.
  172. */
  173. struct intel_engine_execlists {
  174. /**
  175. * @tasklet: softirq tasklet for bottom handler
  176. */
  177. struct tasklet_struct tasklet;
  178. /**
  179. * @default_priolist: priority list for I915_PRIORITY_NORMAL
  180. */
  181. struct i915_priolist default_priolist;
  182. /**
  183. * @no_priolist: priority lists disabled
  184. */
  185. bool no_priolist;
  186. /**
  187. * @submit_reg: gen-specific execlist submission register
  188. * set to the ExecList Submission Port (elsp) register pre-Gen11 and to
  189. * the ExecList Submission Queue Contents register array for Gen11+
  190. */
  191. u32 __iomem *submit_reg;
  192. /**
  193. * @ctrl_reg: the enhanced execlists control register, used to load the
  194. * submit queue on the HW and to request preemptions to idle
  195. */
  196. u32 __iomem *ctrl_reg;
  197. /**
  198. * @port: execlist port states
  199. *
  200. * For each hardware ELSP (ExecList Submission Port) we keep
  201. * track of the last request and the number of times we submitted
  202. * that port to hw. We then count the number of times the hw reports
  203. * a context completion or preemption. As only one context can
  204. * be active on hw, we limit resubmission of context to port[0]. This
  205. * is called Lite Restore, of the context.
  206. */
  207. struct execlist_port {
  208. /**
  209. * @request_count: combined request and submission count
  210. */
  211. struct i915_request *request_count;
  212. #define EXECLIST_COUNT_BITS 2
  213. #define port_request(p) ptr_mask_bits((p)->request_count, EXECLIST_COUNT_BITS)
  214. #define port_count(p) ptr_unmask_bits((p)->request_count, EXECLIST_COUNT_BITS)
  215. #define port_pack(rq, count) ptr_pack_bits(rq, count, EXECLIST_COUNT_BITS)
  216. #define port_unpack(p, count) ptr_unpack_bits((p)->request_count, count, EXECLIST_COUNT_BITS)
  217. #define port_set(p, packed) ((p)->request_count = (packed))
  218. #define port_isset(p) ((p)->request_count)
  219. #define port_index(p, execlists) ((p) - (execlists)->port)
  220. /**
  221. * @context_id: context ID for port
  222. */
  223. GEM_DEBUG_DECL(u32 context_id);
  224. #define EXECLIST_MAX_PORTS 2
  225. } port[EXECLIST_MAX_PORTS];
  226. /**
  227. * @active: is the HW active? We consider the HW as active after
  228. * submitting any context for execution and until we have seen the
  229. * last context completion event. After that, we do not expect any
  230. * more events until we submit, and so can park the HW.
  231. *
  232. * As we have a small number of different sources from which we feed
  233. * the HW, we track the state of each inside a single bitfield.
  234. */
  235. unsigned int active;
  236. #define EXECLISTS_ACTIVE_USER 0
  237. #define EXECLISTS_ACTIVE_PREEMPT 1
  238. #define EXECLISTS_ACTIVE_HWACK 2
  239. /**
  240. * @port_mask: number of execlist ports - 1
  241. */
  242. unsigned int port_mask;
  243. /**
  244. * @queue_priority: Highest pending priority.
  245. *
  246. * When we add requests into the queue, or adjust the priority of
  247. * executing requests, we compute the maximum priority of those
  248. * pending requests. We can then use this value to determine if
  249. * we need to preempt the executing requests to service the queue.
  250. */
  251. int queue_priority;
  252. /**
  253. * @queue: queue of requests, in priority lists
  254. */
  255. struct rb_root_cached queue;
  256. /**
  257. * @csb_read: control register for Context Switch buffer
  258. *
  259. * Note this register is always in mmio.
  260. */
  261. u32 __iomem *csb_read;
  262. /**
  263. * @csb_write: control register for Context Switch buffer
  264. *
  265. * Note this register may be either mmio or HWSP shadow.
  266. */
  267. u32 *csb_write;
  268. /**
  269. * @csb_status: status array for Context Switch buffer
  270. *
  271. * Note these register may be either mmio or HWSP shadow.
  272. */
  273. u32 *csb_status;
  274. /**
  275. * @preempt_complete_status: expected CSB upon completing preemption
  276. */
  277. u32 preempt_complete_status;
  278. /**
  279. * @csb_write_reset: reset value for CSB write pointer
  280. *
  281. * As the CSB write pointer maybe either in HWSP or as a field
  282. * inside an mmio register, we want to reprogram it slightly
  283. * differently to avoid later confusion.
  284. */
  285. u32 csb_write_reset;
  286. /**
  287. * @csb_head: context status buffer head
  288. */
  289. u8 csb_head;
  290. I915_SELFTEST_DECLARE(struct st_preempt_hang preempt_hang;)
  291. };
  292. #define INTEL_ENGINE_CS_MAX_NAME 8
  293. struct intel_engine_cs {
  294. struct drm_i915_private *i915;
  295. char name[INTEL_ENGINE_CS_MAX_NAME];
  296. enum intel_engine_id id;
  297. unsigned int hw_id;
  298. unsigned int guc_id;
  299. u8 uabi_id;
  300. u8 uabi_class;
  301. u8 class;
  302. u8 instance;
  303. u32 context_size;
  304. u32 mmio_base;
  305. struct intel_ring *buffer;
  306. struct i915_timeline timeline;
  307. struct drm_i915_gem_object *default_state;
  308. void *pinned_default_state;
  309. unsigned long irq_posted;
  310. #define ENGINE_IRQ_BREADCRUMB 0
  311. /* Rather than have every client wait upon all user interrupts,
  312. * with the herd waking after every interrupt and each doing the
  313. * heavyweight seqno dance, we delegate the task (of being the
  314. * bottom-half of the user interrupt) to the first client. After
  315. * every interrupt, we wake up one client, who does the heavyweight
  316. * coherent seqno read and either goes back to sleep (if incomplete),
  317. * or wakes up all the completed clients in parallel, before then
  318. * transferring the bottom-half status to the next client in the queue.
  319. *
  320. * Compared to walking the entire list of waiters in a single dedicated
  321. * bottom-half, we reduce the latency of the first waiter by avoiding
  322. * a context switch, but incur additional coherent seqno reads when
  323. * following the chain of request breadcrumbs. Since it is most likely
  324. * that we have a single client waiting on each seqno, then reducing
  325. * the overhead of waking that client is much preferred.
  326. */
  327. struct intel_breadcrumbs {
  328. spinlock_t irq_lock; /* protects irq_*; irqsafe */
  329. struct intel_wait *irq_wait; /* oldest waiter by retirement */
  330. spinlock_t rb_lock; /* protects the rb and wraps irq_lock */
  331. struct rb_root waiters; /* sorted by retirement, priority */
  332. struct list_head signals; /* sorted by retirement */
  333. struct task_struct *signaler; /* used for fence signalling */
  334. struct timer_list fake_irq; /* used after a missed interrupt */
  335. struct timer_list hangcheck; /* detect missed interrupts */
  336. unsigned int hangcheck_interrupts;
  337. unsigned int irq_enabled;
  338. unsigned int irq_count;
  339. bool irq_armed : 1;
  340. I915_SELFTEST_DECLARE(bool mock : 1);
  341. } breadcrumbs;
  342. struct {
  343. /**
  344. * @enable: Bitmask of enable sample events on this engine.
  345. *
  346. * Bits correspond to sample event types, for instance
  347. * I915_SAMPLE_QUEUED is bit 0 etc.
  348. */
  349. u32 enable;
  350. /**
  351. * @enable_count: Reference count for the enabled samplers.
  352. *
  353. * Index number corresponds to the bit number from @enable.
  354. */
  355. unsigned int enable_count[I915_PMU_SAMPLE_BITS];
  356. /**
  357. * @sample: Counter values for sampling events.
  358. *
  359. * Our internal timer stores the current counters in this field.
  360. */
  361. #define I915_ENGINE_SAMPLE_MAX (I915_SAMPLE_SEMA + 1)
  362. struct i915_pmu_sample sample[I915_ENGINE_SAMPLE_MAX];
  363. } pmu;
  364. /*
  365. * A pool of objects to use as shadow copies of client batch buffers
  366. * when the command parser is enabled. Prevents the client from
  367. * modifying the batch contents after software parsing.
  368. */
  369. struct i915_gem_batch_pool batch_pool;
  370. struct intel_hw_status_page status_page;
  371. struct i915_ctx_workarounds wa_ctx;
  372. struct i915_vma *scratch;
  373. u32 irq_keep_mask; /* always keep these interrupts */
  374. u32 irq_enable_mask; /* bitmask to enable ring interrupt */
  375. void (*irq_enable)(struct intel_engine_cs *engine);
  376. void (*irq_disable)(struct intel_engine_cs *engine);
  377. int (*init_hw)(struct intel_engine_cs *engine);
  378. struct {
  379. struct i915_request *(*prepare)(struct intel_engine_cs *engine);
  380. void (*reset)(struct intel_engine_cs *engine,
  381. struct i915_request *rq);
  382. void (*finish)(struct intel_engine_cs *engine);
  383. } reset;
  384. void (*park)(struct intel_engine_cs *engine);
  385. void (*unpark)(struct intel_engine_cs *engine);
  386. void (*set_default_submission)(struct intel_engine_cs *engine);
  387. struct intel_context *(*context_pin)(struct intel_engine_cs *engine,
  388. struct i915_gem_context *ctx);
  389. int (*request_alloc)(struct i915_request *rq);
  390. int (*init_context)(struct i915_request *rq);
  391. int (*emit_flush)(struct i915_request *request, u32 mode);
  392. #define EMIT_INVALIDATE BIT(0)
  393. #define EMIT_FLUSH BIT(1)
  394. #define EMIT_BARRIER (EMIT_INVALIDATE | EMIT_FLUSH)
  395. int (*emit_bb_start)(struct i915_request *rq,
  396. u64 offset, u32 length,
  397. unsigned int dispatch_flags);
  398. #define I915_DISPATCH_SECURE BIT(0)
  399. #define I915_DISPATCH_PINNED BIT(1)
  400. #define I915_DISPATCH_RS BIT(2)
  401. void (*emit_breadcrumb)(struct i915_request *rq, u32 *cs);
  402. int emit_breadcrumb_sz;
  403. /* Pass the request to the hardware queue (e.g. directly into
  404. * the legacy ringbuffer or to the end of an execlist).
  405. *
  406. * This is called from an atomic context with irqs disabled; must
  407. * be irq safe.
  408. */
  409. void (*submit_request)(struct i915_request *rq);
  410. /* Call when the priority on a request has changed and it and its
  411. * dependencies may need rescheduling. Note the request itself may
  412. * not be ready to run!
  413. *
  414. * Called under the struct_mutex.
  415. */
  416. void (*schedule)(struct i915_request *request,
  417. const struct i915_sched_attr *attr);
  418. /*
  419. * Cancel all requests on the hardware, or queued for execution.
  420. * This should only cancel the ready requests that have been
  421. * submitted to the engine (via the engine->submit_request callback).
  422. * This is called when marking the device as wedged.
  423. */
  424. void (*cancel_requests)(struct intel_engine_cs *engine);
  425. /* Some chipsets are not quite as coherent as advertised and need
  426. * an expensive kick to force a true read of the up-to-date seqno.
  427. * However, the up-to-date seqno is not always required and the last
  428. * seen value is good enough. Note that the seqno will always be
  429. * monotonic, even if not coherent.
  430. */
  431. void (*irq_seqno_barrier)(struct intel_engine_cs *engine);
  432. void (*cleanup)(struct intel_engine_cs *engine);
  433. /* GEN8 signal/wait table - never trust comments!
  434. * signal to signal to signal to signal to signal to
  435. * RCS VCS BCS VECS VCS2
  436. * --------------------------------------------------------------------
  437. * RCS | NOP (0x00) | VCS (0x08) | BCS (0x10) | VECS (0x18) | VCS2 (0x20) |
  438. * |-------------------------------------------------------------------
  439. * VCS | RCS (0x28) | NOP (0x30) | BCS (0x38) | VECS (0x40) | VCS2 (0x48) |
  440. * |-------------------------------------------------------------------
  441. * BCS | RCS (0x50) | VCS (0x58) | NOP (0x60) | VECS (0x68) | VCS2 (0x70) |
  442. * |-------------------------------------------------------------------
  443. * VECS | RCS (0x78) | VCS (0x80) | BCS (0x88) | NOP (0x90) | VCS2 (0x98) |
  444. * |-------------------------------------------------------------------
  445. * VCS2 | RCS (0xa0) | VCS (0xa8) | BCS (0xb0) | VECS (0xb8) | NOP (0xc0) |
  446. * |-------------------------------------------------------------------
  447. *
  448. * Generalization:
  449. * f(x, y) := (x->id * NUM_RINGS * seqno_size) + (seqno_size * y->id)
  450. * ie. transpose of g(x, y)
  451. *
  452. * sync from sync from sync from sync from sync from
  453. * RCS VCS BCS VECS VCS2
  454. * --------------------------------------------------------------------
  455. * RCS | NOP (0x00) | VCS (0x28) | BCS (0x50) | VECS (0x78) | VCS2 (0xa0) |
  456. * |-------------------------------------------------------------------
  457. * VCS | RCS (0x08) | NOP (0x30) | BCS (0x58) | VECS (0x80) | VCS2 (0xa8) |
  458. * |-------------------------------------------------------------------
  459. * BCS | RCS (0x10) | VCS (0x38) | NOP (0x60) | VECS (0x88) | VCS2 (0xb0) |
  460. * |-------------------------------------------------------------------
  461. * VECS | RCS (0x18) | VCS (0x40) | BCS (0x68) | NOP (0x90) | VCS2 (0xb8) |
  462. * |-------------------------------------------------------------------
  463. * VCS2 | RCS (0x20) | VCS (0x48) | BCS (0x70) | VECS (0x98) | NOP (0xc0) |
  464. * |-------------------------------------------------------------------
  465. *
  466. * Generalization:
  467. * g(x, y) := (y->id * NUM_RINGS * seqno_size) + (seqno_size * x->id)
  468. * ie. transpose of f(x, y)
  469. */
  470. struct {
  471. #define GEN6_SEMAPHORE_LAST VECS_HW
  472. #define GEN6_NUM_SEMAPHORES (GEN6_SEMAPHORE_LAST + 1)
  473. #define GEN6_SEMAPHORES_MASK GENMASK(GEN6_SEMAPHORE_LAST, 0)
  474. struct {
  475. /* our mbox written by others */
  476. u32 wait[GEN6_NUM_SEMAPHORES];
  477. /* mboxes this ring signals to */
  478. i915_reg_t signal[GEN6_NUM_SEMAPHORES];
  479. } mbox;
  480. /* AKA wait() */
  481. int (*sync_to)(struct i915_request *rq,
  482. struct i915_request *signal);
  483. u32 *(*signal)(struct i915_request *rq, u32 *cs);
  484. } semaphore;
  485. struct intel_engine_execlists execlists;
  486. /* Contexts are pinned whilst they are active on the GPU. The last
  487. * context executed remains active whilst the GPU is idle - the
  488. * switch away and write to the context object only occurs on the
  489. * next execution. Contexts are only unpinned on retirement of the
  490. * following request ensuring that we can always write to the object
  491. * on the context switch even after idling. Across suspend, we switch
  492. * to the kernel context and trash it as the save may not happen
  493. * before the hardware is powered down.
  494. */
  495. struct intel_context *last_retired_context;
  496. /* status_notifier: list of callbacks for context-switch changes */
  497. struct atomic_notifier_head context_status_notifier;
  498. struct intel_engine_hangcheck hangcheck;
  499. #define I915_ENGINE_USING_CMD_PARSER BIT(0)
  500. #define I915_ENGINE_SUPPORTS_STATS BIT(1)
  501. #define I915_ENGINE_HAS_PREEMPTION BIT(2)
  502. #define I915_ENGINE_REQUIRES_CMD_PARSER BIT(3)
  503. unsigned int flags;
  504. /*
  505. * Table of commands the command parser needs to know about
  506. * for this engine.
  507. */
  508. DECLARE_HASHTABLE(cmd_hash, I915_CMD_HASH_ORDER);
  509. /*
  510. * Table of registers allowed in commands that read/write registers.
  511. */
  512. const struct drm_i915_reg_table *reg_tables;
  513. int reg_table_count;
  514. /*
  515. * Returns the bitmask for the length field of the specified command.
  516. * Return 0 for an unrecognized/invalid command.
  517. *
  518. * If the command parser finds an entry for a command in the engine's
  519. * cmd_tables, it gets the command's length based on the table entry.
  520. * If not, it calls this function to determine the per-engine length
  521. * field encoding for the command (i.e. different opcode ranges use
  522. * certain bits to encode the command length in the header).
  523. */
  524. u32 (*get_cmd_length_mask)(u32 cmd_header);
  525. struct {
  526. /**
  527. * @lock: Lock protecting the below fields.
  528. */
  529. seqlock_t lock;
  530. /**
  531. * @enabled: Reference count indicating number of listeners.
  532. */
  533. unsigned int enabled;
  534. /**
  535. * @active: Number of contexts currently scheduled in.
  536. */
  537. unsigned int active;
  538. /**
  539. * @enabled_at: Timestamp when busy stats were enabled.
  540. */
  541. ktime_t enabled_at;
  542. /**
  543. * @start: Timestamp of the last idle to active transition.
  544. *
  545. * Idle is defined as active == 0, active is active > 0.
  546. */
  547. ktime_t start;
  548. /**
  549. * @total: Total time this engine was busy.
  550. *
  551. * Accumulated time not counting the most recent block in cases
  552. * where engine is currently busy (active > 0).
  553. */
  554. ktime_t total;
  555. } stats;
  556. };
  557. static inline bool
  558. intel_engine_using_cmd_parser(const struct intel_engine_cs *engine)
  559. {
  560. return engine->flags & I915_ENGINE_USING_CMD_PARSER;
  561. }
  562. static inline bool
  563. intel_engine_requires_cmd_parser(const struct intel_engine_cs *engine)
  564. {
  565. return engine->flags & I915_ENGINE_REQUIRES_CMD_PARSER;
  566. }
  567. static inline bool
  568. intel_engine_supports_stats(const struct intel_engine_cs *engine)
  569. {
  570. return engine->flags & I915_ENGINE_SUPPORTS_STATS;
  571. }
  572. static inline bool
  573. intel_engine_has_preemption(const struct intel_engine_cs *engine)
  574. {
  575. return engine->flags & I915_ENGINE_HAS_PREEMPTION;
  576. }
  577. static inline bool __execlists_need_preempt(int prio, int last)
  578. {
  579. return prio > max(0, last);
  580. }
  581. static inline void
  582. execlists_set_active(struct intel_engine_execlists *execlists,
  583. unsigned int bit)
  584. {
  585. __set_bit(bit, (unsigned long *)&execlists->active);
  586. }
  587. static inline bool
  588. execlists_set_active_once(struct intel_engine_execlists *execlists,
  589. unsigned int bit)
  590. {
  591. return !__test_and_set_bit(bit, (unsigned long *)&execlists->active);
  592. }
  593. static inline void
  594. execlists_clear_active(struct intel_engine_execlists *execlists,
  595. unsigned int bit)
  596. {
  597. __clear_bit(bit, (unsigned long *)&execlists->active);
  598. }
  599. static inline void
  600. execlists_clear_all_active(struct intel_engine_execlists *execlists)
  601. {
  602. execlists->active = 0;
  603. }
  604. static inline bool
  605. execlists_is_active(const struct intel_engine_execlists *execlists,
  606. unsigned int bit)
  607. {
  608. return test_bit(bit, (unsigned long *)&execlists->active);
  609. }
  610. void execlists_user_begin(struct intel_engine_execlists *execlists,
  611. const struct execlist_port *port);
  612. void execlists_user_end(struct intel_engine_execlists *execlists);
  613. void
  614. execlists_cancel_port_requests(struct intel_engine_execlists * const execlists);
  615. void
  616. execlists_unwind_incomplete_requests(struct intel_engine_execlists *execlists);
  617. static inline unsigned int
  618. execlists_num_ports(const struct intel_engine_execlists * const execlists)
  619. {
  620. return execlists->port_mask + 1;
  621. }
  622. static inline struct execlist_port *
  623. execlists_port_complete(struct intel_engine_execlists * const execlists,
  624. struct execlist_port * const port)
  625. {
  626. const unsigned int m = execlists->port_mask;
  627. GEM_BUG_ON(port_index(port, execlists) != 0);
  628. GEM_BUG_ON(!execlists_is_active(execlists, EXECLISTS_ACTIVE_USER));
  629. memmove(port, port + 1, m * sizeof(struct execlist_port));
  630. memset(port + m, 0, sizeof(struct execlist_port));
  631. return port;
  632. }
  633. static inline unsigned int
  634. intel_engine_flag(const struct intel_engine_cs *engine)
  635. {
  636. return BIT(engine->id);
  637. }
  638. static inline u32
  639. intel_read_status_page(const struct intel_engine_cs *engine, int reg)
  640. {
  641. /* Ensure that the compiler doesn't optimize away the load. */
  642. return READ_ONCE(engine->status_page.page_addr[reg]);
  643. }
  644. static inline void
  645. intel_write_status_page(struct intel_engine_cs *engine, int reg, u32 value)
  646. {
  647. /* Writing into the status page should be done sparingly. Since
  648. * we do when we are uncertain of the device state, we take a bit
  649. * of extra paranoia to try and ensure that the HWS takes the value
  650. * we give and that it doesn't end up trapped inside the CPU!
  651. */
  652. if (static_cpu_has(X86_FEATURE_CLFLUSH)) {
  653. mb();
  654. clflush(&engine->status_page.page_addr[reg]);
  655. engine->status_page.page_addr[reg] = value;
  656. clflush(&engine->status_page.page_addr[reg]);
  657. mb();
  658. } else {
  659. WRITE_ONCE(engine->status_page.page_addr[reg], value);
  660. }
  661. }
  662. /*
  663. * Reads a dword out of the status page, which is written to from the command
  664. * queue by automatic updates, MI_REPORT_HEAD, MI_STORE_DATA_INDEX, or
  665. * MI_STORE_DATA_IMM.
  666. *
  667. * The following dwords have a reserved meaning:
  668. * 0x00: ISR copy, updated when an ISR bit not set in the HWSTAM changes.
  669. * 0x04: ring 0 head pointer
  670. * 0x05: ring 1 head pointer (915-class)
  671. * 0x06: ring 2 head pointer (915-class)
  672. * 0x10-0x1b: Context status DWords (GM45)
  673. * 0x1f: Last written status offset. (GM45)
  674. * 0x20-0x2f: Reserved (Gen6+)
  675. *
  676. * The area from dword 0x30 to 0x3ff is available for driver usage.
  677. */
  678. #define I915_GEM_HWS_INDEX 0x30
  679. #define I915_GEM_HWS_INDEX_ADDR (I915_GEM_HWS_INDEX << MI_STORE_DWORD_INDEX_SHIFT)
  680. #define I915_GEM_HWS_PREEMPT_INDEX 0x32
  681. #define I915_GEM_HWS_PREEMPT_ADDR (I915_GEM_HWS_PREEMPT_INDEX << MI_STORE_DWORD_INDEX_SHIFT)
  682. #define I915_GEM_HWS_SCRATCH_INDEX 0x40
  683. #define I915_GEM_HWS_SCRATCH_ADDR (I915_GEM_HWS_SCRATCH_INDEX << MI_STORE_DWORD_INDEX_SHIFT)
  684. #define I915_HWS_CSB_BUF0_INDEX 0x10
  685. #define I915_HWS_CSB_WRITE_INDEX 0x1f
  686. #define CNL_HWS_CSB_WRITE_INDEX 0x2f
  687. struct intel_ring *
  688. intel_engine_create_ring(struct intel_engine_cs *engine,
  689. struct i915_timeline *timeline,
  690. int size);
  691. int intel_ring_pin(struct intel_ring *ring,
  692. struct drm_i915_private *i915,
  693. unsigned int offset_bias);
  694. void intel_ring_reset(struct intel_ring *ring, u32 tail);
  695. unsigned int intel_ring_update_space(struct intel_ring *ring);
  696. void intel_ring_unpin(struct intel_ring *ring);
  697. void intel_ring_free(struct intel_ring *ring);
  698. void intel_engine_stop(struct intel_engine_cs *engine);
  699. void intel_engine_cleanup(struct intel_engine_cs *engine);
  700. void intel_legacy_submission_resume(struct drm_i915_private *dev_priv);
  701. int __must_check intel_ring_cacheline_align(struct i915_request *rq);
  702. int intel_ring_wait_for_space(struct intel_ring *ring, unsigned int bytes);
  703. u32 __must_check *intel_ring_begin(struct i915_request *rq, unsigned int n);
  704. static inline void intel_ring_advance(struct i915_request *rq, u32 *cs)
  705. {
  706. /* Dummy function.
  707. *
  708. * This serves as a placeholder in the code so that the reader
  709. * can compare against the preceding intel_ring_begin() and
  710. * check that the number of dwords emitted matches the space
  711. * reserved for the command packet (i.e. the value passed to
  712. * intel_ring_begin()).
  713. */
  714. GEM_BUG_ON((rq->ring->vaddr + rq->ring->emit) != cs);
  715. }
  716. static inline u32 intel_ring_wrap(const struct intel_ring *ring, u32 pos)
  717. {
  718. return pos & (ring->size - 1);
  719. }
  720. static inline bool
  721. intel_ring_offset_valid(const struct intel_ring *ring,
  722. unsigned int pos)
  723. {
  724. if (pos & -ring->size) /* must be strictly within the ring */
  725. return false;
  726. if (!IS_ALIGNED(pos, 8)) /* must be qword aligned */
  727. return false;
  728. return true;
  729. }
  730. static inline u32 intel_ring_offset(const struct i915_request *rq, void *addr)
  731. {
  732. /* Don't write ring->size (equivalent to 0) as that hangs some GPUs. */
  733. u32 offset = addr - rq->ring->vaddr;
  734. GEM_BUG_ON(offset > rq->ring->size);
  735. return intel_ring_wrap(rq->ring, offset);
  736. }
  737. static inline void
  738. assert_ring_tail_valid(const struct intel_ring *ring, unsigned int tail)
  739. {
  740. GEM_BUG_ON(!intel_ring_offset_valid(ring, tail));
  741. /*
  742. * "Ring Buffer Use"
  743. * Gen2 BSpec "1. Programming Environment" / 1.4.4.6
  744. * Gen3 BSpec "1c Memory Interface Functions" / 2.3.4.5
  745. * Gen4+ BSpec "1c Memory Interface and Command Stream" / 5.3.4.5
  746. * "If the Ring Buffer Head Pointer and the Tail Pointer are on the
  747. * same cacheline, the Head Pointer must not be greater than the Tail
  748. * Pointer."
  749. *
  750. * We use ring->head as the last known location of the actual RING_HEAD,
  751. * it may have advanced but in the worst case it is equally the same
  752. * as ring->head and so we should never program RING_TAIL to advance
  753. * into the same cacheline as ring->head.
  754. */
  755. #define cacheline(a) round_down(a, CACHELINE_BYTES)
  756. GEM_BUG_ON(cacheline(tail) == cacheline(ring->head) &&
  757. tail < ring->head);
  758. #undef cacheline
  759. }
  760. static inline unsigned int
  761. intel_ring_set_tail(struct intel_ring *ring, unsigned int tail)
  762. {
  763. /* Whilst writes to the tail are strictly order, there is no
  764. * serialisation between readers and the writers. The tail may be
  765. * read by i915_request_retire() just as it is being updated
  766. * by execlists, as although the breadcrumb is complete, the context
  767. * switch hasn't been seen.
  768. */
  769. assert_ring_tail_valid(ring, tail);
  770. ring->tail = tail;
  771. return tail;
  772. }
  773. void intel_engine_init_global_seqno(struct intel_engine_cs *engine, u32 seqno);
  774. void intel_engine_setup_common(struct intel_engine_cs *engine);
  775. int intel_engine_init_common(struct intel_engine_cs *engine);
  776. void intel_engine_cleanup_common(struct intel_engine_cs *engine);
  777. int intel_engine_create_scratch(struct intel_engine_cs *engine,
  778. unsigned int size);
  779. void intel_engine_cleanup_scratch(struct intel_engine_cs *engine);
  780. int intel_init_render_ring_buffer(struct intel_engine_cs *engine);
  781. int intel_init_bsd_ring_buffer(struct intel_engine_cs *engine);
  782. int intel_init_blt_ring_buffer(struct intel_engine_cs *engine);
  783. int intel_init_vebox_ring_buffer(struct intel_engine_cs *engine);
  784. int intel_engine_stop_cs(struct intel_engine_cs *engine);
  785. u64 intel_engine_get_active_head(const struct intel_engine_cs *engine);
  786. u64 intel_engine_get_last_batch_head(const struct intel_engine_cs *engine);
  787. static inline u32 intel_engine_get_seqno(struct intel_engine_cs *engine)
  788. {
  789. return intel_read_status_page(engine, I915_GEM_HWS_INDEX);
  790. }
  791. static inline u32 intel_engine_last_submit(struct intel_engine_cs *engine)
  792. {
  793. /* We are only peeking at the tail of the submit queue (and not the
  794. * queue itself) in order to gain a hint as to the current active
  795. * state of the engine. Callers are not expected to be taking
  796. * engine->timeline->lock, nor are they expected to be concerned
  797. * wtih serialising this hint with anything, so document it as
  798. * a hint and nothing more.
  799. */
  800. return READ_ONCE(engine->timeline.seqno);
  801. }
  802. void intel_engine_get_instdone(struct intel_engine_cs *engine,
  803. struct intel_instdone *instdone);
  804. /*
  805. * Arbitrary size for largest possible 'add request' sequence. The code paths
  806. * are complex and variable. Empirical measurement shows that the worst case
  807. * is BDW at 192 bytes (6 + 6 + 36 dwords), then ILK at 136 bytes. However,
  808. * we need to allocate double the largest single packet within that emission
  809. * to account for tail wraparound (so 6 + 6 + 72 dwords for BDW).
  810. */
  811. #define MIN_SPACE_FOR_ADD_REQUEST 336
  812. static inline u32 intel_hws_seqno_address(struct intel_engine_cs *engine)
  813. {
  814. return engine->status_page.ggtt_offset + I915_GEM_HWS_INDEX_ADDR;
  815. }
  816. static inline u32 intel_hws_preempt_done_address(struct intel_engine_cs *engine)
  817. {
  818. return engine->status_page.ggtt_offset + I915_GEM_HWS_PREEMPT_ADDR;
  819. }
  820. /* intel_breadcrumbs.c -- user interrupt bottom-half for waiters */
  821. int intel_engine_init_breadcrumbs(struct intel_engine_cs *engine);
  822. static inline void intel_wait_init(struct intel_wait *wait)
  823. {
  824. wait->tsk = current;
  825. wait->request = NULL;
  826. }
  827. static inline void intel_wait_init_for_seqno(struct intel_wait *wait, u32 seqno)
  828. {
  829. wait->tsk = current;
  830. wait->seqno = seqno;
  831. }
  832. static inline bool intel_wait_has_seqno(const struct intel_wait *wait)
  833. {
  834. return wait->seqno;
  835. }
  836. static inline bool
  837. intel_wait_update_seqno(struct intel_wait *wait, u32 seqno)
  838. {
  839. wait->seqno = seqno;
  840. return intel_wait_has_seqno(wait);
  841. }
  842. static inline bool
  843. intel_wait_update_request(struct intel_wait *wait,
  844. const struct i915_request *rq)
  845. {
  846. return intel_wait_update_seqno(wait, i915_request_global_seqno(rq));
  847. }
  848. static inline bool
  849. intel_wait_check_seqno(const struct intel_wait *wait, u32 seqno)
  850. {
  851. return wait->seqno == seqno;
  852. }
  853. static inline bool
  854. intel_wait_check_request(const struct intel_wait *wait,
  855. const struct i915_request *rq)
  856. {
  857. return intel_wait_check_seqno(wait, i915_request_global_seqno(rq));
  858. }
  859. static inline bool intel_wait_complete(const struct intel_wait *wait)
  860. {
  861. return RB_EMPTY_NODE(&wait->node);
  862. }
  863. bool intel_engine_add_wait(struct intel_engine_cs *engine,
  864. struct intel_wait *wait);
  865. void intel_engine_remove_wait(struct intel_engine_cs *engine,
  866. struct intel_wait *wait);
  867. bool intel_engine_enable_signaling(struct i915_request *request, bool wakeup);
  868. void intel_engine_cancel_signaling(struct i915_request *request);
  869. static inline bool intel_engine_has_waiter(const struct intel_engine_cs *engine)
  870. {
  871. return READ_ONCE(engine->breadcrumbs.irq_wait);
  872. }
  873. unsigned int intel_engine_wakeup(struct intel_engine_cs *engine);
  874. #define ENGINE_WAKEUP_WAITER BIT(0)
  875. #define ENGINE_WAKEUP_ASLEEP BIT(1)
  876. void intel_engine_pin_breadcrumbs_irq(struct intel_engine_cs *engine);
  877. void intel_engine_unpin_breadcrumbs_irq(struct intel_engine_cs *engine);
  878. void __intel_engine_disarm_breadcrumbs(struct intel_engine_cs *engine);
  879. void intel_engine_disarm_breadcrumbs(struct intel_engine_cs *engine);
  880. void intel_engine_reset_breadcrumbs(struct intel_engine_cs *engine);
  881. void intel_engine_fini_breadcrumbs(struct intel_engine_cs *engine);
  882. static inline u32 *gen8_emit_pipe_control(u32 *batch, u32 flags, u32 offset)
  883. {
  884. memset(batch, 0, 6 * sizeof(u32));
  885. batch[0] = GFX_OP_PIPE_CONTROL(6);
  886. batch[1] = flags;
  887. batch[2] = offset;
  888. return batch + 6;
  889. }
  890. static inline u32 *
  891. gen8_emit_ggtt_write_rcs(u32 *cs, u32 value, u32 gtt_offset)
  892. {
  893. /* We're using qword write, offset should be aligned to 8 bytes. */
  894. GEM_BUG_ON(!IS_ALIGNED(gtt_offset, 8));
  895. /* w/a for post sync ops following a GPGPU operation we
  896. * need a prior CS_STALL, which is emitted by the flush
  897. * following the batch.
  898. */
  899. *cs++ = GFX_OP_PIPE_CONTROL(6);
  900. *cs++ = PIPE_CONTROL_GLOBAL_GTT_IVB | PIPE_CONTROL_CS_STALL |
  901. PIPE_CONTROL_QW_WRITE;
  902. *cs++ = gtt_offset;
  903. *cs++ = 0;
  904. *cs++ = value;
  905. /* We're thrashing one dword of HWS. */
  906. *cs++ = 0;
  907. return cs;
  908. }
  909. static inline u32 *
  910. gen8_emit_ggtt_write(u32 *cs, u32 value, u32 gtt_offset)
  911. {
  912. /* w/a: bit 5 needs to be zero for MI_FLUSH_DW address. */
  913. GEM_BUG_ON(gtt_offset & (1 << 5));
  914. /* Offset should be aligned to 8 bytes for both (QW/DW) write types */
  915. GEM_BUG_ON(!IS_ALIGNED(gtt_offset, 8));
  916. *cs++ = (MI_FLUSH_DW + 1) | MI_FLUSH_DW_OP_STOREDW;
  917. *cs++ = gtt_offset | MI_FLUSH_DW_USE_GTT;
  918. *cs++ = 0;
  919. *cs++ = value;
  920. return cs;
  921. }
  922. void intel_engines_sanitize(struct drm_i915_private *i915);
  923. bool intel_engine_is_idle(struct intel_engine_cs *engine);
  924. bool intel_engines_are_idle(struct drm_i915_private *dev_priv);
  925. bool intel_engine_has_kernel_context(const struct intel_engine_cs *engine);
  926. void intel_engine_lost_context(struct intel_engine_cs *engine);
  927. void intel_engines_park(struct drm_i915_private *i915);
  928. void intel_engines_unpark(struct drm_i915_private *i915);
  929. void intel_engines_reset_default_submission(struct drm_i915_private *i915);
  930. unsigned int intel_engines_has_context_isolation(struct drm_i915_private *i915);
  931. bool intel_engine_can_store_dword(struct intel_engine_cs *engine);
  932. __printf(3, 4)
  933. void intel_engine_dump(struct intel_engine_cs *engine,
  934. struct drm_printer *m,
  935. const char *header, ...);
  936. struct intel_engine_cs *
  937. intel_engine_lookup_user(struct drm_i915_private *i915, u8 class, u8 instance);
  938. static inline void intel_engine_context_in(struct intel_engine_cs *engine)
  939. {
  940. unsigned long flags;
  941. if (READ_ONCE(engine->stats.enabled) == 0)
  942. return;
  943. write_seqlock_irqsave(&engine->stats.lock, flags);
  944. if (engine->stats.enabled > 0) {
  945. if (engine->stats.active++ == 0)
  946. engine->stats.start = ktime_get();
  947. GEM_BUG_ON(engine->stats.active == 0);
  948. }
  949. write_sequnlock_irqrestore(&engine->stats.lock, flags);
  950. }
  951. static inline void intel_engine_context_out(struct intel_engine_cs *engine)
  952. {
  953. unsigned long flags;
  954. if (READ_ONCE(engine->stats.enabled) == 0)
  955. return;
  956. write_seqlock_irqsave(&engine->stats.lock, flags);
  957. if (engine->stats.enabled > 0) {
  958. ktime_t last;
  959. if (engine->stats.active && --engine->stats.active == 0) {
  960. /*
  961. * Decrement the active context count and in case GPU
  962. * is now idle add up to the running total.
  963. */
  964. last = ktime_sub(ktime_get(), engine->stats.start);
  965. engine->stats.total = ktime_add(engine->stats.total,
  966. last);
  967. } else if (engine->stats.active == 0) {
  968. /*
  969. * After turning on engine stats, context out might be
  970. * the first event in which case we account from the
  971. * time stats gathering was turned on.
  972. */
  973. last = ktime_sub(ktime_get(), engine->stats.enabled_at);
  974. engine->stats.total = ktime_add(engine->stats.total,
  975. last);
  976. }
  977. }
  978. write_sequnlock_irqrestore(&engine->stats.lock, flags);
  979. }
  980. int intel_enable_engine_stats(struct intel_engine_cs *engine);
  981. void intel_disable_engine_stats(struct intel_engine_cs *engine);
  982. ktime_t intel_engine_get_busy_time(struct intel_engine_cs *engine);
  983. #if IS_ENABLED(CONFIG_DRM_I915_SELFTEST)
  984. static inline bool inject_preempt_hang(struct intel_engine_execlists *execlists)
  985. {
  986. if (!execlists->preempt_hang.inject_hang)
  987. return false;
  988. complete(&execlists->preempt_hang.completion);
  989. return true;
  990. }
  991. #else
  992. static inline bool inject_preempt_hang(struct intel_engine_execlists *execlists)
  993. {
  994. return false;
  995. }
  996. #endif
  997. #endif /* _INTEL_RINGBUFFER_H_ */