18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#undef TRACE_SYSTEM
38c2ecf20Sopenharmony_ci#define TRACE_SYSTEM msr
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci#undef TRACE_INCLUDE_FILE
68c2ecf20Sopenharmony_ci#define TRACE_INCLUDE_FILE msr-trace
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci#undef TRACE_INCLUDE_PATH
98c2ecf20Sopenharmony_ci#define TRACE_INCLUDE_PATH asm/
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#if !defined(_TRACE_MSR_H) || defined(TRACE_HEADER_MULTI_READ)
128c2ecf20Sopenharmony_ci#define _TRACE_MSR_H
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci#include <linux/tracepoint.h>
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci/*
178c2ecf20Sopenharmony_ci * Tracing for x86 model specific registers. Directly maps to the
188c2ecf20Sopenharmony_ci * RDMSR/WRMSR instructions.
198c2ecf20Sopenharmony_ci */
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ciDECLARE_EVENT_CLASS(msr_trace_class,
228c2ecf20Sopenharmony_ci	    TP_PROTO(unsigned msr, u64 val, int failed),
238c2ecf20Sopenharmony_ci	    TP_ARGS(msr, val, failed),
248c2ecf20Sopenharmony_ci	    TP_STRUCT__entry(
258c2ecf20Sopenharmony_ci		    __field(	unsigned,	msr )
268c2ecf20Sopenharmony_ci		    __field(    u64,		val )
278c2ecf20Sopenharmony_ci		    __field(    int,		failed )
288c2ecf20Sopenharmony_ci	    ),
298c2ecf20Sopenharmony_ci	    TP_fast_assign(
308c2ecf20Sopenharmony_ci		    __entry->msr = msr;
318c2ecf20Sopenharmony_ci		    __entry->val = val;
328c2ecf20Sopenharmony_ci		    __entry->failed = failed;
338c2ecf20Sopenharmony_ci	    ),
348c2ecf20Sopenharmony_ci	    TP_printk("%x, value %llx%s",
358c2ecf20Sopenharmony_ci		      __entry->msr,
368c2ecf20Sopenharmony_ci		      __entry->val,
378c2ecf20Sopenharmony_ci		      __entry->failed ? " #GP" : "")
388c2ecf20Sopenharmony_ci);
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ciDEFINE_EVENT(msr_trace_class, read_msr,
418c2ecf20Sopenharmony_ci	     TP_PROTO(unsigned msr, u64 val, int failed),
428c2ecf20Sopenharmony_ci	     TP_ARGS(msr, val, failed)
438c2ecf20Sopenharmony_ci);
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_ciDEFINE_EVENT(msr_trace_class, write_msr,
468c2ecf20Sopenharmony_ci	     TP_PROTO(unsigned msr, u64 val, int failed),
478c2ecf20Sopenharmony_ci	     TP_ARGS(msr, val, failed)
488c2ecf20Sopenharmony_ci);
498c2ecf20Sopenharmony_ci
508c2ecf20Sopenharmony_ciDEFINE_EVENT(msr_trace_class, rdpmc,
518c2ecf20Sopenharmony_ci	     TP_PROTO(unsigned msr, u64 val, int failed),
528c2ecf20Sopenharmony_ci	     TP_ARGS(msr, val, failed)
538c2ecf20Sopenharmony_ci);
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_ci#endif /* _TRACE_MSR_H */
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_ci/* This part must be outside protection */
588c2ecf20Sopenharmony_ci#include <trace/define_trace.h>
59