xref: /openbmc/linux/arch/x86/include/asm/trace/fpu.h (revision 03ab8e6297acd1bc0eedaa050e2a1635c576fd11)
1b2441318SGreg Kroah-Hartman /* SPDX-License-Identifier: GPL-2.0 */
2d1898b73SDave Hansen #undef TRACE_SYSTEM
3d1898b73SDave Hansen #define TRACE_SYSTEM x86_fpu
4d1898b73SDave Hansen 
5d1898b73SDave Hansen #if !defined(_TRACE_FPU_H) || defined(TRACE_HEADER_MULTI_READ)
6d1898b73SDave Hansen #define _TRACE_FPU_H
7d1898b73SDave Hansen 
8d1898b73SDave Hansen #include <linux/tracepoint.h>
9d1898b73SDave Hansen 
10d1898b73SDave Hansen DECLARE_EVENT_CLASS(x86_fpu,
11d1898b73SDave Hansen 	TP_PROTO(struct fpu *fpu),
12d1898b73SDave Hansen 	TP_ARGS(fpu),
13d1898b73SDave Hansen 
14d1898b73SDave Hansen 	TP_STRUCT__entry(
15d1898b73SDave Hansen 		__field(struct fpu *, fpu)
165f409e20SRik van Riel 		__field(bool, load_fpu)
17d1898b73SDave Hansen 		__field(u64, xfeatures)
18d1898b73SDave Hansen 		__field(u64, xcomp_bv)
19d1898b73SDave Hansen 		),
20d1898b73SDave Hansen 
21d1898b73SDave Hansen 	TP_fast_assign(
22d1898b73SDave Hansen 		__entry->fpu		= fpu;
235f409e20SRik van Riel 		__entry->load_fpu	= test_thread_flag(TIF_NEED_FPU_LOAD);
24d1898b73SDave Hansen 		if (boot_cpu_has(X86_FEATURE_OSXSAVE)) {
25*cceb4964SThomas Gleixner 			__entry->xfeatures = fpu->fpstate->regs.xsave.header.xfeatures;
26*cceb4964SThomas Gleixner 			__entry->xcomp_bv  = fpu->fpstate->regs.xsave.header.xcomp_bv;
27d1898b73SDave Hansen 		}
28d1898b73SDave Hansen 	),
295f409e20SRik van Riel 	TP_printk("x86/fpu: %p load: %d xfeatures: %llx xcomp_bv: %llx",
30d1898b73SDave Hansen 			__entry->fpu,
315f409e20SRik van Riel 			__entry->load_fpu,
32d1898b73SDave Hansen 			__entry->xfeatures,
33d1898b73SDave Hansen 			__entry->xcomp_bv
34d1898b73SDave Hansen 	)
35d1898b73SDave Hansen );
36d1898b73SDave Hansen 
37d1898b73SDave Hansen DEFINE_EVENT(x86_fpu, x86_fpu_before_save,
38d1898b73SDave Hansen 	TP_PROTO(struct fpu *fpu),
39d1898b73SDave Hansen 	TP_ARGS(fpu)
40d1898b73SDave Hansen );
41d1898b73SDave Hansen 
42d1898b73SDave Hansen DEFINE_EVENT(x86_fpu, x86_fpu_after_save,
43d1898b73SDave Hansen 	TP_PROTO(struct fpu *fpu),
44d1898b73SDave Hansen 	TP_ARGS(fpu)
45d1898b73SDave Hansen );
46d1898b73SDave Hansen 
47d1898b73SDave Hansen DEFINE_EVENT(x86_fpu, x86_fpu_before_restore,
48d1898b73SDave Hansen 	TP_PROTO(struct fpu *fpu),
49d1898b73SDave Hansen 	TP_ARGS(fpu)
50d1898b73SDave Hansen );
51d1898b73SDave Hansen 
52d1898b73SDave Hansen DEFINE_EVENT(x86_fpu, x86_fpu_after_restore,
53d1898b73SDave Hansen 	TP_PROTO(struct fpu *fpu),
54d1898b73SDave Hansen 	TP_ARGS(fpu)
55d1898b73SDave Hansen );
56d1898b73SDave Hansen 
57d1898b73SDave Hansen DEFINE_EVENT(x86_fpu, x86_fpu_regs_activated,
58d1898b73SDave Hansen 	TP_PROTO(struct fpu *fpu),
59d1898b73SDave Hansen 	TP_ARGS(fpu)
60d1898b73SDave Hansen );
61d1898b73SDave Hansen 
62d1898b73SDave Hansen DEFINE_EVENT(x86_fpu, x86_fpu_regs_deactivated,
63d1898b73SDave Hansen 	TP_PROTO(struct fpu *fpu),
64d1898b73SDave Hansen 	TP_ARGS(fpu)
65d1898b73SDave Hansen );
66d1898b73SDave Hansen 
67d1898b73SDave Hansen DEFINE_EVENT(x86_fpu, x86_fpu_init_state,
68d1898b73SDave Hansen 	TP_PROTO(struct fpu *fpu),
69d1898b73SDave Hansen 	TP_ARGS(fpu)
70d1898b73SDave Hansen );
71d1898b73SDave Hansen 
72d1898b73SDave Hansen DEFINE_EVENT(x86_fpu, x86_fpu_dropped,
73d1898b73SDave Hansen 	TP_PROTO(struct fpu *fpu),
74d1898b73SDave Hansen 	TP_ARGS(fpu)
75d1898b73SDave Hansen );
76d1898b73SDave Hansen 
77d1898b73SDave Hansen DEFINE_EVENT(x86_fpu, x86_fpu_copy_src,
78d1898b73SDave Hansen 	TP_PROTO(struct fpu *fpu),
79d1898b73SDave Hansen 	TP_ARGS(fpu)
80d1898b73SDave Hansen );
81d1898b73SDave Hansen 
82d1898b73SDave Hansen DEFINE_EVENT(x86_fpu, x86_fpu_copy_dst,
83d1898b73SDave Hansen 	TP_PROTO(struct fpu *fpu),
84d1898b73SDave Hansen 	TP_ARGS(fpu)
85d1898b73SDave Hansen );
86d1898b73SDave Hansen 
87d1898b73SDave Hansen DEFINE_EVENT(x86_fpu, x86_fpu_xstate_check_failed,
88d1898b73SDave Hansen 	TP_PROTO(struct fpu *fpu),
89d1898b73SDave Hansen 	TP_ARGS(fpu)
90d1898b73SDave Hansen );
91d1898b73SDave Hansen 
92d1898b73SDave Hansen #undef TRACE_INCLUDE_PATH
93d1898b73SDave Hansen #define TRACE_INCLUDE_PATH asm/trace/
94d1898b73SDave Hansen #undef TRACE_INCLUDE_FILE
95d1898b73SDave Hansen #define TRACE_INCLUDE_FILE fpu
96d1898b73SDave Hansen #endif /* _TRACE_FPU_H */
97d1898b73SDave Hansen 
98d1898b73SDave Hansen /* This part must be outside protection */
99d1898b73SDave Hansen #include <trace/define_trace.h>
100