summaryrefslogtreecommitdiff
path: root/drivers/platform
diff options
context:
space:
mode:
authorAndrei Danaila <adanaila@codeaurora.org>2014-12-04 17:21:10 -0800
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-23 21:11:03 -0700
commitfd631cba6d2ecc2cd39b3de4665e580451822e71 (patch)
treeec03c1ac6481aa6ec87bf19ee561393c93fd3cab /drivers/platform
parent05c228020fff3b7d792d71ba404594383fd0c248 (diff)
mhi: core: Enable ftrace events in MHI
Enable ftrace events in MHI for the tracing of power state transitions. Change-Id: I74373b7429c6d7316c4a66db141cc09e2a4418dd Signed-off-by: Andrei Danaila <adanaila@codeaurora.org>
Diffstat (limited to 'drivers/platform')
-rw-r--r--drivers/platform/msm/mhi/Makefile1
-rw-r--r--drivers/platform/msm/mhi/mhi_iface.c4
-rw-r--r--drivers/platform/msm/mhi/mhi_isr.c2
-rw-r--r--drivers/platform/msm/mhi/mhi_main.c20
-rw-r--r--drivers/platform/msm/mhi/mhi_states.c2
-rw-r--r--drivers/platform/msm/mhi/mhi_trace.h142
6 files changed, 165 insertions, 6 deletions
diff --git a/drivers/platform/msm/mhi/Makefile b/drivers/platform/msm/mhi/Makefile
index 4470a26defcb..707de2310981 100644
--- a/drivers/platform/msm/mhi/Makefile
+++ b/drivers/platform/msm/mhi/Makefile
@@ -10,3 +10,4 @@ obj-y += mhi_sys.o
obj-y += mhi_bhi.o
obj-y += mhi_pm.o
obj-y += mhi_ssr.o
+CFLAGS_mhi_iface.o := -I$(src)
diff --git a/drivers/platform/msm/mhi/mhi_iface.c b/drivers/platform/msm/mhi/mhi_iface.c
index 292d62644e0c..4fb1c2547612 100644
--- a/drivers/platform/msm/mhi/mhi_iface.c
+++ b/drivers/platform/msm/mhi/mhi_iface.c
@@ -10,6 +10,7 @@
* GNU General Public License for more details.
*/
+
#include <linux/pci.h>
#include <linux/gpio.h>
#include <linux/module.h>
@@ -18,6 +19,9 @@
#include <linux/delay.h>
#include <linux/debugfs.h>
+#define CREATE_TRACE_POINTS
+#include "mhi_trace.h"
+
#include "mhi_sys.h"
#include "mhi.h"
#include "mhi_macros.h"
diff --git a/drivers/platform/msm/mhi/mhi_isr.c b/drivers/platform/msm/mhi/mhi_isr.c
index 90572210ef20..ff3f88d67f59 100644
--- a/drivers/platform/msm/mhi/mhi_isr.c
+++ b/drivers/platform/msm/mhi/mhi_isr.c
@@ -12,6 +12,7 @@
#include <linux/interrupt.h>
#include "mhi_sys.h"
+#include "mhi_trace.h"
irqreturn_t mhi_msi_handlr(int irq_number, void *dev_id)
@@ -30,6 +31,7 @@ irqreturn_t mhi_msi_handlr(int irq_number, void *dev_id)
mhi_dev_ctxt->msi_counter[IRQ_TO_MSI(mhi_dev_ctxt, irq_number)]++;
mhi_log(MHI_MSG_VERBOSE,
"Got MSI 0x%x\n", IRQ_TO_MSI(mhi_dev_ctxt, irq_number));
+ trace_mhi_msi(IRQ_TO_MSI(mhi_dev_ctxt, irq_number));
switch (IRQ_TO_MSI(mhi_dev_ctxt, irq_number)) {
case 0:
case 1:
diff --git a/drivers/platform/msm/mhi/mhi_main.c b/drivers/platform/msm/mhi/mhi_main.c
index 1695f0663945..d772b6e12f4a 100644
--- a/drivers/platform/msm/mhi/mhi_main.c
+++ b/drivers/platform/msm/mhi/mhi_main.c
@@ -26,6 +26,7 @@
#include "mhi.h"
#include "mhi_hwio.h"
#include "mhi_macros.h"
+#include "mhi_trace.h"
static void mhi_write_db(struct mhi_device_ctxt *mhi_dev_ctxt,
void __iomem *io_addr_lower,
@@ -585,6 +586,7 @@ enum MHI_STATUS mhi_queue_xfer(struct mhi_client_handle *client_handle,
pkt_loc = mhi_dev_ctxt->mhi_local_chan_ctxt[chan].wp;
pkt_loc->data_tx_pkt.buffer_ptr = buf;
pkt_loc->type.info = mhi_flags;
+ trace_mhi_tre(pkt_loc, chan, 0);
if (likely(0 != client_handle->intmod_t))
MHI_TRB_SET_INFO(TX_TRB_BEI, pkt_loc, 1);
@@ -632,17 +634,19 @@ enum MHI_STATUS mhi_send_cmd(struct mhi_device_ctxt *mhi_dev_ctxt,
enum MHI_PKT_TYPE ring_el_type = MHI_PKT_TYPE_NOOP_CMD;
struct mutex *chan_mutex = NULL;
+ if (chan >= MHI_MAX_CHANNELS ||
+ cmd >= MHI_COMMAND_MAX_NR || mhi_dev_ctxt == NULL) {
+ mhi_log(MHI_MSG_ERROR,
+ "Invalid channel id, received id: 0x%x", chan);
+ return MHI_STATUS_ERROR;
+ }
+
mhi_log(MHI_MSG_INFO,
"Entered, MHI state %d dev_exec_env %d chan %d cmd %d\n",
mhi_dev_ctxt->mhi_state,
mhi_dev_ctxt->dev_exec_env,
chan, cmd);
- if (chan >= MHI_MAX_CHANNELS ||
- cmd >= MHI_COMMAND_MAX_NR || NULL == mhi_dev_ctxt) {
- mhi_log(MHI_MSG_ERROR,
- "Invalid channel id, received id: 0x%x", chan);
- goto error_general;
- }
+
mhi_assert_device_wake(mhi_dev_ctxt);
/*
* If there is a cmd pending a struct device confirmation,
@@ -863,6 +867,8 @@ enum MHI_STATUS parse_xfer_event(struct mhi_device_ctxt *ctxt,
u32 nr_trb_to_parse;
u32 i = 0;
+ trace_mhi_ev(event);
+
switch (MHI_EV_READ_CODE(EV_TRB_CODE, event)) {
case MHI_EVENT_CC_EOB:
chan = MHI_EV_READ_CHID(EV_CHID, event);
@@ -906,6 +912,8 @@ enum MHI_STATUS parse_xfer_event(struct mhi_device_ctxt *ctxt,
phy_ev_trb_loc);
local_trb_loc = (union mhi_xfer_pkt *)local_chan_ctxt->rp;
+ trace_mhi_tre(local_trb_loc, chan, 1);
+
ret_val = get_nr_enclosed_el(local_chan_ctxt,
local_trb_loc,
local_ev_trb_loc,
diff --git a/drivers/platform/msm/mhi/mhi_states.c b/drivers/platform/msm/mhi/mhi_states.c
index aa8cd760ea75..b962dad10a7e 100644
--- a/drivers/platform/msm/mhi/mhi_states.c
+++ b/drivers/platform/msm/mhi/mhi_states.c
@@ -12,6 +12,7 @@
#include "mhi_sys.h"
#include "mhi_hwio.h"
+#include "mhi_trace.h"
static void conditional_chan_db_write(
struct mhi_device_ctxt *mhi_dev_ctxt, u32 chan)
@@ -656,6 +657,7 @@ static enum MHI_STATUS process_stt_work_item(
mhi_log(MHI_MSG_INFO, "Transitioning to %d\n",
(int)cur_work_item);
+ trace_mhi_state(cur_work_item);
switch (cur_work_item) {
case STATE_TRANSITION_BHI:
ret_val = process_bhi_transition(mhi_dev_ctxt, cur_work_item);
diff --git a/drivers/platform/msm/mhi/mhi_trace.h b/drivers/platform/msm/mhi/mhi_trace.h
new file mode 100644
index 000000000000..47f34991822c
--- /dev/null
+++ b/drivers/platform/msm/mhi/mhi_trace.h
@@ -0,0 +1,142 @@
+/* Copyright (c) 2014, The Linux Foundation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 and
+ * only version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM mhi
+#define TRACE_INCLUDE_FILE mhi_trace
+
+#if !defined(_TRACE_SCHED_H) || defined(TRACE_HEADER_MULTI_READ)
+#define _MHI_TRACE_H_
+
+#include <linux/tracepoint.h>
+#include "mhi.h"
+
+DECLARE_EVENT_CLASS(mhi_handler_template,
+
+ TP_PROTO(int state),
+
+ TP_ARGS(state),
+
+ TP_STRUCT__entry(
+ __field(int, state)
+ ),
+
+ TP_fast_assign(
+ __entry->state = state;
+ ),
+
+ TP_printk("State is %d", __entry->state)
+)
+
+DEFINE_EVENT(mhi_handler_template, mhi_state,
+
+ TP_PROTO(int state),
+
+ TP_ARGS(state)
+);
+
+DECLARE_EVENT_CLASS(mhi_tre_template,
+
+ TP_PROTO(union mhi_xfer_pkt *tre, int chan, int dir),
+
+ TP_ARGS(tre, chan, dir),
+
+ TP_STRUCT__entry(
+ __field(void *, tre_addr)
+ __field(unsigned long long, buf_ptr)
+ __field(unsigned int, buf_len)
+ __field(int, chan)
+ __field(int, dir)
+ ),
+
+ TP_fast_assign(
+ __entry->tre_addr = tre;
+ __entry->buf_ptr = tre->data_tx_pkt.buffer_ptr;
+ __entry->buf_len = tre->data_tx_pkt.buf_len;
+ __entry->chan = chan;
+ __entry->dir = dir;
+ ),
+
+ TP_printk("CHAN: %d TRE: 0x%p BUF: 0x%llx LEN: 0x%x DIR:%s",
+ __entry->chan, __entry->tre_addr,
+ __entry->buf_ptr, __entry->buf_len,
+ __entry->dir ? "IN" : "OUT")
+)
+
+DEFINE_EVENT(mhi_tre_template, mhi_tre,
+
+ TP_PROTO(union mhi_xfer_pkt *tre, int chan, int dir),
+
+ TP_ARGS(tre, chan, dir)
+);
+
+DECLARE_EVENT_CLASS(mhi_ev_template,
+
+ TP_PROTO(union mhi_event_pkt *ev),
+
+ TP_ARGS(ev),
+
+ TP_STRUCT__entry(
+ __field(void *, ev_addr)
+ __field(unsigned long long, tre_addr)
+ __field(int, tre_len)
+ __field(int, chan)
+ ),
+
+ TP_fast_assign(
+ __entry->ev_addr = ev;
+ __entry->tre_addr = ev->xfer_event_pkt.xfer_ptr;
+ __entry->tre_len = MHI_EV_READ_LEN(EV_LEN, ev);
+ __entry->chan = MHI_EV_READ_CHID(EV_CHID, ev);
+ ),
+
+ TP_printk("CHAN: %d EVENT 0x%p TRE_p: 0x%llx LEN: 0x%x",
+ __entry->chan, __entry->ev_addr,
+ __entry->tre_addr, __entry->tre_len)
+)
+
+DEFINE_EVENT(mhi_ev_template, mhi_ev,
+
+ TP_PROTO(union mhi_event_pkt *mhi_ev),
+
+ TP_ARGS(mhi_ev)
+);
+
+DECLARE_EVENT_CLASS(mhi_msi_template,
+
+ TP_PROTO(int msi),
+
+ TP_ARGS(msi),
+
+ TP_STRUCT__entry(
+ __field(int, msi)
+ ),
+
+ TP_fast_assign(
+ __entry->msi = msi;
+ ),
+
+ TP_printk("MSI received %d", __entry->msi)
+)
+
+DEFINE_EVENT(mhi_msi_template, mhi_msi,
+
+ TP_PROTO(int msi),
+
+ TP_ARGS(msi)
+);
+#endif /* _MHI_TRACE_H_ */
+
+/* This part must be outside protection */
+#undef TRACE_INCLUDE_PATH
+#define TRACE_INCLUDE_PATH .
+#include <trace/define_trace.h>