2019-06-21 14:07:41 +07:00
|
|
|
/* SPDX-License-Identifier: MIT */
|
|
|
|
/*
|
|
|
|
* Copyright © 2019 Intel Corporation
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __INTEL_GT__
|
|
|
|
#define __INTEL_GT__
|
|
|
|
|
2019-06-21 14:07:44 +07:00
|
|
|
#include "intel_engine_types.h"
|
2019-06-21 14:07:41 +07:00
|
|
|
#include "intel_gt_types.h"
|
2019-07-13 02:29:53 +07:00
|
|
|
#include "intel_reset.h"
|
2019-06-21 14:07:41 +07:00
|
|
|
|
2019-06-21 14:07:42 +07:00
|
|
|
struct drm_i915_private;
|
|
|
|
|
2019-12-17 01:53:32 +07:00
|
|
|
#define GT_TRACE(gt, fmt, ...) do { \
|
|
|
|
const struct intel_gt *gt__ __maybe_unused = (gt); \
|
2020-01-16 19:57:49 +07:00
|
|
|
GEM_TRACE("%s " fmt, dev_name(gt__->i915->drm.dev), \
|
2019-12-13 22:51:52 +07:00
|
|
|
##__VA_ARGS__); \
|
|
|
|
} while (0)
|
|
|
|
|
2019-07-13 17:00:13 +07:00
|
|
|
static inline struct intel_gt *uc_to_gt(struct intel_uc *uc)
|
|
|
|
{
|
|
|
|
return container_of(uc, struct intel_gt, uc);
|
|
|
|
}
|
|
|
|
|
2019-07-13 17:00:14 +07:00
|
|
|
static inline struct intel_gt *guc_to_gt(struct intel_guc *guc)
|
|
|
|
{
|
|
|
|
return container_of(guc, struct intel_gt, uc.guc);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline struct intel_gt *huc_to_gt(struct intel_huc *huc)
|
|
|
|
{
|
|
|
|
return container_of(huc, struct intel_gt, uc.huc);
|
|
|
|
}
|
|
|
|
|
2019-06-21 14:07:42 +07:00
|
|
|
void intel_gt_init_early(struct intel_gt *gt, struct drm_i915_private *i915);
|
2019-11-01 21:10:06 +07:00
|
|
|
void intel_gt_init_hw_early(struct intel_gt *gt, struct i915_ggtt *ggtt);
|
2019-09-10 21:38:20 +07:00
|
|
|
int __must_check intel_gt_init_hw(struct intel_gt *gt);
|
2019-09-05 18:14:03 +07:00
|
|
|
int intel_gt_init(struct intel_gt *gt);
|
|
|
|
void intel_gt_driver_register(struct intel_gt *gt);
|
|
|
|
|
|
|
|
void intel_gt_driver_unregister(struct intel_gt *gt);
|
|
|
|
void intel_gt_driver_remove(struct intel_gt *gt);
|
|
|
|
void intel_gt_driver_release(struct intel_gt *gt);
|
2019-06-21 14:07:41 +07:00
|
|
|
|
2019-08-01 07:57:07 +07:00
|
|
|
void intel_gt_driver_late_release(struct intel_gt *gt);
|
2019-07-13 02:29:53 +07:00
|
|
|
|
2019-06-21 14:07:44 +07:00
|
|
|
void intel_gt_check_and_clear_faults(struct intel_gt *gt);
|
|
|
|
void intel_gt_clear_error_registers(struct intel_gt *gt,
|
|
|
|
intel_engine_mask_t engine_mask);
|
|
|
|
|
2019-06-21 14:08:01 +07:00
|
|
|
void intel_gt_flush_ggtt_writes(struct intel_gt *gt);
|
2019-06-21 14:08:02 +07:00
|
|
|
void intel_gt_chipset_flush(struct intel_gt *gt);
|
2019-06-21 14:08:01 +07:00
|
|
|
|
2019-07-09 19:33:43 +07:00
|
|
|
static inline u32 intel_gt_scratch_offset(const struct intel_gt *gt,
|
|
|
|
enum intel_gt_scratch_field field)
|
2019-06-21 14:08:11 +07:00
|
|
|
{
|
2019-07-09 19:33:43 +07:00
|
|
|
return i915_ggtt_offset(gt->scratch) + field;
|
2019-06-21 14:08:11 +07:00
|
|
|
}
|
|
|
|
|
2019-12-27 02:12:37 +07:00
|
|
|
static inline bool intel_gt_is_wedged(const struct intel_gt *gt)
|
2019-07-13 02:29:53 +07:00
|
|
|
{
|
|
|
|
return __intel_reset_failed(>->reset);
|
|
|
|
}
|
|
|
|
|
2019-12-27 02:12:37 +07:00
|
|
|
static inline bool intel_gt_has_init_error(const struct intel_gt *gt)
|
|
|
|
{
|
|
|
|
return test_bit(I915_WEDGED_ON_INIT, >->reset.flags);
|
|
|
|
}
|
|
|
|
|
2019-06-21 14:07:41 +07:00
|
|
|
#endif /* __INTEL_GT_H__ */
|