49 lines · c
1/* SPDX-License-Identifier: MIT */2/*3 * Copyright © 2022 Intel Corporation4 */5 6#ifndef _XE_GUC_LOG_H_7#define _XE_GUC_LOG_H_8 9#include "xe_guc_log_types.h"10 11struct drm_printer;12 13#if IS_ENABLED(CONFIG_DRM_XE_LARGE_GUC_BUFFER)14#define CRASH_BUFFER_SIZE SZ_1M15#define DEBUG_BUFFER_SIZE SZ_8M16#define CAPTURE_BUFFER_SIZE SZ_2M17#else18#define CRASH_BUFFER_SIZE SZ_8K19#define DEBUG_BUFFER_SIZE SZ_64K20#define CAPTURE_BUFFER_SIZE SZ_16K21#endif22/*23 * While we're using plain log level in i915, GuC controls are much more...24 * "elaborate"? We have a couple of bits for verbosity, separate bit for actual25 * log enabling, and separate bit for default logging - which "conveniently"26 * ignores the enable bit.27 */28#define GUC_LOG_LEVEL_DISABLED 029#define GUC_LOG_LEVEL_NON_VERBOSE 130#define GUC_LOG_LEVEL_IS_ENABLED(x) ((x) > GUC_LOG_LEVEL_DISABLED)31#define GUC_LOG_LEVEL_IS_VERBOSE(x) ((x) > GUC_LOG_LEVEL_NON_VERBOSE)32#define GUC_LOG_LEVEL_TO_VERBOSITY(x) ({ \33 typeof(x) _x = (x); \34 GUC_LOG_LEVEL_IS_VERBOSE(_x) ? _x - 2 : 0; \35})36#define GUC_VERBOSITY_TO_LOG_LEVEL(x) ((x) + 2)37#define GUC_LOG_LEVEL_MAX GUC_VERBOSITY_TO_LOG_LEVEL(GUC_LOG_VERBOSITY_MAX)38 39int xe_guc_log_init(struct xe_guc_log *log);40void xe_guc_log_print(struct xe_guc_log *log, struct drm_printer *p);41 42static inline u3243xe_guc_log_get_level(struct xe_guc_log *log)44{45 return log->level;46}47 48#endif49