drivers: qcom: rpmh-rsc: log RPMH requests in FTRACE
authorLina Iyer <ilina@codeaurora.org>
Wed, 20 Jun 2018 13:27:00 +0000 (18:57 +0530)
committerAndy Gross <andy.gross@linaro.org>
Sat, 21 Jul 2018 18:32:31 +0000 (13:32 -0500)
Log sent RPMH requests and interrupt responses in FTRACE.

Signed-off-by: Lina Iyer <ilina@codeaurora.org>
Reviewed-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
[rplsssn@codeaurora.org: rebase to v4.18-rc1 & fix merge conflict]
Signed-off-by: Raju P.L.S.S.S.N <rplsssn@codeaurora.org>
Signed-off-by: Andy Gross <andy.gross@linaro.org>
drivers/soc/qcom/Makefile
drivers/soc/qcom/rpmh-rsc.c
drivers/soc/qcom/trace-rpmh.h [new file with mode: 0644]

index b2faf9aeed3ff19a080d77517ed2b97c0523a2ec..036ecc45cbbdc05314fd7762192c09c4aeff7824 100644 (file)
@@ -1,4 +1,5 @@
 # SPDX-License-Identifier: GPL-2.0
+CFLAGS_rpmh-rsc.o := -I$(src)
 obj-$(CONFIG_QCOM_GENI_SE) +=  qcom-geni-se.o
 obj-$(CONFIG_QCOM_COMMAND_DB) += cmd-db.o
 obj-$(CONFIG_QCOM_GLINK_SSR) +=        glink_ssr.o
index c5e0793cdfb76c59a44dfd113979297d4dab2f6a..89d41cdd8d71b8a052f3785b552c529bf536f199 100644 (file)
@@ -23,6 +23,9 @@
 
 #include "rpmh-internal.h"
 
+#define CREATE_TRACE_POINTS
+#include "trace-rpmh.h"
+
 #define RSC_DRV_TCS_OFFSET             672
 #define RSC_DRV_CMD_OFFSET             20
 
@@ -135,7 +138,7 @@ static const struct tcs_request *get_req_from_tcs(struct rsc_drv *drv,
 static irqreturn_t tcs_tx_done(int irq, void *p)
 {
        struct rsc_drv *drv = p;
-       int i, j;
+       int i, j, err;
        unsigned long irq_status;
        const struct tcs_request *req;
        struct tcs_cmd *cmd;
@@ -149,6 +152,7 @@ static irqreturn_t tcs_tx_done(int irq, void *p)
                        goto skip;
                }
 
+               err = 0;
                for (j = 0; j < req->num_cmds; j++) {
                        u32 sts;
 
@@ -159,8 +163,11 @@ static irqreturn_t tcs_tx_done(int irq, void *p)
                           !(sts & CMD_STATUS_COMPL))) {
                                pr_err("Incomplete request: %s: addr=%#x data=%#x",
                                       drv->name, cmd->addr, cmd->data);
+                               err = -EIO;
                        }
                }
+
+               trace_rpmh_tx_done(drv, i, req, err);
 skip:
                /* Reclaim the TCS */
                write_tcs_reg(drv, RSC_DRV_CMD_ENABLE, i, 0);
@@ -194,9 +201,11 @@ static void __tcs_buffer_write(struct rsc_drv *drv, int tcs_id, int cmd_id,
                cmd_complete |= cmd->wait << j;
                msgid = cmd_msgid;
                msgid |= cmd->wait ? CMD_MSGID_RESP_REQ : 0;
+
                write_tcs_cmd(drv, RSC_DRV_CMD_MSGID, tcs_id, j, msgid);
                write_tcs_cmd(drv, RSC_DRV_CMD_ADDR, tcs_id, j, cmd->addr);
                write_tcs_cmd(drv, RSC_DRV_CMD_DATA, tcs_id, j, cmd->data);
+               trace_rpmh_send_msg(drv, tcs_id, j, msgid, cmd);
        }
 
        write_tcs_reg(drv, RSC_DRV_CMD_WAIT_FOR_CMPL, tcs_id, cmd_complete);
diff --git a/drivers/soc/qcom/trace-rpmh.h b/drivers/soc/qcom/trace-rpmh.h
new file mode 100644 (file)
index 0000000..feb0cb4
--- /dev/null
@@ -0,0 +1,82 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
+ */
+
+#if !defined(_TRACE_RPMH_H) || defined(TRACE_HEADER_MULTI_READ)
+#define _TRACE_RPMH_H
+
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM rpmh
+
+#include <linux/tracepoint.h>
+#include "rpmh-internal.h"
+
+TRACE_EVENT(rpmh_tx_done,
+
+       TP_PROTO(struct rsc_drv *d, int m, const struct tcs_request *r, int e),
+
+       TP_ARGS(d, m, r, e),
+
+       TP_STRUCT__entry(
+                        __string(name, d->name)
+                        __field(int, m)
+                        __field(u32, addr)
+                        __field(u32, data)
+                        __field(int, err)
+       ),
+
+       TP_fast_assign(
+                      __assign_str(name, d->name);
+                      __entry->m = m;
+                      __entry->addr = r->cmds[0].addr;
+                      __entry->data = r->cmds[0].data;
+                      __entry->err = e;
+       ),
+
+       TP_printk("%s: ack: tcs-m: %d addr: %#x data: %#x errno: %d",
+                 __get_str(name), __entry->m, __entry->addr, __entry->data,
+                 __entry->err)
+);
+
+TRACE_EVENT(rpmh_send_msg,
+
+       TP_PROTO(struct rsc_drv *d, int m, int n, u32 h,
+                const struct tcs_cmd *c),
+
+       TP_ARGS(d, m, n, h, c),
+
+       TP_STRUCT__entry(
+                        __string(name, d->name)
+                        __field(int, m)
+                        __field(int, n)
+                        __field(u32, hdr)
+                        __field(u32, addr)
+                        __field(u32, data)
+                        __field(bool, wait)
+       ),
+
+       TP_fast_assign(
+                      __assign_str(name, d->name);
+                      __entry->m = m;
+                      __entry->n = n;
+                      __entry->hdr = h;
+                      __entry->addr = c->addr;
+                      __entry->data = c->data;
+                      __entry->wait = c->wait;
+       ),
+
+       TP_printk("%s: send-msg: tcs(m): %d cmd(n): %d msgid: %#x addr: %#x data: %#x complete: %d",
+                 __get_str(name), __entry->m, __entry->n, __entry->hdr,
+                 __entry->addr, __entry->data, __entry->wait)
+);
+
+#endif /* _TRACE_RPMH_H */
+
+#undef TRACE_INCLUDE_PATH
+#define TRACE_INCLUDE_PATH .
+
+#undef TRACE_INCLUDE_FILE
+#define TRACE_INCLUDE_FILE trace-rpmh
+
+#include <trace/define_trace.h>