Lines Matching +full:test +full:- +full:rules
1 // SPDX-License-Identifier: GPL-2.0
12 #include <kunit/test.h>
63 .name = "coalesce-same-reg",
71 { XE_RTP_NAME("basic-1"),
75 { XE_RTP_NAME("basic-2"),
83 .name = "no-match-no-add",
89 /* Don't coalesce second entry since rules don't match */
91 { XE_RTP_NAME("basic-1"),
95 { XE_RTP_NAME("basic-2"),
103 .name = "match-or",
124 { XE_RTP_NAME("no-match"),
132 .name = "match-or-xfail",
136 { XE_RTP_NAME("leading-or"),
140 { XE_RTP_NAME("trailing-or"),
144 * soon as it has a matching set of rules
149 { XE_RTP_NAME("no-or-or-yes"),
157 .name = "no-match-no-add-multiple-rules",
163 /* Don't coalesce second entry due to one of the rules */
165 { XE_RTP_NAME("basic-1"),
169 { XE_RTP_NAME("basic-2"),
177 .name = "two-regs-two-entries",
185 { XE_RTP_NAME("basic-1"),
189 { XE_RTP_NAME("basic-2"),
197 .name = "clr-one-set-other",
205 { XE_RTP_NAME("basic-1"),
209 { XE_RTP_NAME("basic-2"),
219 .name = "set-field",
227 { XE_RTP_NAME("basic-1"),
238 .name = "conflict-duplicate",
246 { XE_RTP_NAME("basic-1"),
251 { XE_RTP_NAME("basic-2"),
259 .name = "conflict-not-disjoint",
267 { XE_RTP_NAME("basic-1"),
272 { XE_RTP_NAME("basic-2"),
280 .name = "conflict-reg-type",
288 { XE_RTP_NAME("basic-1"),
293 { XE_RTP_NAME("basic-2"),
298 { XE_RTP_NAME("basic-3"),
307 static void xe_rtp_process_to_sr_tests(struct kunit *test) in xe_rtp_process_to_sr_tests() argument
309 const struct rtp_to_sr_test_case *param = test->param_value; in xe_rtp_process_to_sr_tests()
310 struct xe_device *xe = test->priv; in xe_rtp_process_to_sr_tests()
311 struct xe_gt *gt = xe_device_get_root_tile(xe)->primary_gt; in xe_rtp_process_to_sr_tests()
312 struct xe_reg_sr *reg_sr = >->reg_sr; in xe_rtp_process_to_sr_tests()
319 while (param->entries[count_rtp_entries].rules) in xe_rtp_process_to_sr_tests()
323 xe_rtp_process_to_sr(&ctx, param->entries, reg_sr); in xe_rtp_process_to_sr_tests()
325 xa_for_each(®_sr->xa, idx, sre) { in xe_rtp_process_to_sr_tests()
326 if (idx == param->expected_reg.addr) in xe_rtp_process_to_sr_tests()
332 KUNIT_EXPECT_EQ(test, active, param->expected_active); in xe_rtp_process_to_sr_tests()
334 KUNIT_EXPECT_EQ(test, count_sr_entries, param->expected_count_sr_entries); in xe_rtp_process_to_sr_tests()
336 KUNIT_EXPECT_EQ(test, sr_entry->clr_bits, param->expected_clr_bits); in xe_rtp_process_to_sr_tests()
337 KUNIT_EXPECT_EQ(test, sr_entry->set_bits, param->expected_set_bits); in xe_rtp_process_to_sr_tests()
338 KUNIT_EXPECT_EQ(test, sr_entry->reg.raw, param->expected_reg.raw); in xe_rtp_process_to_sr_tests()
340 KUNIT_EXPECT_NULL(test, sr_entry); in xe_rtp_process_to_sr_tests()
343 KUNIT_EXPECT_EQ(test, reg_sr->errors, param->expected_sr_errors); in xe_rtp_process_to_sr_tests()
347 * Entries below follow the logic used with xe_wa_oob.rules:
350 * 2) There are no action associated with rules
377 .name = "active-inactive",
390 .name = "inactive-active",
403 .name = "inactive-1st_or_active-inactive",
420 .name = "inactive-2nd_or_active-inactive",
437 .name = "inactive-last_or_active-inactive",
454 .name = "inactive-no_or_active-inactive",
472 static void xe_rtp_process_tests(struct kunit *test) in xe_rtp_process_tests() argument
474 const struct rtp_test_case *param = test->param_value; in xe_rtp_process_tests()
475 struct xe_device *xe = test->priv; in xe_rtp_process_tests()
476 struct xe_gt *gt = xe_device_get_root_tile(xe)->primary_gt; in xe_rtp_process_tests()
480 while (param->entries[count_rtp_entries].rules) in xe_rtp_process_tests()
484 xe_rtp_process(&ctx, param->entries); in xe_rtp_process_tests()
486 KUNIT_EXPECT_EQ(test, active, param->expected_active); in xe_rtp_process_tests()
491 strscpy(desc, t->name, KUNIT_PARAM_DESC_SIZE); in rtp_to_sr_desc()
498 strscpy(desc, t->name, KUNIT_PARAM_DESC_SIZE); in rtp_desc()
503 static int xe_rtp_test_init(struct kunit *test) in xe_rtp_test_init() argument
509 dev = drm_kunit_helper_alloc_device(test); in xe_rtp_test_init()
510 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, dev); in xe_rtp_test_init()
512 xe = xe_kunit_helper_alloc_xe_device(test, dev); in xe_rtp_test_init()
513 KUNIT_ASSERT_NOT_ERR_OR_NULL(test, xe); in xe_rtp_test_init()
516 test->priv = NULL; in xe_rtp_test_init()
518 KUNIT_ASSERT_EQ(test, ret, 0); in xe_rtp_test_init()
520 xe->drm.dev = dev; in xe_rtp_test_init()
521 test->priv = xe; in xe_rtp_test_init()
526 static void xe_rtp_test_exit(struct kunit *test) in xe_rtp_test_exit() argument
528 struct xe_device *xe = test->priv; in xe_rtp_test_exit()
530 drm_kunit_helper_free_device(test, xe->drm.dev); in xe_rtp_test_exit()