Commit 0c29efa2 authored by Tejas Upadhyay's avatar Tejas Upadhyay Committed by Andi Shyti
Browse files

drm/i915/selftests: Consider multi-gt instead of to_gt()



In order to enable complete multi-GT, loop through all
the GTs, rather than relying on the to_gt(), which only
provides a reference to the primary GT.

Problem appear when it runs on platform like MTL where
different set of engines are possible on different GTs.

Signed-off-by: default avatarTejas Upadhyay <tejas.upadhyay@intel.com>
Reviewed-by: default avatarAndi Shyti <andi.shyti@linux.intel.com>
Signed-off-by: default avatarAndi Shyti <andi.shyti@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230419060036.3422635-4-tejas.upadhyay@intel.com
parent a347279d
Loading
Loading
Loading
Loading
+27 −19
Original line number Diff line number Diff line
@@ -16,15 +16,18 @@ int igt_live_test_begin(struct igt_live_test *t,
			const char *func,
			const char *name)
{
	struct intel_gt *gt = to_gt(i915);
	struct intel_engine_cs *engine;
	enum intel_engine_id id;
	struct intel_gt *gt;
	unsigned int i;
	int err;

	t->i915 = i915;
	t->func = func;
	t->name = name;

	for_each_gt(gt, i915, i) {

		err = intel_gt_wait_for_idle(gt, MAX_SCHEDULE_TIMEOUT);
		if (err) {
			pr_err("%s(%s): failed to idle before, with err=%d!",
@@ -32,11 +35,12 @@ int igt_live_test_begin(struct igt_live_test *t,
			return err;
		}

	t->reset_global = i915_reset_count(&i915->gpu_error);

		for_each_engine(engine, gt, id)
			t->reset_engine[id] =
			i915_reset_engine_count(&i915->gpu_error, engine);
	}

	t->reset_global = i915_reset_count(&i915->gpu_error);

	return 0;
}
@@ -46,6 +50,8 @@ int igt_live_test_end(struct igt_live_test *t)
	struct drm_i915_private *i915 = t->i915;
	struct intel_engine_cs *engine;
	enum intel_engine_id id;
	struct intel_gt *gt;
	unsigned int i;

	if (igt_flush_test(i915))
		return -EIO;
@@ -57,7 +63,8 @@ int igt_live_test_end(struct igt_live_test *t)
		return -EIO;
	}

	for_each_engine(engine, to_gt(i915), id) {
	for_each_gt(gt, i915, i) {
		for_each_engine(engine, gt, id) {
			if (t->reset_engine[id] ==
			    i915_reset_engine_count(&i915->gpu_error, engine))
				continue;
@@ -68,6 +75,7 @@ int igt_live_test_end(struct igt_live_test *t)
			       t->reset_engine[id]);
			return -EIO;
		}
	}

	return 0;
}