1 1.1 riastrad /* $NetBSD: intel_gt.h,v 1.2 2021/12/18 23:45:30 riastradh Exp $ */ 2 1.1 riastrad 3 1.1 riastrad /* SPDX-License-Identifier: MIT */ 4 1.1 riastrad /* 5 1.1 riastrad * Copyright 2019 Intel Corporation 6 1.1 riastrad */ 7 1.1 riastrad 8 1.1 riastrad #ifndef __INTEL_GT__ 9 1.1 riastrad #define __INTEL_GT__ 10 1.1 riastrad 11 1.1 riastrad #include "intel_engine_types.h" 12 1.1 riastrad #include "intel_gt_types.h" 13 1.1 riastrad #include "intel_reset.h" 14 1.1 riastrad 15 1.1 riastrad struct drm_i915_private; 16 1.1 riastrad 17 1.1 riastrad #define GT_TRACE(gt, fmt, ...) do { \ 18 1.1 riastrad const struct intel_gt *gt__ __maybe_unused = (gt); \ 19 1.1 riastrad GEM_TRACE("%s " fmt, dev_name(gt__->i915->drm.dev), \ 20 1.1 riastrad ##__VA_ARGS__); \ 21 1.1 riastrad } while (0) 22 1.1 riastrad 23 1.1 riastrad static inline struct intel_gt *uc_to_gt(struct intel_uc *uc) 24 1.1 riastrad { 25 1.1 riastrad return container_of(uc, struct intel_gt, uc); 26 1.1 riastrad } 27 1.1 riastrad 28 1.1 riastrad static inline struct intel_gt *guc_to_gt(struct intel_guc *guc) 29 1.1 riastrad { 30 1.1 riastrad return container_of(guc, struct intel_gt, uc.guc); 31 1.1 riastrad } 32 1.1 riastrad 33 1.1 riastrad static inline struct intel_gt *huc_to_gt(struct intel_huc *huc) 34 1.1 riastrad { 35 1.1 riastrad return container_of(huc, struct intel_gt, uc.huc); 36 1.1 riastrad } 37 1.1 riastrad 38 1.1 riastrad void intel_gt_init_early(struct intel_gt *gt, struct drm_i915_private *i915); 39 1.1 riastrad void intel_gt_init_hw_early(struct intel_gt *gt, struct i915_ggtt *ggtt); 40 1.1 riastrad int __must_check intel_gt_init_hw(struct intel_gt *gt); 41 1.1 riastrad int intel_gt_init(struct intel_gt *gt); 42 1.1 riastrad void intel_gt_driver_register(struct intel_gt *gt); 43 1.1 riastrad 44 1.1 riastrad void intel_gt_driver_unregister(struct intel_gt *gt); 45 1.1 riastrad void intel_gt_driver_remove(struct intel_gt *gt); 46 1.1 riastrad void intel_gt_driver_release(struct intel_gt *gt); 47 1.1 riastrad 48 1.1 riastrad void intel_gt_driver_late_release(struct intel_gt *gt); 49 1.1 riastrad 50 1.1 riastrad void intel_gt_check_and_clear_faults(struct intel_gt *gt); 51 1.1 riastrad void intel_gt_clear_error_registers(struct intel_gt *gt, 52 1.1 riastrad intel_engine_mask_t engine_mask); 53 1.1 riastrad 54 1.1 riastrad void intel_gt_flush_ggtt_writes(struct intel_gt *gt); 55 1.1 riastrad void intel_gt_chipset_flush(struct intel_gt *gt); 56 1.1 riastrad 57 1.1 riastrad static inline u32 intel_gt_scratch_offset(const struct intel_gt *gt, 58 1.1 riastrad enum intel_gt_scratch_field field) 59 1.1 riastrad { 60 1.1 riastrad return i915_ggtt_offset(gt->scratch) + field; 61 1.1 riastrad } 62 1.1 riastrad 63 1.1 riastrad static inline bool intel_gt_is_wedged(const struct intel_gt *gt) 64 1.1 riastrad { 65 1.1 riastrad return __intel_reset_failed(>->reset); 66 1.1 riastrad } 67 1.1 riastrad 68 1.1 riastrad static inline bool intel_gt_has_init_error(const struct intel_gt *gt) 69 1.1 riastrad { 70 1.1 riastrad return test_bit(I915_WEDGED_ON_INIT, >->reset.flags); 71 1.1 riastrad } 72 1.1 riastrad 73 1.1 riastrad #endif /* __INTEL_GT_H__ */ 74