1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _LINUX_FTRACE_IRQ_H
3#define _LINUX_FTRACE_IRQ_H
4
5#ifdef CONFIG_HWLAT_TRACER
6extern bool trace_hwlat_callback_enabled;
7extern void trace_hwlat_callback(bool enter);
8#endif
9
10#ifdef CONFIG_OSNOISE_TRACER
11extern bool trace_osnoise_callback_enabled;
12extern void trace_osnoise_callback(bool enter);
13#endif
14
15static inline void ftrace_nmi_enter(void)
16{
17#ifdef CONFIG_HWLAT_TRACER
18	if (trace_hwlat_callback_enabled)
19		trace_hwlat_callback(true);
20#endif
21#ifdef CONFIG_OSNOISE_TRACER
22	if (trace_osnoise_callback_enabled)
23		trace_osnoise_callback(true);
24#endif
25}
26
27static inline void ftrace_nmi_exit(void)
28{
29#ifdef CONFIG_HWLAT_TRACER
30	if (trace_hwlat_callback_enabled)
31		trace_hwlat_callback(false);
32#endif
33#ifdef CONFIG_OSNOISE_TRACER
34	if (trace_osnoise_callback_enabled)
35		trace_osnoise_callback(false);
36#endif
37}
38
39#endif /* _LINUX_FTRACE_IRQ_H */
40