File Index
Files and directories
Sign in
FILE

igt_flush_test.c

File preview with syntax highlighting.

linux-6.19.14/drivers/gpu/drm/i915/selftests/igt_flush_test.c C
 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
15int igt_flush_test(struct drm_i915_private *i915)
16{
17	struct intel_gt *gt;
18	unsigned int i;
19	int ret = 0;
20
21	for_each_gt(gt, i915, i) {
22		struct intel_engine_cs *engine;
23		unsigned long timeout_ms = 0;
24		unsigned int id;
25
26		if (intel_gt_is_wedged(gt))
27			ret = -EIO;
28
29		for_each_engine(engine, gt, id) {
30			if (engine->props.preempt_timeout_ms > timeout_ms)
31				timeout_ms = engine->props.preempt_timeout_ms;
32		}
33
34		cond_resched();
35
36		/* 2x longest preempt timeout, experimentally determined */
37		if (intel_gt_wait_for_idle(gt, HZ * timeout_ms / 500) == -ETIME) {
38			pr_err("%pS timed out, cancelling all further testing.\n",
39			       __builtin_return_address(0));
40
41			GEM_TRACE("%pS timed out.\n",
42				  __builtin_return_address(0));
43			GEM_TRACE_DUMP();
44
45			intel_gt_set_wedged(gt);
46			ret = -EIO;
47		}
48	}
49
50	return ret;
51}
~/ Read-only file preview.