Linux Audio

Check our new training course

Loading...
v6.13.7
  1/* SPDX-License-Identifier: MIT */
  2/*
  3 * Copyright © 2021 Intel Corporation
  4 */
  5#ifndef _XE_LRC_H_
  6#define _XE_LRC_H_
  7
  8#include <linux/types.h>
  9
 10#include "xe_lrc_types.h"
 11
 12struct drm_printer;
 13struct xe_bb;
 14struct xe_device;
 15struct xe_exec_queue;
 16enum xe_engine_class;
 17struct xe_gt;
 18struct xe_hw_engine;
 19struct xe_lrc;
 20struct xe_vm;
 21
 22struct xe_lrc_snapshot {
 23	struct xe_bo *lrc_bo;
 24	void *lrc_snapshot;
 25	unsigned long lrc_size, lrc_offset;
 26
 27	u32 context_desc;
 28	u32 indirect_context_desc;
 29	u32 head;
 30	struct {
 31		u32 internal;
 32		u32 memory;
 33	} tail;
 34	u32 start_seqno;
 35	u32 seqno;
 36	u32 ctx_timestamp;
 37	u32 ctx_job_timestamp;
 38};
 39
 40#define LRC_PPHWSP_SCRATCH_ADDR (0x34 * 4)
 41
 42struct xe_lrc *xe_lrc_create(struct xe_hw_engine *hwe, struct xe_vm *vm,
 43			     u32 ring_size);
 44void xe_lrc_destroy(struct kref *ref);
 45
 46/**
 47 * xe_lrc_get - Get reference to the LRC
 48 * @lrc: Logical Ring Context
 49 *
 50 * Increment reference count of @lrc
 51 */
 52static inline struct xe_lrc *xe_lrc_get(struct xe_lrc *lrc)
 53{
 54	kref_get(&lrc->refcount);
 55	return lrc;
 56}
 57
 58/**
 59 * xe_lrc_put - Put reference of the LRC
 60 * @lrc: Logical Ring Context
 61 *
 62 * Decrement reference count of @lrc, call xe_lrc_destroy when
 63 * reference count reaches 0.
 64 */
 65static inline void xe_lrc_put(struct xe_lrc *lrc)
 66{
 67	kref_put(&lrc->refcount, xe_lrc_destroy);
 68}
 69
 70size_t xe_gt_lrc_size(struct xe_gt *gt, enum xe_engine_class class);
 71u32 xe_lrc_pphwsp_offset(struct xe_lrc *lrc);
 72u32 xe_lrc_regs_offset(struct xe_lrc *lrc);
 73
 74void xe_lrc_set_ring_tail(struct xe_lrc *lrc, u32 tail);
 75u32 xe_lrc_ring_tail(struct xe_lrc *lrc);
 76void xe_lrc_set_ring_head(struct xe_lrc *lrc, u32 head);
 77u32 xe_lrc_ring_head(struct xe_lrc *lrc);
 78u32 xe_lrc_ring_space(struct xe_lrc *lrc);
 79void xe_lrc_write_ring(struct xe_lrc *lrc, const void *data, size_t size);
 80
 81u32 xe_lrc_indirect_ring_ggtt_addr(struct xe_lrc *lrc);
 82u32 xe_lrc_ggtt_addr(struct xe_lrc *lrc);
 83u32 *xe_lrc_regs(struct xe_lrc *lrc);
 84
 85u32 xe_lrc_read_ctx_reg(struct xe_lrc *lrc, int reg_nr);
 86void xe_lrc_write_ctx_reg(struct xe_lrc *lrc, int reg_nr, u32 val);
 87
 88u64 xe_lrc_descriptor(struct xe_lrc *lrc);
 89
 90u32 xe_lrc_seqno_ggtt_addr(struct xe_lrc *lrc);
 91struct dma_fence *xe_lrc_alloc_seqno_fence(void);
 92void xe_lrc_free_seqno_fence(struct dma_fence *fence);
 93void xe_lrc_init_seqno_fence(struct xe_lrc *lrc, struct dma_fence *fence);
 94s32 xe_lrc_seqno(struct xe_lrc *lrc);
 95
 96u32 xe_lrc_start_seqno_ggtt_addr(struct xe_lrc *lrc);
 97s32 xe_lrc_start_seqno(struct xe_lrc *lrc);
 98
 99u32 xe_lrc_parallel_ggtt_addr(struct xe_lrc *lrc);
100struct iosys_map xe_lrc_parallel_map(struct xe_lrc *lrc);
101
102size_t xe_lrc_skip_size(struct xe_device *xe);
103
104void xe_lrc_dump_default(struct drm_printer *p,
105			 struct xe_gt *gt,
106			 enum xe_engine_class);
107
108void xe_lrc_emit_hwe_state_instructions(struct xe_exec_queue *q, struct xe_bb *bb);
109
110struct xe_lrc_snapshot *xe_lrc_snapshot_capture(struct xe_lrc *lrc);
111void xe_lrc_snapshot_capture_delayed(struct xe_lrc_snapshot *snapshot);
112void xe_lrc_snapshot_print(struct xe_lrc_snapshot *snapshot, struct drm_printer *p);
113void xe_lrc_snapshot_free(struct xe_lrc_snapshot *snapshot);
114
115u32 xe_lrc_ctx_timestamp_ggtt_addr(struct xe_lrc *lrc);
116u32 xe_lrc_ctx_timestamp(struct xe_lrc *lrc);
117u32 xe_lrc_ctx_job_timestamp_ggtt_addr(struct xe_lrc *lrc);
118u32 xe_lrc_ctx_job_timestamp(struct xe_lrc *lrc);
119
120/**
121 * xe_lrc_update_timestamp - readout LRC timestamp and update cached value
122 * @lrc: logical ring context for this exec queue
123 * @old_ts: pointer where to save the previous timestamp
124 *
125 * Read the current timestamp for this LRC and update the cached value. The
126 * previous cached value is also returned in @old_ts so the caller can calculate
127 * the delta between 2 updates. Note that this is not intended to be called from
128 * any place, but just by the paths updating the drm client utilization.
129 *
130 * Returns the current LRC timestamp
131 */
132u32 xe_lrc_update_timestamp(struct xe_lrc *lrc, u32 *old_ts);
133
134#endif
v6.9.4
 1/* SPDX-License-Identifier: MIT */
 2/*
 3 * Copyright © 2021 Intel Corporation
 4 */
 5#ifndef _XE_LRC_H_
 6#define _XE_LRC_H_
 7
 
 
 8#include "xe_lrc_types.h"
 9
10struct drm_printer;
11struct xe_bb;
12struct xe_device;
13struct xe_exec_queue;
14enum xe_engine_class;
 
15struct xe_hw_engine;
 
16struct xe_vm;
17
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18#define LRC_PPHWSP_SCRATCH_ADDR (0x34 * 4)
19
20int xe_lrc_init(struct xe_lrc *lrc, struct xe_hw_engine *hwe,
21		struct xe_exec_queue *q, struct xe_vm *vm, u32 ring_size);
22void xe_lrc_finish(struct xe_lrc *lrc);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
24size_t xe_lrc_size(struct xe_device *xe, enum xe_engine_class class);
25u32 xe_lrc_pphwsp_offset(struct xe_lrc *lrc);
 
26
 
 
27void xe_lrc_set_ring_head(struct xe_lrc *lrc, u32 head);
28u32 xe_lrc_ring_head(struct xe_lrc *lrc);
29u32 xe_lrc_ring_space(struct xe_lrc *lrc);
30void xe_lrc_write_ring(struct xe_lrc *lrc, const void *data, size_t size);
31
 
32u32 xe_lrc_ggtt_addr(struct xe_lrc *lrc);
33u32 *xe_lrc_regs(struct xe_lrc *lrc);
34
35u32 xe_lrc_read_ctx_reg(struct xe_lrc *lrc, int reg_nr);
36void xe_lrc_write_ctx_reg(struct xe_lrc *lrc, int reg_nr, u32 val);
37
38u64 xe_lrc_descriptor(struct xe_lrc *lrc);
39
40u32 xe_lrc_seqno_ggtt_addr(struct xe_lrc *lrc);
41struct dma_fence *xe_lrc_create_seqno_fence(struct xe_lrc *lrc);
 
 
42s32 xe_lrc_seqno(struct xe_lrc *lrc);
43
44u32 xe_lrc_start_seqno_ggtt_addr(struct xe_lrc *lrc);
45s32 xe_lrc_start_seqno(struct xe_lrc *lrc);
46
47u32 xe_lrc_parallel_ggtt_addr(struct xe_lrc *lrc);
48struct iosys_map xe_lrc_parallel_map(struct xe_lrc *lrc);
49
50size_t xe_lrc_skip_size(struct xe_device *xe);
51
52void xe_lrc_dump_default(struct drm_printer *p,
53			 struct xe_gt *gt,
54			 enum xe_engine_class);
55
56void xe_lrc_emit_hwe_state_instructions(struct xe_exec_queue *q, struct xe_bb *bb);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
58#endif