xref: /linux/drivers/gpu/drm/xe/xe_rtp.h (revision 570f7e331f5febb30f1384817463c7e42b65ca7d)
1 /* SPDX-License-Identifier: MIT */
2 /*
3  * Copyright © 2022 Intel Corporation
4  */
5 
6 #ifndef _XE_RTP_H_
7 #define _XE_RTP_H_
8 
9 #include <linux/types.h>
10 #include <linux/xarray.h>
11 
12 #define _XE_RTP_INCLUDE_PRIVATE_HELPERS
13 
14 #include "xe_rtp_helpers.h"
15 #include "xe_rtp_types.h"
16 
17 #undef _XE_RTP_INCLUDE_PRIVATE_HELPERS
18 
19 /*
20  * Register table poke infrastructure
21  */
22 
23 struct xe_hw_engine;
24 struct xe_gt;
25 struct xe_reg_sr;
26 
27 /*
28  * Macros to encode rules to match against platform, IP version, stepping, etc.
29  * Shouldn't be used directly - see XE_RTP_RULES()
30  */
31 #define _XE_RTP_RULE_PLATFORM(plat__)						\
32 	{ .match_type = XE_RTP_MATCH_PLATFORM, .platform = plat__ }
33 
34 #define _XE_RTP_RULE_SUBPLATFORM(plat__, sub__)					\
35 	{ .match_type = XE_RTP_MATCH_SUBPLATFORM,				\
36 	  .platform = plat__, .subplatform = sub__ }
37 
38 #define _XE_RTP_RULE_PLATFORM_STEP(start__, end__)				\
39 	{ .match_type = XE_RTP_MATCH_PLATFORM_STEP,				\
40 	  .step_start = start__, .step_end = end__ }
41 
42 #define _XE_RTP_RULE_GRAPHICS_STEP(start__, end__)				\
43 	{ .match_type = XE_RTP_MATCH_GRAPHICS_STEP,				\
44 	  .step_start = start__, .step_end = end__ }
45 
46 #define _XE_RTP_RULE_MEDIA_STEP(start__, end__)					\
47 	{ .match_type = XE_RTP_MATCH_MEDIA_STEP,				\
48 	  .step_start = start__, .step_end = end__ }
49 
50 #define _XE_RTP_RULE_ENGINE_CLASS(cls__)					\
51 	{ .match_type = XE_RTP_MATCH_ENGINE_CLASS,				\
52 	  .engine_class = (cls__) }
53 
54 /**
55  * XE_RTP_RULE_PLATFORM - Create rule matching platform
56  * @plat_: platform to match
57  *
58  * Refer to XE_RTP_RULES() for expected usage.
59  */
60 #define XE_RTP_RULE_PLATFORM(plat_)						\
61 	_XE_RTP_RULE_PLATFORM(XE_##plat_)
62 
63 /**
64  * XE_RTP_RULE_SUBPLATFORM - Create rule matching platform and sub-platform
65  * @plat_: platform to match
66  * @sub_: sub-platform to match
67  *
68  * Refer to XE_RTP_RULES() for expected usage.
69  */
70 #define XE_RTP_RULE_SUBPLATFORM(plat_, sub_)					\
71 	_XE_RTP_RULE_SUBPLATFORM(XE_##plat_, XE_SUBPLATFORM_##plat_##_##sub_)
72 
73 /**
74  * XE_RTP_RULE_PLATFORM_STEP - Create rule matching platform-level stepping
75  * @start_: First stepping matching the rule
76  * @end_: First stepping that does not match the rule
77  *
78  * Note that the range matching this rule is [ @start_, @end_ ), i.e. inclusive
79  * on the left, exclusive on the right.
80  *
81  * You need to make sure that proper support for reading platform-level stepping
82  * information is present for the target platform before using this rule.
83  *
84  * Refer to XE_RTP_RULES() for expected usage.
85  */
86 #define XE_RTP_RULE_PLATFORM_STEP(start_, end_)					\
87 	_XE_RTP_RULE_PLATFORM_STEP(STEP_##start_, STEP_##end_)
88 
89 /**
90  * XE_RTP_RULE_GRAPHICS_STEP - Create rule matching graphics stepping
91  * @start_: First stepping matching the rule
92  * @end_: First stepping that does not match the rule
93  *
94  * Note that the range matching this rule is [ @start_, @end_ ), i.e. inclusive
95  * on the left, exclusive on the right.
96  *
97  * Refer to XE_RTP_RULES() for expected usage.
98  */
99 #define XE_RTP_RULE_GRAPHICS_STEP(start_, end_)					\
100 	_XE_RTP_RULE_GRAPHICS_STEP(STEP_##start_, STEP_##end_)
101 
102 /**
103  * XE_RTP_RULE_MEDIA_STEP - Create rule matching media stepping
104  * @start_: First stepping matching the rule
105  * @end_: First stepping that does not match the rule
106  *
107  * Note that the range matching this rule is [ @start_, @end_ ), i.e. inclusive
108  * on the left, exclusive on the right.
109  *
110  * Refer to XE_RTP_RULES() for expected usage.
111  */
112 #define XE_RTP_RULE_MEDIA_STEP(start_, end_)					\
113 	_XE_RTP_RULE_MEDIA_STEP(STEP_##start_, STEP_##end_)
114 
115 /**
116  * XE_RTP_RULE_ENGINE_CLASS - Create rule matching an engine class
117  * @cls_: Engine class to match
118  *
119  * Refer to XE_RTP_RULES() for expected usage.
120  */
121 #define XE_RTP_RULE_ENGINE_CLASS(cls_)						\
122 	_XE_RTP_RULE_ENGINE_CLASS(XE_ENGINE_CLASS_##cls_)
123 
124 /**
125  * XE_RTP_RULE_FUNC - Create rule using callback function for match
126  * @func__: Function to call to decide if rule matches
127  *
128  * This allows more complex checks to be performed. The ``XE_RTP``
129  * infrastructure will simply call the function @func_ passed to decide if this
130  * rule matches the device.
131  *
132  * Refer to XE_RTP_RULES() for expected usage.
133  */
134 #define XE_RTP_RULE_FUNC(func__)						\
135 	{ .match_type = XE_RTP_MATCH_FUNC,					\
136 	  .match_func = (func__) }
137 
138 /**
139  * XE_RTP_RULE_GRAPHICS_VERSION - Create rule matching graphics version
140  * @ver__: Graphics IP version to match
141  *
142  * Refer to XE_RTP_RULES() for expected usage.
143  */
144 #define XE_RTP_RULE_GRAPHICS_VERSION(ver__)					\
145 	{ .match_type = XE_RTP_MATCH_GRAPHICS_VERSION,				\
146 	  .ver_start = ver__, }
147 
148 /**
149  * XE_RTP_RULE_GRAPHICS_VERSION_RANGE - Create rule matching a range of graphics version
150  * @ver_start__: First graphics IP version to match
151  * @ver_end__: Last graphics IP version to match
152  *
153  * Note that the range matching this rule is [ @ver_start__, @ver_end__ ], i.e.
154  * inclusive on both sides
155  *
156  * Refer to XE_RTP_RULES() for expected usage.
157  */
158 #define XE_RTP_RULE_GRAPHICS_VERSION_RANGE(ver_start__, ver_end__)		\
159 	{ .match_type = XE_RTP_MATCH_GRAPHICS_VERSION_RANGE,			\
160 	  .ver_start = ver_start__, .ver_end = ver_end__, }
161 
162 /**
163  * XE_RTP_RULE_GRAPHICS_VERSION_ANY_GT - Create rule matching graphics version on any GT
164  * @ver__: Graphics IP version to match
165  *
166  * Like XE_RTP_RULE_GRAPHICS_VERSION, but it matches even if the current GT
167  * being checked is not of the graphics type. It allows to add RTP entries to
168  * another GT when the device contains a Graphics IP with that version.
169  *
170  * Refer to XE_RTP_RULES() for expected usage.
171  */
172 #define XE_RTP_RULE_GRAPHICS_VERSION_ANY_GT(ver__)				\
173 	{ .match_type = XE_RTP_MATCH_GRAPHICS_VERSION_ANY_GT,			\
174 	  .ver_start = ver__, }
175 
176 /**
177  * XE_RTP_RULE_MEDIA_VERSION - Create rule matching media version
178  * @ver__: Media IP version to match
179  *
180  * Refer to XE_RTP_RULES() for expected usage.
181  */
182 #define XE_RTP_RULE_MEDIA_VERSION(ver__)					\
183 	{ .match_type = XE_RTP_MATCH_MEDIA_VERSION,				\
184 	  .ver_start = ver__, }
185 
186 /**
187  * XE_RTP_RULE_MEDIA_VERSION_RANGE - Create rule matching a range of media version
188  * @ver_start__: First media IP version to match
189  * @ver_end__: Last media IP version to match
190  *
191  * Note that the range matching this rule is [ @ver_start__, @ver_end__ ], i.e.
192  * inclusive on both sides
193  *
194  * Refer to XE_RTP_RULES() for expected usage.
195  */
196 #define XE_RTP_RULE_MEDIA_VERSION_RANGE(ver_start__, ver_end__)			\
197 	{ .match_type = XE_RTP_MATCH_MEDIA_VERSION_RANGE,			\
198 	  .ver_start = ver_start__, .ver_end = ver_end__, }
199 
200 /**
201  * XE_RTP_RULE_MEDIA_VERSION_ANY_GT - Create rule matching media version on any GT
202  * @ver__: Media IP version to match
203  *
204  * Like XE_RTP_RULE_MEDIA_VERSION, but it matches even if the current GT being
205  * checked is not of the media type. It allows to add RTP entries to another
206  * GT when the device contains a Media IP with that version.
207  *
208  * Refer to XE_RTP_RULES() for expected usage.
209  */
210 #define XE_RTP_RULE_MEDIA_VERSION_ANY_GT(ver__)					\
211 	{ .match_type = XE_RTP_MATCH_MEDIA_VERSION_ANY_GT,			\
212 	  .ver_start = ver__, }
213 
214 /**
215  * XE_RTP_RULE_IS_INTEGRATED - Create a rule matching integrated graphics devices
216  *
217  * Refer to XE_RTP_RULES() for expected usage.
218  */
219 #define XE_RTP_RULE_IS_INTEGRATED						\
220 	{ .match_type = XE_RTP_MATCH_INTEGRATED }
221 
222 /**
223  * XE_RTP_RULE_IS_DISCRETE - Create a rule matching discrete graphics devices
224  *
225  * Refer to XE_RTP_RULES() for expected usage.
226  */
227 #define XE_RTP_RULE_IS_DISCRETE							\
228 	{ .match_type = XE_RTP_MATCH_DISCRETE }
229 
230 /**
231  * XE_RTP_RULE_OR - Create an OR condition for rtp rules
232  *
233  * RTP rules are AND'ed when evaluated and all of them need to match.
234  * XE_RTP_RULE_OR allows to create set of rules where any of them matching is
235  * sufficient for the action to trigger. Example:
236  *
237  * .. code-block:: c
238  *
239  *	const struct xe_rtp_entry_sr entries[] = {
240  *		...
241  *		{ XE_RTP_NAME("test-entry"),
242  *		  XE_RTP_RULES(PLATFORM(DG2), OR, PLATFORM(TIGERLAKE)),
243  *		  ...
244  *		},
245  *		...
246  *	};
247  */
248 #define XE_RTP_RULE_OR								\
249 	{ .match_type = XE_RTP_MATCH_OR }
250 
251 /**
252  * XE_RTP_ACTION_WR - Helper to write a value to the register, overriding all
253  *                    the bits
254  * @reg_: Register
255  * @val_: Value to set
256  * @...: Additional fields to override in the struct xe_rtp_action entry
257  *
258  * The correspondent notation in bspec is:
259  *
260  *	REGNAME = VALUE
261  */
262 #define XE_RTP_ACTION_WR(reg_, val_, ...)					\
263 	{ .reg = XE_RTP_DROP_CAST(reg_),					\
264 	  .clr_bits = ~0u, .set_bits = (val_),					\
265 	  .read_mask = (~0u), ##__VA_ARGS__ }
266 
267 /**
268  * XE_RTP_ACTION_SET - Set bits from @val_ in the register.
269  * @reg_: Register
270  * @val_: Bits to set in the register
271  * @...: Additional fields to override in the struct xe_rtp_action entry
272  *
273  * For masked registers this translates to a single write, while for other
274  * registers it's a RMW. The correspondent bspec notation is (example for bits 2
275  * and 5, but could be any):
276  *
277  *	REGNAME[2] = 1
278  *	REGNAME[5] = 1
279  */
280 #define XE_RTP_ACTION_SET(reg_, val_, ...)					\
281 	{ .reg = XE_RTP_DROP_CAST(reg_),					\
282 	  .clr_bits = val_, .set_bits = val_,					\
283 	  .read_mask = val_, ##__VA_ARGS__ }
284 
285 /**
286  * XE_RTP_ACTION_CLR: Clear bits from @val_ in the register.
287  * @reg_: Register
288  * @val_: Bits to clear in the register
289  * @...: Additional fields to override in the struct xe_rtp_action entry
290  *
291  * For masked registers this translates to a single write, while for other
292  * registers it's a RMW. The correspondent bspec notation is (example for bits 2
293  * and 5, but could be any):
294  *
295  *	REGNAME[2] = 0
296  *	REGNAME[5] = 0
297  */
298 #define XE_RTP_ACTION_CLR(reg_, val_, ...)					\
299 	{ .reg = XE_RTP_DROP_CAST(reg_),					\
300 	  .clr_bits = val_, .set_bits = 0,					\
301 	  .read_mask = val_, ##__VA_ARGS__ }
302 
303 /**
304  * XE_RTP_ACTION_FIELD_SET: Set a bit range
305  * @reg_: Register
306  * @mask_bits_: Mask of bits to be changed in the register, forming a field
307  * @val_: Value to set in the field denoted by @mask_bits_
308  * @...: Additional fields to override in the struct xe_rtp_action entry
309  *
310  * For masked registers this translates to a single write, while for other
311  * registers it's a RMW. The correspondent bspec notation is:
312  *
313  *	REGNAME[<end>:<start>] = VALUE
314  */
315 #define XE_RTP_ACTION_FIELD_SET(reg_, mask_bits_, val_, ...)			\
316 	{ .reg = XE_RTP_DROP_CAST(reg_),					\
317 	  .clr_bits = mask_bits_, .set_bits = val_,				\
318 	  .read_mask = mask_bits_, ##__VA_ARGS__ }
319 
320 #define XE_RTP_ACTION_FIELD_SET_NO_READ_MASK(reg_, mask_bits_, val_, ...)	\
321 	{ .reg = XE_RTP_DROP_CAST(reg_),					\
322 	  .clr_bits = (mask_bits_), .set_bits = (val_),				\
323 	  .read_mask = 0, ##__VA_ARGS__ }
324 
325 /**
326  * XE_RTP_ACTION_FIELD_SET_FUNC: Set a bit range to the value returned by a function
327  * @reg_: Register
328  * @mask_bits_: Mask of bits to be changed in the register, forming a field
329  * @func_: Function that returns value to set in the field denoted by @mask_bits_
330  * @...: Additional fields to override in the struct xe_rtp_action entry
331  *
332  * This macro works like XE_RTP_ACTION_FIELD_SET(), except that the
333  * field value is evaluated at the time the RTP table is processed.
334  *
335  * @func_ will only be called a single time, when the RTP table is being
336  * processed.  After processing, the value in the reg_sr entry is fixed and
337  * will not be re-evaluated.
338  */
339 #define XE_RTP_ACTION_FIELD_SET_FUNC(reg_, mask_bits_, func_, ...)		\
340 	{ .reg = XE_RTP_DROP_CAST(reg_),					\
341 	  .clr_bits = mask_bits_, .set_func = func_, .use_func = 1,		\
342 	  .read_mask = mask_bits_, ##__VA_ARGS__ }
343 
344 /**
345  * XE_RTP_ACTION_WHITELIST - Add register to userspace whitelist
346  * @reg_: Register
347  * @val_: Whitelist-specific flags to set
348  * @...: Additional fields to override in the struct xe_rtp_action entry
349  *
350  * Add a register to the whitelist, allowing userspace to modify the ster with
351  * regular user privileges.
352  */
353 #define XE_RTP_ACTION_WHITELIST(reg_, val_, ...)				\
354 	/* TODO fail build if ((flags) & ~(RING_FORCE_TO_NONPRIV_MASK_VALID)) */\
355 	{ .reg = XE_RTP_DROP_CAST(reg_),					\
356 	  .set_bits = val_,							\
357 	  .clr_bits = RING_FORCE_TO_NONPRIV_MASK_VALID,				\
358 	  ##__VA_ARGS__ }
359 
360 /**
361  * XE_RTP_NAME - Helper to set the name in xe_rtp_entry
362  * @s_: Name describing this rule, often a HW-specific number
363  *
364  * TODO: maybe move this behind a debug config?
365  */
366 #define XE_RTP_NAME(s_)	.name = (s_)
367 
368 /**
369  * XE_RTP_ENTRY_FLAG - Helper to add multiple flags to a struct xe_rtp_entry_sr
370  * @...: Entry flags, without the ``XE_RTP_ENTRY_FLAG_`` prefix
371  *
372  * Helper to automatically add a ``XE_RTP_ENTRY_FLAG_`` prefix to the flags
373  * when defining struct xe_rtp_entry entries. Example:
374  *
375  * .. code-block:: c
376  *
377  *	const struct xe_rtp_entry_sr wa_entries[] = {
378  *		...
379  *		{ XE_RTP_NAME("test-entry"),
380  *		  ...
381  *		  XE_RTP_ENTRY_FLAG(FOREACH_ENGINE),
382  *		  ...
383  *		},
384  *		...
385  *	};
386  */
387 #define XE_RTP_ENTRY_FLAG(...)							\
388 	.flags = (XE_RTP_PASTE_FOREACH(ENTRY_FLAG_, BITWISE_OR, (__VA_ARGS__)))
389 
390 /**
391  * XE_RTP_ACTION_FLAG - Helper to add multiple flags to a struct xe_rtp_action
392  * @...: Action flags, without the ``XE_RTP_ACTION_FLAG_`` prefix
393  *
394  * Helper to automatically add a ``XE_RTP_ACTION_FLAG_`` prefix to the flags
395  * when defining struct xe_rtp_action entries. Example:
396  *
397  * .. code-block:: c
398  *
399  *	const struct xe_rtp_entry_sr wa_entries[] = {
400  *		...
401  *		{ XE_RTP_NAME("test-entry"),
402  *		  ...
403  *		  XE_RTP_ACTION_SET(..., XE_RTP_ACTION_FLAG(FOREACH_ENGINE)),
404  *		  ...
405  *		},
406  *		...
407  *	};
408  */
409 #define XE_RTP_ACTION_FLAG(...)							\
410 	.flags = (XE_RTP_PASTE_FOREACH(ACTION_FLAG_, BITWISE_OR, (__VA_ARGS__)))
411 
412 /**
413  * XE_RTP_RULES - Helper to set multiple rules to a struct xe_rtp_entry_sr entry
414  * @...: Rules
415  *
416  * When an RTP table is being processed, the rules of each entry are evaluated
417  * to check if they match the target entity (platform, gt or hwe, depending on
418  * the specific RTP table).
419  *
420  * The sequence of arguments of this macro must follow the following eBNF
421  * grammar::
422  *
423  *            rules = disjunction;
424  *      disjunction = conjunction, { "OR", conjunction };
425  *      conjunction = single_rule, { single_rule };
426  *				   (* the AND operator is implicit *)
427  *      single_rule = ? GRAPHICS_VERSION(...), MEDIA_VERSION(...),
428  *                      FUNC(...), etc ?
429  *
430  * Examples:
431  *
432  * .. code-block:: c
433  *
434  *	const struct xe_rtp_entry_sr wa_entries[] = {
435  *		...
436  *		{ XE_RTP_NAME("entry-a"),
437  *		  // Match DG2-G10 with graphics steppings A0 up-to B0
438  *		  // (exclusive).
439  *		  XE_RTP_RULES(SUBPLATFORM(DG2, G10), GRAPHICS_STEP(A0, B0)),
440  *		  ...
441  *		},
442  *		{ XE_RTP_NAME("entry-b"),
443  *		  // Match graphics version 20 (all steppings) or graphics
444  *		  // version 30 steppings A0 up-to B0 (exclusive).
445  *		  XE_RTP_RULES(GRAPHICS_VERSION(2000), OR,
446  *			       GRAPHICS_VERSION(3000), GRAPHICS_STEP(A0, B0))
447  *		  ...
448  *		},
449  *		...
450  *	};
451  */
452 #define XE_RTP_RULES(...)							\
453 	.n_rules = COUNT_ARGS(__VA_ARGS__),					\
454 	.rules = (const struct xe_rtp_rule[]) {					\
455 		XE_RTP_PASTE_FOREACH(RULE_, COMMA, (__VA_ARGS__))	\
456 	}
457 
458 /**
459  * XE_RTP_ACTIONS - Helper to set multiple actions to a struct xe_rtp_entry_sr
460  * @...: Actions to be taken
461  *
462  * At least one action is needed and up to 12 are supported. See XE_RTP_ACTION_*
463  * for the possible actions. Example:
464  *
465  * .. code-block:: c
466  *
467  *	const struct xe_rtp_entry_sr wa_entries[] = {
468  *		...
469  *		{ XE_RTP_NAME("test-entry"),
470  *		  XE_RTP_RULES(...),
471  *		  XE_RTP_ACTIONS(SET(..), SET(...), CLR(...)),
472  *		  ...
473  *		},
474  *		...
475  *	};
476  */
477 #define XE_RTP_ACTIONS(...)							\
478 	.n_actions = COUNT_ARGS(__VA_ARGS__),					\
479 	.actions = (const struct xe_rtp_action[]) {				\
480 		XE_RTP_PASTE_FOREACH(ACTION_, COMMA, (__VA_ARGS__))	\
481 	}
482 
483 /*
484  * Note: ARRAY_SIZE() cannot be used here because it expands through
485  * __must_be_array() -> __BUILD_BUG_ON_ZERO_MSG() -> _Static_assert inside
486  * sizeof(struct{}), which clang < 21 rejects when the compound literal
487  * contains non-compile-time-constant initializers.
488  */
489 #define XE_RTP_TABLE_SR(...) { \
490 	.entries = (const struct xe_rtp_entry_sr[]){__VA_ARGS__}, \
491 	.n_entries = sizeof((const struct xe_rtp_entry_sr[]){__VA_ARGS__}) / \
492 		sizeof(struct xe_rtp_entry_sr), \
493 }
494 
495 #define XE_RTP_TABLE(...) { \
496 	.entries = (const struct xe_rtp_entry[]){__VA_ARGS__}, \
497 	.n_entries = sizeof((const struct xe_rtp_entry[]){__VA_ARGS__}) / \
498 		sizeof(struct xe_rtp_entry), \
499 }
500 
501 #define XE_RTP_PROCESS_CTX_INITIALIZER(arg__) _Generic((arg__),							\
502 	struct xe_hw_engine * :	(struct xe_rtp_process_ctx){ { (void *)(arg__) }, XE_RTP_PROCESS_TYPE_ENGINE },	\
503 	struct xe_gt * :	(struct xe_rtp_process_ctx){ { (void *)(arg__) }, XE_RTP_PROCESS_TYPE_GT },	\
504 	struct xe_device * :	(struct xe_rtp_process_ctx){ { (void *)(arg__) }, XE_RTP_PROCESS_TYPE_DEVICE })
505 
506 void xe_rtp_process_ctx_enable_active_tracking(struct xe_rtp_process_ctx *ctx,
507 					       unsigned long *active_entries,
508 					       size_t n_entries);
509 
510 void xe_rtp_process_to_sr(struct xe_rtp_process_ctx *ctx,
511 			  const struct xe_rtp_table_sr *table,
512 			  struct xe_reg_sr *sr,
513 			  bool process_in_vf);
514 
515 void xe_rtp_process(struct xe_rtp_process_ctx *ctx,
516 		    const struct xe_rtp_table *table);
517 
518 /* Match functions to be used with XE_RTP_MATCH_FUNC */
519 
520 /**
521  * xe_rtp_match_always - Match RTP entry unconditionally
522  * @xe: Device structure
523  * @gt: GT structure
524  * @hwe: Engine instance
525  *
526  * Returns: true, regardless of inputs
527  */
528 bool xe_rtp_match_always(const struct xe_device *xe,
529 			 const struct xe_gt *gt,
530 			 const struct xe_hw_engine *hwe);
531 
532 /**
533  * xe_rtp_match_even_instance - Match if engine instance is even
534  * @xe: Device structure
535  * @gt: GT structure
536  * @hwe: Engine instance
537  *
538  * Returns: true if engine instance is even, false otherwise
539  */
540 bool xe_rtp_match_even_instance(const struct xe_device *xe,
541 				const struct xe_gt *gt,
542 				const struct xe_hw_engine *hwe);
543 
544 /*
545  * xe_rtp_match_first_render_or_compute - Match if it's first render or compute
546  * engine in the GT
547  *
548  * @xe: Device structure
549  * @gt: GT structure
550  * @hwe: Engine instance
551  *
552  * Registers on the render reset domain need to have their values re-applied
553  * when any of those engines are reset. Since the engines reset together, a
554  * programming can be set to just one of them. For simplicity the first engine
555  * of either render or compute class can be chosen.
556  *
557  * Returns: true if engine id is the first to match the render reset domain,
558  * false otherwise.
559  */
560 bool xe_rtp_match_first_render_or_compute(const struct xe_device *xe,
561 					  const struct xe_gt *gt,
562 					  const struct xe_hw_engine *hwe);
563 
564 /*
565  * xe_rtp_match_not_sriov_vf - Match when not on SR-IOV VF device
566  *
567  * @xe: Device structure
568  * @gt: GT structure
569  * @hwe: Engine instance
570  *
571  * Returns: true if device is not VF, false otherwise.
572  */
573 bool xe_rtp_match_not_sriov_vf(const struct xe_device *xe,
574 			       const struct xe_gt *gt,
575 			       const struct xe_hw_engine *hwe);
576 
577 bool xe_rtp_match_psmi_enabled(const struct xe_device *xe,
578 			       const struct xe_gt *gt,
579 			       const struct xe_hw_engine *hwe);
580 
581 bool xe_rtp_match_gt_has_discontiguous_dss_groups(const struct xe_device *xe,
582 						  const struct xe_gt *gt,
583 						  const struct xe_hw_engine *hwe);
584 
585 /**
586  * xe_rtp_match_has_flat_ccs - Match when platform has FlatCCS compression
587  * @xe: Device structure
588  * @gt: GT structure
589  * @hwe: Engine instance
590  *
591  * Returns: true if platform has FlatCCS compression, false otherwise
592  */
593 bool xe_rtp_match_has_flat_ccs(const struct xe_device *xe,
594 			       const struct xe_gt *gt,
595 			       const struct xe_hw_engine *hwe);
596 
597 /**
598  * xe_rtp_match_has_msix - Match when platform has MSI-X
599  * @xe: Device structure
600  * @gt: GT structure
601  * @hwe: Engine instance
602  *
603  * Returns: true if platform has MSI-X interrupt support
604  */
605 bool xe_rtp_match_has_msix(const struct xe_device *xe,
606 			   const struct xe_gt *gt,
607 			   const struct xe_hw_engine *hwe);
608 
609 #endif
610