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