2 * SPDX-License-Identifier: MIT
4 * Copyright © 2018 Intel Corporation
7 #include "../i915_drv.h"
9 #include "../i915_selftest.h"
10 #include "igt_flush_test.h"
12 int igt_flush_test(struct drm_i915_private *i915, unsigned int flags)
16 if (flags & I915_WAIT_LOCKED &&
17 i915_gem_switch_to_kernel_context(i915)) {
18 pr_err("Failed to switch back to kernel context; declaring wedged\n");
19 i915_gem_set_wedged(i915);
22 if (i915_gem_wait_for_idle(i915, flags, HZ / 5) == -ETIME) {
23 pr_err("%pS timed out, cancelling all further testing.\n",
24 __builtin_return_address(0));
26 GEM_TRACE("%pS timed out.\n", __builtin_return_address(0));
29 i915_gem_set_wedged(i915);
32 return i915_terminally_wedged(&i915->gpu_error) ? -EIO : 0;