Skip to contentSkip to conversation

FSI master tracepoints

PATCH In review Joel Stanley 2 participants 4 messages Oct 16, 2019

Subsystems (3)
lore
Share & tools
lore

Joel Stanley

author maintainer
#0 lore raw

v2 cover FSI master tracepoints

v2: fix review comments, endian swap in patch 2

The first patch removes the base pointer from the tracepoint which I don't think is useful.

The second adds a tracepoint for some status registers when an error occurs.

Joel Stanley (2):
fsi: aspeed: Remove base from trace
fsi: aspeed: Add trace when error occurs

 drivers/fsi/fsi-master-aspeed.c          | 18 +++++++++--
 include/trace/events/fsi_master_aspeed.h | 38 ++++++++++++++++--------
 2 files changed, 41 insertions(+), 15 deletions(-)
Signature · 1 line
2.23.0
author maintainer
#1 lore raw

PATCH v2 1/2 fsi: aspeed: Remove base from trace

The base was showing the virtual address of the FSI master, which was not useful for most users of the tracepoint.

---
 drivers/fsi/fsi-master-aspeed.c          |  5 ++---
 include/trace/events/fsi_master_aspeed.h | 20 ++++++++------------
 2 files changed, 10 insertions(+), 15 deletions(-)
drivers/fsi/fsi-master-aspeed.c +2 -3
index 2048e38e7200..d796c4012875 100644
@@ -194,8 +194,7 @@ static u32 opb_write(void __iomem *base, uint32_t addr, uint32_t val,
 
 	status = readl(base + OPB0_STATUS);
 
-	trace_fsi_master_aspeed_opb_write(base, addr, val, size,
-			status, reg);
+	trace_fsi_master_aspeed_opb_write(addr, val, size, status, reg);
 
 	/* Return error when poll timed out */
 	if (ret)
@@ -231,7 +230,7 @@ static int opb_read(void __iomem *base, uint32_t addr, size_t size, u32 *out)
 
 	result = readl(base + OPB0_FSI_DATA_R);
 
-	trace_fsi_master_aspeed_opb_read(base, addr, size, result,
+	trace_fsi_master_aspeed_opb_read(addr, size, result,
 			readl(base + OPB0_STATUS),
 			reg);
 
include/trace/events/fsi_master_aspeed.h +8 -12
index 06ff6a14bf11..63b9ce7f0de6 100644
@@ -9,10 +9,9 @@
 #include <linux/tracepoint.h>
 
 TRACE_EVENT(fsi_master_aspeed_opb_read,
-	TP_PROTO(void __iomem *base, uint32_t addr, size_t size, uint32_t result, uint32_t status, uint32_t irq_status),
-	TP_ARGS(base, addr, size, result, status, irq_status),
+	TP_PROTO(uint32_t addr, size_t size, uint32_t result, uint32_t status, uint32_t irq_status),
+	TP_ARGS(addr, size, result, status, irq_status),
 	TP_STRUCT__entry(
-		__field(void *,    base)
 		__field(uint32_t,  addr)
 		__field(size_t,    size)
 		__field(uint32_t,  result)
@@ -20,24 +19,22 @@ TRACE_EVENT(fsi_master_aspeed_opb_read,
 		__field(uint32_t,  irq_status)
 		),
 	TP_fast_assign(
-		__entry->base = base;
 		__entry->addr = addr;
 		__entry->size = size;
 		__entry->result = result;
 		__entry->status = status;
 		__entry->irq_status = irq_status;
 		),
-	TP_printk("fsi: opb read: base %p addr %08x size %zu: result %08x status: %08x irq_status: %08x",
-		__entry->base, __entry->addr, __entry->size, __entry->result,
+	TP_printk("fsi: opb read: addr %08x size %zu: result %08x status: %08x irq_status: %08x",
+		__entry->addr, __entry->size, __entry->result,
 		__entry->status, __entry->irq_status
 	   )
 );
 
 TRACE_EVENT(fsi_master_aspeed_opb_write,
-	TP_PROTO(void __iomem *base, uint32_t addr, uint32_t val, size_t size, uint32_t status, uint32_t irq_status),
-	TP_ARGS(base, addr, val, size, status, irq_status),
+	TP_PROTO(uint32_t addr, uint32_t val, size_t size, uint32_t status, uint32_t irq_status),
+	TP_ARGS(addr, val, size, status, irq_status),
 	TP_STRUCT__entry(
-		__field(void *,    base)
 		__field(uint32_t,    addr)
 		__field(uint32_t,    val)
 		__field(size_t,    size)
@@ -45,15 +42,14 @@ TRACE_EVENT(fsi_master_aspeed_opb_write,
 		__field(uint32_t,  irq_status)
 		),
 	TP_fast_assign(
-		__entry->base = base;
 		__entry->addr = addr;
 		__entry->val = val;
 		__entry->size = size;
 		__entry->status = status;
 		__entry->irq_status = irq_status;
 		),
-	TP_printk("fsi: opb write: base %p addr %08x val %08x size %zu status: %08x irq_status: %08x",
-		__entry->base, __entry->addr, __entry->val, __entry->size,
+	TP_printk("fsi: opb write: addr %08x val %08x size %zu status: %08x irq_status: %08x",
+		__entry->addr, __entry->val, __entry->size,
 		__entry->status, __entry->irq_status
 		)
 	);
Signature · 1 line
2.23.0
author maintainer
#2 lore raw

PATCH v2 2/2 fsi: aspeed: Add trace when error occurs

In reply to Joel Stanley

This prints out three registers in the FSI master when an error occurs.

---
v2:
endian swap the values
only read them out when tracepoint is enabled

---
 drivers/fsi/fsi-master-aspeed.c          | 13 +++++++++++++
 include/trace/events/fsi_master_aspeed.h | 18 ++++++++++++++++++
 2 files changed, 31 insertions(+)
drivers/fsi/fsi-master-aspeed.c +13 -0
index d796c4012875..6fa9712c70c4 100644
@@ -252,6 +252,19 @@ static int check_errors(struct fsi_master_aspeed *aspeed, int err)
 {
 	int ret;
 
+	 if (trace_fsi_master_aspeed_opb_error_enabled()) {
+		 __be32 mresp0, mstap0, mesrb0;
+
+		 opb_read(aspeed->base, ctrl_base + FSI_MRESP0, 4, &mresp0);
+		 opb_read(aspeed->base, ctrl_base + FSI_MSTAP0, 4, &mstap0);
+		 opb_read(aspeed->base, ctrl_base + FSI_MESRB0, 4, &mesrb0);
+
+		 trace_fsi_master_aspeed_opb_error(
+				 be32_to_cpu(mresp0),
+				 be32_to_cpu(mstap0),
+				 be32_to_cpu(mesrb0));
+	 };
+
 	if (err == -EIO) {
 		/* Check MAEB (0x70) ? */
 
include/trace/events/fsi_master_aspeed.h +18 -0
index 63b9ce7f0de6..8e47637c5fb7 100644
@@ -54,6 +54,24 @@ TRACE_EVENT(fsi_master_aspeed_opb_write,
 		)
 	);
 
+TRACE_EVENT(fsi_master_aspeed_opb_error,
+	TP_PROTO(uint32_t mresp0, uint32_t mstap0, uint32_t mesrb0),
+	TP_ARGS(mresp0, mstap0, mesrb0),
+	TP_STRUCT__entry(
+		__field(uint32_t,  mresp0)
+		__field(uint32_t,  mstap0)
+		__field(uint32_t,  mesrb0)
+		),
+	TP_fast_assign(
+		__entry->mresp0 = mresp0;
+		__entry->mstap0 = mstap0;
+		__entry->mesrb0 = mesrb0;
+		),
+	TP_printk("mresp0 %08x mstap0 %08x mesrb0 %08x",
+		__entry->mresp0, __entry->mstap0, __entry->mesrb0
+		)
+	);
+
 #endif
 
 #include <trace/define_trace.h>
Signature · 1 line
2.23.0