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.

Bug: 173984660
Signed-off-by: Todd Kjos <tkjos@google.com>
Change-Id: Ida11256f399f0730bc1228524b9687df3e7b8bf4
This commit is contained in:
Todd Kjos
2020-11-23 11:08:48 -08:00
parent 65f5ed41f6
commit efab334061
4 changed files with 46 additions and 1 deletions

View File

@@ -24,6 +24,7 @@
#include <trace/hooks/printk.h>
#include <trace/hooks/gic_v3.h>
#include <trace/hooks/epoch.h>
#include <trace/hooks/cpufreq.h>
/*
* Export tracepoints that act as a bare tracehook (ie: have no trace event
@@ -73,3 +74,5 @@ 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);

View File

@@ -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);

View File

@@ -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 = policy->cpuinfo.max_freq = max_freq;

View File

@@ -0,0 +1,32 @@
/* 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/tracepoint.h>
#include <trace/hooks/vendor_hooks.h>
#if defined(CONFIG_TRACEPOINTS) && defined(CONFIG_ANDROID_VENDOR_HOOKS)
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));
#else
#define trace_android_vh_show_max_freq(policy, max_freq)
#define trace_android_vh_freq_table_limits(policy, min_freq, max_freq)
#endif
#endif /* _TRACE_HOOK_CPUFREQ_H */
/* This part must be outside protection */
#include <trace/define_trace.h>