1 /* SPDX-License-Identifier: MIT */
3 * Copyright © 2022 Intel Corporation
6 #ifndef _XE_GUC_CT_TYPES_H_
7 #define _XE_GUC_CT_TYPES_H_
9 #include <linux/interrupt.h>
10 #include <linux/iosys-map.h>
11 #include <linux/spinlock_types.h>
12 #include <linux/wait.h>
13 #include <linux/xarray.h>
15 #include "abi/guc_communication_ctb_abi.h"
20 * struct guc_ctb_info - GuC command transport buffer (CTB) info
23 /** @size: size of CTB commands (DW) */
25 /** @resv_space: reserved space of CTB commands (DW) */
27 /** @head: head of CTB commands (DW) */
29 /** @tail: tail of CTB commands (DW) */
31 /** @space: space in CTB commands (DW) */
33 /** @broken: channel broken */
38 * struct guc_ctb - GuC command transport buffer (CTB)
41 /** @desc: dma buffer map for CTB descriptor */
42 struct iosys_map desc;
43 /** @cmds: dma buffer map for CTB commands */
44 struct iosys_map cmds;
45 /** @info: CTB info */
46 struct guc_ctb_info info;
50 * struct guc_ctb_snapshot - GuC command transport buffer (CTB) snapshot
52 struct guc_ctb_snapshot {
53 /** @desc: snapshot of the CTB descriptor */
54 struct guc_ct_buffer_desc desc;
55 /** @cmds: snapshot of the CTB commands */
57 /** @info: snapshot of the CTB info */
58 struct guc_ctb_info info;
62 * struct xe_guc_ct_snapshot - GuC command transport (CT) snapshot
64 struct xe_guc_ct_snapshot {
65 /** @ct_enabled: CT enabled info at capture time. */
67 /** @g2h_outstanding: G2H outstanding info at the capture time */
69 /** @g2h: G2H CTB snapshot */
70 struct guc_ctb_snapshot g2h;
71 /** @h2g: H2G CTB snapshot */
72 struct guc_ctb_snapshot h2g;
76 * struct xe_guc_ct - GuC command transport (CT) layer
78 * Includes a pair of CT buffers for bi-directional communication and tracking
79 * for the H2G and G2H requests sent and received through the buffers.
82 /** @bo: XE BO for CT */
84 /** @lock: protects everything in CT layer */
86 /** @fast_lock: protects G2H channel and credits */
88 /** @ctbs: buffers for sending and receiving commands */
90 /** @send: Host to GuC (H2G, send) channel */
92 /** @recv: GuC to Host (G2H, receive) channel */
95 /** @g2h_outstanding: number of outstanding G2H */
97 /** @g2h_worker: worker to process G2H messages */
98 struct work_struct g2h_worker;
99 /** @enabled: CT enabled */
101 /** @fence_seqno: G2H fence seqno - 16 bits used by CT */
103 /** @fence_lookup: G2H fence lookup */
104 struct xarray fence_lookup;
105 /** @wq: wait queue used for reliable CT sends and freeing G2H credits */
106 wait_queue_head_t wq;
107 /** @g2h_fence_wq: wait queue used for G2H fencing */
108 wait_queue_head_t g2h_fence_wq;
109 /** @msg: Message buffer */
110 u32 msg[GUC_CTB_MSG_MAX_LEN];
111 /** @fast_msg: Message buffer */
112 u32 fast_msg[GUC_CTB_MSG_MAX_LEN];