From 839bf852e27b7a16ad5ecd394212f2797948831e Mon Sep 17 00:00:00 2001 From: Sujeev Dias Date: Sat, 11 Mar 2017 17:53:03 -0800 Subject: [PATCH 1/2] mhi: core: only accumulate transfer complete events as processed events When a client ask MHI host to processed X number of events, only count transfer events as part of processed events. All other events are internal events. CRs-Fixed: 2018324 Change-Id: I4cfcae0ba187348442c3fc45b76d7c4b01f687bd Signed-off-by: Sujeev Dias --- drivers/platform/msm/mhi/mhi_isr.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/platform/msm/mhi/mhi_isr.c b/drivers/platform/msm/mhi/mhi_isr.c index 95efe62eb8d4..9aa9aeb7e646 100644 --- a/drivers/platform/msm/mhi/mhi_isr.c +++ b/drivers/platform/msm/mhi/mhi_isr.c @@ -114,6 +114,7 @@ static int mhi_process_event_ring( ev_index); spin_unlock_bh(&ring->ring_lock); __pm_relax(&mhi_dev_ctxt->w_lock); + event_quota--; break; } case MHI_PKT_TYPE_STATE_CHANGE_EVENT: @@ -207,7 +208,6 @@ static int mhi_process_event_ring( ev_ctxt->mhi_event_read_ptr); spin_unlock_irqrestore(&local_ev_ctxt->ring_lock, flags); ret_val = 0; - --event_quota; } read_lock_bh(&mhi_dev_ctxt->pm_xfer_lock); mhi_dev_ctxt->deassert_wake(mhi_dev_ctxt); @@ -222,12 +222,10 @@ void mhi_ev_task(unsigned long data) struct mhi_device_ctxt *mhi_dev_ctxt = mhi_ring->mhi_dev_ctxt; int ev_index = mhi_ring->index; - struct mhi_event_ring_cfg *ring_props = - &mhi_dev_ctxt->ev_ring_props[ev_index]; mhi_log(mhi_dev_ctxt, MHI_MSG_VERBOSE, "Enter\n"); /* Process event ring */ - mhi_process_event_ring(mhi_dev_ctxt, ev_index, ring_props->nr_desc); + mhi_process_event_ring(mhi_dev_ctxt, ev_index, U32_MAX); enable_irq(MSI_TO_IRQ(mhi_dev_ctxt, ev_index)); mhi_log(mhi_dev_ctxt, MHI_MSG_VERBOSE, "Exit\n"); @@ -240,12 +238,10 @@ void process_event_ring(struct work_struct *work) struct mhi_device_ctxt *mhi_dev_ctxt = mhi_ring->mhi_dev_ctxt; int ev_index = mhi_ring->index; - struct mhi_event_ring_cfg *ring_props = - &mhi_dev_ctxt->ev_ring_props[ev_index]; mhi_log(mhi_dev_ctxt, MHI_MSG_VERBOSE, "Enter\n"); /* Process event ring */ - mhi_process_event_ring(mhi_dev_ctxt, ev_index, ring_props->nr_desc); + mhi_process_event_ring(mhi_dev_ctxt, ev_index, U32_MAX); enable_irq(MSI_TO_IRQ(mhi_dev_ctxt, ev_index)); mhi_log(mhi_dev_ctxt, MHI_MSG_VERBOSE, "Exit\n"); From 0ee8cf4de3d89cf958b3ab4a34a7a4917caaadcd Mon Sep 17 00:00:00 2001 From: Sujeev Dias Date: Tue, 28 Feb 2017 14:03:04 -0800 Subject: [PATCH 2/2] mhi: core: process incoming data based on event ring type mhi clients can manage both hardware and software event rings. Process incoming data based on event ring type instead of channel type. CRs-Fixed: 2018326 Change-Id: Ifa2de76034224c19a846f7be153400888f8c66de Signed-off-by: Sujeev Dias --- drivers/platform/msm/mhi/mhi_main.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/platform/msm/mhi/mhi_main.c b/drivers/platform/msm/mhi/mhi_main.c index 66d56bdd8f85..644004672cd2 100644 --- a/drivers/platform/msm/mhi/mhi_main.c +++ b/drivers/platform/msm/mhi/mhi_main.c @@ -1096,7 +1096,8 @@ static int parse_outbound(struct mhi_device_ctxt *mhi_dev_ctxt, } static int parse_inbound(struct mhi_device_ctxt *mhi_dev_ctxt, - u32 chan, union mhi_xfer_pkt *local_ev_trb_loc, u16 xfer_len) + u32 chan, union mhi_xfer_pkt *local_ev_trb_loc, + u16 xfer_len, unsigned ev_ring) { struct mhi_client_handle *client_handle; struct mhi_client_config *client_config; @@ -1104,6 +1105,8 @@ static int parse_inbound(struct mhi_device_ctxt *mhi_dev_ctxt, struct mhi_result *result; struct mhi_cb_info cb_info; struct mhi_ring *bb_ctxt = &mhi_dev_ctxt->chan_bb_list[chan]; + bool ev_managed = GET_EV_PROPS(EV_MANAGED, + mhi_dev_ctxt->ev_ring_props[ev_ring].flags); int r; uintptr_t bb_index, ctxt_index_rp, ctxt_index_wp; @@ -1117,7 +1120,7 @@ static int parse_inbound(struct mhi_device_ctxt *mhi_dev_ctxt, result = &client_config->result; parse_inbound_bb(mhi_dev_ctxt, bb_ctxt, result, xfer_len); - if (unlikely(IS_SOFTWARE_CHANNEL(chan))) { + if (ev_managed) { MHI_TX_TRB_SET_LEN(TX_TRB_LEN, local_ev_trb_loc, xfer_len); r = ctxt_del_element(local_chan_ctxt, NULL); BUG_ON(r); @@ -1283,7 +1286,8 @@ int parse_xfer_event(struct mhi_device_ctxt *mhi_dev_ctxt, } if (local_chan_ctxt->dir == MHI_IN) { parse_inbound(mhi_dev_ctxt, chan, - local_ev_trb_loc, xfer_len); + local_ev_trb_loc, xfer_len, + event_id); } else { parse_outbound(mhi_dev_ctxt, chan, local_ev_trb_loc, xfer_len);