mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-22 20:23:57 +08:00
a9fce37481
Add tracepoints to retrieve information about read, write and non-data commands. For performance measurement support tracepoints are added at the beginning and at the end of transfers. Following is a list showing the new tracepoint events. The "cmd" parameter here represents the opcode, SID, and full 16-bit address. spmi_write_begin: cmd and data buffer. spmi_write_end : cmd and return value. spmi_read_begin : cmd. spmi_read_end : cmd, return value and data buffer. spmi_cmd : cmd. The reason that cmd appears at both the beginning and at the end event is that SPMI drivers can request commands concurrently. cmd helps in matching the corresponding events. SPMI tracepoints can be enabled like: echo 1 >/sys/kernel/debug/tracing/events/spmi/enable and will dump messages that can be viewed in /sys/kernel/debug/tracing/trace that look like: ... spmi_read_begin: opc=56 sid=00 addr=0x0000 ... spmi_read_end: opc=56 sid=00 addr=0x0000 ret=0 len=02 buf=0x[01-40] ... spmi_write_begin: opc=48 sid=00 addr=0x0000 len=3 buf=0x[ff-ff-ff] Suggested-by: Sagar Dharia <sdharia@codeaurora.org> Acked-by: Steven Rostedt <rostedt@goodmis.org> Reviewed-by: Stephen Boyd <sboyd@codeaurora.org> Signed-off-by: Gilad Avidov <gavidov@codeaurora.org> Signed-off-by: Ankit Gupta <ankgupta@codeaurora.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
136 lines
3.2 KiB
C
136 lines
3.2 KiB
C
#undef TRACE_SYSTEM
|
|
#define TRACE_SYSTEM spmi
|
|
|
|
#if !defined(_TRACE_SPMI_H) || defined(TRACE_HEADER_MULTI_READ)
|
|
#define _TRACE_SPMI_H
|
|
|
|
#include <linux/spmi.h>
|
|
#include <linux/tracepoint.h>
|
|
|
|
/*
|
|
* drivers/spmi/spmi.c
|
|
*/
|
|
|
|
TRACE_EVENT(spmi_write_begin,
|
|
TP_PROTO(u8 opcode, u8 sid, u16 addr, u8 len, const u8 *buf),
|
|
TP_ARGS(opcode, sid, addr, len, buf),
|
|
|
|
TP_STRUCT__entry(
|
|
__field ( u8, opcode )
|
|
__field ( u8, sid )
|
|
__field ( u16, addr )
|
|
__field ( u8, len )
|
|
__dynamic_array ( u8, buf, len + 1 )
|
|
),
|
|
|
|
TP_fast_assign(
|
|
__entry->opcode = opcode;
|
|
__entry->sid = sid;
|
|
__entry->addr = addr;
|
|
__entry->len = len + 1;
|
|
memcpy(__get_dynamic_array(buf), buf, len + 1);
|
|
),
|
|
|
|
TP_printk("opc=%d sid=%02d addr=0x%04x len=%d buf=0x[%*phD]",
|
|
(int)__entry->opcode, (int)__entry->sid,
|
|
(int)__entry->addr, (int)__entry->len,
|
|
(int)__entry->len, __get_dynamic_array(buf))
|
|
);
|
|
|
|
TRACE_EVENT(spmi_write_end,
|
|
TP_PROTO(u8 opcode, u8 sid, u16 addr, int ret),
|
|
TP_ARGS(opcode, sid, addr, ret),
|
|
|
|
TP_STRUCT__entry(
|
|
__field ( u8, opcode )
|
|
__field ( u8, sid )
|
|
__field ( u16, addr )
|
|
__field ( int, ret )
|
|
),
|
|
|
|
TP_fast_assign(
|
|
__entry->opcode = opcode;
|
|
__entry->sid = sid;
|
|
__entry->addr = addr;
|
|
__entry->ret = ret;
|
|
),
|
|
|
|
TP_printk("opc=%d sid=%02d addr=0x%04x ret=%d",
|
|
(int)__entry->opcode, (int)__entry->sid,
|
|
(int)__entry->addr, __entry->ret)
|
|
);
|
|
|
|
TRACE_EVENT(spmi_read_begin,
|
|
TP_PROTO(u8 opcode, u8 sid, u16 addr),
|
|
TP_ARGS(opcode, sid, addr),
|
|
|
|
TP_STRUCT__entry(
|
|
__field ( u8, opcode )
|
|
__field ( u8, sid )
|
|
__field ( u16, addr )
|
|
),
|
|
|
|
TP_fast_assign(
|
|
__entry->opcode = opcode;
|
|
__entry->sid = sid;
|
|
__entry->addr = addr;
|
|
),
|
|
|
|
TP_printk("opc=%d sid=%02d addr=0x%04x",
|
|
(int)__entry->opcode, (int)__entry->sid,
|
|
(int)__entry->addr)
|
|
);
|
|
|
|
TRACE_EVENT(spmi_read_end,
|
|
TP_PROTO(u8 opcode, u8 sid, u16 addr, int ret, u8 len, const u8 *buf),
|
|
TP_ARGS(opcode, sid, addr, ret, len, buf),
|
|
|
|
TP_STRUCT__entry(
|
|
__field ( u8, opcode )
|
|
__field ( u8, sid )
|
|
__field ( u16, addr )
|
|
__field ( int, ret )
|
|
__field ( u8, len )
|
|
__dynamic_array ( u8, buf, len + 1 )
|
|
),
|
|
|
|
TP_fast_assign(
|
|
__entry->opcode = opcode;
|
|
__entry->sid = sid;
|
|
__entry->addr = addr;
|
|
__entry->ret = ret;
|
|
__entry->len = len + 1;
|
|
memcpy(__get_dynamic_array(buf), buf, len + 1);
|
|
),
|
|
|
|
TP_printk("opc=%d sid=%02d addr=0x%04x ret=%d len=%02d buf=0x[%*phD]",
|
|
(int)__entry->opcode, (int)__entry->sid,
|
|
(int)__entry->addr, __entry->ret, (int)__entry->len,
|
|
(int)__entry->len, __get_dynamic_array(buf))
|
|
);
|
|
|
|
TRACE_EVENT(spmi_cmd,
|
|
TP_PROTO(u8 opcode, u8 sid, int ret),
|
|
TP_ARGS(opcode, sid, ret),
|
|
|
|
TP_STRUCT__entry(
|
|
__field ( u8, opcode )
|
|
__field ( u8, sid )
|
|
__field ( int, ret )
|
|
),
|
|
|
|
TP_fast_assign(
|
|
__entry->opcode = opcode;
|
|
__entry->sid = sid;
|
|
__entry->ret = ret;
|
|
),
|
|
|
|
TP_printk("opc=%d sid=%02d ret=%d", (int)__entry->opcode,
|
|
(int)__entry->sid, ret)
|
|
);
|
|
|
|
#endif /* _TRACE_SPMI_H */
|
|
|
|
/* This part must be outside protection */
|
|
#include <trace/define_trace.h>
|