2 * SPDX-License-Identifier: MIT
4 * Copyright © 2018 Intel Corporation
8 #include "gt/intel_gt_requests.h"
10 #include "../i915_selftest.h"
11 #include "igt_flush_test.h"
12 #include "igt_live_test.h"
14 int igt_live_test_begin(struct igt_live_test
*t
,
15 struct drm_i915_private
*i915
,
19 struct intel_gt
*gt
= &i915
->gt
;
20 struct intel_engine_cs
*engine
;
21 enum intel_engine_id id
;
28 err
= intel_gt_wait_for_idle(gt
, MAX_SCHEDULE_TIMEOUT
);
30 pr_err("%s(%s): failed to idle before, with err=%d!",
35 t
->reset_global
= i915_reset_count(&i915
->gpu_error
);
37 for_each_engine(engine
, gt
, id
)
39 i915_reset_engine_count(&i915
->gpu_error
, engine
);
44 int igt_live_test_end(struct igt_live_test
*t
)
46 struct drm_i915_private
*i915
= t
->i915
;
47 struct intel_engine_cs
*engine
;
48 enum intel_engine_id id
;
50 if (igt_flush_test(i915
))
53 if (t
->reset_global
!= i915_reset_count(&i915
->gpu_error
)) {
54 pr_err("%s(%s): GPU was reset %d times!\n",
56 i915_reset_count(&i915
->gpu_error
) - t
->reset_global
);
60 for_each_engine(engine
, &i915
->gt
, id
) {
61 if (t
->reset_engine
[id
] ==
62 i915_reset_engine_count(&i915
->gpu_error
, engine
))
65 pr_err("%s(%s): engine '%s' was reset %d times!\n",
66 t
->func
, t
->name
, engine
->name
,
67 i915_reset_engine_count(&i915
->gpu_error
, engine
) -