diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index ccb64d09f380..e42cca2789ca 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -62,6 +62,7 @@ #include #include #include +#include #include /* @@ -258,6 +259,8 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_shrink_slab_bypass); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_do_shrink_slab); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_get_page_wmark); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_page_add_new_anon_rmap); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_psci_tos_resident_on); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_psci_cpu_suspend); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_psi_event); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_psi_group); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cpufreq_acct_update_power); diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c index f78249fe2512..c8c074061614 100644 --- a/drivers/firmware/psci/psci.c +++ b/drivers/firmware/psci/psci.c @@ -28,6 +28,7 @@ #include #include #include +#include /* * While a 64-bit OS can make calls with SMC32 calling conventions, for some @@ -53,6 +54,12 @@ static enum arm_smccc_conduit psci_conduit = SMCCC_CONDUIT_NONE; bool psci_tos_resident_on(int cpu) { + bool resident = false; + + trace_android_rvh_psci_tos_resident_on(cpu, &resident); + if (resident) + return resident; + return cpu == resident_cpu; } @@ -175,6 +182,11 @@ static __always_inline int __psci_cpu_suspend(u32 fn, u32 state, unsigned long entry_point) { int err; + bool deny = false; + + trace_android_rvh_psci_cpu_suspend(state, &deny); + if (deny) + return -EPERM; err = invoke_psci_fn(fn, state, entry_point, 0); return psci_to_linux_errno(err); diff --git a/include/trace/hooks/psci.h b/include/trace/hooks/psci.h new file mode 100644 index 000000000000..a00925df75da --- /dev/null +++ b/include/trace/hooks/psci.h @@ -0,0 +1,25 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM psci +#undef TRACE_INCLUDE_PATH + +#define TRACE_INCLUDE_PATH trace/hooks + +#if !defined(_TRACE_HOOK_PSCI_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_HOOK_PSCI_H + +#include + +DECLARE_HOOK(android_rvh_psci_tos_resident_on, + TP_PROTO(int cpu, bool *resident), + TP_ARGS(cpu, resident)); + +DECLARE_HOOK(android_rvh_psci_cpu_suspend, + TP_PROTO(u32 state, bool *deny), + TP_ARGS(state, deny)); + +/* macro versions of hooks are no longer required */ + +#endif /* _TRACE_HOOK_PSCI_H */ +/* This part must be outside protection */ +#include