From fbec6ce31d46b72efa376ab835e4b10580f39f4b Mon Sep 17 00:00:00 2001 From: Ashok Vuyyuru Date: Mon, 4 Nov 2019 19:06:06 +0530 Subject: [PATCH] msm: ipa3: Fix to increase timeout value for send command Due to freeing the command payload Observing proc error from IPA HW when HW delayed to process the command. Add changes to increase timeout value and handling return value from timeout function. Change-Id: I0c953a9cc299ffdf1bd8c746a2b60a2107e993ee Signed-off-by: Ashok Vuyyuru --- drivers/platform/msm/ipa/ipa_v3/ipa.c | 12 ++++++++++++ drivers/platform/msm/ipa/ipa_v3/ipa_dp.c | 4 +++- drivers/platform/msm/ipa/ipa_v3/ipa_i.h | 1 + drivers/platform/msm/ipa/ipa_v3/ipa_utils.c | 6 ++---- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa.c b/drivers/platform/msm/ipa/ipa_v3/ipa.c index 54de34a50cb4..2a566b68fe68 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa.c +++ b/drivers/platform/msm/ipa/ipa_v3/ipa.c @@ -5033,6 +5033,18 @@ static void __ipa3_dec_client_disable_clks(void) if (ret) goto bail; + /* Send force close coalsecing frame command in LPM mode before taking + * mutex lock and otherwise observing race condition. + */ + if (atomic_read(&ipa3_ctx->ipa3_active_clients.cnt) == 1 && + !ipa3_ctx->tag_process_before_gating) { + ipa3_force_close_coal(); + /* While sending force close command setting + * tag process as true to make configure to + * original state + */ + ipa3_ctx->tag_process_before_gating = false; + } /* seems like this is the only client holding the clocks */ mutex_lock(&ipa3_ctx->ipa3_active_clients.mutex); if (atomic_read(&ipa3_ctx->ipa3_active_clients.cnt) == 1 && diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_dp.c b/drivers/platform/msm/ipa/ipa_v3/ipa_dp.c index 72b2df6a8dbf..ae0f110134be 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa_dp.c +++ b/drivers/platform/msm/ipa/ipa_v3/ipa_dp.c @@ -717,8 +717,10 @@ int ipa3_send_cmd_timeout(u16 num_desc, struct ipa3_desc *descr, u32 timeout) completed = wait_for_completion_timeout( &comp->comp, msecs_to_jiffies(timeout)); - if (!completed) + if (!completed) { IPADBG("timeout waiting for imm-cmd ACK\n"); + result = -EBUSY; + } if (atomic_dec_return(&comp->cnt) == 0) kfree(comp); diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_i.h b/drivers/platform/msm/ipa/ipa_v3/ipa_i.h index b8ce5c42fd0d..35fac1407778 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa_i.h +++ b/drivers/platform/msm/ipa/ipa_v3/ipa_i.h @@ -3017,6 +3017,7 @@ int ipa3_set_flt_tuple_mask(int pipe_idx, struct ipahal_reg_hash_tuple *tuple); int ipa3_set_rt_tuple_mask(int tbl_idx, struct ipahal_reg_hash_tuple *tuple); void ipa3_set_resorce_groups_min_max_limits(void); int ipa3_suspend_apps_pipes(bool suspend); +void ipa3_force_close_coal(void); int ipa3_flt_read_tbl_from_hw(u32 pipe_idx, enum ipa_ip_type ip_type, bool hashable, diff --git a/drivers/platform/msm/ipa/ipa_v3/ipa_utils.c b/drivers/platform/msm/ipa/ipa_v3/ipa_utils.c index d1f914433894..03af63f13c45 100644 --- a/drivers/platform/msm/ipa/ipa_v3/ipa_utils.c +++ b/drivers/platform/msm/ipa/ipa_v3/ipa_utils.c @@ -64,6 +64,7 @@ #define IPA_FILT_ROUT_HASH_REG_VAL_v4_2 (0x00000000) #define IPA_DMA_TASK_FOR_GSI_TIMEOUT_MSEC (15) +#define IPA_COAL_CLOSE_FRAME_CMD_TIMEOUT_MSEC (500) #define IPA_AGGR_BYTE_LIMIT (\ IPA_ENDP_INIT_AGGR_N_AGGR_BYTE_LIMIT_BMSK >> \ @@ -8120,7 +8121,7 @@ void ipa3_force_close_coal(void) IPADBG("Sending 1 descriptor for coal force close\n"); if (ipa3_send_cmd_timeout(1, &desc, - IPA_DMA_TASK_FOR_GSI_TIMEOUT_MSEC)) { + IPA_COAL_CLOSE_FRAME_CMD_TIMEOUT_MSEC)) { IPAERR("ipa3_send_cmd failed\n"); ipa_assert(); } @@ -8131,9 +8132,6 @@ int ipa3_suspend_apps_pipes(bool suspend) { int res; - if (suspend) - ipa3_force_close_coal(); - /* As per HPG first need start/stop coalescing channel * then default one. Coalescing client number was greater then * default one so starting the last client.