1 /* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */
2 /*
3  * Copyright(c) 2017 Intel Corporation.
4  */
5 
6 #if !defined(__HFI1_TRACE_MMU_H) || defined(TRACE_HEADER_MULTI_READ)
7 #define __HFI1_TRACE_MMU_H
8 
9 #include <linux/tracepoint.h>
10 #include <linux/trace_seq.h>
11 
12 #include "hfi.h"
13 
14 #undef TRACE_SYSTEM
15 #define TRACE_SYSTEM hfi1_mmu
16 
17 DECLARE_EVENT_CLASS(hfi1_mmu_rb_template,
18 		    TP_PROTO(struct mmu_rb_node *node),
19 		    TP_ARGS(node),
20 		    TP_STRUCT__entry(__field(unsigned long, addr)
21 				     __field(unsigned long, len)
22 				     __field(unsigned int, refcount)
23 			    ),
24 		    TP_fast_assign(__entry->addr = node->addr;
25 				   __entry->len = node->len;
26 				   __entry->refcount = kref_read(&node->refcount);
27 			    ),
28 		    TP_printk("MMU node addr 0x%lx, len %lu, refcount %u",
29 			      __entry->addr,
30 			      __entry->len,
31 			      __entry->refcount
32 			    )
33 );
34 
35 DEFINE_EVENT(hfi1_mmu_rb_template, hfi1_mmu_rb_insert,
36 	     TP_PROTO(struct mmu_rb_node *node),
37 	     TP_ARGS(node));
38 
39 TRACE_EVENT(hfi1_mmu_rb_search,
40 	    TP_PROTO(unsigned long addr, unsigned long len),
41 	    TP_ARGS(addr, len),
42 	    TP_STRUCT__entry(__field(unsigned long, addr)
43 			     __field(unsigned long, len)
44 		    ),
45 	    TP_fast_assign(__entry->addr = addr;
46 			   __entry->len = len;
47 		    ),
48 	    TP_printk("MMU node addr 0x%lx, len %lu",
49 		      __entry->addr,
50 		      __entry->len
51 		    )
52 );
53 
54 DEFINE_EVENT(hfi1_mmu_rb_template, hfi1_mmu_mem_invalidate,
55 	     TP_PROTO(struct mmu_rb_node *node),
56 	     TP_ARGS(node));
57 
58 DEFINE_EVENT(hfi1_mmu_rb_template, hfi1_mmu_rb_evict,
59 	     TP_PROTO(struct mmu_rb_node *node),
60 	     TP_ARGS(node));
61 
62 DEFINE_EVENT(hfi1_mmu_rb_template, hfi1_mmu_release_node,
63 	     TP_PROTO(struct mmu_rb_node *node),
64 	     TP_ARGS(node));
65 
66 #endif /* __HFI1_TRACE_RC_H */
67 
68 #undef TRACE_INCLUDE_PATH
69 #undef TRACE_INCLUDE_FILE
70 #define TRACE_INCLUDE_PATH .
71 #define TRACE_INCLUDE_FILE trace_mmu
72 #include <trace/define_trace.h>
73