Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754526AbdDECJ1 (ORCPT ); Tue, 4 Apr 2017 22:09:27 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:38888 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751021AbdDECJY (ORCPT ); Tue, 4 Apr 2017 22:09:24 -0400 From: Christopher Bostic To: robh+dt@kernel.org, mark.rutland@arm.com, linux@armlinux.org.uk, rostedt@goodmis.org, mingo@redhat.com, gregkh@linuxfoundation.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Jeremy Kerr , joel@jms.id.au, linux-kernel@vger.kernel.org, andrew@aj.id.au, alistair@popple.id.au, benh@kernel.crashing.org, Chris Bostic Subject: [PATCH v5 16/23] drivers/fsi: Add tracepoints for low-level operations Date: Tue, 4 Apr 2017 21:06:00 -0500 X-Mailer: git-send-email 2.10.1 (Apple Git-78) In-Reply-To: <20170405020607.79939-1-cbostic@linux.vnet.ibm.com> References: <20170405020607.79939-1-cbostic@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 17040502-0056-0000-0000-0000032DEA40 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00006884; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000208; SDB=6.00843220; UDB=6.00415442; IPR=6.00621396; BA=6.00005266; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00014914; XFM=3.00000013; UTC=2017-04-05 02:09:21 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17040502-0057-0000-0000-00000763EB9E Message-Id: <20170405020607.79939-17-cbostic@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-04-05_01:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1702020001 definitions=main-1704050018 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 5312 Lines: 209 From: Jeremy Kerr Signed-off-by: Jeremy Kerr Signed-off-by: Joel Stanley Signed-off-by: Chris Bostic --- drivers/fsi/fsi-core.c | 27 +++++++--- include/trace/events/fsi.h | 127 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 148 insertions(+), 6 deletions(-) create mode 100644 include/trace/events/fsi.h diff --git a/drivers/fsi/fsi-core.c b/drivers/fsi/fsi-core.c index f7e55e7..09becec 100644 --- a/drivers/fsi/fsi-core.c +++ b/drivers/fsi/fsi-core.c @@ -21,6 +21,9 @@ #include "fsi-master.h" +#define CREATE_TRACE_POINTS +#include + #define FSI_SLAVE_CONF_NEXT_MASK 0x80000000 #define FSI_SLAVE_CONF_SLOTS_MASK 0x00ff0000 #define FSI_SLAVE_CONF_SLOTS_SHIFT 16 @@ -541,11 +544,16 @@ static int fsi_master_read(struct fsi_master *master, int link, { int rc; + trace_fsi_master_read(master, link, slave_id, addr, size); + rc = fsi_check_access(addr, size); - if (rc) - return rc; + if (!rc) + rc = master->read(master, link, slave_id, addr, val, size); + + trace_fsi_master_rw_result(master, link, slave_id, addr, size, + false, val, rc); - return master->read(master, link, slave_id, addr, val, size); + return rc; } static int fsi_master_write(struct fsi_master *master, int link, @@ -553,11 +561,16 @@ static int fsi_master_write(struct fsi_master *master, int link, { int rc; + trace_fsi_master_write(master, link, slave_id, addr, size, val); + rc = fsi_check_access(addr, size); - if (rc) - return rc; + if (!rc) + rc = master->write(master, link, slave_id, addr, val, size); - return master->write(master, link, slave_id, addr, val, size); + trace_fsi_master_rw_result(master, link, slave_id, addr, size, + true, val, rc); + + return rc; } static int fsi_master_link_enable(struct fsi_master *master, int link) @@ -573,6 +586,8 @@ static int fsi_master_link_enable(struct fsi_master *master, int link) */ static int fsi_master_break(struct fsi_master *master, int link) { + trace_fsi_master_break(master, link); + if (master->send_break) return master->send_break(master, link); diff --git a/include/trace/events/fsi.h b/include/trace/events/fsi.h new file mode 100644 index 0000000..ac74a30 --- /dev/null +++ b/include/trace/events/fsi.h @@ -0,0 +1,127 @@ + +#undef TRACE_SYSTEM +#define TRACE_SYSTEM fsi + +#if !defined(_TRACE_FSI_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_FSI_H + +#include + +TRACE_EVENT(fsi_master_read, + TP_PROTO(const struct fsi_master *master, int link, int id, + uint32_t addr, size_t size), + TP_ARGS(master, link, id, addr, size), + TP_STRUCT__entry( + __field(int, master_idx) + __field(int, link) + __field(int, id) + __field(__u32, addr) + __field(size_t, size) + ), + TP_fast_assign( + __entry->master_idx = master->idx; + __entry->link = link; + __entry->id = id; + __entry->addr = addr; + __entry->size = size; + ), + TP_printk("fsi%d:%02d:%02d %08x[%zd]", + __entry->master_idx, + __entry->link, + __entry->id, + __entry->addr, + __entry->size + ) +); + +TRACE_EVENT(fsi_master_write, + TP_PROTO(const struct fsi_master *master, int link, int id, + uint32_t addr, size_t size, const void *data), + TP_ARGS(master, link, id, addr, size, data), + TP_STRUCT__entry( + __field(int, master_idx) + __field(int, link) + __field(int, id) + __field(__u32, addr) + __field(size_t, size) + __field(__u32, data) + ), + TP_fast_assign( + __entry->master_idx = master->idx; + __entry->link = link; + __entry->id = id; + __entry->addr = addr; + __entry->size = size; + __entry->data = 0; + memcpy(&__entry->data, data, size); + ), + TP_printk("fsi%d:%02d:%02d %08x[%zd] <= {%*ph}", + __entry->master_idx, + __entry->link, + __entry->id, + __entry->addr, + __entry->size, + __entry->size, &__entry->data + ) +); + +TRACE_EVENT(fsi_master_rw_result, + TP_PROTO(const struct fsi_master *master, int link, int id, + uint32_t addr, size_t size, + bool write, const void *data, int ret), + TP_ARGS(master, link, id, addr, size, write, data, ret), + TP_STRUCT__entry( + __field(int, master_idx) + __field(int, link) + __field(int, id) + __field(__u32, addr) + __field(size_t, size) + __field(bool, write) + __field(__u32, data) + __field(int, ret) + ), + TP_fast_assign( + __entry->master_idx = master->idx; + __entry->link = link; + __entry->id = id; + __entry->addr = addr; + __entry->size = size; + __entry->write = write; + __entry->data = 0; + __entry->ret = ret; + if (__entry->write || !__entry->ret) + memcpy(&__entry->data, data, size); + ), + TP_printk("fsi%d:%02d:%02d %08x[%zd] %s {%*ph} ret %d", + __entry->master_idx, + __entry->link, + __entry->id, + __entry->addr, + __entry->size, + __entry->write ? "<=" : "=>", + __entry->size, &__entry->data, + __entry->ret + ) +); + +TRACE_EVENT(fsi_master_break, + TP_PROTO(const struct fsi_master *master, int link), + TP_ARGS(master, link), + TP_STRUCT__entry( + __field(int, master_idx) + __field(int, link) + ), + TP_fast_assign( + __entry->master_idx = master->idx; + __entry->link = link; + ), + TP_printk("fsi%d:%d", + __entry->master_idx, + __entry->link + ) +); + + +#endif /* _TRACE_FSI_H */ + +#include -- 1.8.2.2