summaryrefslogtreecommitdiff
path: root/drivers/platform/msm/ipa
diff options
context:
space:
mode:
authorSkylar Chang <chiaweic@codeaurora.org>2016-04-19 12:30:44 -0700
committerJeevan Shriram <jshriram@codeaurora.org>2016-05-03 15:50:42 -0700
commit4ab1f7ac6e211b059bde20f0956cd5eeb6145e59 (patch)
treeca0e4861c986048bae9bc86741bcfabb8814383c /drivers/platform/msm/ipa
parent49d9d205a16337cf9d0eeb04c9424695002ad63c (diff)
msm: ipa3: mhi: add IPC logging to common buffer
Add IPC logging to IPA MHI driver. IPC logging will be stored in the same log buffer as IPA IPC log. CRs-Fixed: 1005492 Change-Id: I31acc2008800d213cc69003f9781fee04b5935aa Acked-by: Ady Abraham <adya@qti.qualcomm.com> Signed-off-by: Skylar Chang <chiaweic@codeaurora.org>
Diffstat (limited to 'drivers/platform/msm/ipa')
-rw-r--r--drivers/platform/msm/ipa/ipa_v3/ipa_dma.c52
-rw-r--r--drivers/platform/msm/ipa/ipa_v3/ipa_mhi.c118
2 files changed, 110 insertions, 60 deletions
diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_dma.c b/drivers/platform/msm/ipa/ipa_v3/ipa_dma.c
index 966f279d863b..9d1ff18d7ed0 100644
--- a/drivers/platform/msm/ipa/ipa_v3/ipa_dma.c
+++ b/drivers/platform/msm/ipa/ipa_v3/ipa_dma.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2015, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2015-2016, 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
@@ -33,16 +33,38 @@
#define IPADMA_DRV_NAME "ipa_dma"
#define IPADMA_DBG(fmt, args...) \
- pr_debug(IPADMA_DRV_NAME " %s:%d " fmt, \
- __func__, __LINE__, ## args)
+ do { \
+ pr_debug(IPADMA_DRV_NAME " %s:%d " fmt, \
+ __func__, __LINE__, ## args); \
+ IPA_IPC_LOGGING(ipa_get_ipc_logbuf(), \
+ IPADMA_DRV_NAME " %s:%d " fmt, ## args); \
+ IPA_IPC_LOGGING(ipa_get_ipc_logbuf_low(), \
+ IPADMA_DRV_NAME " %s:%d " fmt, ## args); \
+ } while (0)
+
+#define IPADMA_DBG_LOW(fmt, args...) \
+ do { \
+ pr_debug(IPADMA_DRV_NAME " %s:%d " fmt, \
+ __func__, __LINE__, ## args); \
+ IPA_IPC_LOGGING(ipa_get_ipc_logbuf_low(), \
+ IPADMA_DRV_NAME " %s:%d " fmt, ## args); \
+ } while (0)
+
#define IPADMA_ERR(fmt, args...) \
- pr_err(IPADMA_DRV_NAME " %s:%d " fmt, __func__, __LINE__, ## args)
+ do { \
+ pr_err(IPADMA_DRV_NAME " %s:%d " fmt, \
+ __func__, __LINE__, ## args); \
+ IPA_IPC_LOGGING(ipa_get_ipc_logbuf(), \
+ IPADMA_DRV_NAME " %s:%d " fmt, ## args); \
+ IPA_IPC_LOGGING(ipa_get_ipc_logbuf_low(), \
+ IPADMA_DRV_NAME " %s:%d " fmt, ## args); \
+ } while (0)
#define IPADMA_FUNC_ENTRY() \
- IPADMA_DBG("ENTRY\n")
+ IPADMA_DBG_LOW("ENTRY\n")
#define IPADMA_FUNC_EXIT() \
- IPADMA_DBG("EXIT\n")
+ IPADMA_DBG_LOW("EXIT\n")
#ifdef CONFIG_DEBUG_FS
#define IPADMA_MAX_MSG_LEN 1024
@@ -255,7 +277,7 @@ int ipa3_dma_enable(void)
}
mutex_lock(&ipa3_dma_ctx->enable_lock);
if (ipa3_dma_ctx->is_enabled) {
- IPADMA_DBG("Already enabled.\n");
+ IPADMA_ERR("Already enabled.\n");
mutex_unlock(&ipa3_dma_ctx->enable_lock);
return -EPERM;
}
@@ -281,7 +303,7 @@ static bool ipa3_dma_work_pending(void)
IPADMA_DBG("pending uc\n");
return true;
}
- IPADMA_DBG("no pending work\n");
+ IPADMA_DBG_LOW("no pending work\n");
return false;
}
@@ -309,7 +331,7 @@ int ipa3_dma_disable(void)
mutex_lock(&ipa3_dma_ctx->enable_lock);
spin_lock_irqsave(&ipa3_dma_ctx->pending_lock, flags);
if (!ipa3_dma_ctx->is_enabled) {
- IPADMA_DBG("Already disabled.\n");
+ IPADMA_ERR("Already disabled.\n");
spin_unlock_irqrestore(&ipa3_dma_ctx->pending_lock, flags);
mutex_unlock(&ipa3_dma_ctx->enable_lock);
return -EPERM;
@@ -358,7 +380,7 @@ int ipa3_dma_sync_memcpy(u64 dest, u64 src, int len)
bool stop_polling = false;
IPADMA_FUNC_ENTRY();
- IPADMA_DBG("input parameters: dest = 0x%llx, src = 0x%llx, len = %d\n",
+ IPADMA_DBG_LOW("dest = 0x%llx, src = 0x%llx, len = %d\n",
dest, src, len);
if (ipa3_dma_ctx == NULL) {
IPADMA_ERR("IPADMA isn't initialized, can't memcpy\n");
@@ -390,7 +412,7 @@ int ipa3_dma_sync_memcpy(u64 dest, u64 src, int len)
if (atomic_read(&ipa3_dma_ctx->sync_memcpy_pending_cnt) >=
IPA_DMA_MAX_PENDING_SYNC) {
atomic_dec(&ipa3_dma_ctx->sync_memcpy_pending_cnt);
- IPADMA_DBG("Reached pending requests limit\n");
+ IPADMA_ERR("Reached pending requests limit\n");
return -EFAULT;
}
}
@@ -575,7 +597,7 @@ int ipa3_dma_async_memcpy(u64 dest, u64 src, int len,
unsigned long flags;
IPADMA_FUNC_ENTRY();
- IPADMA_DBG("input parameters: dest = 0x%llx, src = 0x%llx, len = %d\n",
+ IPADMA_DBG_LOW("dest = 0x%llx, src = 0x%llx, len = %d\n",
dest, src, len);
if (ipa3_dma_ctx == NULL) {
IPADMA_ERR("IPADMA isn't initialized, can't memcpy\n");
@@ -612,7 +634,7 @@ int ipa3_dma_async_memcpy(u64 dest, u64 src, int len,
if (atomic_read(&ipa3_dma_ctx->async_memcpy_pending_cnt) >=
IPA_DMA_MAX_PENDING_ASYNC) {
atomic_dec(&ipa3_dma_ctx->async_memcpy_pending_cnt);
- IPADMA_DBG("Reached pending requests limit\n");
+ IPADMA_ERR("Reached pending requests limit\n");
return -EFAULT;
}
}
@@ -774,7 +796,7 @@ void ipa3_dma_destroy(void)
IPADMA_FUNC_ENTRY();
if (!ipa3_dma_ctx) {
- IPADMA_DBG("IPADMA isn't initialized\n");
+ IPADMA_ERR("IPADMA isn't initialized\n");
return;
}
@@ -919,7 +941,7 @@ static ssize_t ipa3_dma_debugfs_reset_statistics(struct file *file,
switch (in_num) {
case 0:
if (ipa3_dma_work_pending())
- IPADMA_DBG("Note, there are pending memcpy\n");
+ IPADMA_ERR("Note, there are pending memcpy\n");
atomic_set(&ipa3_dma_ctx->total_async_memcpy, 0);
atomic_set(&ipa3_dma_ctx->total_sync_memcpy, 0);
diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_mhi.c b/drivers/platform/msm/ipa/ipa_v3/ipa_mhi.c
index 401bb0f61ee8..517093adbe81 100644
--- a/drivers/platform/msm/ipa/ipa_v3/ipa_mhi.c
+++ b/drivers/platform/msm/ipa/ipa_v3/ipa_mhi.c
@@ -21,15 +21,42 @@
#include "ipa_qmi_service.h"
#define IPA_MHI_DRV_NAME "ipa_mhi"
+
+
#define IPA_MHI_DBG(fmt, args...) \
- pr_debug(IPA_MHI_DRV_NAME " %s:%d " fmt, \
- __func__, __LINE__, ## args)
+ do { \
+ pr_debug(IPA_MHI_DRV_NAME " %s:%d " fmt, \
+ __func__, __LINE__, ## args); \
+ IPA_IPC_LOGGING(ipa_get_ipc_logbuf(), \
+ IPA_MHI_DRV_NAME " %s:%d " fmt, ## args); \
+ IPA_IPC_LOGGING(ipa_get_ipc_logbuf_low(), \
+ IPA_MHI_DRV_NAME " %s:%d " fmt, ## args); \
+ } while (0)
+
+#define IPA_MHI_DBG_LOW(fmt, args...) \
+ do { \
+ pr_debug(IPA_MHI_DRV_NAME " %s:%d " fmt, \
+ __func__, __LINE__, ## args); \
+ IPA_IPC_LOGGING(ipa_get_ipc_logbuf_low(), \
+ IPA_MHI_DRV_NAME " %s:%d " fmt, ## args); \
+ } while (0)
+
+
#define IPA_MHI_ERR(fmt, args...) \
- pr_err(IPA_MHI_DRV_NAME " %s:%d " fmt, __func__, __LINE__, ## args)
+ do { \
+ pr_err(IPA_MHI_DRV_NAME " %s:%d " fmt, \
+ __func__, __LINE__, ## args); \
+ IPA_IPC_LOGGING(ipa_get_ipc_logbuf(), \
+ IPA_MHI_DRV_NAME " %s:%d " fmt, ## args); \
+ IPA_IPC_LOGGING(ipa_get_ipc_logbuf_low(), \
+ IPA_MHI_DRV_NAME " %s:%d " fmt, ## args); \
+ } while (0)
+
+
#define IPA_MHI_FUNC_ENTRY() \
- IPA_MHI_DBG("ENTRY\n")
+ IPA_MHI_DBG_LOW("ENTRY\n")
#define IPA_MHI_FUNC_EXIT() \
- IPA_MHI_DBG("EXIT\n")
+ IPA_MHI_DBG_LOW("EXIT\n")
#define IPA_MHI_GSI_ER_START 10
#define IPA_MHI_GSI_ER_END 16
@@ -756,12 +783,12 @@ static void ipa3_mhi_rm_prod_notify(void *user_data, enum ipa_rm_event event,
switch (event) {
case IPA_RM_RESOURCE_GRANTED:
- IPA_MHI_DBG("IPA_RM_RESOURCE_GRANTED\n");
+ IPA_MHI_DBG_LOW("IPA_RM_RESOURCE_GRANTED\n");
complete_all(&ipa3_mhi_ctx->rm_prod_granted_comp);
break;
case IPA_RM_RESOURCE_RELEASED:
- IPA_MHI_DBG("IPA_RM_RESOURCE_RELEASED\n");
+ IPA_MHI_DBG_LOW("IPA_RM_RESOURCE_RELEASED\n");
break;
default:
@@ -828,7 +855,7 @@ static int ipa3_mhi_rm_cons_request(void)
}
spin_unlock_irqrestore(&ipa3_mhi_ctx->state_lock, flags);
- IPA_MHI_DBG("EXIT with %d\n", res);
+ IPA_MHI_DBG_LOW("EXIT with %d\n", res);
return res;
}
@@ -878,7 +905,7 @@ static int ipa3_mhi_request_prod(void)
IPA_MHI_FUNC_ENTRY();
reinit_completion(&ipa3_mhi_ctx->rm_prod_granted_comp);
- IPA_MHI_DBG("requesting mhi prod\n");
+ IPA_MHI_DBG_LOW("requesting mhi prod\n");
res = ipa_rm_request_resource(IPA_RM_RESOURCE_MHI_PROD);
if (res) {
if (res != -EINPROGRESS) {
@@ -894,7 +921,7 @@ static int ipa3_mhi_request_prod(void)
}
}
- IPA_MHI_DBG("mhi prod granted\n");
+ IPA_MHI_DBG_LOW("mhi prod granted\n");
IPA_MHI_FUNC_EXIT();
return 0;
@@ -1071,11 +1098,12 @@ static bool ipa3_mhi_gsi_channel_empty(struct ipa3_mhi_channel_ctx *channel)
IPA_MHI_FUNC_ENTRY();
if (!channel->stop_in_proc) {
- IPA_MHI_DBG("Channel is not in STOP_IN_PROC\n");
+ IPA_MHI_DBG_LOW("Channel is not in STOP_IN_PROC\n");
return true;
}
- IPA_MHI_DBG("Stopping GSI channel %ld\n", channel->ep->gsi_chan_hdl);
+ IPA_MHI_DBG_LOW("Stopping GSI channel %ld\n",
+ channel->ep->gsi_chan_hdl);
res = gsi_stop_channel(channel->ep->gsi_chan_hdl);
if (res != 0 &&
res != -GSI_STATUS_AGAIN &&
@@ -1087,7 +1115,7 @@ static bool ipa3_mhi_gsi_channel_empty(struct ipa3_mhi_channel_ctx *channel)
}
if (res == 0) {
- IPA_MHI_DBG("GSI channel %ld STOP\n",
+ IPA_MHI_DBG_LOW("GSI channel %ld STOP\n",
channel->ep->gsi_chan_hdl);
channel->stop_in_proc = false;
return true;
@@ -1129,7 +1157,7 @@ static bool ipa3_mhi_wait_for_ul_empty_timeout(unsigned int msecs)
}
if (time_after(jiffies, jiffies_start + jiffies_timeout)) {
- IPA_MHI_DBG("timeout waiting for UL empty\n");
+ IPA_MHI_DBG_LOW("timeout waiting for UL empty\n");
break;
}
@@ -1441,31 +1469,31 @@ static int ipa_mhi_start_uc_channel(struct ipa3_mhi_channel_ctx *channel,
static void ipa_mhi_dump_ch_ctx(struct ipa3_mhi_channel_ctx *channel)
{
- IPA_MHI_DBG("ch_id %d\n", channel->id);
- IPA_MHI_DBG("chstate 0x%x\n", channel->ch_ctx_host.chstate);
- IPA_MHI_DBG("brstmode 0x%x\n", channel->ch_ctx_host.brstmode);
- IPA_MHI_DBG("pollcfg 0x%x\n", channel->ch_ctx_host.pollcfg);
- IPA_MHI_DBG("chtype 0x%x\n", channel->ch_ctx_host.chtype);
- IPA_MHI_DBG("erindex 0x%x\n", channel->ch_ctx_host.erindex);
- IPA_MHI_DBG("rbase 0x%llx\n", channel->ch_ctx_host.rbase);
- IPA_MHI_DBG("rlen 0x%llx\n", channel->ch_ctx_host.rlen);
- IPA_MHI_DBG("rp 0x%llx\n", channel->ch_ctx_host.rp);
- IPA_MHI_DBG("wp 0x%llx\n", channel->ch_ctx_host.wp);
+ IPA_MHI_DBG_LOW("ch_id %d\n", channel->id);
+ IPA_MHI_DBG_LOW("chstate 0x%x\n", channel->ch_ctx_host.chstate);
+ IPA_MHI_DBG_LOW("brstmode 0x%x\n", channel->ch_ctx_host.brstmode);
+ IPA_MHI_DBG_LOW("pollcfg 0x%x\n", channel->ch_ctx_host.pollcfg);
+ IPA_MHI_DBG_LOW("chtype 0x%x\n", channel->ch_ctx_host.chtype);
+ IPA_MHI_DBG_LOW("erindex 0x%x\n", channel->ch_ctx_host.erindex);
+ IPA_MHI_DBG_LOW("rbase 0x%llx\n", channel->ch_ctx_host.rbase);
+ IPA_MHI_DBG_LOW("rlen 0x%llx\n", channel->ch_ctx_host.rlen);
+ IPA_MHI_DBG_LOW("rp 0x%llx\n", channel->ch_ctx_host.rp);
+ IPA_MHI_DBG_LOW("wp 0x%llx\n", channel->ch_ctx_host.wp);
}
static void ipa_mhi_dump_ev_ctx(struct ipa3_mhi_channel_ctx *channel)
{
- IPA_MHI_DBG("ch_id %d event id %d\n", channel->id,
+ IPA_MHI_DBG_LOW("ch_id %d event id %d\n", channel->id,
channel->ch_ctx_host.erindex);
- IPA_MHI_DBG("intmodc 0x%x\n", channel->ev_ctx_host.intmodc);
- IPA_MHI_DBG("intmodt 0x%x\n", channel->ev_ctx_host.intmodt);
- IPA_MHI_DBG("ertype 0x%x\n", channel->ev_ctx_host.ertype);
- IPA_MHI_DBG("msivec 0x%x\n", channel->ev_ctx_host.msivec);
- IPA_MHI_DBG("rbase 0x%llx\n", channel->ev_ctx_host.rbase);
- IPA_MHI_DBG("rlen 0x%llx\n", channel->ev_ctx_host.rlen);
- IPA_MHI_DBG("rp 0x%llx\n", channel->ev_ctx_host.rp);
- IPA_MHI_DBG("wp 0x%llx\n", channel->ev_ctx_host.wp);
+ IPA_MHI_DBG_LOW("intmodc 0x%x\n", channel->ev_ctx_host.intmodc);
+ IPA_MHI_DBG_LOW("intmodt 0x%x\n", channel->ev_ctx_host.intmodt);
+ IPA_MHI_DBG_LOW("ertype 0x%x\n", channel->ev_ctx_host.ertype);
+ IPA_MHI_DBG_LOW("msivec 0x%x\n", channel->ev_ctx_host.msivec);
+ IPA_MHI_DBG_LOW("rbase 0x%llx\n", channel->ev_ctx_host.rbase);
+ IPA_MHI_DBG_LOW("rlen 0x%llx\n", channel->ev_ctx_host.rlen);
+ IPA_MHI_DBG_LOW("rp 0x%llx\n", channel->ev_ctx_host.rp);
+ IPA_MHI_DBG_LOW("wp 0x%llx\n", channel->ev_ctx_host.wp);
}
static int ipa_mhi_read_ch_ctx(struct ipa3_mhi_channel_ctx *channel)
@@ -2235,7 +2263,7 @@ static int ipa3_mhi_suspend_ul_channels(void)
if (ipa3_mhi_ctx->ul_channels[i].state !=
IPA_HW_MHI_CHANNEL_STATE_RUN)
continue;
- IPA_MHI_DBG("suspending channel %d\n",
+ IPA_MHI_DBG_LOW("suspending channel %d\n",
ipa3_mhi_ctx->ul_channels[i].id);
if (ipa3_ctx->transport_prototype == IPA_TRANSPORT_TYPE_GSI)
@@ -2271,7 +2299,7 @@ static int ipa3_mhi_resume_ul_channels(bool LPTransitionRejected)
IPA_HW_MHI_CHANNEL_STATE_SUSPEND)
continue;
channel = &ipa3_mhi_ctx->ul_channels[i];
- IPA_MHI_DBG("resuming channel %d\n", channel->id);
+ IPA_MHI_DBG_LOW("resuming channel %d\n", channel->id);
if (ipa3_ctx->transport_prototype == IPA_TRANSPORT_TYPE_GSI) {
if (channel->brstmode_enabled &&
@@ -2324,7 +2352,7 @@ static int ipa3_mhi_stop_event_update_ul_channels(void)
if (ipa3_mhi_ctx->ul_channels[i].state !=
IPA_HW_MHI_CHANNEL_STATE_SUSPEND)
continue;
- IPA_MHI_DBG("stop update event channel %d\n",
+ IPA_MHI_DBG_LOW("stop update event channel %d\n",
ipa3_mhi_ctx->ul_channels[i].id);
res = ipa3_uc_mhi_stop_event_update_channel(
ipa3_mhi_ctx->ul_channels[i].index);
@@ -2351,7 +2379,7 @@ static int ipa3_mhi_suspend_dl_channels(void)
if (ipa3_mhi_ctx->dl_channels[i].state !=
IPA_HW_MHI_CHANNEL_STATE_RUN)
continue;
- IPA_MHI_DBG("suspending channel %d\n",
+ IPA_MHI_DBG_LOW("suspending channel %d\n",
ipa3_mhi_ctx->dl_channels[i].id);
if (ipa3_ctx->transport_prototype == IPA_TRANSPORT_TYPE_GSI)
res = ipa3_mhi_suspend_gsi_channel(
@@ -2386,7 +2414,7 @@ static int ipa3_mhi_resume_dl_channels(bool LPTransitionRejected)
IPA_HW_MHI_CHANNEL_STATE_SUSPEND)
continue;
channel = &ipa3_mhi_ctx->dl_channels[i];
- IPA_MHI_DBG("resuming channel %d\n", channel->id);
+ IPA_MHI_DBG_LOW("resuming channel %d\n", channel->id);
if (ipa3_ctx->transport_prototype == IPA_TRANSPORT_TYPE_GSI) {
if (channel->brstmode_enabled &&
@@ -2437,7 +2465,7 @@ static int ipa3_mhi_stop_event_update_dl_channels(void)
if (ipa3_mhi_ctx->dl_channels[i].state !=
IPA_HW_MHI_CHANNEL_STATE_SUSPEND)
continue;
- IPA_MHI_DBG("stop update event channel %d\n",
+ IPA_MHI_DBG_LOW("stop update event channel %d\n",
ipa3_mhi_ctx->dl_channels[i].id);
res = ipa3_uc_mhi_stop_event_update_channel(
ipa3_mhi_ctx->dl_channels[i].index);
@@ -2577,7 +2605,7 @@ static bool ipa3_mhi_has_open_aggr_frame(void)
int ipa_ep_idx;
aggr_state_active = ipahal_read_reg(IPA_STATE_AGGR_ACTIVE);
- IPA_MHI_DBG("IPA_STATE_AGGR_ACTIVE_OFST 0x%x\n", aggr_state_active);
+ IPA_MHI_DBG_LOW("IPA_STATE_AGGR_ACTIVE_OFST 0x%x\n", aggr_state_active);
for (i = 0; i < IPA_MHI_MAX_DL_CHANNELS; i++) {
channel = &ipa3_mhi_ctx->dl_channels[i];
@@ -2647,7 +2675,7 @@ int ipa3_mhi_suspend(bool force)
return res;
}
force_clear = true;
- IPA_MHI_DBG("force clear datapath enabled\n");
+ IPA_MHI_DBG_LOW("force clear datapath enabled\n");
empty = ipa3_mhi_wait_for_ul_empty_timeout(
IPA_MHI_CH_EMPTY_TIMEOUT_MSEC);
@@ -2676,7 +2704,7 @@ int ipa3_mhi_suspend(bool force)
BUG();
return res;
}
- IPA_MHI_DBG("force clear datapath disabled\n");
+ IPA_MHI_DBG_LOW("force clear datapath disabled\n");
ipa3_mhi_ctx->qmi_req_id++;
}
@@ -2701,14 +2729,14 @@ int ipa3_mhi_suspend(bool force)
*/
IPA_ACTIVE_CLIENTS_INC_SIMPLE();
- IPA_MHI_DBG("release prod\n");
+ IPA_MHI_DBG_LOW("release prod\n");
res = ipa3_mhi_release_prod();
if (res) {
IPA_MHI_ERR("ipa3_mhi_release_prod failed %d\n", res);
goto fail_release_prod;
}
- IPA_MHI_DBG("wait for cons release\n");
+ IPA_MHI_DBG_LOW("wait for cons release\n");
res = ipa3_mhi_wait_for_cons_release();
if (res) {
IPA_MHI_ERR("ipa3_mhi_wait_for_cons_release failed %d\n", res);
@@ -2772,7 +2800,7 @@ fail_suspend_ul_channel:
IPA_MHI_ERR("failed to disable force clear\n");
BUG();
}
- IPA_MHI_DBG("force clear datapath disabled\n");
+ IPA_MHI_DBG_LOW("force clear datapath disabled\n");
ipa3_mhi_ctx->qmi_req_id++;
}
return res;