From: Matt Roper <matthew.d.roper@intel.com>
To: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: <intel-xe@lists.freedesktop.org>,
Lucas De Marchi <lucas.demarchi@intel.com>
Subject: Re: [PATCH v2 4/5] drm/xe/kunit: Update RTP tests with SR-IOV rules
Date: Mon, 24 Feb 2025 14:55:28 -0800 [thread overview]
Message-ID: <20250224225528.GD4460@mdroper-desk1.amr.corp.intel.com> (raw)
In-Reply-To: <20250224150700.1778-5-michal.wajdeczko@intel.com>
On Mon, Feb 24, 2025 at 04:06:59PM +0100, Michal Wajdeczko wrote:
> Add more test cases that verifies use of RTP SRIOV() rules in
> driver running as native, PF and VF mode.
>
> 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 | 112 ++++++++++++++++++++++++-
> 1 file changed, 111 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 36a3b5420fef..b21474df933e 100644
> --- a/drivers/gpu/drm/xe/tests/xe_rtp_test.c
> +++ b/drivers/gpu/drm/xe/tests/xe_rtp_test.c
> @@ -45,6 +45,8 @@ struct rtp_to_sr_test_case {
> struct rtp_test_case {
> const char *name;
> unsigned long expected_active;
> + unsigned long expected_active_pf;
> + unsigned long expected_active_vf;
> const struct xe_rtp_entry *entries;
> };
>
> @@ -469,6 +471,89 @@ static const struct rtp_test_case rtp_cases[] = {
> },
> };
>
> +static const struct rtp_test_case sriov_cases[] = {
> + {
> + .name = "non_vf",
> + .expected_active = BIT(0) | BIT(1),
> + .expected_active_pf = BIT(0) | BIT(1),
> + .expected_active_vf = 0,
> + .entries = (const struct xe_rtp_entry[]) {
> + { XE_RTP_NAME("and"),
> + XE_RTP_RULES(FUNC(match_yes)),
> + },
> + { XE_RTP_NAME("or"),
> + XE_RTP_RULES(FUNC(match_no), OR,
> + FUNC(match_yes)),
> + },
> + {}
> + },
> + },
> + {
> + .name = "vf_ready",
> + .expected_active = BIT(0) | BIT(1),
> + .expected_active_pf = BIT(0) | BIT(1),
> + .expected_active_vf = BIT(0) | BIT(1),
> + .entries = (const struct xe_rtp_entry[]) {
> + { XE_RTP_NAME("and"),
> + XE_RTP_RULES(FUNC(match_yes), SRIOV(VF_READY)),
> + },
> + { XE_RTP_NAME("or"),
> + XE_RTP_RULES(FUNC(match_no), OR,
> + FUNC(match_yes), SRIOV(VF_READY)),
> + },
> + {}
> + },
> + },
> + {
> + .name = "vf_only",
> + .expected_active = 0,
> + .expected_active_pf = 0,
> + .expected_active_vf = BIT(0) | BIT(1),
> + .entries = (const struct xe_rtp_entry[]) {
> + { XE_RTP_NAME("and"),
> + XE_RTP_RULES(FUNC(match_yes), SRIOV(VF_ONLY)),
> + },
> + { XE_RTP_NAME("or"),
> + XE_RTP_RULES(FUNC(match_no), OR,
> + FUNC(match_yes), SRIOV(VF_ONLY)),
> + },
> + {}
> + },
> + },
> + {
> + .name = "pf_only",
> + .expected_active = 0,
> + .expected_active_pf = BIT(0) | BIT(1),
> + .expected_active_vf = 0,
> + .entries = (const struct xe_rtp_entry[]) {
> + { XE_RTP_NAME("and"),
> + XE_RTP_RULES(FUNC(match_yes), SRIOV(PF_ONLY)),
> + },
> + { XE_RTP_NAME("or"),
> + XE_RTP_RULES(FUNC(match_no), OR,
> + FUNC(match_yes), SRIOV(PF_ONLY)),
> + },
> + {}
> + },
> + },
> + {
> + .name = "sriov_only",
> + .expected_active = 0,
> + .expected_active_pf = BIT(0) | BIT(1),
> + .expected_active_vf = BIT(0) | BIT(1),
> + .entries = (const struct xe_rtp_entry[]) {
> + { XE_RTP_NAME("and"),
> + XE_RTP_RULES(FUNC(match_yes), SRIOV(ONLY)),
> + },
> + { XE_RTP_NAME("or"),
> + XE_RTP_RULES(FUNC(match_no), OR,
> + FUNC(match_yes), SRIOV(ONLY)),
> + },
> + {}
> + },
> + },
> +};
> +
> static void xe_rtp_process_tests(struct kunit *test)
> {
> const struct rtp_test_case *param = test->param_value;
> @@ -483,7 +568,28 @@ static void xe_rtp_process_tests(struct kunit *test)
> xe_rtp_process_ctx_enable_active_tracking(&ctx, &active, count_rtp_entries);
> xe_rtp_process(&ctx, param->entries);
>
> - KUNIT_EXPECT_EQ(test, active, param->expected_active);
> + if (IS_SRIOV_PF(xe))
The xe here is a mock device (from drm_kunit_helper_alloc_device).
Won't these SRIOV tests require something extra in
xe_pci_fake_device_init() to ever be SRIOV-enabled? Or am I overlooking
something?
Matt
> + KUNIT_EXPECT_EQ(test, active, param->expected_active_pf);
> + else if (IS_SRIOV_VF(xe))
> + KUNIT_EXPECT_EQ(test, active, param->expected_active_vf);
> + else
> + KUNIT_EXPECT_EQ(test, active, param->expected_active);
> +}
> +
> +static void xe_rtp_process_tests_pf(struct kunit *test)
> +{
> + struct xe_device *xe = test->priv;
> +
> + xe->sriov.__mode = XE_SRIOV_MODE_PF;
> + xe_rtp_process_tests(test);
> +}
> +
> +static void xe_rtp_process_tests_vf(struct kunit *test)
> +{
> + struct xe_device *xe = test->priv;
> +
> + xe->sriov.__mode = XE_SRIOV_MODE_VF;
> + xe_rtp_process_tests(test);
> }
>
> static void rtp_to_sr_desc(const struct rtp_to_sr_test_case *t, char *desc)
> @@ -499,6 +605,7 @@ static void rtp_desc(const struct rtp_test_case *t, char *desc)
> }
>
> KUNIT_ARRAY_PARAM(rtp, rtp_cases, rtp_desc);
> +KUNIT_ARRAY_PARAM(sriov, sriov_cases, rtp_desc);
>
> static int xe_rtp_test_init(struct kunit *test)
> {
> @@ -533,6 +640,9 @@ static void xe_rtp_test_exit(struct kunit *test)
> static struct kunit_case xe_rtp_tests[] = {
> KUNIT_CASE_PARAM(xe_rtp_process_to_sr_tests, rtp_to_sr_gen_params),
> KUNIT_CASE_PARAM(xe_rtp_process_tests, rtp_gen_params),
> + KUNIT_CASE_PARAM(xe_rtp_process_tests, sriov_gen_params),
> + KUNIT_CASE_PARAM(xe_rtp_process_tests_pf, sriov_gen_params),
> + KUNIT_CASE_PARAM(xe_rtp_process_tests_vf, sriov_gen_params),
> {}
> };
>
> --
> 2.47.1
>
--
Matt Roper
Graphics Software Engineer
Linux GPU Platform Enablement
Intel Corporation
next prev parent reply other threads:[~2025-02-24 22:56 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-24 15:06 [PATCH v2 0/5] *Prepare RTP to define SR-IOV specific rules Michal Wajdeczko
2025-02-24 15:06 ` [PATCH v2 1/5] drm/xe/rtp: Prepare " Michal Wajdeczko
2025-02-24 19:41 ` Matt Roper
2025-02-24 23:36 ` Michal Wajdeczko
2025-02-25 3:04 ` Matt Roper
2025-02-26 14:24 ` Michał Winiarski
2025-02-24 15:06 ` [PATCH v2 2/5] drm/xe/sriov: Prepare IS_SRIOV_PF to accept const pointer Michal Wajdeczko
2025-02-24 22:39 ` Matt Roper
2025-02-24 15:06 ` [PATCH v2 3/5] drm/xe/kunit: Export xe_step_name for KUNIT Michal Wajdeczko
2025-02-24 22:45 ` Matt Roper
2025-02-24 15:06 ` [PATCH v2 4/5] drm/xe/kunit: Update RTP tests with SR-IOV rules Michal Wajdeczko
2025-02-24 22:55 ` Matt Roper [this message]
2025-02-24 23:41 ` Michal Wajdeczko
2025-02-25 3:10 ` Matt Roper
2025-02-25 15:09 ` Michal Wajdeczko
2025-02-25 23:07 ` Matt Roper
2025-02-24 15:07 ` [PATCH v2 5/5] drm/xe/rtp: Remove redundant rule to omit VF Michal Wajdeczko
2025-02-24 22:56 ` Matt Roper
2025-02-24 20:58 ` ✓ CI.Patch_applied: success for *Prepare RTP to define SR-IOV specific rules Patchwork
2025-02-24 20:58 ` ✓ CI.checkpatch: " Patchwork
2025-02-24 21:00 ` ✓ CI.KUnit: " Patchwork
2025-02-24 21:16 ` ✓ CI.Build: " Patchwork
2025-02-24 21:18 ` ✗ CI.Hooks: failure " Patchwork
2025-02-24 21:20 ` ✓ CI.checksparse: success " Patchwork
2025-02-25 6:41 ` ✓ Xe.CI.BAT: " Patchwork
2025-02-25 8:07 ` ✗ Xe.CI.Full: failure " 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=20250224225528.GD4460@mdroper-desk1.amr.corp.intel.com \
--to=matthew.d.roper@intel.com \
--cc=intel-xe@lists.freedesktop.org \
--cc=lucas.demarchi@intel.com \
--cc=michal.wajdeczko@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