habanalabs: define traces for COMMS protocol
authorOhad Sharabi <osharabi@habana.ai>
Wed, 30 Nov 2022 09:16:51 +0000 (11:16 +0200)
committerOded Gabbay <ogabbay@kernel.org>
Thu, 26 Jan 2023 08:56:21 +0000 (10:56 +0200)
As the COMMS protocol is being used more widely in our driver,
an available debug tool for the handshake will be handy.

This commit defines tracepoints to various key points of the COMMS
protocol.

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 f05c5fa668a26db8a318b63ff59918af98650037..10233e13cee45df3ccb62dcb53214b606d1e87c8 100644 (file)
@@ -87,6 +87,42 @@ DEFINE_EVENT(habanalabs_dma_alloc_template, habanalabs_dma_free,
        TP_PROTO(struct device *dev, u64 cpu_addr, u64 dma_addr, size_t size, const char *caller),
        TP_ARGS(dev, cpu_addr, dma_addr, size, caller));
 
+DECLARE_EVENT_CLASS(habanalabs_comms_template,
+       TP_PROTO(struct device *dev, char *op_str),
+
+       TP_ARGS(dev, op_str),
+
+       TP_STRUCT__entry(
+               __string(dname, dev_name(dev))
+               __field(char *, op_str)
+       ),
+
+       TP_fast_assign(
+               __assign_str(dname, dev_name(dev));
+               __entry->op_str = op_str;
+       ),
+
+       TP_printk("%s: cms: %s",
+               __get_str(dname),
+               __entry->op_str)
+);
+
+DEFINE_EVENT(habanalabs_comms_template, habanalabs_comms_protocol_cmd,
+       TP_PROTO(struct device *dev, char *op_str),
+       TP_ARGS(dev, op_str));
+
+DEFINE_EVENT(habanalabs_comms_template, habanalabs_comms_send_cmd,
+       TP_PROTO(struct device *dev, char *op_str),
+       TP_ARGS(dev, op_str));
+
+DEFINE_EVENT(habanalabs_comms_template, habanalabs_comms_wait_status,
+       TP_PROTO(struct device *dev, char *op_str),
+       TP_ARGS(dev, op_str));
+
+DEFINE_EVENT(habanalabs_comms_template, habanalabs_comms_wait_status_done,
+       TP_PROTO(struct device *dev, char *op_str),
+       TP_ARGS(dev, op_str));
+
 #endif /* if !defined(_TRACE_HABANALABS_H) || defined(TRACE_HEADER_MULTI_READ) */
 
 /* This part must be outside protection */