kernel-brax3-ubuntu-touch/drivers/misc/mediatek/apusys/mdla/utilities/mdla_trace.c
erascape f319b992b1 kernel-5.15: Initial import brax3 UT kernel
* halium configs enabled

Signed-off-by: erascape <erascape@proton.me>
2025-09-23 15:17:10 +00:00

65 lines
1.3 KiB
C

// SPDX-License-Identifier: GPL-2.0
/*
* Copyright (c) 2019 MediaTek Inc.
*/
#include <linux/kernel.h>
#include <apusys_trace.h>
#include <common/mdla_device.h>
#include <utilities/mdla_debug.h>
#define CREATE_TRACE_POINTS
#include <utilities/met_mdlasys_events.h>
bool mdla_trace_enable(void)
{
return cfg_apusys_trace;
}
void mdla_trace_begin(u32 core_id, struct command_entry *ce)
{
char buf[TRACE_LEN] = {0};
if (!mdla_trace_enable())
return;
if (snprintf(buf, sizeof(buf),
"mdla-%d|fin_cid:%d,total_cmd_num:%d",
core_id, ce->fin_cid, ce->count) > 0) {
mdla_perf_debug("%s\n", __func__);
trace_async_tag(1, buf);
}
}
void mdla_trace_end(u32 core_id, int preempt, struct command_entry *ce)
{
char buf[TRACE_LEN] = {0};
if (!ce->req_end_t || !mdla_trace_enable())
return;
if (snprintf(buf, sizeof(buf),
"mdla-%d|fin_id:%d,preempted:%d",
core_id, ce->fin_cid, preempt) > 0) {
mdla_perf_debug("%s\n", __func__);
trace_async_tag(0, buf);
}
}
/* restore trace settings after reset */
void mdla_trace_reset(u32 core_id, const char *str)
{
if (!mdla_trace_enable())
return;
trace_tag_customer("C|%d|mdla-%d,reset:%s|0",
task_pid_nr(current), core_id, str);
}
void mdla_trace_pmu_polling(u32 core_id, u32 *c)
{
trace_mdla_polling(core_id, c);
}