drm/i915/gt: Use intel_gt as the primary object for handling resets
[linux-2.6-block.git] / drivers / gpu / drm / i915 / gt / intel_gt.h
1 /* SPDX-License-Identifier: MIT */
2 /*
3  * Copyright © 2019 Intel Corporation
4  */
5
6 #ifndef __INTEL_GT__
7 #define __INTEL_GT__
8
9 #include "intel_engine_types.h"
10 #include "intel_gt_types.h"
11 #include "intel_reset.h"
12
13 struct drm_i915_private;
14
15 void intel_gt_init_early(struct intel_gt *gt, struct drm_i915_private *i915);
16 void intel_gt_init_hw(struct drm_i915_private *i915);
17
18 void intel_gt_cleanup_early(struct intel_gt *gt);
19
20 void intel_gt_check_and_clear_faults(struct intel_gt *gt);
21 void intel_gt_clear_error_registers(struct intel_gt *gt,
22                                     intel_engine_mask_t engine_mask);
23
24 void intel_gt_flush_ggtt_writes(struct intel_gt *gt);
25 void intel_gt_chipset_flush(struct intel_gt *gt);
26
27 void intel_gt_init_hangcheck(struct intel_gt *gt);
28
29 int intel_gt_init_scratch(struct intel_gt *gt, unsigned int size);
30 void intel_gt_fini_scratch(struct intel_gt *gt);
31
32 static inline u32 intel_gt_scratch_offset(const struct intel_gt *gt,
33                                           enum intel_gt_scratch_field field)
34 {
35         return i915_ggtt_offset(gt->scratch) + field;
36 }
37
38 static inline bool intel_gt_is_wedged(struct intel_gt *gt)
39 {
40         return __intel_reset_failed(&gt->reset);
41 }
42
43 void intel_gt_queue_hangcheck(struct intel_gt *gt);
44
45 #endif /* __INTEL_GT_H__ */