Loading...
Note: File does not exist in v3.1.
1/*
2 * SPDX-License-Identifier: MIT
3 *
4 * Copyright © 2018 Intel Corporation
5 */
6
7#include "gem/i915_gem_context.h"
8#include "gt/intel_gt.h"
9
10#include "i915_drv.h"
11#include "i915_selftest.h"
12
13#include "igt_flush_test.h"
14
15int igt_flush_test(struct drm_i915_private *i915, unsigned int flags)
16{
17 int ret = intel_gt_is_wedged(&i915->gt) ? -EIO : 0;
18 int repeat = !!(flags & I915_WAIT_LOCKED);
19
20 cond_resched();
21
22 do {
23 if (i915_gem_wait_for_idle(i915, flags, HZ / 5) == -ETIME) {
24 pr_err("%pS timed out, cancelling all further testing.\n",
25 __builtin_return_address(0));
26
27 GEM_TRACE("%pS timed out.\n",
28 __builtin_return_address(0));
29 GEM_TRACE_DUMP();
30
31 intel_gt_set_wedged(&i915->gt);
32 repeat = 0;
33 ret = -EIO;
34 }
35
36 /* Ensure we also flush after wedging. */
37 if (flags & I915_WAIT_LOCKED)
38 i915_retire_requests(i915);
39 } while (repeat--);
40
41 return ret;
42}