ANDROID: topology: Add restricted vendor hook for cpu_capacity_show

Introduce a restricted vendor hook to allow vendor modules to update
cpu_capacity shown via userspace.

Bug: 335410902
Change-Id: I5a196c8cffdfb6835e75b60d983cd30541a9756e
Signed-off-by: Shaleen Agrawal <quic_shalagra@quicinc.com>
(cherry picked from commit 333328523be5556b7fa0bfe045da466936ff8b81)
This commit is contained in:
Shaleen Agrawal
2024-04-17 11:18:59 -07:00
committed by Treehugger Robot
parent 73b3806ea1
commit ef1f4c9120
3 changed files with 8 additions and 1 deletions
+1
View File
@@ -122,3 +122,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_look_around_migrate_folio);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_test_clear_look_around_ref);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_arm64_serror_panic);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_do_sea);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_cpu_capacity_show);
+3 -1
View File
@@ -220,8 +220,10 @@ static ssize_t cpu_capacity_show(struct device *dev,
char *buf)
{
struct cpu *cpu = container_of(dev, struct cpu, dev);
unsigned long capacity = topology_get_cpu_scale(cpu->dev.id);
return sysfs_emit(buf, "%lu\n", topology_get_cpu_scale(cpu->dev.id));
trace_android_rvh_cpu_capacity_show(&capacity, cpu->dev.id);
return sysfs_emit(buf, "%lu\n", capacity);
}
static void update_topology_flags_workfn(struct work_struct *work);
+4
View File
@@ -16,6 +16,10 @@ DECLARE_HOOK(android_vh_arch_set_freq_scale,
unsigned long *scale),
TP_ARGS(cpus, freq, max, scale));
DECLARE_RESTRICTED_HOOK(android_rvh_cpu_capacity_show,
TP_PROTO(unsigned long *capacity, int cpu),
TP_ARGS(capacity, cpu), 1);
#endif /* _TRACE_HOOK_TOPOLOGY_H */
/* This part must be outside protection */
#include <trace/define_trace.h>