Commit 0d68d065 authored by Ruthuvikas Ravikumar's avatar Ruthuvikas Ravikumar Committed by Matt Roper
Browse files

drm/xe: Add mocs reset kunit



This kunit verifies the mocs registers content
with the KMD programmed values before and after
GT reset.

v2: Remove extra blank lines between the local variables
definitions (Matt Roper)

Cc: Matt Roper <matthew.d.roper@intel.com>
Signed-off-by: default avatarRuthuvikas Ravikumar <ruthuvikas.ravikumar@intel.com>
Signed-off-by: default avatarJanga Rahul Kumar <janga.rahul.kumar@intel.com>
Reviewed-by: default avatarMatt Roper <matthew.d.roper@intel.com>
Link: https://lore.kernel.org/r/20231222192352.927101-1-janga.rahul.kumar@intel.com


Signed-off-by: default avatarMatt Roper <matthew.d.roper@intel.com>
parent 26d4481a
Loading
Loading
Loading
Loading
+36 −0
Original line number Diff line number Diff line
@@ -128,3 +128,39 @@ 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;
	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(&gt->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);
+1 −0
Original line number Diff line number Diff line
@@ -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),
	{}
};

+1 −0
Original line number Diff line number Diff line
@@ -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