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>
This commit is contained in:
parent
05c228020f
commit
fd631cba6d
6 changed files with 165 additions and 6 deletions
|
@ -10,3 +10,4 @@ obj-y += mhi_sys.o
|
||||||
obj-y += mhi_bhi.o
|
obj-y += mhi_bhi.o
|
||||||
obj-y += mhi_pm.o
|
obj-y += mhi_pm.o
|
||||||
obj-y += mhi_ssr.o
|
obj-y += mhi_ssr.o
|
||||||
|
CFLAGS_mhi_iface.o := -I$(src)
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#include <linux/pci.h>
|
#include <linux/pci.h>
|
||||||
#include <linux/gpio.h>
|
#include <linux/gpio.h>
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
|
@ -18,6 +19,9 @@
|
||||||
#include <linux/delay.h>
|
#include <linux/delay.h>
|
||||||
#include <linux/debugfs.h>
|
#include <linux/debugfs.h>
|
||||||
|
|
||||||
|
#define CREATE_TRACE_POINTS
|
||||||
|
#include "mhi_trace.h"
|
||||||
|
|
||||||
#include "mhi_sys.h"
|
#include "mhi_sys.h"
|
||||||
#include "mhi.h"
|
#include "mhi.h"
|
||||||
#include "mhi_macros.h"
|
#include "mhi_macros.h"
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include <linux/interrupt.h>
|
#include <linux/interrupt.h>
|
||||||
|
|
||||||
#include "mhi_sys.h"
|
#include "mhi_sys.h"
|
||||||
|
#include "mhi_trace.h"
|
||||||
|
|
||||||
|
|
||||||
irqreturn_t mhi_msi_handlr(int irq_number, void *dev_id)
|
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_dev_ctxt->msi_counter[IRQ_TO_MSI(mhi_dev_ctxt, irq_number)]++;
|
||||||
mhi_log(MHI_MSG_VERBOSE,
|
mhi_log(MHI_MSG_VERBOSE,
|
||||||
"Got MSI 0x%x\n", IRQ_TO_MSI(mhi_dev_ctxt, irq_number));
|
"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)) {
|
switch (IRQ_TO_MSI(mhi_dev_ctxt, irq_number)) {
|
||||||
case 0:
|
case 0:
|
||||||
case 1:
|
case 1:
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include "mhi.h"
|
#include "mhi.h"
|
||||||
#include "mhi_hwio.h"
|
#include "mhi_hwio.h"
|
||||||
#include "mhi_macros.h"
|
#include "mhi_macros.h"
|
||||||
|
#include "mhi_trace.h"
|
||||||
|
|
||||||
static void mhi_write_db(struct mhi_device_ctxt *mhi_dev_ctxt,
|
static void mhi_write_db(struct mhi_device_ctxt *mhi_dev_ctxt,
|
||||||
void __iomem *io_addr_lower,
|
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 = mhi_dev_ctxt->mhi_local_chan_ctxt[chan].wp;
|
||||||
pkt_loc->data_tx_pkt.buffer_ptr = buf;
|
pkt_loc->data_tx_pkt.buffer_ptr = buf;
|
||||||
pkt_loc->type.info = mhi_flags;
|
pkt_loc->type.info = mhi_flags;
|
||||||
|
trace_mhi_tre(pkt_loc, chan, 0);
|
||||||
|
|
||||||
if (likely(0 != client_handle->intmod_t))
|
if (likely(0 != client_handle->intmod_t))
|
||||||
MHI_TRB_SET_INFO(TX_TRB_BEI, pkt_loc, 1);
|
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;
|
enum MHI_PKT_TYPE ring_el_type = MHI_PKT_TYPE_NOOP_CMD;
|
||||||
struct mutex *chan_mutex = NULL;
|
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,
|
mhi_log(MHI_MSG_INFO,
|
||||||
"Entered, MHI state %d dev_exec_env %d chan %d cmd %d\n",
|
"Entered, MHI state %d dev_exec_env %d chan %d cmd %d\n",
|
||||||
mhi_dev_ctxt->mhi_state,
|
mhi_dev_ctxt->mhi_state,
|
||||||
mhi_dev_ctxt->dev_exec_env,
|
mhi_dev_ctxt->dev_exec_env,
|
||||||
chan, cmd);
|
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);
|
mhi_assert_device_wake(mhi_dev_ctxt);
|
||||||
/*
|
/*
|
||||||
* If there is a cmd pending a struct device confirmation,
|
* 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 nr_trb_to_parse;
|
||||||
u32 i = 0;
|
u32 i = 0;
|
||||||
|
|
||||||
|
trace_mhi_ev(event);
|
||||||
|
|
||||||
switch (MHI_EV_READ_CODE(EV_TRB_CODE, event)) {
|
switch (MHI_EV_READ_CODE(EV_TRB_CODE, event)) {
|
||||||
case MHI_EVENT_CC_EOB:
|
case MHI_EVENT_CC_EOB:
|
||||||
chan = MHI_EV_READ_CHID(EV_CHID, event);
|
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);
|
phy_ev_trb_loc);
|
||||||
local_trb_loc = (union mhi_xfer_pkt *)local_chan_ctxt->rp;
|
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,
|
ret_val = get_nr_enclosed_el(local_chan_ctxt,
|
||||||
local_trb_loc,
|
local_trb_loc,
|
||||||
local_ev_trb_loc,
|
local_ev_trb_loc,
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
|
|
||||||
#include "mhi_sys.h"
|
#include "mhi_sys.h"
|
||||||
#include "mhi_hwio.h"
|
#include "mhi_hwio.h"
|
||||||
|
#include "mhi_trace.h"
|
||||||
|
|
||||||
static void conditional_chan_db_write(
|
static void conditional_chan_db_write(
|
||||||
struct mhi_device_ctxt *mhi_dev_ctxt, u32 chan)
|
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",
|
mhi_log(MHI_MSG_INFO, "Transitioning to %d\n",
|
||||||
(int)cur_work_item);
|
(int)cur_work_item);
|
||||||
|
trace_mhi_state(cur_work_item);
|
||||||
switch (cur_work_item) {
|
switch (cur_work_item) {
|
||||||
case STATE_TRANSITION_BHI:
|
case STATE_TRANSITION_BHI:
|
||||||
ret_val = process_bhi_transition(mhi_dev_ctxt, cur_work_item);
|
ret_val = process_bhi_transition(mhi_dev_ctxt, cur_work_item);
|
||||||
|
|
142
drivers/platform/msm/mhi/mhi_trace.h
Normal file
142
drivers/platform/msm/mhi/mhi_trace.h
Normal file
|
@ -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>
|
Loading…
Add table
Reference in a new issue