Linux Audio

Check our new training course

Loading...
Note: File does not exist in v6.2.
 1/* SPDX-License-Identifier: MIT */
 2/*
 3 * Copyright © 2022 Intel Corporation
 4 */
 5
 6#ifndef _XE_GUC_LOG_H_
 7#define _XE_GUC_LOG_H_
 8
 9#include "xe_guc_log_types.h"
10#include "abi/guc_log_abi.h"
11
12struct drm_printer;
13struct xe_device;
14
15#if IS_ENABLED(CONFIG_DRM_XE_LARGE_GUC_BUFFER)
16#define CRASH_BUFFER_SIZE       SZ_1M
17#define DEBUG_BUFFER_SIZE       SZ_8M
18#define CAPTURE_BUFFER_SIZE     SZ_2M
19#else
20#define CRASH_BUFFER_SIZE	SZ_8K
21#define DEBUG_BUFFER_SIZE	SZ_64K
22#define CAPTURE_BUFFER_SIZE	SZ_1M
23#endif
24/*
25 * While we're using plain log level in i915, GuC controls are much more...
26 * "elaborate"? We have a couple of bits for verbosity, separate bit for actual
27 * log enabling, and separate bit for default logging - which "conveniently"
28 * ignores the enable bit.
29 */
30#define GUC_LOG_LEVEL_DISABLED		0
31#define GUC_LOG_LEVEL_NON_VERBOSE	1
32#define GUC_LOG_LEVEL_IS_ENABLED(x)	((x) > GUC_LOG_LEVEL_DISABLED)
33#define GUC_LOG_LEVEL_IS_VERBOSE(x)	((x) > GUC_LOG_LEVEL_NON_VERBOSE)
34#define GUC_LOG_LEVEL_TO_VERBOSITY(x) ({		\
35	typeof(x) _x = (x);				\
36	GUC_LOG_LEVEL_IS_VERBOSE(_x) ? _x - 2 : 0;	\
37})
38#define GUC_VERBOSITY_TO_LOG_LEVEL(x)	((x) + 2)
39#define GUC_LOG_LEVEL_MAX GUC_VERBOSITY_TO_LOG_LEVEL(GUC_LOG_VERBOSITY_MAX)
40
41int xe_guc_log_init(struct xe_guc_log *log);
42void xe_guc_log_print(struct xe_guc_log *log, struct drm_printer *p);
43void xe_guc_log_print_dmesg(struct xe_guc_log *log);
44struct xe_guc_log_snapshot *xe_guc_log_snapshot_capture(struct xe_guc_log *log, bool atomic);
45void xe_guc_log_snapshot_print(struct xe_guc_log_snapshot *snapshot, struct drm_printer *p);
46void xe_guc_log_snapshot_free(struct xe_guc_log_snapshot *snapshot);
47
48static inline u32
49xe_guc_log_get_level(struct xe_guc_log *log)
50{
51	return log->level;
52}
53
54u32 xe_guc_log_section_size_capture(struct xe_guc_log *log);
55u32 xe_guc_get_log_buffer_size(struct xe_guc_log *log, enum guc_log_buffer_type type);
56u32 xe_guc_get_log_buffer_offset(struct xe_guc_log *log, enum guc_log_buffer_type type);
57bool xe_guc_check_log_buf_overflow(struct xe_guc_log *log,
58				   enum guc_log_buffer_type type,
59				   unsigned int full_cnt);
60
61#endif