From 2b25d535d0703dbee0f9860dfd2c487e96a89fd8 Mon Sep 17 00:00:00 2001 From: Rick Yiu Date: Mon, 19 Dec 2022 07:02:04 +0000 Subject: [PATCH] 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 --- arch/arm64/kernel/topology.c | 7 +++++++ drivers/android/vendor_hooks.c | 1 + drivers/base/arch_topology.c | 6 ++++++ include/trace/hooks/topology.h | 4 ++++ 4 files changed, 18 insertions(+) diff --git a/arch/arm64/kernel/topology.c b/arch/arm64/kernel/topology.c index 817d788cd866..7c93307bd960 100644 --- a/arch/arm64/kernel/topology.c +++ b/arch/arm64/kernel/topology.c @@ -22,6 +22,8 @@ #include #include +#include + #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); diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index 9a310923f1ed..b42e7f6ee83e 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -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); diff --git a/drivers/base/arch_topology.c b/drivers/base/arch_topology.c index 2cdade8aa933..148e24b91cf1 100644 --- a/drivers/base/arch_topology.c +++ b/drivers/base/arch_topology.c @@ -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); } diff --git a/include/trace/hooks/topology.h b/include/trace/hooks/topology.h index d2673d4379c1..56a9fd22f8c6 100644 --- a/include/trace/hooks/topology.h +++ b/include/trace/hooks/topology.h @@ -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