ANDROID: topology: Add vendor hook for use_amu_fie

Vendors could decide to use amu fie feature or not, such as if they
have some feature that needs amu fie to be disabled.

Bug: 297343949
Change-Id: I6b44ee899c58e7d5a8b2db03a30e3ab14b08f101
Signed-off-by: Rick Yiu <rickyiu@google.com>
This commit is contained in:
Rick Yiu 2022-12-19 07:02:04 +00:00 committed by Treehugger Robot
parent eb9686932b
commit 2b25d535d0
4 changed files with 18 additions and 0 deletions

View File

@ -22,6 +22,8 @@
#include <asm/cputype.h>
#include <asm/topology.h>
#include <trace/hooks/topology.h>
#ifdef CONFIG_ACPI
static bool __init acpi_cpu_is_threaded(int cpu)
{
@ -151,6 +153,11 @@ static void amu_scale_freq_tick(void)
{
u64 prev_core_cnt, prev_const_cnt;
u64 core_cnt, const_cnt, scale;
bool use_amu_fie = true;
trace_android_vh_use_amu_fie(&use_amu_fie);
if(!use_amu_fie)
return;
prev_const_cnt = this_cpu_read(arch_const_cycles_prev);
prev_core_cnt = this_cpu_read(arch_core_cycles_prev);

View File

@ -326,3 +326,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_tune_swappiness);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_exit_signal_whether_wake);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_exit_check);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_freeze_whether_wake);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_use_amu_fie);

View File

@ -34,6 +34,12 @@ static DEFINE_PER_CPU(u32, freq_factor) = 1;
static bool supports_scale_freq_counters(const struct cpumask *cpus)
{
bool use_amu_fie = true;
trace_android_vh_use_amu_fie(&use_amu_fie);
if (!use_amu_fie)
return false;
return cpumask_subset(cpus, &scale_freq_counters_mask);
}

View File

@ -24,6 +24,10 @@ DECLARE_HOOK(android_vh_arch_set_freq_scale,
#endif
DECLARE_HOOK(android_vh_use_amu_fie,
TP_PROTO(bool *use_amu_fie),
TP_ARGS(use_amu_fie));
#endif /* _TRACE_HOOK_TOPOLOGY_H */
/* This part must be outside protection */
#include <trace/define_trace.h>