Loading...
Note: File does not exist in v3.1.
1/* SPDX-License-Identifier: MIT */
2/*
3 * Copyright © 2008-2018 Intel Corporation
4 */
5
6#ifndef I915_RESET_H
7#define I915_RESET_H
8
9#include <linux/compiler.h>
10#include <linux/types.h>
11#include <linux/srcu.h>
12
13#include "intel_engine_types.h"
14#include "intel_reset_types.h"
15
16struct i915_request;
17struct intel_engine_cs;
18struct intel_gt;
19struct intel_guc;
20
21void intel_gt_init_reset(struct intel_gt *gt);
22void intel_gt_fini_reset(struct intel_gt *gt);
23
24__printf(4, 5)
25void intel_gt_handle_error(struct intel_gt *gt,
26 intel_engine_mask_t engine_mask,
27 unsigned long flags,
28 const char *fmt, ...);
29#define I915_ERROR_CAPTURE BIT(0)
30
31void intel_gt_reset(struct intel_gt *gt,
32 intel_engine_mask_t stalled_mask,
33 const char *reason);
34int intel_engine_reset(struct intel_engine_cs *engine,
35 const char *reason);
36int __intel_engine_reset_bh(struct intel_engine_cs *engine,
37 const char *reason);
38
39void __i915_request_reset(struct i915_request *rq, bool guilty);
40
41int __must_check intel_gt_reset_trylock(struct intel_gt *gt, int *srcu);
42void intel_gt_reset_unlock(struct intel_gt *gt, int tag);
43
44void intel_gt_set_wedged(struct intel_gt *gt);
45bool intel_gt_unset_wedged(struct intel_gt *gt);
46int intel_gt_terminally_wedged(struct intel_gt *gt);
47
48/*
49 * There's no unset_wedged_on_init paired with this one.
50 * Once we're wedged on init, there's no going back.
51 * Same thing for unset_wedged_on_fini.
52 */
53void intel_gt_set_wedged_on_init(struct intel_gt *gt);
54void intel_gt_set_wedged_on_fini(struct intel_gt *gt);
55
56int __intel_gt_reset(struct intel_gt *gt, intel_engine_mask_t engine_mask);
57
58int intel_reset_guc(struct intel_gt *gt);
59
60struct intel_wedge_me {
61 struct delayed_work work;
62 struct intel_gt *gt;
63 const char *name;
64};
65
66void __intel_init_wedge(struct intel_wedge_me *w,
67 struct intel_gt *gt,
68 long timeout,
69 const char *name);
70void __intel_fini_wedge(struct intel_wedge_me *w);
71
72#define intel_wedge_on_timeout(W, GT, TIMEOUT) \
73 for (__intel_init_wedge((W), (GT), (TIMEOUT), __func__); \
74 (W)->gt; \
75 __intel_fini_wedge((W)))
76
77bool intel_has_gpu_reset(const struct intel_gt *gt);
78bool intel_has_reset_engine(const struct intel_gt *gt);
79
80#endif /* I915_RESET_H */