[PATCH v2 2/2] drm/xe/kunit: Update RTP test to check VF flags
Michal Wajdeczko
michal.wajdeczko at intel.com
Tue Jun 18 22:00:26 UTC 2024
Add basic test cases that will verify VF_READY and VF_ONLY entries.
Signed-off-by: Michal Wajdeczko <michal.wajdeczko at intel.com>
Cc: Lucas De Marchi <lucas.demarchi at intel.com>
Cc: Matt Roper <matthew.d.roper at intel.com>
---
v2: rebased
---
drivers/gpu/drm/xe/tests/xe_rtp_test.c | 119 +++++++++++++++++++++++++
1 file changed, 119 insertions(+)
diff --git a/drivers/gpu/drm/xe/tests/xe_rtp_test.c b/drivers/gpu/drm/xe/tests/xe_rtp_test.c
index f217445c246a..7ebf048d706b 100644
--- a/drivers/gpu/drm/xe/tests/xe_rtp_test.c
+++ b/drivers/gpu/drm/xe/tests/xe_rtp_test.c
@@ -285,6 +285,115 @@ 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)),
+ XE_RTP_ACTIONS(SET(REGULAR_REG1, REG_BIT(0))),
+ XE_RTP_ENTRY_FLAG(VF_READY),
+ },
+ {}
+ },
+ },
+ {
+ .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)),
+ XE_RTP_ACTIONS(SET(REGULAR_REG1, REG_BIT(0))),
+ XE_RTP_ENTRY_FLAG(VF_ONLY),
+ },
+ { 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)),
+ XE_RTP_ACTIONS(SET(REGULAR_REG1, REG_BIT(1))),
+ XE_RTP_ENTRY_FLAG(VF_READY),
+ },
+ {}
+ },
+ },
+ {
+ .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)),
+ XE_RTP_ACTIONS(SET(REGULAR_REG1, REG_BIT(1))),
+ XE_RTP_ENTRY_FLAG(VF_ONLY),
+ },
+ {}
+ },
+ },
+ {
+ .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)),
+ XE_RTP_ACTIONS(SET(REGULAR_REG1, REG_BIT(0))),
+ XE_RTP_ENTRY_FLAG(VF_READY),
+ },
+ { XE_RTP_NAME("basic-2"),
+ XE_RTP_RULES(FUNC(match_yes)),
+ XE_RTP_ACTIONS(SET(REGULAR_REG1, REG_BIT(1))),
+ XE_RTP_ENTRY_FLAG(VF_ONLY),
+ },
+ {}
+ },
+ },
};
static void xe_rtp_process_tests(struct kunit *test)
@@ -319,12 +428,21 @@ static void xe_rtp_process_tests(struct kunit *test)
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)
{
@@ -358,6 +476,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
More information about the Intel-xe
mailing list