From bcf4630798ff0adb283c0bcfbad3948927732cfe Mon Sep 17 00:00:00 2001 From: Dezhi Huang Date: Mon, 20 May 2024 09:57:04 +0800 Subject: [PATCH] ANDROID: vendor_hooks: add hook to show more vendor cpu info. Add hook to show the more information about cpu, when cat /proc/cpuinfo , some chip info will be appended. Bug: 341597636 Change-Id: I4dbf7ba305a428f3dcf71e71d700a51dac8f7be0 Signed-off-by: Dezhi Huang (cherry picked from commit 08c63cde8c2bbdd5ab44c4f644422764f9b9ad14) --- arch/arm64/kernel/cpuinfo.c | 4 ++++ drivers/android/vendor_hooks.c | 2 ++ include/trace/hooks/cpuinfo.h | 18 ++++++++++++++++++ 3 files changed, 24 insertions(+) create mode 100644 include/trace/hooks/cpuinfo.h diff --git a/arch/arm64/kernel/cpuinfo.c b/arch/arm64/kernel/cpuinfo.c index b944bbab77e9..579301b89338 100644 --- a/arch/arm64/kernel/cpuinfo.c +++ b/arch/arm64/kernel/cpuinfo.c @@ -25,6 +25,8 @@ #include #include +#include + /* * In case the boot CPU is hotpluggable, we record its initial state and * current state separately. Certain system registers may contain different @@ -255,6 +257,8 @@ static int c_show(struct seq_file *m, void *v) seq_printf(m, "CPU revision\t: %d\n\n", MIDR_REVISION(midr)); } + trace_android_rvh_cpuinfo_c_show(m); + return 0; } diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index 5a2b3a9ad0f9..a275cae115fc 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -60,6 +60,7 @@ #include #include #include +#include #include #include #include @@ -114,6 +115,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_irqs_disable); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_irqs_enable); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_cpu_cgroup_attach); EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_cpu_cgroup_online); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_cpuinfo_c_show); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_meminfo_cache_adjust); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_si_mem_available_adjust); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_si_meminfo_adjust); diff --git a/include/trace/hooks/cpuinfo.h b/include/trace/hooks/cpuinfo.h new file mode 100644 index 000000000000..97c5e4f1347d --- /dev/null +++ b/include/trace/hooks/cpuinfo.h @@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM cpuinfo + +#define TRACE_INCLUDE_PATH trace/hooks + +#if !defined(_TRACE_HOOK_CPUINFO_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_HOOK_CPUINFO_H + +#include + +DECLARE_RESTRICTED_HOOK(android_rvh_cpuinfo_c_show, + TP_PROTO(struct seq_file *m), + TP_ARGS(m), 1); + +#endif /* _TRACE_HOOK_CPUINFO_H */ +/* This part must be outside protection */ +#include