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: 344826816
Bug: 297343949
Bug: 261753861
Change-Id: I6b44ee899c58e7d5a8b2db03a30e3ab14b08f101
Signed-off-by: Rick Yiu <rickyiu@google.com>
(cherry picked from commit 2b25d535d0703dbee0f9860dfd2c487e96a89fd8)
[Fix trivial conflict in vendor_hooks.c due to different ordering]
Signed-off-by: Qais Yousef <qyousef@google.com>
This commit is contained in:
Rick Yiu
2022-12-19 07:02:04 +00:00
committed by Treehugger Robot
parent 124897124a
commit 2ab1628371
4 changed files with 19 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)
{
@@ -154,6 +156,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

@@ -558,3 +558,5 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_try_to_unmap_one);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_resume_begin);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_resume_end);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_early_resume_begin);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_use_amu_fie);

View File

@@ -37,6 +37,12 @@ EXPORT_PER_CPU_SYMBOL_GPL(capacity_freq_ref);
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

@@ -20,6 +20,10 @@ DECLARE_RESTRICTED_HOOK(android_rvh_cpu_capacity_show,
TP_PROTO(unsigned long *capacity, int cpu),
TP_ARGS(capacity, cpu), 1);
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>