Skip to content

Commit 0a8e247

Browse files
mwajdeczdanvet
authored andcommitted
drm/i915/guc: Keep strict GuC ABI definitions
Our fwif.h file is now mix of strict firmware ABI definitions and set of our helpers. In anticipation of upcoming changes to the GuC interface try to keep them separate in smaller maintainable files. Signed-off-by: Michal Wajdeczko <[email protected]> Signed-off-by: Matthew Brost <[email protected]> Reviewed-by: Michał Winiarski <[email protected]> Signed-off-by: Daniel Vetter <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 28bef5b commit 0a8e247

File tree

6 files changed

+250
-197
lines changed

6 files changed

+250
-197
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/* SPDX-License-Identifier: MIT */
2+
/*
3+
* Copyright © 2014-2021 Intel Corporation
4+
*/
5+
6+
#ifndef _ABI_GUC_ACTIONS_ABI_H
7+
#define _ABI_GUC_ACTIONS_ABI_H
8+
9+
enum intel_guc_action {
10+
INTEL_GUC_ACTION_DEFAULT = 0x0,
11+
INTEL_GUC_ACTION_REQUEST_PREEMPTION = 0x2,
12+
INTEL_GUC_ACTION_REQUEST_ENGINE_RESET = 0x3,
13+
INTEL_GUC_ACTION_ALLOCATE_DOORBELL = 0x10,
14+
INTEL_GUC_ACTION_DEALLOCATE_DOORBELL = 0x20,
15+
INTEL_GUC_ACTION_LOG_BUFFER_FILE_FLUSH_COMPLETE = 0x30,
16+
INTEL_GUC_ACTION_UK_LOG_ENABLE_LOGGING = 0x40,
17+
INTEL_GUC_ACTION_FORCE_LOG_BUFFER_FLUSH = 0x302,
18+
INTEL_GUC_ACTION_ENTER_S_STATE = 0x501,
19+
INTEL_GUC_ACTION_EXIT_S_STATE = 0x502,
20+
INTEL_GUC_ACTION_SLPC_REQUEST = 0x3003,
21+
INTEL_GUC_ACTION_AUTHENTICATE_HUC = 0x4000,
22+
INTEL_GUC_ACTION_REGISTER_COMMAND_TRANSPORT_BUFFER = 0x4505,
23+
INTEL_GUC_ACTION_DEREGISTER_COMMAND_TRANSPORT_BUFFER = 0x4506,
24+
INTEL_GUC_ACTION_LIMIT
25+
};
26+
27+
enum intel_guc_preempt_options {
28+
INTEL_GUC_PREEMPT_OPTION_DROP_WORK_Q = 0x4,
29+
INTEL_GUC_PREEMPT_OPTION_DROP_SUBMIT_Q = 0x8,
30+
};
31+
32+
enum intel_guc_report_status {
33+
INTEL_GUC_REPORT_STATUS_UNKNOWN = 0x0,
34+
INTEL_GUC_REPORT_STATUS_ACKED = 0x1,
35+
INTEL_GUC_REPORT_STATUS_ERROR = 0x2,
36+
INTEL_GUC_REPORT_STATUS_COMPLETE = 0x4,
37+
};
38+
39+
enum intel_guc_sleep_state_status {
40+
INTEL_GUC_SLEEP_STATE_SUCCESS = 0x1,
41+
INTEL_GUC_SLEEP_STATE_PREEMPT_TO_IDLE_FAILED = 0x2,
42+
INTEL_GUC_SLEEP_STATE_ENGINE_RESET_FAILED = 0x3
43+
#define INTEL_GUC_SLEEP_STATE_INVALID_MASK 0x80000000
44+
};
45+
46+
#define GUC_LOG_CONTROL_LOGGING_ENABLED (1 << 0)
47+
#define GUC_LOG_CONTROL_VERBOSITY_SHIFT 4
48+
#define GUC_LOG_CONTROL_VERBOSITY_MASK (0xF << GUC_LOG_CONTROL_VERBOSITY_SHIFT)
49+
#define GUC_LOG_CONTROL_DEFAULT_LOGGING (1 << 8)
50+
51+
#endif /* _ABI_GUC_ACTIONS_ABI_H */
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
/* SPDX-License-Identifier: MIT */
2+
/*
3+
* Copyright © 2014-2021 Intel Corporation
4+
*/
5+
6+
#ifndef _ABI_GUC_COMMUNICATION_CTB_ABI_H
7+
#define _ABI_GUC_COMMUNICATION_CTB_ABI_H
8+
9+
#include <linux/types.h>
10+
11+
/**
12+
* DOC: CTB based communication
13+
*
14+
* The CTB (command transport buffer) communication between Host and GuC
15+
* is based on u32 data stream written to the shared buffer. One buffer can
16+
* be used to transmit data only in one direction (one-directional channel).
17+
*
18+
* Current status of the each buffer is stored in the buffer descriptor.
19+
* Buffer descriptor holds tail and head fields that represents active data
20+
* stream. The tail field is updated by the data producer (sender), and head
21+
* field is updated by the data consumer (receiver)::
22+
*
23+
* +------------+
24+
* | DESCRIPTOR | +=================+============+========+
25+
* +============+ | | MESSAGE(s) | |
26+
* | address |--------->+=================+============+========+
27+
* +------------+
28+
* | head | ^-----head--------^
29+
* +------------+
30+
* | tail | ^---------tail-----------------^
31+
* +------------+
32+
* | size | ^---------------size--------------------^
33+
* +------------+
34+
*
35+
* Each message in data stream starts with the single u32 treated as a header,
36+
* followed by optional set of u32 data that makes message specific payload::
37+
*
38+
* +------------+---------+---------+---------+
39+
* | MESSAGE |
40+
* +------------+---------+---------+---------+
41+
* | msg[0] | [1] | ... | [n-1] |
42+
* +------------+---------+---------+---------+
43+
* | MESSAGE | MESSAGE PAYLOAD |
44+
* + HEADER +---------+---------+---------+
45+
* | | 0 | ... | n |
46+
* +======+=====+=========+=========+=========+
47+
* | 31:16| code| | | |
48+
* +------+-----+ | | |
49+
* | 15:5|flags| | | |
50+
* +------+-----+ | | |
51+
* | 4:0| len| | | |
52+
* +------+-----+---------+---------+---------+
53+
*
54+
* ^-------------len-------------^
55+
*
56+
* The message header consists of:
57+
*
58+
* - **len**, indicates length of the message payload (in u32)
59+
* - **code**, indicates message code
60+
* - **flags**, holds various bits to control message handling
61+
*/
62+
63+
/*
64+
* Describes single command transport buffer.
65+
* Used by both guc-master and clients.
66+
*/
67+
struct guc_ct_buffer_desc {
68+
u32 addr; /* gfx address */
69+
u64 host_private; /* host private data */
70+
u32 size; /* size in bytes */
71+
u32 head; /* offset updated by GuC*/
72+
u32 tail; /* offset updated by owner */
73+
u32 is_in_error; /* error indicator */
74+
u32 fence; /* fence updated by GuC */
75+
u32 status; /* status updated by GuC */
76+
u32 owner; /* id of the channel owner */
77+
u32 owner_sub_id; /* owner-defined field for extra tracking */
78+
u32 reserved[5];
79+
} __packed;
80+
81+
/* Type of command transport buffer */
82+
#define INTEL_GUC_CT_BUFFER_TYPE_SEND 0x0u
83+
#define INTEL_GUC_CT_BUFFER_TYPE_RECV 0x1u
84+
85+
/*
86+
* Definition of the command transport message header (DW0)
87+
*
88+
* bit[4..0] message len (in dwords)
89+
* bit[7..5] reserved
90+
* bit[8] response (G2H only)
91+
* bit[8] write fence to desc (H2G only)
92+
* bit[9] write status to H2G buff (H2G only)
93+
* bit[10] send status back via G2H (H2G only)
94+
* bit[15..11] reserved
95+
* bit[31..16] action code
96+
*/
97+
#define GUC_CT_MSG_LEN_SHIFT 0
98+
#define GUC_CT_MSG_LEN_MASK 0x1F
99+
#define GUC_CT_MSG_IS_RESPONSE (1 << 8)
100+
#define GUC_CT_MSG_WRITE_FENCE_TO_DESC (1 << 8)
101+
#define GUC_CT_MSG_WRITE_STATUS_TO_BUFF (1 << 9)
102+
#define GUC_CT_MSG_SEND_STATUS (1 << 10)
103+
#define GUC_CT_MSG_ACTION_SHIFT 16
104+
#define GUC_CT_MSG_ACTION_MASK 0xFFFF
105+
106+
#endif /* _ABI_GUC_COMMUNICATION_CTB_ABI_H */
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/* SPDX-License-Identifier: MIT */
2+
/*
3+
* Copyright © 2014-2021 Intel Corporation
4+
*/
5+
6+
#ifndef _ABI_GUC_COMMUNICATION_MMIO_ABI_H
7+
#define _ABI_GUC_COMMUNICATION_MMIO_ABI_H
8+
9+
/**
10+
* DOC: MMIO based communication
11+
*
12+
* The MMIO based communication between Host and GuC uses software scratch
13+
* registers, where first register holds data treated as message header,
14+
* and other registers are used to hold message payload.
15+
*
16+
* For Gen9+, GuC uses software scratch registers 0xC180-0xC1B8,
17+
* but no H2G command takes more than 8 parameters and the GuC FW
18+
* itself uses an 8-element array to store the H2G message.
19+
*
20+
* +-----------+---------+---------+---------+
21+
* | MMIO[0] | MMIO[1] | ... | MMIO[n] |
22+
* +-----------+---------+---------+---------+
23+
* | header | optional payload |
24+
* +======+====+=========+=========+=========+
25+
* | 31:28|type| | | |
26+
* +------+----+ | | |
27+
* | 27:16|data| | | |
28+
* +------+----+ | | |
29+
* | 15:0|code| | | |
30+
* +------+----+---------+---------+---------+
31+
*
32+
* The message header consists of:
33+
*
34+
* - **type**, indicates message type
35+
* - **code**, indicates message code, is specific for **type**
36+
* - **data**, indicates message data, optional, depends on **code**
37+
*
38+
* The following message **types** are supported:
39+
*
40+
* - **REQUEST**, indicates Host-to-GuC request, requested GuC action code
41+
* must be priovided in **code** field. Optional action specific parameters
42+
* can be provided in remaining payload registers or **data** field.
43+
*
44+
* - **RESPONSE**, indicates GuC-to-Host response from earlier GuC request,
45+
* action response status will be provided in **code** field. Optional
46+
* response data can be returned in remaining payload registers or **data**
47+
* field.
48+
*/
49+
50+
#define GUC_MAX_MMIO_MSG_LEN 8
51+
52+
#endif /* _ABI_GUC_COMMUNICATION_MMIO_ABI_H */
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/* SPDX-License-Identifier: MIT */
2+
/*
3+
* Copyright © 2014-2021 Intel Corporation
4+
*/
5+
6+
#ifndef _ABI_GUC_ERRORS_ABI_H
7+
#define _ABI_GUC_ERRORS_ABI_H
8+
9+
enum intel_guc_response_status {
10+
INTEL_GUC_RESPONSE_STATUS_SUCCESS = 0x0,
11+
INTEL_GUC_RESPONSE_STATUS_GENERIC_FAIL = 0xF000,
12+
};
13+
14+
#endif /* _ABI_GUC_ERRORS_ABI_H */
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/* SPDX-License-Identifier: MIT */
2+
/*
3+
* Copyright © 2014-2021 Intel Corporation
4+
*/
5+
6+
#ifndef _ABI_GUC_MESSAGES_ABI_H
7+
#define _ABI_GUC_MESSAGES_ABI_H
8+
9+
#define INTEL_GUC_MSG_TYPE_SHIFT 28
10+
#define INTEL_GUC_MSG_TYPE_MASK (0xF << INTEL_GUC_MSG_TYPE_SHIFT)
11+
#define INTEL_GUC_MSG_DATA_SHIFT 16
12+
#define INTEL_GUC_MSG_DATA_MASK (0xFFF << INTEL_GUC_MSG_DATA_SHIFT)
13+
#define INTEL_GUC_MSG_CODE_SHIFT 0
14+
#define INTEL_GUC_MSG_CODE_MASK (0xFFFF << INTEL_GUC_MSG_CODE_SHIFT)
15+
16+
enum intel_guc_msg_type {
17+
INTEL_GUC_MSG_TYPE_REQUEST = 0x0,
18+
INTEL_GUC_MSG_TYPE_RESPONSE = 0xF,
19+
};
20+
21+
#endif /* _ABI_GUC_MESSAGES_ABI_H */

0 commit comments

Comments
 (0)