1  /* SPDX-License-Identifier: MIT */
2  /*
3   * Copyright © 2022 Intel Corporation
4   */
5  
6  #ifndef _XE_LRC_TYPES_H_
7  #define _XE_LRC_TYPES_H_
8  
9  #include <linux/kref.h>
10  
11  #include "xe_hw_fence_types.h"
12  
13  struct xe_bo;
14  
15  /**
16   * struct xe_lrc - Logical ring context (LRC) and submission ring object
17   */
18  struct xe_lrc {
19  	/**
20  	 * @bo: buffer object (memory) for logical ring context, per process HW
21  	 * status page, and submission ring.
22  	 */
23  	struct xe_bo *bo;
24  
25  	/** @size: size of lrc including any indirect ring state page */
26  	u32 size;
27  
28  	/** @tile: tile which this LRC belongs to */
29  	struct xe_tile *tile;
30  
31  	/** @flags: LRC flags */
32  #define XE_LRC_FLAG_INDIRECT_RING_STATE		0x1
33  	u32 flags;
34  
35  	/** @refcount: ref count of this lrc */
36  	struct kref refcount;
37  
38  	/** @ring: submission ring state */
39  	struct {
40  		/** @ring.size: size of submission ring */
41  		u32 size;
42  		/** @ring.tail: tail of submission ring */
43  		u32 tail;
44  		/** @ring.old_tail: shadow of tail */
45  		u32 old_tail;
46  	} ring;
47  
48  	/** @desc: LRC descriptor */
49  	u64 desc;
50  
51  	/** @fence_ctx: context for hw fence */
52  	struct xe_hw_fence_ctx fence_ctx;
53  
54  	/** @ctx_timestamp: readout value of CTX_TIMESTAMP on last update */
55  	u32 ctx_timestamp;
56  };
57  
58  struct xe_lrc_snapshot;
59  
60  #endif
61