diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index 4fc11cd948ea..8607c6779c6c 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -58,6 +58,7 @@ #include #include #include +#include #include #include #include @@ -284,6 +285,8 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_audio_usb_offload_disconnect); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_atomic_remove_fb); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_drm_atomic_check_modeset); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_get_thermal_zone_device); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_psci_tos_resident_on); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_psci_cpu_suspend); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_usb_new_device_added); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_force_compatible_pre); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_force_compatible_post); diff --git a/drivers/firmware/psci/psci.c b/drivers/firmware/psci/psci.c index cfb448eabdaa..b41cacaaf961 100644 --- a/drivers/firmware/psci/psci.c +++ b/drivers/firmware/psci/psci.c @@ -27,6 +27,7 @@ #include #include #include +#include /* * While a 64-bit OS can make calls with SMC32 calling conventions, for some @@ -52,6 +53,12 @@ static enum arm_smccc_conduit psci_conduit = SMCCC_CONDUIT_NONE; bool psci_tos_resident_on(int cpu) { + bool resident = false; + + trace_android_vh_psci_tos_resident_on(cpu, &resident); + if (resident) + return resident; + return cpu == resident_cpu; } @@ -169,6 +176,11 @@ int psci_set_osi_mode(bool enable) static int __psci_cpu_suspend(u32 fn, u32 state, unsigned long entry_point) { int err; + bool deny = false; + + trace_android_vh_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..23090d9d2ef9 --- /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_vh_psci_tos_resident_on, + TP_PROTO(int cpu, bool *resident), + TP_ARGS(cpu, resident)); + +DECLARE_HOOK(android_vh_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