treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / drivers / gpu / drm / i915 / gt / intel_gt.h
blob1dac441cb8f4e7d0aa86082e379e0b1e11eb1233
1 /* SPDX-License-Identifier: MIT */
2 /*
3 * Copyright © 2019 Intel Corporation
4 */
6 #ifndef __INTEL_GT__
7 #define __INTEL_GT__
9 #include "intel_engine_types.h"
10 #include "intel_gt_types.h"
11 #include "intel_reset.h"
13 struct drm_i915_private;
15 #define GT_TRACE(gt, fmt, ...) do { \
16 const struct intel_gt *gt__ __maybe_unused = (gt); \
17 GEM_TRACE("%s " fmt, dev_name(gt__->i915->drm.dev), \
18 ##__VA_ARGS__); \
19 } while (0)
21 static inline struct intel_gt *uc_to_gt(struct intel_uc *uc)
23 return container_of(uc, struct intel_gt, uc);
26 static inline struct intel_gt *guc_to_gt(struct intel_guc *guc)
28 return container_of(guc, struct intel_gt, uc.guc);
31 static inline struct intel_gt *huc_to_gt(struct intel_huc *huc)
33 return container_of(huc, struct intel_gt, uc.huc);
36 void intel_gt_init_early(struct intel_gt *gt, struct drm_i915_private *i915);
37 void intel_gt_init_hw_early(struct intel_gt *gt, struct i915_ggtt *ggtt);
38 int __must_check intel_gt_init_hw(struct intel_gt *gt);
39 int intel_gt_init(struct intel_gt *gt);
40 void intel_gt_driver_register(struct intel_gt *gt);
42 void intel_gt_driver_unregister(struct intel_gt *gt);
43 void intel_gt_driver_remove(struct intel_gt *gt);
44 void intel_gt_driver_release(struct intel_gt *gt);
46 void intel_gt_driver_late_release(struct intel_gt *gt);
48 void intel_gt_check_and_clear_faults(struct intel_gt *gt);
49 void intel_gt_clear_error_registers(struct intel_gt *gt,
50 intel_engine_mask_t engine_mask);
52 void intel_gt_flush_ggtt_writes(struct intel_gt *gt);
53 void intel_gt_chipset_flush(struct intel_gt *gt);
55 static inline u32 intel_gt_scratch_offset(const struct intel_gt *gt,
56 enum intel_gt_scratch_field field)
58 return i915_ggtt_offset(gt->scratch) + field;
61 static inline bool intel_gt_is_wedged(const struct intel_gt *gt)
63 return __intel_reset_failed(&gt->reset);
66 static inline bool intel_gt_has_init_error(const struct intel_gt *gt)
68 return test_bit(I915_WEDGED_ON_INIT, &gt->reset.flags);
71 #endif /* __INTEL_GT_H__ */