linux/drivers/gpu/drm/xe/tests/xe_rtp.c
Gustavo Sousa 833e3f7e32 drm/xe/rtp: Write kunit test cases specific for rule matching
The kunit test cases for the RTP framework are currently separated into
those that validate xe_rtp_process_to_sr() and those that validate
xe_rtp_process().  In both of them, we also have mixed stuff to validate
rule matching functionality, which should rather be done in a separate
test case group.

Let's create such a group, specific for validating rule matching, and
also add an initial set of cases.  In an upcoming change, we will do a
cleanup of the other groups by migrating those cases intended for rule
matching to this new group.

v2:
  - s/no-yes-or-no-yes/no-yes-or-yes-no/ (Matt)
  - Drop leftover include of <kunit/test.h>.

Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
Link: https://patch.msgid.link/20260522-rtp-rule-parser-v3-1-0c51039899f4@intel.com
Signed-off-by: Gustavo Sousa <gustavo.sousa@intel.com>
2026-05-22 10:52:29 -03:00

39 lines
1.1 KiB
C

// SPDX-License-Identifier: GPL-2.0 AND MIT
/*
* Copyright © 2026 Intel Corporation
*/
#include "tests/xe_rtp_test.h"
#include <kunit/visibility.h>
/**
* xe_rtp_rule_matches - Check if a set of RTP rule set match against the
* device/GT/hwe
* @xe: The xe device
* @gt: The GT struct (may be NULL)
* @hwe: The hw_engine (may be NULL)
* @rules: The array of rules to match against
* @n_rules: Number of items in @rules
* @err: Pointer (may be NULL) to set error number.
*
* This parses the set of rules and check if they match against the passed
* parameters.
*
* If passed, @err is updated with a non-zero negative error number or zero if
* no errors were found during the parsing/evaluation of rules.
*
* Returns true if there is a match and false if there is no match or if an
* error was found.
*/
bool xe_rtp_rule_matches(const struct xe_device *xe,
struct xe_gt *gt,
struct xe_hw_engine *hwe,
const struct xe_rtp_rule *rules,
unsigned int n_rules,
int *err)
{
return rule_matches_with_err(xe, gt, hwe, rules, n_rules, err);
}
EXPORT_SYMBOL_IF_KUNIT(xe_rtp_rule_matches);