Lines Matching +full:test +full:- +full:rules
1 // SPDX-License-Identifier: GPL-2.0
12 #include <kunit/test.h>
55 .name = "coalesce-same-reg",
62 { XE_RTP_NAME("basic-1"),
66 { XE_RTP_NAME("basic-2"),
74 .name = "no-match-no-add",
79 /* Don't coalesce second entry since rules don't match */
81 { XE_RTP_NAME("basic-1"),
85 { XE_RTP_NAME("basic-2"),
93 .name = "no-match-no-add-multiple-rules",
98 /* Don't coalesce second entry due to one of the rules */
100 { XE_RTP_NAME("basic-1"),
104 { XE_RTP_NAME("basic-2"),
112 .name = "two-regs-two-entries",
119 { XE_RTP_NAME("basic-1"),
123 { XE_RTP_NAME("basic-2"),
131 .name = "clr-one-set-other",
138 { XE_RTP_NAME("basic-1"),
142 { XE_RTP_NAME("basic-2"),
152 .name = "set-field",
159 { XE_RTP_NAME("basic-1"),
170 .name = "conflict-duplicate",
177 { XE_RTP_NAME("basic-1"),
182 { XE_RTP_NAME("basic-2"),
190 .name = "conflict-not-disjoint",
197 { XE_RTP_NAME("basic-1"),
202 { XE_RTP_NAME("basic-2"),
210 .name = "conflict-reg-type",
217 { XE_RTP_NAME("basic-1"),
222 { XE_RTP_NAME("basic-2"),
227 { XE_RTP_NAME("basic-3"),
236 static void xe_rtp_process_tests(struct kunit *test) in xe_rtp_process_tests() argument
238 const struct rtp_test_case *param = test->param_value; in xe_rtp_process_tests()
239 struct xe_device *xe = test->priv; in xe_rtp_process_tests()
240 struct xe_gt *gt = xe_device_get_root_tile(xe)->primary_gt; in xe_rtp_process_tests()
241 struct xe_reg_sr *reg_sr = >->reg_sr; in xe_rtp_process_tests()
247 xe_rtp_process_to_sr(&ctx, param->entries, reg_sr); in xe_rtp_process_tests()
249 xa_for_each(®_sr->xa, idx, sre) { in xe_rtp_process_tests()
250 if (idx == param->expected_reg.addr) in xe_rtp_process_tests()
256 KUNIT_EXPECT_EQ(test, count, param->expected_count); in xe_rtp_process_tests()
257 KUNIT_EXPECT_EQ(test, sr_entry->clr_bits, param->expected_clr_bits); in xe_rtp_process_tests()
258 KUNIT_EXPECT_EQ(test, sr_entry->set_bits, param->expected_set_bits); in xe_rtp_process_tests()
259 KUNIT_EXPECT_EQ(test, sr_entry->reg.raw, param->expected_reg.raw); in xe_rtp_process_tests()
260 KUNIT_EXPECT_EQ(test, reg_sr->errors, param->expected_sr_errors); in xe_rtp_process_tests()
265 strscpy(desc, t->name, KUNIT_PARAM_DESC_SIZE); in rtp_desc()
270 static int xe_rtp_test_init(struct kunit *test) in xe_rtp_test_init() argument
276 dev = drm_kunit_helper_alloc_device(test); in xe_rtp_test_init()
277 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, dev); in xe_rtp_test_init()
279 xe = drm_kunit_helper_alloc_drm_device(test, dev, in xe_rtp_test_init()
282 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, xe); in xe_rtp_test_init()
285 test->priv = NULL; in xe_rtp_test_init()
287 KUNIT_ASSERT_EQ(test, ret, 0); in xe_rtp_test_init()
289 xe->drm.dev = dev; in xe_rtp_test_init()
290 test->priv = xe; in xe_rtp_test_init()
295 static void xe_rtp_test_exit(struct kunit *test) in xe_rtp_test_exit() argument
297 struct xe_device *xe = test->priv; in xe_rtp_test_exit()
299 drm_kunit_helper_free_device(test, xe->drm.dev); in xe_rtp_test_exit()
318 MODULE_DESCRIPTION("xe_rtp kunit test");