| From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 |
| From: Todd Kjos <tkjos@google.com> |
| Date: Mon, 23 Nov 2020 11:08:48 -0800 |
| Subject: NOUPSTREAM: ANDROID: add vendor hooks to override |
| show_cpufinfo_max_freq |
| |
| QC value-add requires the ability to override the value displayed |
| by show_cpuinfo_max_freq. |
| |
| [CPNOTE: 03/06/21] Lee: Vendor related code - maintain forever |
| |
| Bug: 173984660 |
| Signed-off-by: Todd Kjos <tkjos@google.com> |
| Change-Id: Ida11256f399f0730bc1228524b9687df3e7b8bf4 |
| --- |
| drivers/android/vendor_hooks.c | 3 +++ |
| drivers/cpufreq/cpufreq.c | 10 +++++++++- |
| drivers/cpufreq/freq_table.c | 2 ++ |
| include/trace/hooks/cpufreq.h | 25 +++++++++++++++++++++++++ |
| 4 files changed, 39 insertions(+), 1 deletion(-) |
| create mode 100644 include/trace/hooks/cpufreq.h |
| |
| diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c |
| --- a/drivers/android/vendor_hooks.c |
| +++ b/drivers/android/vendor_hooks.c |
| @@ -23,6 +23,7 @@ |
| #include <trace/hooks/printk.h> |
| #include <trace/hooks/gic_v3.h> |
| #include <trace/hooks/epoch.h> |
| +#include <trace/hooks/cpufreq.h> |
| #include <trace/hooks/mm.h> |
| #include <trace/hooks/preemptirq.h> |
| #include <trace/hooks/ftrace_dump.h> |
| @@ -81,6 +82,8 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_gic_v3_set_affinity); |
| EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_gic_v3_affinity_init); |
| EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_show_suspend_epoch_val); |
| EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_show_resume_epoch_val); |
| +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_show_max_freq); |
| +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_freq_table_limits); |
| EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_sched_newidle_balance); |
| EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_sched_nohz_balancer_kick); |
| EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_find_busiest_queue); |
| diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c |
| --- a/drivers/cpufreq/cpufreq.c |
| +++ b/drivers/cpufreq/cpufreq.c |
| @@ -30,6 +30,7 @@ |
| #include <linux/syscore_ops.h> |
| #include <linux/tick.h> |
| #include <trace/events/power.h> |
| +#include <trace/hooks/cpufreq.h> |
| |
| static LIST_HEAD(cpufreq_policy_list); |
| |
| @@ -690,8 +691,15 @@ static ssize_t show_##file_name \ |
| return sprintf(buf, "%u\n", policy->object); \ |
| } |
| |
| +static ssize_t show_cpuinfo_max_freq(struct cpufreq_policy *policy, char *buf) |
| +{ |
| + unsigned int max_freq = policy->cpuinfo.max_freq; |
| + |
| + trace_android_vh_show_max_freq(policy, &max_freq); |
| + return sprintf(buf, "%u\n", max_freq); |
| +} |
| + |
| show_one(cpuinfo_min_freq, cpuinfo.min_freq); |
| -show_one(cpuinfo_max_freq, cpuinfo.max_freq); |
| show_one(cpuinfo_transition_latency, cpuinfo.transition_latency); |
| show_one(scaling_min_freq, min); |
| show_one(scaling_max_freq, max); |
| diff --git a/drivers/cpufreq/freq_table.c b/drivers/cpufreq/freq_table.c |
| --- a/drivers/cpufreq/freq_table.c |
| +++ b/drivers/cpufreq/freq_table.c |
| @@ -9,6 +9,7 @@ |
| |
| #include <linux/cpufreq.h> |
| #include <linux/module.h> |
| +#include <trace/hooks/cpufreq.h> |
| |
| /********************************************************************* |
| * FREQUENCY TABLE HELPERS * |
| @@ -51,6 +52,7 @@ int cpufreq_frequency_table_cpuinfo(struct cpufreq_policy *policy, |
| max_freq = freq; |
| } |
| |
| + trace_android_vh_freq_table_limits(policy, min_freq, max_freq); |
| policy->min = policy->cpuinfo.min_freq = min_freq; |
| policy->max = max_freq; |
| /* |
| diff --git a/include/trace/hooks/cpufreq.h b/include/trace/hooks/cpufreq.h |
| new file mode 100644 |
| --- /dev/null |
| +++ b/include/trace/hooks/cpufreq.h |
| @@ -0,0 +1,25 @@ |
| +/* SPDX-License-Identifier: GPL-2.0 */ |
| +#undef TRACE_SYSTEM |
| +#define TRACE_SYSTEM cpufreq |
| + |
| +#define TRACE_INCLUDE_PATH trace/hooks |
| + |
| +#if !defined(_TRACE_HOOK_CPUFREQ_H) || defined(TRACE_HEADER_MULTI_READ) |
| +#define _TRACE_HOOK_CPUFREQ_H |
| + |
| +#include <linux/cpufreq.h> |
| +#include <linux/tracepoint.h> |
| +#include <trace/hooks/vendor_hooks.h> |
| + |
| +DECLARE_HOOK(android_vh_show_max_freq, |
| + TP_PROTO(struct cpufreq_policy *policy, unsigned int *max_freq), |
| + TP_ARGS(policy, max_freq)); |
| + |
| +DECLARE_HOOK(android_vh_freq_table_limits, |
| + TP_PROTO(struct cpufreq_policy *policy, unsigned int min_freq, |
| + unsigned int max_freq), |
| + TP_ARGS(policy, min_freq, max_freq)); |
| + |
| +#endif /* _TRACE_HOOK_CPUFREQ_H */ |
| +/* This part must be outside protection */ |
| +#include <trace/define_trace.h> |