1 /* SPDX-License-Identifier: GPL-2.0
3 * Copyright 2022-2023 HabanaLabs, Ltd.
9 #define TRACE_SYSTEM habanalabs
11 #if !defined(_TRACE_HABANALABS_H) || defined(TRACE_HEADER_MULTI_READ)
12 #define _TRACE_HABANALABS_H
14 #include <linux/tracepoint.h>
16 DECLARE_EVENT_CLASS(habanalabs_mmu_template
,
17 TP_PROTO(struct device
*dev
, u64 virt_addr
, u64 phys_addr
, u32 page_size
, bool flush_pte
),
19 TP_ARGS(dev
, virt_addr
, phys_addr
, page_size
, flush_pte
),
22 __string(dname
, dev_name(dev
))
23 __field(u64
, virt_addr
)
24 __field(u64
, phys_addr
)
25 __field(u32
, page_size
)
26 __field(u8
, flush_pte
)
31 __entry
->virt_addr
= virt_addr
;
32 __entry
->phys_addr
= phys_addr
;
33 __entry
->page_size
= page_size
;
34 __entry
->flush_pte
= flush_pte
;
37 TP_printk("%s: vaddr: %#llx, paddr: %#llx, psize: %#x, flush: %s",
42 __entry
->flush_pte
? "true" : "false")
45 DEFINE_EVENT(habanalabs_mmu_template
, habanalabs_mmu_map
,
46 TP_PROTO(struct device
*dev
, u64 virt_addr
, u64 phys_addr
, u32 page_size
, bool flush_pte
),
47 TP_ARGS(dev
, virt_addr
, phys_addr
, page_size
, flush_pte
));
49 DEFINE_EVENT(habanalabs_mmu_template
, habanalabs_mmu_unmap
,
50 TP_PROTO(struct device
*dev
, u64 virt_addr
, u64 phys_addr
, u32 page_size
, bool flush_pte
),
51 TP_ARGS(dev
, virt_addr
, phys_addr
, page_size
, flush_pte
));
53 DECLARE_EVENT_CLASS(habanalabs_dma_alloc_template
,
54 TP_PROTO(struct device
*dev
, u64 cpu_addr
, u64 dma_addr
, size_t size
, const char *caller
),
56 TP_ARGS(dev
, cpu_addr
, dma_addr
, size
, caller
),
59 __string(dname
, dev_name(dev
))
60 __field(u64
, cpu_addr
)
61 __field(u64
, dma_addr
)
63 __field(const char *, caller
)
68 __entry
->cpu_addr
= cpu_addr
;
69 __entry
->dma_addr
= dma_addr
;
71 __entry
->caller
= caller
;
74 TP_printk("%s: cpu_addr: %#llx, dma_addr: %#llx, size: %#x, caller: %s",
82 DEFINE_EVENT(habanalabs_dma_alloc_template
, habanalabs_dma_alloc
,
83 TP_PROTO(struct device
*dev
, u64 cpu_addr
, u64 dma_addr
, size_t size
, const char *caller
),
84 TP_ARGS(dev
, cpu_addr
, dma_addr
, size
, caller
));
86 DEFINE_EVENT(habanalabs_dma_alloc_template
, habanalabs_dma_free
,
87 TP_PROTO(struct device
*dev
, u64 cpu_addr
, u64 dma_addr
, size_t size
, const char *caller
),
88 TP_ARGS(dev
, cpu_addr
, dma_addr
, size
, caller
));
90 DECLARE_EVENT_CLASS(habanalabs_dma_map_template
,
91 TP_PROTO(struct device
*dev
, u64 phys_addr
, u64 dma_addr
, size_t len
,
92 enum dma_data_direction dir
, const char *caller
),
94 TP_ARGS(dev
, phys_addr
, dma_addr
, len
, dir
, caller
),
97 __string(dname
, dev_name(dev
))
98 __field(u64
, phys_addr
)
99 __field(u64
, dma_addr
)
102 __field(const char *, caller
)
107 __entry
->phys_addr
= phys_addr
;
108 __entry
->dma_addr
= dma_addr
;
111 __entry
->caller
= caller
;
114 TP_printk("%s: phys_addr: %#llx, dma_addr: %#llx, len: %#x, dir: %d, caller: %s",
123 DEFINE_EVENT(habanalabs_dma_map_template
, habanalabs_dma_map_page
,
124 TP_PROTO(struct device
*dev
, u64 phys_addr
, u64 dma_addr
, size_t len
,
125 enum dma_data_direction dir
, const char *caller
),
126 TP_ARGS(dev
, phys_addr
, dma_addr
, len
, dir
, caller
));
128 DEFINE_EVENT(habanalabs_dma_map_template
, habanalabs_dma_unmap_page
,
129 TP_PROTO(struct device
*dev
, u64 phys_addr
, u64 dma_addr
, size_t len
,
130 enum dma_data_direction dir
, const char *caller
),
131 TP_ARGS(dev
, phys_addr
, dma_addr
, len
, dir
, caller
));
133 DECLARE_EVENT_CLASS(habanalabs_comms_template
,
134 TP_PROTO(struct device
*dev
, char *op_str
),
136 TP_ARGS(dev
, op_str
),
139 __string(dname
, dev_name(dev
))
140 __field(char *, op_str
)
145 __entry
->op_str
= op_str
;
148 TP_printk("%s: cms: %s",
153 DEFINE_EVENT(habanalabs_comms_template
, habanalabs_comms_protocol_cmd
,
154 TP_PROTO(struct device
*dev
, char *op_str
),
155 TP_ARGS(dev
, op_str
));
157 DEFINE_EVENT(habanalabs_comms_template
, habanalabs_comms_send_cmd
,
158 TP_PROTO(struct device
*dev
, char *op_str
),
159 TP_ARGS(dev
, op_str
));
161 DEFINE_EVENT(habanalabs_comms_template
, habanalabs_comms_wait_status
,
162 TP_PROTO(struct device
*dev
, char *op_str
),
163 TP_ARGS(dev
, op_str
));
165 DEFINE_EVENT(habanalabs_comms_template
, habanalabs_comms_wait_status_done
,
166 TP_PROTO(struct device
*dev
, char *op_str
),
167 TP_ARGS(dev
, op_str
));
169 DECLARE_EVENT_CLASS(habanalabs_reg_access_template
,
170 TP_PROTO(struct device
*dev
, u32 addr
, u32 val
),
172 TP_ARGS(dev
, addr
, val
),
175 __string(dname
, dev_name(dev
))
182 __entry
->addr
= addr
;
186 TP_printk("%s: addr: %#x, val: %#x",
192 DEFINE_EVENT(habanalabs_reg_access_template
, habanalabs_rreg32
,
193 TP_PROTO(struct device
*dev
, u32 addr
, u32 val
),
194 TP_ARGS(dev
, addr
, val
));
196 DEFINE_EVENT(habanalabs_reg_access_template
, habanalabs_wreg32
,
197 TP_PROTO(struct device
*dev
, u32 addr
, u32 val
),
198 TP_ARGS(dev
, addr
, val
));
200 DEFINE_EVENT(habanalabs_reg_access_template
, habanalabs_elbi_read
,
201 TP_PROTO(struct device
*dev
, u32 addr
, u32 val
),
202 TP_ARGS(dev
, addr
, val
));
204 DEFINE_EVENT(habanalabs_reg_access_template
, habanalabs_elbi_write
,
205 TP_PROTO(struct device
*dev
, u32 addr
, u32 val
),
206 TP_ARGS(dev
, addr
, val
));
208 #endif /* if !defined(_TRACE_HABANALABS_H) || defined(TRACE_HEADER_MULTI_READ) */
210 /* This part must be outside protection */
211 #include <trace/define_trace.h>