summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorMatt Roper <matthew.d.roper@intel.com>2026-06-17 12:24:49 -0700
committerMatt Roper <matthew.d.roper@intel.com>2026-06-17 13:59:05 -0700
commitc47ffed42b016ddeea2a45fa9631edb2bd4e88ed (patch)
tree9025a102422b89618e0050422069873e4bc33aaf /drivers
parent4ff7902a64c1831dfc70791d2f88125e003d21c2 (diff)
downloadlinux-next-c47ffed42b016ddeea2a45fa9631edb2bd4e88ed.tar.gz
linux-next-c47ffed42b016ddeea2a45fa9631edb2bd4e88ed.zip
drm/xe/rtp: Add kunit tests to exercise FIELD_SET_FUNC action
Add a couple additional tests to the RTP kunit suite that ensure FIELD_SET_FUNC() actions are evaluated properly and the values properly consolidate/conflict with values coming from other literal SET/FIELD_SET rules. Suggested-by: Gustavo Sousa <gustavo.sousa@intel.com> Reviewed-by: Gustavo Sousa <gustavo.sousa@intel.com> Link: https://patch.msgid.link/20260617-rtp_with_dynamic_vals-v2-5-3f4cb34c2ea1@intel.com Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/xe/tests/xe_rtp_test.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/drivers/gpu/drm/xe/tests/xe_rtp_test.c b/drivers/gpu/drm/xe/tests/xe_rtp_test.c
index 3d0688d058d9..367811621880 100644
--- a/drivers/gpu/drm/xe/tests/xe_rtp_test.c
+++ b/drivers/gpu/drm/xe/tests/xe_rtp_test.c
@@ -280,6 +280,11 @@ static void xe_rtp_rules_tests(struct kunit *test)
KUNIT_EXPECT_EQ(test, err, param->expected_err);
}
+static u32 bits_2_3_set(struct xe_gt *gt, struct xe_hw_engine *hwe)
+{
+ return REG_BIT(2) | REG_BIT(3);
+}
+
static const struct rtp_to_sr_test_case rtp_to_sr_cases[] = {
{
.name = "coalesce-same-reg",
@@ -301,6 +306,29 @@ static const struct rtp_to_sr_test_case rtp_to_sr_cases[] = {
),
},
{
+ .name = "coalesce-same-reg-literal-and-func",
+ .expected_reg = REGULAR_REG1,
+ .expected_set_bits = REG_BIT(0) | REG_BIT(1) | REG_BIT(2) | REG_BIT(3),
+ .expected_clr_bits = REG_BIT(0) | REG_BIT(1) | REG_BIT(2) | REG_BIT(3),
+ .expected_active = BIT(0) | BIT(1),
+ .expected_count_sr_entries = 1,
+ /* Different bits on the same register: create a single entry */
+ .table = XE_RTP_TABLE_SR(
+ { XE_RTP_NAME("basic-1"),
+ XE_RTP_RULES(FUNC(match_yes)),
+ XE_RTP_ACTIONS(FIELD_SET(REGULAR_REG1,
+ REG_BIT(0) | REG_BIT(1),
+ REG_BIT(0) | REG_BIT(1)))
+ },
+ { XE_RTP_NAME("basic-2"),
+ XE_RTP_RULES(FUNC(match_yes)),
+ XE_RTP_ACTIONS(FIELD_SET_FUNC(REGULAR_REG1,
+ REG_BIT(2) | REG_BIT(3),
+ bits_2_3_set))
+ },
+ ),
+ },
+ {
.name = "no-match-no-add",
.expected_reg = REGULAR_REG1,
.expected_set_bits = REG_BIT(0),
@@ -418,6 +446,30 @@ static const struct rtp_to_sr_test_case rtp_to_sr_cases[] = {
),
},
{
+ .name = "conflict-not-disjoint-literal-and-func",
+ .expected_reg = REGULAR_REG1,
+ .expected_set_bits = REG_BIT(1) | REG_BIT(2),
+ .expected_clr_bits = REG_BIT(1) | REG_BIT(2),
+ .expected_active = BIT(0) | BIT(1),
+ .expected_count_sr_entries = 1,
+ .expected_sr_errors = 1,
+ .table = XE_RTP_TABLE_SR(
+ { XE_RTP_NAME("basic-1"),
+ XE_RTP_RULES(FUNC(match_yes)),
+ XE_RTP_ACTIONS(FIELD_SET(REGULAR_REG1,
+ REG_BIT(1) | REG_BIT(2),
+ REG_BIT(1) | REG_BIT(2)))
+ },
+ /* drop: bits are not disjoint with previous entries */
+ { XE_RTP_NAME("basic-2"),
+ XE_RTP_RULES(FUNC(match_yes)),
+ XE_RTP_ACTIONS(FIELD_SET_FUNC(REGULAR_REG1,
+ REG_BIT(2) | REG_BIT(3),
+ bits_2_3_set))
+ },
+ ),
+ },
+ {
.name = "conflict-reg-type",
.expected_reg = REGULAR_REG1,
.expected_set_bits = REG_BIT(0),