Files
android/drivers/misc/mediatek/geniezone/gz-trusty/gz_trace_module.h
T
threeeye bc1d038eac REVVL 6 Pro kernel bring-up: full working tree snapshot (2026-09-12)
Squashed backup commit (no shallow-clone history issues) of
xiaomi-mt6833-dev/kernel_xiaomi_mt6833 (lineage-23.2 branch, upstream
commit 9eece662e) plus all fixes applied to get everpal_defconfig building
clean against a modern (GCC 15.2.0) toolchain -- see the previous commit
message on the lineage-23.2 branch (also in this repo history is not
available here since this is a squashed snapshot; full incremental history
lives in the local DL380 checkout and the upstream GitHub remote).

Upstream: https://github.com/xiaomi-mt6833-dev/kernel_xiaomi_mt6833 (lineage-23.2)
2026-09-12 13:36:46 +00:00

105 lines
2.4 KiB
C

/* SPDX-License-Identifier: GPL-2.0 */
/*
* Copyright (c) 2019 MediaTek Inc.
*/
#ifndef _GZ_TRACE_MODULE_H_
#define _GZ_TRACE_MODULE_H_
#if IS_ENABLED(CONFIG_FTRACE)
#include <linux/kallsyms.h>
#include <linux/trace_events.h>
static noinline void tracing_mark_write(char *fmt, ...)
{
struct va_format vaf;
va_list va;
va_start(va, fmt);
vaf.fmt = fmt;
vaf.va = &va;
trace_printk("%pV", &vaf);
va_end(va);
}
#define GZ_TRUSTY_TRACE_BEGIN(fmt, args...) do { \
preempt_disable(); \
tracing_mark_write( \
"B|%d|GZT_"fmt"\n", current->tgid, ##args); \
preempt_enable();\
} while (0)
#define GZ_TRUSTY_TRACE_END() do { \
preempt_disable(); \
tracing_mark_write("E\n"); \
preempt_enable(); \
} while (0)
#define GZ_TRUSTY_TRACE_CNT(cnt, fmt, args...) do { \
preempt_disable(); \
tracing_mark_write( \
"C|%d|GZT_"fmt"|%d\n", current->tgid, ##args, cnt); \
preempt_enable();\
} while (0)
#define GZ_TRUSTY_ASYNC_TRACE_BEGIN(cookie, fmt, args...) do { \
preempt_disable(); \
tracing_mark_write( \
"S|%d|GZT_"fmt"|%d\n", current->tgid, ##args, cookie); \
preempt_enable();\
} while (0)
#define GZ_TRUSTY_ASYNC_TRACE_END(cookie, fmt, args...) do { \
preempt_disable(); \
tracing_mark_write( \
"F|%d|GZT_"fmt"|%d\n", current->tgid, ##args, cookie); \
preempt_enable();\
} while (0)
#define GZ_TRUSTY_TRACE_INJECTION(fmt, args...) do { \
preempt_disable(); \
tracing_mark_write( \
"GZT|"fmt"\n", ##args); \
preempt_enable();\
} while (0)
/* How to,
* use for in the same process
* no need add "\n"
* you can find time slot in systrace by keyword GZ_XXXX
* GZ_TRUSTY_TRACE_BEGIN("%s", __func__);
* GZ_TRUSTY_TRACE_END();
* use for async case
* no need add "\n"
* you can find time slot in systrace by keyword GZ_XXXX
* GZ_TRUSTY_ASYNC_TRACE_BEGIN(atomic_read(&tctx->kick_cookie), "ToKick");
* GZ_TRUSTY_ASYNC_TRACE_END(atomic_read(&tctx->kick_cookie), "ToKick");
* atomic_inc(&tctx->kick_cookie);
*
* use for add news
* can't find info in systrace UI, only find in raw data
* GZ_TRUSTY_TRACE_CNT(100, "my_std_call32");
*/
#else
#define GZ_TRUSTY_TRACE_BEGIN(fmt, args...) do { \
} while (0)
#define GZ_TRUSTY_TRACE_END() do { \
} while (0)
#define GZ_TRUSTY_TRACE_CNT(cnt, fmt, args...) do { \
} while (0)
#define GZ_TRUSTY_ASYNC_TRACE_BEGIN(cookie, fmt, args...) do { \
} while (0)
#define GZ_TRUSTY_ASYNC_TRACE_END(cookie, fmt, args...) do { \
} while (0)
#endif /* CONFIG_FTRACE */
#endif