Merge tag 'dmaengine-5.1-rc1' of git://git.infradead.org/users/vkoul/slave-dma
[linux-2.6-microblaze.git] / drivers / gpu / drm / i915 / i915_reset.h
1 /*
2  * SPDX-License-Identifier: MIT
3  *
4  * Copyright © 2008-2018 Intel Corporation
5  */
6
7 #ifndef I915_RESET_H
8 #define I915_RESET_H
9
10 #include <linux/compiler.h>
11 #include <linux/types.h>
12
13 struct drm_i915_private;
14 struct intel_engine_cs;
15 struct intel_guc;
16
17 __printf(4, 5)
18 void i915_handle_error(struct drm_i915_private *i915,
19                        u32 engine_mask,
20                        unsigned long flags,
21                        const char *fmt, ...);
22 #define I915_ERROR_CAPTURE BIT(0)
23
24 void i915_clear_error_registers(struct drm_i915_private *i915);
25
26 void i915_reset(struct drm_i915_private *i915,
27                 unsigned int stalled_mask,
28                 const char *reason);
29 int i915_reset_engine(struct intel_engine_cs *engine,
30                       const char *reason);
31
32 void i915_reset_request(struct i915_request *rq, bool guilty);
33 bool i915_reset_flush(struct drm_i915_private *i915);
34
35 bool intel_has_gpu_reset(struct drm_i915_private *i915);
36 bool intel_has_reset_engine(struct drm_i915_private *i915);
37
38 int intel_gpu_reset(struct drm_i915_private *i915, u32 engine_mask);
39
40 int intel_reset_guc(struct drm_i915_private *i915);
41
42 struct i915_wedge_me {
43         struct delayed_work work;
44         struct drm_i915_private *i915;
45         const char *name;
46 };
47
48 void __i915_init_wedge(struct i915_wedge_me *w,
49                        struct drm_i915_private *i915,
50                        long timeout,
51                        const char *name);
52 void __i915_fini_wedge(struct i915_wedge_me *w);
53
54 #define i915_wedge_on_timeout(W, DEV, TIMEOUT)                          \
55         for (__i915_init_wedge((W), (DEV), (TIMEOUT), __func__);        \
56              (W)->i915;                                                 \
57              __i915_fini_wedge((W)))
58
59 #endif /* I915_RESET_H */