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