habanalabs: define events to trace PCI LBW access
authorOhad Sharabi <osharabi@habana.ai>
Wed, 30 Nov 2022 12:02:00 +0000 (14:02 +0200)
committerOded Gabbay <ogabbay@kernel.org>
Thu, 26 Jan 2023 09:52:11 +0000 (11:52 +0200)
There are cases where it may be useful to dump the whole LBW configs.
Yet, doing so while spamming the kernel log will probably shade other
important messages since the LBW access is done in sheer volume.
To answer this we add trace events for those too.

Signed-off-by: Ohad Sharabi <osharabi@habana.ai>
Reviewed-by: Oded Gabbay <ogabbay@kernel.org>
Signed-off-by: Oded Gabbay <ogabbay@kernel.org>
include/trace/events/habanalabs.h

index 10233e1..951643e 100644 (file)
@@ -123,6 +123,45 @@ DEFINE_EVENT(habanalabs_comms_template, habanalabs_comms_wait_status_done,
        TP_PROTO(struct device *dev, char *op_str),
        TP_ARGS(dev, op_str));
 
+DECLARE_EVENT_CLASS(habanalabs_reg_access_template,
+       TP_PROTO(struct device *dev, u32 addr, u32 val),
+
+       TP_ARGS(dev, addr, val),
+
+       TP_STRUCT__entry(
+               __string(dname, dev_name(dev))
+               __field(u32, addr)
+               __field(u32, val)
+       ),
+
+       TP_fast_assign(
+               __assign_str(dname, dev_name(dev));
+               __entry->addr = addr;
+               __entry->val = val;
+       ),
+
+       TP_printk("%s: addr: %#x, val: %#x",
+               __get_str(dname),
+               __entry->addr,
+               __entry->val)
+);
+
+DEFINE_EVENT(habanalabs_reg_access_template, habanalabs_rreg32,
+       TP_PROTO(struct device *dev, u32 addr, u32 val),
+       TP_ARGS(dev, addr, val));
+
+DEFINE_EVENT(habanalabs_reg_access_template, habanalabs_wreg32,
+       TP_PROTO(struct device *dev, u32 addr, u32 val),
+       TP_ARGS(dev, addr, val));
+
+DEFINE_EVENT(habanalabs_reg_access_template, habanalabs_elbi_read,
+       TP_PROTO(struct device *dev, u32 addr, u32 val),
+       TP_ARGS(dev, addr, val));
+
+DEFINE_EVENT(habanalabs_reg_access_template, habanalabs_elbi_write,
+       TP_PROTO(struct device *dev, u32 addr, u32 val),
+       TP_ARGS(dev, addr, val));
+
 #endif /* if !defined(_TRACE_HABANALABS_H) || defined(TRACE_HEADER_MULTI_READ) */
 
 /* This part must be outside protection */