1 /* SPDX-License-Identifier: MIT */
2 /*
3  * Copyright © 2022 Intel Corporation
4  */
5 
6 #ifndef _XE_GUC_LOG_TYPES_H_
7 #define _XE_GUC_LOG_TYPES_H_
8 
9 #include <linux/types.h>
10 #include "abi/guc_log_abi.h"
11 
12 #include "xe_uc_fw_types.h"
13 
14 struct xe_bo;
15 
16 /**
17  * struct xe_guc_log_snapshot:
18  * Capture of the GuC log plus various state useful for decoding the log
19  */
20 struct xe_guc_log_snapshot {
21 	/** @size: Size in bytes of the @copy allocation */
22 	size_t size;
23 	/** @copy: Host memory copy of the log buffer for later dumping, split into chunks */
24 	void **copy;
25 	/** @num_chunks: Number of chunks within @copy */
26 	int num_chunks;
27 	/** @ktime: Kernel time the snapshot was taken */
28 	u64 ktime;
29 	/** @stamp: GuC timestamp at which the snapshot was taken */
30 	u64 stamp;
31 	/** @level: GuC log verbosity level */
32 	u32 level;
33 	/** @ver_found: GuC firmware version */
34 	struct xe_uc_fw_version ver_found;
35 	/** @ver_want: GuC firmware version that driver expected */
36 	struct xe_uc_fw_version ver_want;
37 	/** @path: Path of GuC firmware blob */
38 	const char *path;
39 };
40 
41 /**
42  * struct xe_guc_log - GuC log
43  */
44 struct xe_guc_log {
45 	/** @level: GuC log level */
46 	u32 level;
47 	/** @bo: XE BO for GuC log */
48 	struct xe_bo *bo;
49 	/** @stats: logging related stats */
50 	struct {
51 		u32 sampled_overflow;
52 		u32 overflow;
53 		u32 flush;
54 	} stats[GUC_LOG_BUFFER_TYPE_MAX];
55 };
56 
57 #endif
58