From 58de42af6b8a8cdce33da3e5389a8c12a50de33f Mon Sep 17 00:00:00 2001 From: Ashok Vuyyuru Date: Thu, 17 Oct 2019 15:52:31 +0530 Subject: [PATCH] msm: ipa3: Fix to not send command for test prod pipe Following issues are observed: - For coalescing close frame not incrementing the ep_flt_num - In endpoint mapping added new unused endpoint with filter support because of that sending command for unused pipe. Add changes to increment ep_flt_num number when sending coalescing close frame command and avoid sending command for TEST_PROD pipe. Change-Id: I3604c015308977c45eb1b251ed54d6e6744f643d Signed-off-by: Ashok Vuyyuru Signed-off-by: Chaitanya Pratapa --- drivers/platform/msm/ipa/ipa_v3/ipa.c | 17 +++++++++++------ drivers/platform/msm/ipa/ipa_v3/ipa_utils.c | 6 +++++- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa.c b/drivers/platform/msm/ipa/ipa_v3/ipa.c index 4cfa736abb80..15d29eab2d71 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa.c +++ b/drivers/platform/msm/ipa/ipa_v3/ipa.c @@ -3132,14 +3132,14 @@ static int ipa3_q6_clean_q6_flt_tbls(enum ipa_ip_type ip, int retval = 0; int pipe_idx; int flt_idx = 0; - int num_cmds = 0; + int num_cmds = 0, count = 0; int index; u32 lcl_addr_mem_part; u32 lcl_hdr_sz; struct ipa_mem_buffer mem; struct ipahal_reg_valmask valmask; struct ipahal_imm_cmd_register_write reg_write_coal_close; - int i; + int coal_ep = IPA_EP_NOT_ALLOCATED; IPADBG("Entry\n"); @@ -3195,14 +3195,14 @@ static int ipa3_q6_clean_q6_flt_tbls(enum ipa_ip_type ip, goto free_cmd_pyld; } + coal_ep = ipa3_get_ep_mapping(IPA_CLIENT_APPS_WAN_COAL_CONS); /* IC to close the coal frame before HPS Clear if coal is enabled */ - if (ipa3_get_ep_mapping(IPA_CLIENT_APPS_WAN_COAL_CONS) != -1) { - i = ipa3_get_ep_mapping(IPA_CLIENT_APPS_WAN_COAL_CONS); + if (coal_ep != IPA_EP_NOT_ALLOCATED) { reg_write_coal_close.skip_pipeline_clear = false; reg_write_coal_close.pipeline_clear_options = IPAHAL_HPS_CLEAR; reg_write_coal_close.offset = ipahal_get_reg_ofst( IPA_AGGR_FORCE_CLOSE); - ipahal_get_aggr_force_close_valmask(i, &valmask); + ipahal_get_aggr_force_close_valmask(coal_ep, &valmask); reg_write_coal_close.value = valmask.val; reg_write_coal_close.value_mask = valmask.mask; cmd_pyld[num_cmds] = ipahal_construct_imm_cmd( @@ -3228,7 +3228,12 @@ static int ipa3_q6_clean_q6_flt_tbls(enum ipa_ip_type ip, if (!ipa3_ctx->ep[pipe_idx].valid || ipa3_ctx->ep[pipe_idx].skip_ep_cfg) { - if (num_cmds >= ipa3_ctx->ep_flt_num) { + /* + * When coal pipe is valid send close coalescing frame + * command and increment the ep_flt_num accordingly. + */ + count = (coal_ep != IPA_EP_NOT_ALLOCATED) ? 1 : 0; + if (num_cmds >= (ipa3_ctx->ep_flt_num + count)) { IPAERR("number of commands is out of range\n"); retval = -ENOBUFS; goto free_empty_img; diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_utils.c b/drivers/platform/msm/ipa/ipa_v3/ipa_utils.c index 1470aa4fb222..eefd16bf35a0 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa_utils.c +++ b/drivers/platform/msm/ipa/ipa_v3/ipa_utils.c @@ -4578,7 +4578,11 @@ void ipa_init_ep_flt_bitmap(void) } for (cl = 0; cl < IPA_CLIENT_MAX ; cl++) { - if (ipa3_ep_mapping[hw_idx][cl].support_flt) { + /* In normal mode don't add filter support test pipes*/ + if ((ipa3_ep_mapping[hw_idx][cl].support_flt && + !IPA_CLIENT_IS_TEST(cl)) || + ipa3_ctx->ipa3_hw_mode == IPA_HW_MODE_VIRTUAL || + ipa3_ctx->ipa3_hw_mode == IPA_HW_MODE_EMULATION) { gsi_ep_ptr = &ipa3_ep_mapping[hw_idx][cl].ipa_gsi_ep_info; pipe_num =