| 1 | /* SPDX-License-Identifier: GPL-2.0 */ | 
|---|
| 2 | #undef TRACE_SYSTEM | 
|---|
| 3 | #define TRACE_SYSTEM msr | 
|---|
| 4 |  | 
|---|
| 5 | #undef TRACE_INCLUDE_FILE | 
|---|
| 6 | #define TRACE_INCLUDE_FILE msr-trace | 
|---|
| 7 |  | 
|---|
| 8 | #undef TRACE_INCLUDE_PATH | 
|---|
| 9 | #define TRACE_INCLUDE_PATH asm/ | 
|---|
| 10 |  | 
|---|
| 11 | #if !defined(_TRACE_MSR_H) || defined(TRACE_HEADER_MULTI_READ) | 
|---|
| 12 | #define _TRACE_MSR_H | 
|---|
| 13 |  | 
|---|
| 14 | #include <linux/tracepoint.h> | 
|---|
| 15 |  | 
|---|
| 16 | /* | 
|---|
| 17 | * Tracing for x86 model specific registers. Directly maps to the | 
|---|
| 18 | * RDMSR/WRMSR instructions. | 
|---|
| 19 | */ | 
|---|
| 20 |  | 
|---|
| 21 | DECLARE_EVENT_CLASS(msr_trace_class, | 
|---|
| 22 | TP_PROTO(unsigned msr, u64 val, int failed), | 
|---|
| 23 | TP_ARGS(msr, val, failed), | 
|---|
| 24 | TP_STRUCT__entry( | 
|---|
| 25 | __field(	unsigned,	msr ) | 
|---|
| 26 | __field(    u64,		val ) | 
|---|
| 27 | __field(    int,		failed ) | 
|---|
| 28 | ), | 
|---|
| 29 | TP_fast_assign( | 
|---|
| 30 | __entry->msr = msr; | 
|---|
| 31 | __entry->val = val; | 
|---|
| 32 | __entry->failed = failed; | 
|---|
| 33 | ), | 
|---|
| 34 | TP_printk( "%x, value %llx%s", | 
|---|
| 35 | __entry->msr, | 
|---|
| 36 | __entry->val, | 
|---|
| 37 | __entry->failed ? " #GP": "") | 
|---|
| 38 | ); | 
|---|
| 39 |  | 
|---|
| 40 | DEFINE_EVENT(msr_trace_class, read_msr, | 
|---|
| 41 | TP_PROTO(unsigned msr, u64 val, int failed), | 
|---|
| 42 | TP_ARGS(msr, val, failed) | 
|---|
| 43 | ); | 
|---|
| 44 |  | 
|---|
| 45 | DEFINE_EVENT(msr_trace_class, write_msr, | 
|---|
| 46 | TP_PROTO(unsigned msr, u64 val, int failed), | 
|---|
| 47 | TP_ARGS(msr, val, failed) | 
|---|
| 48 | ); | 
|---|
| 49 |  | 
|---|
| 50 | DEFINE_EVENT(msr_trace_class, rdpmc, | 
|---|
| 51 | TP_PROTO(unsigned msr, u64 val, int failed), | 
|---|
| 52 | TP_ARGS(msr, val, failed) | 
|---|
| 53 | ); | 
|---|
| 54 |  | 
|---|
| 55 | #endif /* _TRACE_MSR_H */ | 
|---|
| 56 |  | 
|---|
| 57 | /* This part must be outside protection */ | 
|---|
| 58 | #include <trace/define_trace.h> | 
|---|
| 59 |  | 
|---|