xref: /linux/drivers/gpu/drm/xe/tests/xe_rtp.c (revision 9611c0ce215a66770ccbe5c126bf57ba8c31bcad)
1*833e3f7eSGustavo Sousa // SPDX-License-Identifier: GPL-2.0 AND MIT
2*833e3f7eSGustavo Sousa /*
3*833e3f7eSGustavo Sousa  * Copyright © 2026 Intel Corporation
4*833e3f7eSGustavo Sousa  */
5*833e3f7eSGustavo Sousa 
6*833e3f7eSGustavo Sousa #include "tests/xe_rtp_test.h"
7*833e3f7eSGustavo Sousa 
8*833e3f7eSGustavo Sousa #include <kunit/visibility.h>
9*833e3f7eSGustavo Sousa 
10*833e3f7eSGustavo Sousa /**
11*833e3f7eSGustavo Sousa  * xe_rtp_rule_matches - Check if a set of RTP rule set match against the
12*833e3f7eSGustavo Sousa  *			 device/GT/hwe
13*833e3f7eSGustavo Sousa  * @xe: The xe device
14*833e3f7eSGustavo Sousa  * @gt: The GT struct (may be NULL)
15*833e3f7eSGustavo Sousa  * @hwe: The hw_engine  (may be NULL)
16*833e3f7eSGustavo Sousa  * @rules: The array of rules to match against
17*833e3f7eSGustavo Sousa  * @n_rules: Number of items in @rules
18*833e3f7eSGustavo Sousa  * @err: Pointer (may be NULL) to set error number.
19*833e3f7eSGustavo Sousa  *
20*833e3f7eSGustavo Sousa  * This parses the set of rules and check if they match against the passed
21*833e3f7eSGustavo Sousa  * parameters.
22*833e3f7eSGustavo Sousa  *
23*833e3f7eSGustavo Sousa  * If passed, @err is updated with a non-zero negative error number or zero if
24*833e3f7eSGustavo Sousa  * no errors were found during the parsing/evaluation of rules.
25*833e3f7eSGustavo Sousa  *
26*833e3f7eSGustavo Sousa  * Returns true if there is a match and false if there is no match or if an
27*833e3f7eSGustavo Sousa  * error was found.
28*833e3f7eSGustavo Sousa  */
29*833e3f7eSGustavo Sousa bool xe_rtp_rule_matches(const struct xe_device *xe,
30*833e3f7eSGustavo Sousa 			 struct xe_gt *gt,
31*833e3f7eSGustavo Sousa 			 struct xe_hw_engine *hwe,
32*833e3f7eSGustavo Sousa 			 const struct xe_rtp_rule *rules,
33*833e3f7eSGustavo Sousa 			 unsigned int n_rules,
34*833e3f7eSGustavo Sousa 			 int *err)
35*833e3f7eSGustavo Sousa {
36*833e3f7eSGustavo Sousa 	return rule_matches_with_err(xe, gt, hwe, rules, n_rules, err);
37*833e3f7eSGustavo Sousa }
38*833e3f7eSGustavo Sousa EXPORT_SYMBOL_IF_KUNIT(xe_rtp_rule_matches);
39