From: Michal Wajdeczko <michal.wajdeczko@intel.com>
To: intel-xe@lists.freedesktop.org
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>,
Lucas De Marchi <lucas.demarchi@intel.com>
Subject: [PATCH 2/2] drm/xe/kunit: Update RTP test to check VF rules
Date: Fri, 14 Jun 2024 23:48:21 +0200 [thread overview]
Message-ID: <20240614214821.2252-3-michal.wajdeczko@intel.com> (raw)
In-Reply-To: <20240614214821.2252-1-michal.wajdeczko@intel.com>
Add basic test cases that will verify VF_READY and VF_ONLY rules.
Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Lucas De Marchi <lucas.demarchi@intel.com>
---
drivers/gpu/drm/xe/tests/xe_rtp_test.c | 118 ++++++++++++++++++++++++-
1 file changed, 117 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/xe/tests/xe_rtp_test.c b/drivers/gpu/drm/xe/tests/xe_rtp_test.c
index 06759d754783..0d8731e13217 100644
--- a/drivers/gpu/drm/xe/tests/xe_rtp_test.c
+++ b/drivers/gpu/drm/xe/tests/xe_rtp_test.c
@@ -232,6 +232,109 @@ static const struct rtp_test_case cases[] = {
{}
},
},
+ {
+ .name = "vf-ready",
+ .expected_reg = REGULAR_REG1,
+ .expected_set_bits = REG_BIT(0),
+ .expected_clr_bits = REG_BIT(0),
+ .expected_count = 1,
+ /* VF-ready does not impact native/PF */
+ .entries = (const struct xe_rtp_entry_sr[]) {
+ { XE_RTP_NAME("basic-1"),
+ XE_RTP_RULES(FUNC(match_yes), VF_READY),
+ XE_RTP_ACTIONS(SET(REGULAR_REG1, REG_BIT(0)))
+ },
+ {}
+ },
+ },
+ {
+ .name = "vf-only",
+ .expected_reg = REGULAR_REG1,
+ .expected_set_bits = REG_BIT(1),
+ .expected_clr_bits = REG_BIT(1),
+ .expected_count = 1,
+ /* VF-only is n/a for native/PF */
+ .entries = (const struct xe_rtp_entry_sr[]) {
+ { XE_RTP_NAME("basic-1"),
+ XE_RTP_RULES(FUNC(match_yes), VF_ONLY),
+ XE_RTP_ACTIONS(SET(REGULAR_REG1, REG_BIT(0)))
+ },
+ { XE_RTP_NAME("basic-2"),
+ XE_RTP_RULES(FUNC(match_yes)),
+ XE_RTP_ACTIONS(SET(REGULAR_REG1, REG_BIT(1)))
+ },
+ {}
+ },
+ },
+};
+
+static const struct rtp_test_case vf_cases[] = {
+ {
+ .name = "no-vf-no-match",
+ .expected_reg = REGULAR_REG1,
+ .expected_count = 0,
+ .entries = (const struct xe_rtp_entry_sr[]) {
+ { XE_RTP_NAME("basic-1"),
+ XE_RTP_RULES(FUNC(match_yes)),
+ XE_RTP_ACTIONS(SET(REGULAR_REG1, REG_BIT(0)))
+ },
+ {}
+ },
+ },
+ {
+ .name = "match-vf-ready",
+ .expected_reg = REGULAR_REG1,
+ .expected_set_bits = REG_BIT(1),
+ .expected_clr_bits = REG_BIT(1),
+ .expected_count = 1,
+ .entries = (const struct xe_rtp_entry_sr[]) {
+ { XE_RTP_NAME("basic-1"),
+ XE_RTP_RULES(FUNC(match_yes)),
+ XE_RTP_ACTIONS(SET(REGULAR_REG1, REG_BIT(0)))
+ },
+ { XE_RTP_NAME("basic-2"),
+ XE_RTP_RULES(FUNC(match_yes), VF_READY),
+ XE_RTP_ACTIONS(SET(REGULAR_REG1, REG_BIT(1)))
+ },
+ {}
+ },
+ },
+ {
+ .name = "match-vf-only",
+ .expected_reg = REGULAR_REG1,
+ .expected_set_bits = REG_BIT(1),
+ .expected_clr_bits = REG_BIT(1),
+ .expected_count = 1,
+ .entries = (const struct xe_rtp_entry_sr[]) {
+ { XE_RTP_NAME("basic-1"),
+ XE_RTP_RULES(FUNC(match_yes)),
+ XE_RTP_ACTIONS(SET(REGULAR_REG1, REG_BIT(0)))
+ },
+ { XE_RTP_NAME("basic-2"),
+ XE_RTP_RULES(FUNC(match_yes), VF_ONLY),
+ XE_RTP_ACTIONS(SET(REGULAR_REG1, REG_BIT(1)))
+ },
+ {}
+ },
+ },
+ {
+ .name = "match-any-vf",
+ .expected_reg = REGULAR_REG1,
+ .expected_set_bits = REG_BIT(0) | REG_BIT(1),
+ .expected_clr_bits = REG_BIT(0) | REG_BIT(1),
+ .expected_count = 1,
+ .entries = (const struct xe_rtp_entry_sr[]) {
+ { XE_RTP_NAME("basic-1"),
+ XE_RTP_RULES(FUNC(match_yes), VF_READY),
+ XE_RTP_ACTIONS(SET(REGULAR_REG1, REG_BIT(0)))
+ },
+ { XE_RTP_NAME("basic-2"),
+ XE_RTP_RULES(FUNC(match_yes), VF_ONLY),
+ XE_RTP_ACTIONS(SET(REGULAR_REG1, REG_BIT(1)))
+ },
+ {}
+ },
+ },
};
static void xe_rtp_process_tests(struct kunit *test)
@@ -254,19 +357,31 @@ static void xe_rtp_process_tests(struct kunit *test)
count++;
}
- KUNIT_EXPECT_EQ(test, count, param->expected_count);
+ KUNIT_ASSERT_EQ(test, count, param->expected_count);
+ if (!param->expected_count)
+ return;
+ KUNIT_ASSERT_NOT_NULL(test, sr_entry);
KUNIT_EXPECT_EQ(test, sr_entry->clr_bits, param->expected_clr_bits);
KUNIT_EXPECT_EQ(test, sr_entry->set_bits, param->expected_set_bits);
KUNIT_EXPECT_EQ(test, sr_entry->reg.raw, param->expected_reg.raw);
KUNIT_EXPECT_EQ(test, reg_sr->errors, param->expected_sr_errors);
}
+static void xe_rtp_process_vf_tests(struct kunit *test)
+{
+ struct xe_device *xe = test->priv;
+
+ xe->sriov.__mode = XE_SRIOV_MODE_VF;
+ xe_rtp_process_tests(test);
+}
+
static void rtp_desc(const struct rtp_test_case *t, char *desc)
{
strscpy(desc, t->name, KUNIT_PARAM_DESC_SIZE);
}
KUNIT_ARRAY_PARAM(rtp, cases, rtp_desc);
+KUNIT_ARRAY_PARAM(rtp_vf, vf_cases, rtp_desc);
static int xe_rtp_test_init(struct kunit *test)
{
@@ -300,6 +415,7 @@ static void xe_rtp_test_exit(struct kunit *test)
static struct kunit_case xe_rtp_tests[] = {
KUNIT_CASE_PARAM(xe_rtp_process_tests, rtp_gen_params),
+ KUNIT_CASE_PARAM(xe_rtp_process_vf_tests, rtp_vf_gen_params),
{}
};
--
2.43.0
next prev parent reply other threads:[~2024-06-14 21:49 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-14 21:48 [PATCH 0/2] Prepare RTP for VF rules Michal Wajdeczko
2024-06-14 21:48 ` [PATCH 1/2] drm/xe/rtp: " Michal Wajdeczko
2024-06-14 21:48 ` Michal Wajdeczko [this message]
2024-06-17 14:48 ` [PATCH 2/2] drm/xe/kunit: Update RTP test to check " Lucas De Marchi
2024-06-17 15:12 ` Michal Wajdeczko
2024-06-14 23:25 ` ✓ CI.Patch_applied: success for Prepare RTP for " Patchwork
2024-06-14 23:25 ` ✓ CI.checkpatch: " Patchwork
2024-06-14 23:26 ` ✓ CI.KUnit: " Patchwork
2024-06-14 23:38 ` ✓ CI.Build: " Patchwork
2024-06-14 23:40 ` ✗ CI.Hooks: failure " Patchwork
2024-06-14 23:42 ` ✓ CI.checksparse: success " Patchwork
2024-06-15 0:08 ` ✗ CI.BAT: failure " Patchwork
2024-06-15 17:55 ` ✓ CI.FULL: success " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240614214821.2252-3-michal.wajdeczko@intel.com \
--to=michal.wajdeczko@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=lucas.demarchi@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox