#include "gem/i915_gem_lmem.h"
#include "gen8_engine_cs.h"
#include "i915_drv.h"
#include "i915_perf.h"
#include "i915_reg.h"
#include "intel_context.h"
#include "intel_engine.h"
#include "intel_engine_regs.h"
#include "intel_gpu_commands.h"
#include "intel_gt.h"
#include "intel_gt_regs.h"
#include "intel_lrc.h"
#include "intel_lrc_reg.h"
#include "intel_ring.h"
#include "shmem_utils.h"
static void set_offsets(u32 *regs,
const u8 *data,
const struct intel_engine_cs *engine,
bool close)
#define NOP(x) (BIT(7) | (x))
#define LRI(count, flags) ((flags) << 6 | (count) | BUILD_BUG_ON_ZERO(count >= BIT(6)))
#define POSTED BIT(0)
#define REG(x) (((x) >> 2) | BUILD_BUG_ON_ZERO(x >= 0x200))
#define REG16(x) \
(((x) >> 9) | BIT(7) | BUILD_BUG_ON_ZERO(x >= 0x10000)), \
(((x) >> 2) & 0x7f)
#define END 0
{ … }
static const u8 gen8_xcs_offsets[] = …;
static const u8 gen9_xcs_offsets[] = …;
static const u8 gen12_xcs_offsets[] = …;
static const u8 dg2_xcs_offsets[] = …;
static const u8 gen8_rcs_offsets[] = …;
static const u8 gen9_rcs_offsets[] = …;
static const u8 gen11_rcs_offsets[] = …;
static const u8 gen12_rcs_offsets[] = …;
static const u8 dg2_rcs_offsets[] = …;
static const u8 mtl_rcs_offsets[] = …;
#undef END
#undef REG16
#undef REG
#undef LRI
#undef NOP
static const u8 *reg_offsets(const struct intel_engine_cs *engine)
{ … }
static int lrc_ring_mi_mode(const struct intel_engine_cs *engine)
{ … }
static int lrc_ring_bb_offset(const struct intel_engine_cs *engine)
{ … }
static int lrc_ring_gpr0(const struct intel_engine_cs *engine)
{ … }
static int lrc_ring_wa_bb_per_ctx(const struct intel_engine_cs *engine)
{ … }
static int lrc_ring_indirect_ptr(const struct intel_engine_cs *engine)
{ … }
static int lrc_ring_indirect_offset(const struct intel_engine_cs *engine)
{ … }
static int lrc_ring_cmd_buf_cctl(const struct intel_engine_cs *engine)
{ … }
static u32
lrc_ring_indirect_offset_default(const struct intel_engine_cs *engine)
{ … }
static void
lrc_setup_bb_per_ctx(u32 *regs,
const struct intel_engine_cs *engine,
u32 ctx_bb_ggtt_addr)
{ … }
static void
lrc_setup_indirect_ctx(u32 *regs,
const struct intel_engine_cs *engine,
u32 ctx_bb_ggtt_addr,
u32 size)
{ … }
static bool ctx_needs_runalone(const struct intel_context *ce)
{ … }
static void init_common_regs(u32 * const regs,
const struct intel_context *ce,
const struct intel_engine_cs *engine,
bool inhibit)
{ … }
static void init_wa_bb_regs(u32 * const regs,
const struct intel_engine_cs *engine)
{ … }
static void init_ppgtt_regs(u32 *regs, const struct i915_ppgtt *ppgtt)
{ … }
static struct i915_ppgtt *vm_alias(struct i915_address_space *vm)
{ … }
static void __reset_stop_ring(u32 *regs, const struct intel_engine_cs *engine)
{ … }
static void __lrc_init_regs(u32 *regs,
const struct intel_context *ce,
const struct intel_engine_cs *engine,
bool inhibit)
{ … }
void lrc_init_regs(const struct intel_context *ce,
const struct intel_engine_cs *engine,
bool inhibit)
{ … }
void lrc_reset_regs(const struct intel_context *ce,
const struct intel_engine_cs *engine)
{ … }
static void
set_redzone(void *vaddr, const struct intel_engine_cs *engine)
{ … }
static void
check_redzone(const void *vaddr, const struct intel_engine_cs *engine)
{ … }
static u32 context_wa_bb_offset(const struct intel_context *ce)
{ … }
static u32 *context_wabb(const struct intel_context *ce, bool per_ctx)
{ … }
void lrc_init_state(struct intel_context *ce,
struct intel_engine_cs *engine,
void *state)
{ … }
u32 lrc_indirect_bb(const struct intel_context *ce)
{ … }
static u32 *setup_predicate_disable_wa(const struct intel_context *ce, u32 *cs)
{ … }
static struct i915_vma *
__lrc_alloc_state(struct intel_context *ce, struct intel_engine_cs *engine)
{ … }
static struct intel_timeline *
pinned_timeline(struct intel_context *ce, struct intel_engine_cs *engine)
{ … }
int lrc_alloc(struct intel_context *ce, struct intel_engine_cs *engine)
{ … }
void lrc_reset(struct intel_context *ce)
{ … }
int
lrc_pre_pin(struct intel_context *ce,
struct intel_engine_cs *engine,
struct i915_gem_ww_ctx *ww,
void **vaddr)
{ … }
int
lrc_pin(struct intel_context *ce,
struct intel_engine_cs *engine,
void *vaddr)
{ … }
void lrc_unpin(struct intel_context *ce)
{ … }
void lrc_post_unpin(struct intel_context *ce)
{ … }
void lrc_fini(struct intel_context *ce)
{ … }
void lrc_destroy(struct kref *kref)
{ … }
static u32 *
gen12_emit_timestamp_wa(const struct intel_context *ce, u32 *cs)
{ … }
static u32 *
gen12_emit_restore_scratch(const struct intel_context *ce, u32 *cs)
{ … }
static u32 *
gen12_emit_cmd_buf_wa(const struct intel_context *ce, u32 *cs)
{ … }
static u32 *
dg2_emit_draw_watermark_setting(u32 *cs)
{ … }
static u32 *
gen12_invalidate_state_cache(u32 *cs)
{ … }
static u32 *
gen12_emit_indirect_ctx_rcs(const struct intel_context *ce, u32 *cs)
{ … }
static u32 *
gen12_emit_indirect_ctx_xcs(const struct intel_context *ce, u32 *cs)
{ … }
static u32 *xehp_emit_fastcolor_blt_wabb(const struct intel_context *ce, u32 *cs)
{ … }
static u32 *
xehp_emit_per_ctx_bb(const struct intel_context *ce, u32 *cs)
{ … }
static void
setup_per_ctx_bb(const struct intel_context *ce,
const struct intel_engine_cs *engine,
u32 *(*emit)(const struct intel_context *, u32 *))
{ … }
static void
setup_indirect_ctx_bb(const struct intel_context *ce,
const struct intel_engine_cs *engine,
u32 *(*emit)(const struct intel_context *, u32 *))
{ … }
static u32 lrc_descriptor(const struct intel_context *ce)
{ … }
u32 lrc_update_regs(const struct intel_context *ce,
const struct intel_engine_cs *engine,
u32 head)
{ … }
void lrc_update_offsets(struct intel_context *ce,
struct intel_engine_cs *engine)
{ … }
void lrc_check_regs(const struct intel_context *ce,
const struct intel_engine_cs *engine,
const char *when)
{ … }
static u32 *
gen8_emit_flush_coherentl3_wa(struct intel_engine_cs *engine, u32 *batch)
{ … }
static u32 *gen8_init_indirectctx_bb(struct intel_engine_cs *engine, u32 *batch)
{ … }
struct lri { … };
static u32 *emit_lri(u32 *batch, const struct lri *lri, unsigned int count)
{ … }
static u32 *gen9_init_indirectctx_bb(struct intel_engine_cs *engine, u32 *batch)
{ … }
#define CTX_WA_BB_SIZE …
static int lrc_create_wa_ctx(struct intel_engine_cs *engine)
{ … }
void lrc_fini_wa_ctx(struct intel_engine_cs *engine)
{ … }
wa_bb_func_t;
void lrc_init_wa_ctx(struct intel_engine_cs *engine)
{ … }
static void st_runtime_underflow(struct intel_context_stats *stats, s32 dt)
{ … }
static u32 lrc_get_runtime(const struct intel_context *ce)
{ … }
void lrc_update_runtime(struct intel_context *ce)
{ … }
#if IS_ENABLED(CONFIG_DRM_I915_SELFTEST)
#include "selftest_lrc.c"
#endif