diff --git a/arch/arm64/include/asm/processor.h b/arch/arm64/include/asm/processor.h index 240fe5e5b720..3986aa9f81ef 100644 --- a/arch/arm64/include/asm/processor.h +++ b/arch/arm64/include/asm/processor.h @@ -27,6 +27,7 @@ #include #include #include +#include #include @@ -140,6 +141,8 @@ struct thread_struct { struct user_fpsimd_state fpsimd_state; } uw; + ANDROID_VENDOR_DATA(1); + unsigned int fpsimd_cpu; void *sve_state; /* SVE registers, if any */ unsigned int sve_vl; /* SVE vector length */ diff --git a/arch/arm64/kernel/process.c b/arch/arm64/kernel/process.c index 6089638c7d43..76532ea63fcb 100644 --- a/arch/arm64/kernel/process.c +++ b/arch/arm64/kernel/process.c @@ -43,6 +43,7 @@ #include #include #include +#include #include #include @@ -539,6 +540,8 @@ __notrace_funcgraph struct task_struct *__switch_to(struct task_struct *prev, */ dsb(ish); + trace_android_vh_is_fpsimd_save(prev, next); + /* the actual thread switch */ last = cpu_switch_to(prev, next); diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index bb6c969475ee..6b04fe0d67b0 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -9,9 +9,11 @@ #define CREATE_TRACE_POINTS #include #include +#include /* * Export tracepoints that act as a bare tracehook (ie: have no trace event * associated with them) to allow external modules to probe them. */ EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_select_task_rq_fair); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_is_fpsimd_save); diff --git a/include/trace/hooks/fpsimd.h b/include/trace/hooks/fpsimd.h new file mode 100644 index 000000000000..73ad2c0009c3 --- /dev/null +++ b/include/trace/hooks/fpsimd.h @@ -0,0 +1,26 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM fpsimd + +#define TRACE_INCLUDE_PATH trace/hooks + +#if !defined(_TRACE_HOOK_FPSIMD_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_HOOK_FPSIMD_H + +#include +#include + +#if defined(CONFIG_TRACEPOINTS) && defined(CONFIG_ANDROID_VENDOR_HOOKS) +struct task_struct; + +DECLARE_HOOK(android_vh_is_fpsimd_save, + TP_PROTO(struct task_struct *prev, struct task_struct *next), + TP_ARGS(prev, next)) +#else + +#define trace_android_vh_is_fpsimd_save(prev, next) +#endif + +#endif /* _TRACE_HOOK_FPSIMD_H */ +/* This part must be outside protection */ +#include