All of lore.kernel.org
 help / color / mirror / Atom feed
From: cbostic@linux.vnet.ibm.com (Christopher Bostic)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v7 16/23] drivers/fsi: Add tracepoints for low-level operations
Date: Thu, 11 May 2017 16:00:53 -0500	[thread overview]
Message-ID: <20170511210101.78409-17-cbostic@linux.vnet.ibm.com> (raw)
In-Reply-To: <20170511210101.78409-1-cbostic@linux.vnet.ibm.com>

From: Jeremy Kerr <jk@ozlabs.org>

Trace low level read and write FSI bus operations.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Christopher Bostic <cbostic@linux.vnet.ibm.com>
---
 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 d319f67..bc73f13 100644
--- a/drivers/fsi/fsi-core.c
+++ b/drivers/fsi/fsi-core.c
@@ -23,6 +23,9 @@
 
 #include "fsi-master.h"
 
+#define CREATE_TRACE_POINTS
+#include <trace/events/fsi.h>
+
 #define FSI_SLAVE_CONF_NEXT_MASK	GENMASK(31, 31)
 #define FSI_SLAVE_CONF_SLOTS_MASK	GENMASK(23, 16)
 #define FSI_SLAVE_CONF_SLOTS_SHIFT	16
@@ -538,11 +541,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,
@@ -550,11 +558,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)
@@ -570,6 +583,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 <linux/tracepoint.h>
+
+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 <trace/define_trace.h>
-- 
1.8.2.2

WARNING: multiple messages have this Message-ID (diff)
From: Christopher Bostic <cbostic@linux.vnet.ibm.com>
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 <jk@ozlabs.org>,
	joel@jms.id.au, linux-kernel@vger.kernel.org, andrew@aj.id.au,
	alistair@popple.id.au, benh@kernel.crashing.org,
	Christopher Bostic <cbostic@linux.vnet.ibm.com>
Subject: [PATCH v7 16/23] drivers/fsi: Add tracepoints for low-level operations
Date: Thu, 11 May 2017 16:00:53 -0500	[thread overview]
Message-ID: <20170511210101.78409-17-cbostic@linux.vnet.ibm.com> (raw)
In-Reply-To: <20170511210101.78409-1-cbostic@linux.vnet.ibm.com>

From: Jeremy Kerr <jk@ozlabs.org>

Trace low level read and write FSI bus operations.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
Signed-off-by: Joel Stanley <joel@jms.id.au>
Signed-off-by: Christopher Bostic <cbostic@linux.vnet.ibm.com>
---
 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 d319f67..bc73f13 100644
--- a/drivers/fsi/fsi-core.c
+++ b/drivers/fsi/fsi-core.c
@@ -23,6 +23,9 @@
 
 #include "fsi-master.h"
 
+#define CREATE_TRACE_POINTS
+#include <trace/events/fsi.h>
+
 #define FSI_SLAVE_CONF_NEXT_MASK	GENMASK(31, 31)
 #define FSI_SLAVE_CONF_SLOTS_MASK	GENMASK(23, 16)
 #define FSI_SLAVE_CONF_SLOTS_SHIFT	16
@@ -538,11 +541,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,
@@ -550,11 +558,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)
@@ -570,6 +583,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 <linux/tracepoint.h>
+
+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 <trace/define_trace.h>
-- 
1.8.2.2

  parent reply	other threads:[~2017-05-11 21:00 UTC|newest]

Thread overview: 72+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-11 21:00 [PATCH v7 00/23] FSI device driver implementation Christopher Bostic
2017-05-11 21:00 ` Christopher Bostic
2017-05-11 21:00 ` Christopher Bostic
2017-05-11 21:00 ` [PATCH v7 01/23] drivers/fsi: Add fsi master definition Christopher Bostic
2017-05-11 21:00   ` Christopher Bostic
2017-05-11 21:00 ` [PATCH v7 02/23] drivers/fsi: Add slave definition Christopher Bostic
2017-05-11 21:00   ` Christopher Bostic
2017-05-11 21:00   ` Christopher Bostic
2017-05-11 21:00 ` [PATCH v7 03/23] drivers/fsi: Add empty master scan Christopher Bostic
2017-05-11 21:00   ` Christopher Bostic
2017-05-11 21:00 ` [PATCH v7 04/23] lib: Add crc4 module Christopher Bostic
2017-05-11 21:00   ` Christopher Bostic
2017-05-11 21:00   ` Christopher Bostic
2017-05-11 21:00 ` [PATCH v7 05/23] drivers/fsi: Add slave & master read/write APIs Christopher Bostic
2017-05-11 21:00   ` Christopher Bostic
2017-05-11 21:00 ` [PATCH v7 06/23] drivers/fsi: Set up links for slave communication Christopher Bostic
2017-05-11 21:00   ` Christopher Bostic
2017-05-11 21:00 ` [PATCH v7 07/23] drivers/fsi: Implement slave initialisation Christopher Bostic
2017-05-11 21:00   ` Christopher Bostic
2017-05-11 21:00   ` Christopher Bostic
2017-05-11 21:00 ` [PATCH v7 08/23] drivers/fsi: Set slave SMODE to init communication Christopher Bostic
2017-05-11 21:00   ` Christopher Bostic
2017-05-11 21:00 ` [PATCH v7 09/23] drivers/fsi: scan slaves & register devices Christopher Bostic
2017-05-11 21:00   ` Christopher Bostic
2017-05-11 21:00   ` Christopher Bostic
2017-05-11 21:00 ` [PATCH v7 10/23] drivers/fsi: Add device read/write/peek API Christopher Bostic
2017-05-11 21:00   ` Christopher Bostic
2017-05-11 21:00   ` Christopher Bostic
2017-05-11 21:00 ` [PATCH v7 11/23] drivers/fsi: Add master unscan Christopher Bostic
2017-05-11 21:00   ` Christopher Bostic
2017-05-11 21:00   ` Christopher Bostic
2017-05-11 21:00 ` [PATCH v7 12/23] drivers/fsi: Add documentation for GPIO bindings Christopher Bostic
2017-05-11 21:00   ` Christopher Bostic
2017-05-11 21:00 ` [PATCH v7 13/23] drivers/fsi: Add client driver register utilities Christopher Bostic
2017-05-11 21:00   ` Christopher Bostic
2017-05-11 21:00 ` [PATCH v7 14/23] drivers/fsi: Add sysfs files for FSI master & slave accesses Christopher Bostic
2017-05-11 21:00   ` Christopher Bostic
2017-05-11 21:00   ` Christopher Bostic
2017-05-11 21:00 ` [PATCH v7 15/23] drivers/fsi: expose direct-access slave API Christopher Bostic
2017-05-11 21:00   ` Christopher Bostic
2017-05-11 21:00 ` Christopher Bostic [this message]
2017-05-11 21:00   ` [PATCH v7 16/23] drivers/fsi: Add tracepoints for low-level operations Christopher Bostic
2017-05-11 21:00 ` [PATCH v7 17/23] drivers/fsi: Add error handling for slave Christopher Bostic
2017-05-11 21:00   ` Christopher Bostic
2017-05-11 21:00 ` [PATCH v7 18/23] drivers/fsi: Document FSI master sysfs files in ABI Christopher Bostic
2017-05-11 21:00   ` Christopher Bostic
2017-05-11 21:00 ` [PATCH v7 19/23] drivers/fsi: Add GPIO based FSI master Christopher Bostic
2017-05-11 21:00   ` Christopher Bostic
2017-05-11 21:00 ` [PATCH v7 20/23] drivers/fsi/gpio: Add tracepoints for GPIO master Christopher Bostic
2017-05-11 21:00   ` Christopher Bostic
2017-05-11 21:00   ` Christopher Bostic
2017-05-11 21:00 ` [PATCH v7 21/23] drivers/fsi: Add SCOM FSI client device driver Christopher Bostic
2017-05-11 21:00   ` Christopher Bostic
2017-05-11 21:00 ` [PATCH v7 22/23] drivers/fsi: Add hub master support Christopher Bostic
2017-05-11 21:00   ` Christopher Bostic
2017-05-11 21:01 ` [PATCH v7 23/23] drivers/fsi: Use asynchronous slave mode Christopher Bostic
2017-05-11 21:01   ` Christopher Bostic
2017-05-31 17:17 ` [PATCH v7 00/23] FSI device driver implementation Christopher Bostic
2017-05-31 17:17   ` Christopher Bostic
2017-05-31 17:17   ` Christopher Bostic
2017-06-03 10:05   ` Greg KH
2017-06-03 10:05     ` Greg KH
2017-06-03 10:05     ` Greg KH
2017-06-03 21:25     ` Steven Rostedt
2017-06-03 21:25       ` Steven Rostedt
2017-06-03 21:25       ` Steven Rostedt
2017-06-05 19:21       ` Christopher Bostic
2017-06-05 19:21         ` Christopher Bostic
2017-06-05 19:21         ` Christopher Bostic
2017-06-05 19:20     ` Christopher Bostic
2017-06-05 19:20       ` Christopher Bostic
2017-06-05 19:20       ` Christopher Bostic

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170511210101.78409-17-cbostic@linux.vnet.ibm.com \
    --to=cbostic@linux.vnet.ibm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.