treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / drivers / gpu / drm / i915 / gt / intel_reset.h
blob8e8d5f7611665904565275c99f6037bd206e1709
1 /*
2 * SPDX-License-Identifier: MIT
4 * Copyright © 2008-2018 Intel Corporation
5 */
7 #ifndef I915_RESET_H
8 #define I915_RESET_H
10 #include <linux/compiler.h>
11 #include <linux/types.h>
12 #include <linux/srcu.h>
14 #include "intel_engine_types.h"
15 #include "intel_reset_types.h"
17 struct i915_request;
18 struct intel_engine_cs;
19 struct intel_gt;
20 struct intel_guc;
22 void intel_gt_init_reset(struct intel_gt *gt);
23 void intel_gt_fini_reset(struct intel_gt *gt);
25 __printf(4, 5)
26 void intel_gt_handle_error(struct intel_gt *gt,
27 intel_engine_mask_t engine_mask,
28 unsigned long flags,
29 const char *fmt, ...);
30 #define I915_ERROR_CAPTURE BIT(0)
32 void intel_gt_reset(struct intel_gt *gt,
33 intel_engine_mask_t stalled_mask,
34 const char *reason);
35 int intel_engine_reset(struct intel_engine_cs *engine,
36 const char *reason);
38 void __i915_request_reset(struct i915_request *rq, bool guilty);
40 int __must_check intel_gt_reset_trylock(struct intel_gt *gt, int *srcu);
41 void intel_gt_reset_unlock(struct intel_gt *gt, int tag);
43 void intel_gt_set_wedged(struct intel_gt *gt);
44 bool intel_gt_unset_wedged(struct intel_gt *gt);
45 int intel_gt_terminally_wedged(struct intel_gt *gt);
48 * There's no unset_wedged_on_init paired with this one.
49 * Once we're wedged on init, there's no going back.
51 void intel_gt_set_wedged_on_init(struct intel_gt *gt);
53 int __intel_gt_reset(struct intel_gt *gt, intel_engine_mask_t engine_mask);
55 int intel_reset_guc(struct intel_gt *gt);
57 struct intel_wedge_me {
58 struct delayed_work work;
59 struct intel_gt *gt;
60 const char *name;
63 void __intel_init_wedge(struct intel_wedge_me *w,
64 struct intel_gt *gt,
65 long timeout,
66 const char *name);
67 void __intel_fini_wedge(struct intel_wedge_me *w);
69 #define intel_wedge_on_timeout(W, GT, TIMEOUT) \
70 for (__intel_init_wedge((W), (GT), (TIMEOUT), __func__); \
71 (W)->gt; \
72 __intel_fini_wedge((W)))
74 static inline bool __intel_reset_failed(const struct intel_reset *reset)
76 GEM_BUG_ON(test_bit(I915_WEDGED_ON_INIT, &reset->flags) ?
77 !test_bit(I915_WEDGED, &reset->flags) : false);
79 return unlikely(test_bit(I915_WEDGED, &reset->flags));
82 bool intel_has_gpu_reset(const struct intel_gt *gt);
83 bool intel_has_reset_engine(const struct intel_gt *gt);
85 #endif /* I915_RESET_H */