Skip to content

Commit 8bfc496

Browse files
zhanjunmattrope
authored andcommitted
drm/xe/guc: Extract GuC error capture lists
Upon the G2H Notify-Err-Capture event, parse through the GuC Log Buffer (error-capture-subregion) and generate one or more capture-nodes. A single node represents a single "engine- instance-capture-dump" and contains at least 3 register lists: global, engine-class and engine-instance. An internal link list is maintained to store one or more nodes. Because the link-list node generation happen before the call to devcoredump, duplicate global and engine-class register lists for each engine-instance register dump if we find dependent-engine resets in a engine-capture-group. To avoid dynamically allocate the output nodes during gt reset, pre-allocate a fixed number of empty nodes up front (at the time of ADS registration) that we can consume from or return to an internal cached list of nodes. Signed-off-by: Zhanjun Dong <[email protected]> Reviewed-by: Alan Previn <[email protected]> Signed-off-by: Matt Roper <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 84d15f4 commit 8bfc496

File tree

10 files changed

+883
-20
lines changed

10 files changed

+883
-20
lines changed

drivers/gpu/drm/xe/abi/guc_actions_abi.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,14 @@ enum xe_guc_sleep_state_status {
176176
#define GUC_LOG_CONTROL_VERBOSITY_MASK (0xF << GUC_LOG_CONTROL_VERBOSITY_SHIFT)
177177
#define GUC_LOG_CONTROL_DEFAULT_LOGGING (1 << 8)
178178

179+
enum xe_guc_state_capture_event_status {
180+
XE_GUC_STATE_CAPTURE_EVENT_STATUS_SUCCESS = 0x0,
181+
XE_GUC_STATE_CAPTURE_EVENT_STATUS_NOSPACE = 0x1,
182+
};
183+
184+
#define XE_GUC_STATE_CAPTURE_EVENT_STATUS_MASK 0x000000FF
185+
#define XE_GUC_ACTION_STATE_CAPTURE_NOTIFICATION_DATA_LEN 1
186+
179187
#define XE_GUC_TLB_INVAL_TYPE_SHIFT 0
180188
#define XE_GUC_TLB_INVAL_MODE_SHIFT 8
181189
/* Flush PPC or SMRO caches along with TLB invalidation request */

drivers/gpu/drm/xe/abi/guc_log_abi.h

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,59 @@ enum guc_log_buffer_type {
1717

1818
#define GUC_LOG_BUFFER_TYPE_MAX 3
1919

20+
/**
21+
* struct guc_log_buffer_state - GuC log buffer state
22+
*
23+
* Below state structure is used for coordination of retrieval of GuC firmware
24+
* logs. Separate state is maintained for each log buffer type.
25+
* read_ptr points to the location where Xe read last in log buffer and
26+
* is read only for GuC firmware. write_ptr is incremented by GuC with number
27+
* of bytes written for each log entry and is read only for Xe.
28+
* When any type of log buffer becomes half full, GuC sends a flush interrupt.
29+
* GuC firmware expects that while it is writing to 2nd half of the buffer,
30+
* first half would get consumed by Host and then get a flush completed
31+
* acknowledgment from Host, so that it does not end up doing any overwrite
32+
* causing loss of logs. So when buffer gets half filled & Xe has requested
33+
* for interrupt, GuC will set flush_to_file field, set the sampled_write_ptr
34+
* to the value of write_ptr and raise the interrupt.
35+
* On receiving the interrupt Xe should read the buffer, clear flush_to_file
36+
* field and also update read_ptr with the value of sample_write_ptr, before
37+
* sending an acknowledgment to GuC. marker & version fields are for internal
38+
* usage of GuC and opaque to Xe. buffer_full_cnt field is incremented every
39+
* time GuC detects the log buffer overflow.
40+
*/
41+
struct guc_log_buffer_state {
42+
/** @marker: buffer state start marker */
43+
u32 marker[2];
44+
/** @read_ptr: the last byte offset that was read by KMD previously */
45+
u32 read_ptr;
46+
/**
47+
* @write_ptr: the next byte offset location that will be written by
48+
* GuC
49+
*/
50+
u32 write_ptr;
51+
/** @size: Log buffer size */
52+
u32 size;
53+
/**
54+
* @sampled_write_ptr: Log buffer write pointer
55+
* This is written by GuC to the byte offset of the next free entry in
56+
* the buffer on log buffer half full or state capture notification
57+
*/
58+
u32 sampled_write_ptr;
59+
/**
60+
* @wrap_offset: wraparound offset
61+
* This is the byte offset of location 1 byte after last valid guc log
62+
* event entry written by Guc firmware before there was a wraparound.
63+
* This field is updated by guc firmware and should be used by Host
64+
* when copying buffer contents to file.
65+
*/
66+
u32 wrap_offset;
67+
/** @flags: Flush to file flag and buffer full count */
68+
u32 flags;
69+
#define GUC_LOG_BUFFER_STATE_FLUSH_TO_FILE GENMASK(0, 0)
70+
#define GUC_LOG_BUFFER_STATE_BUFFER_FULL_CNT GENMASK(4, 1)
71+
/** @version: The Guc-Log-Entry format version */
72+
u32 version;
73+
} __packed;
74+
2075
#endif

0 commit comments

Comments
 (0)