1 /*
2  * SPDX-License-Identifier: MIT
3  *
4  * Copyright © 2018 Intel Corporation
5  */
6 
7 #include "gt/intel_gt.h"
8 #include "gt/intel_gt_requests.h"
9 
10 #include "i915_drv.h"
11 #include "i915_selftest.h"
12 
13 #include "igt_flush_test.h"
14 
igt_flush_test(struct drm_i915_private * i915)15 int igt_flush_test(struct drm_i915_private *i915)
16 {
17 	struct intel_gt *gt = to_gt(i915);
18 	int ret = intel_gt_is_wedged(gt) ? -EIO : 0;
19 
20 	cond_resched();
21 
22 	if (intel_gt_wait_for_idle(gt, HZ * 3) == -ETIME) {
23 		pr_err("%pS timed out, cancelling all further testing.\n",
24 		       __builtin_return_address(0));
25 
26 		GEM_TRACE("%pS timed out.\n",
27 			  __builtin_return_address(0));
28 		GEM_TRACE_DUMP();
29 
30 		intel_gt_set_wedged(gt);
31 		ret = -EIO;
32 	}
33 
34 	return ret;
35 }
36