1 /* SPDX-License-Identifier: GPL-2.0 */
3 #define TRACE_SYSTEM mpx
5 #if !defined(_TRACE_MPX_H) || defined(TRACE_HEADER_MULTI_READ)
8 #include <linux/tracepoint.h>
10 #ifdef CONFIG_X86_INTEL_MPX
12 TRACE_EVENT(mpx_bounds_register_exception,
14 TP_PROTO(void *addr_referenced,
15 const struct mpx_bndreg *bndreg),
16 TP_ARGS(addr_referenced, bndreg),
19 __field(void *, addr_referenced)
20 __field(u64, lower_bound)
21 __field(u64, upper_bound)
25 __entry->addr_referenced = addr_referenced;
26 __entry->lower_bound = bndreg->lower_bound;
27 __entry->upper_bound = bndreg->upper_bound;
30 * Note that we are printing out the '~' of the upper
31 * bounds register here. It is actually stored in its
32 * one's complement form so that its 'init' state
33 * corresponds to all 0's. But, that looks like
34 * gibberish when printed out, so print out the 1's
35 * complement instead of the actual value here. Note
36 * though that you still need to specify filters for the
37 * actual value, not the displayed one.
39 TP_printk("address referenced: 0x%p bounds: lower: 0x%llx ~upper: 0x%llx",
40 __entry->addr_referenced,
46 TRACE_EVENT(bounds_exception_mpx,
48 TP_PROTO(const struct mpx_bndcsr *bndcsr),
53 __field(u64, bndstatus)
57 /* need to get rid of the 'const' on bndcsr */
58 __entry->bndcfgu = (u64)bndcsr->bndcfgu;
59 __entry->bndstatus = (u64)bndcsr->bndstatus;
62 TP_printk("bndcfgu:0x%llx bndstatus:0x%llx",
67 DECLARE_EVENT_CLASS(mpx_range_trace,
69 TP_PROTO(unsigned long start,
74 __field(unsigned long, start)
75 __field(unsigned long, end)
79 __entry->start = start;
83 TP_printk("[0x%p:0x%p]",
84 (void *)__entry->start,
89 DEFINE_EVENT(mpx_range_trace, mpx_unmap_zap,
90 TP_PROTO(unsigned long start, unsigned long end),
94 DEFINE_EVENT(mpx_range_trace, mpx_unmap_search,
95 TP_PROTO(unsigned long start, unsigned long end),
99 TRACE_EVENT(mpx_new_bounds_table,
101 TP_PROTO(unsigned long table_vaddr),
102 TP_ARGS(table_vaddr),
105 __field(unsigned long, table_vaddr)
109 __entry->table_vaddr = table_vaddr;
112 TP_printk("table vaddr:%p", (void *)__entry->table_vaddr)
118 * This gets used outside of MPX-specific code, so we need a stub.
121 void trace_bounds_exception_mpx(const struct mpx_bndcsr *bndcsr)
125 #endif /* CONFIG_X86_INTEL_MPX */
127 #undef TRACE_INCLUDE_PATH
128 #define TRACE_INCLUDE_PATH asm/trace/
129 #undef TRACE_INCLUDE_FILE
130 #define TRACE_INCLUDE_FILE mpx
131 #endif /* _TRACE_MPX_H */
133 /* This part must be outside protection */
134 #include <trace/define_trace.h>