[PATCH] drm/xe: Add mocs reset kunit
Matt Roper
matthew.d.roper at intel.com
Fri Dec 22 18:13:48 UTC 2023
On Fri, Dec 22, 2023 at 07:22:23AM +0530, Janga Rahul Kumar wrote:
> From: Ruthuvikas Ravikumar <ruthuvikas.ravikumar at intel.com>
>
> This kunit verifies the mocs registers content
> with the KMD programmed values before and after
> GT reset.
>
> Cc: Mathew D Roper <matthew.d.roper at intel.com>
> Signed-off-by: Ruthuvikas Ravikumar <ruthuvikas.ravikumar at intel.com>
> Signed-off-by: Janga Rahul Kumar <janga.rahul.kumar at intel.com>
> ---
> drivers/gpu/drm/xe/tests/xe_mocs.c | 38 +++++++++++++++++++++++++
> drivers/gpu/drm/xe/tests/xe_mocs_test.c | 1 +
> drivers/gpu/drm/xe/tests/xe_mocs_test.h | 1 +
> 3 files changed, 40 insertions(+)
>
> diff --git a/drivers/gpu/drm/xe/tests/xe_mocs.c b/drivers/gpu/drm/xe/tests/xe_mocs.c
> index 7dd34f94e809..98dd63031c5c 100644
> --- a/drivers/gpu/drm/xe/tests/xe_mocs.c
> +++ b/drivers/gpu/drm/xe/tests/xe_mocs.c
> @@ -128,3 +128,41 @@ void xe_live_mocs_kernel_kunit(struct kunit *test)
> xe_call_for_each_device(mocs_kernel_test_run_device);
> }
> EXPORT_SYMBOL_IF_KUNIT(xe_live_mocs_kernel_kunit);
> +
> +static int mocs_reset_test_run_device(struct xe_device *xe)
> +{
> + /* Check the mocs setup is retained over GT reset */
> +
> + struct live_mocs mocs;
> + struct xe_gt *gt;
> +
> + unsigned int flags;
> + int id;
> +
Minor nitpick: there probably shouldn't be extra blank lines between
the various local variables definitions here.
Aside from that,
Reviewed-by: Matt Roper <matthew.d.roper at intel.com>
> + struct kunit *test = xe_cur_kunit();
> +
> + for_each_gt(gt, xe, id) {
> + flags = live_mocs_init(&mocs, gt);
> + kunit_info(test, "mocs_reset_test before reset\n");
> + if (flags & HAS_GLOBAL_MOCS)
> + read_mocs_table(gt, &mocs.table);
> + if (flags & HAS_LNCF_MOCS)
> + read_l3cc_table(gt, &mocs.table);
> +
> + xe_gt_reset_async(gt);
> + flush_work(>->reset.worker);
> +
> + kunit_info(test, "mocs_reset_test after reset\n");
> + if (flags & HAS_GLOBAL_MOCS)
> + read_mocs_table(gt, &mocs.table);
> + if (flags & HAS_LNCF_MOCS)
> + read_l3cc_table(gt, &mocs.table);
> + }
> + return 0;
> +}
> +
> +void xe_live_mocs_reset_kunit(struct kunit *test)
> +{
> + xe_call_for_each_device(mocs_reset_test_run_device);
> +}
> +EXPORT_SYMBOL_IF_KUNIT(xe_live_mocs_reset_kunit);
> diff --git a/drivers/gpu/drm/xe/tests/xe_mocs_test.c b/drivers/gpu/drm/xe/tests/xe_mocs_test.c
> index ef56bd517b28..4f62e7a4270b 100644
> --- a/drivers/gpu/drm/xe/tests/xe_mocs_test.c
> +++ b/drivers/gpu/drm/xe/tests/xe_mocs_test.c
> @@ -9,6 +9,7 @@
>
> static struct kunit_case xe_mocs_tests[] = {
> KUNIT_CASE(xe_live_mocs_kernel_kunit),
> + KUNIT_CASE(xe_live_mocs_reset_kunit),
> {}
> };
>
> diff --git a/drivers/gpu/drm/xe/tests/xe_mocs_test.h b/drivers/gpu/drm/xe/tests/xe_mocs_test.h
> index 7faa3575e6c3..e7699d495411 100644
> --- a/drivers/gpu/drm/xe/tests/xe_mocs_test.h
> +++ b/drivers/gpu/drm/xe/tests/xe_mocs_test.h
> @@ -9,5 +9,6 @@
> struct kunit;
>
> void xe_live_mocs_kernel_kunit(struct kunit *test);
> +void xe_live_mocs_reset_kunit(struct kunit *test);
>
> #endif
> --
> 2.25.1
>
--
Matt Roper
Graphics Software Engineer
Linux GPU Platform Enablement
Intel Corporation
More information about the Intel-xe
mailing list