Kaynağa Gözat

msm: ipa: disable gsi flow control for mhi flow control channel

disable gsi flow control for mhi flow control channel
if modem is already up.

Change-Id: I5d7f63d85fab8372bf4830d1fe1328027a1ab889
Signed-off-by: Bojun Pan <[email protected]>
Bojun Pan 4 yıl önce
ebeveyn
işleme
7ed013574a

+ 1 - 0
drivers/platform/msm/ipa/ipa_v3/ipa.c

@@ -8267,6 +8267,7 @@ static int ipa3_pre_init(const struct ipa3_plat_drv_res *resource_p,
 	}
 
 	mutex_init(&ipa3_ctx->app_clock_vote.mutex);
+	ipa3_ctx->is_modem_up = false;
 
 	return 0;
 

+ 5 - 0
drivers/platform/msm/ipa/ipa_v3/ipa_i.h

@@ -2211,6 +2211,7 @@ struct ipa3_context {
 	struct ipa_mem_buffer pkt_init_mem;
 	struct ipa_mem_buffer pkt_init_ex_mem;
 	struct ipa_mem_buffer pkt_init_ex_imm[IPA_IMM_IP_PACKET_INIT_EX_CMD_NUM];
+	bool is_modem_up;
 };
 
 struct ipa3_plat_drv_res {
@@ -3321,4 +3322,8 @@ int ipa3_uc_send_update_flow_control(uint32_t bitmask,
 	uint8_t  add_delete);
 
 enum ipa_hw_type ipa_get_hw_type_internal(void);
+/* check if modem is up */
+bool ipa3_is_modem_up(void);
+/* set modem is up */
+void ipa3_set_modem_up(bool is_up);
 #endif /* _IPA3_I_H_ */

+ 8 - 2
drivers/platform/msm/ipa/ipa_v3/ipa_mhi.c

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
- * Copyright (c) 2015-2020, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2015-2021, The Linux Foundation. All rights reserved.
  */
 
 #include <linux/debugfs.h>
@@ -56,6 +56,10 @@
 #define IPA_MHI_MAX_UL_CHANNELS 2
 #define IPA_MHI_MAX_DL_CHANNELS 3
 
+#define IPA_CLIENT_IS_MHI_LOW_LAT(client) \
+	((client) == IPA_CLIENT_MHI_LOW_LAT_PROD || \
+	(client) == IPA_CLIENT_MHI_LOW_LAT_CONS)
+
 /* bit #40 in address should be asserted for MHI transfers over pcie */
 #define IPA_MHI_HOST_ADDR_COND(addr) \
 		((params->assert_bit40)?(IPA_MHI_HOST_ADDR(addr)):(addr))
@@ -423,7 +427,9 @@ static int ipa_mhi_start_gsi_channel(enum ipa_client_type client,
 
 	if (IPA_CLIENT_IS_PROD(ep->client) && ep->skip_ep_cfg &&
 			ipa3_ctx->ipa_endp_delay_wa &&
-			!ipa3_is_mhip_offload_enabled()) {
+			!ipa3_is_mhip_offload_enabled() &&
+			!(IPA_CLIENT_IS_MHI_LOW_LAT(ep->client) &&
+			ipa3_is_modem_up())) {
 		res = gsi_enable_flow_control_ee(ep->gsi_chan_hdl, 0, &code);
 		if (res == GSI_STATUS_SUCCESS) {
 			IPA_MHI_DBG("flow ctrl sussess gsi ch %d code %d\n",

+ 18 - 1
drivers/platform/msm/ipa/ipa_v3/ipa_utils.c

@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
- * Copyright (c) 2012-2020, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2021, The Linux Foundation. All rights reserved.
  */
 
 #include <net/ip.h>
@@ -11645,3 +11645,20 @@ int ipa3_get_max_pdn(void)
 	else
 		return IPA_MAX_PDN_NUM_v4;
 }
+
+bool ipa3_is_modem_up(void)
+{
+	bool is_up;
+
+	mutex_lock(&ipa3_ctx->lock);
+	is_up = ipa3_ctx->is_modem_up;
+	mutex_unlock(&ipa3_ctx->lock);
+	return is_up;
+}
+
+void ipa3_set_modem_up(bool is_up)
+{
+	mutex_lock(&ipa3_ctx->lock);
+	ipa3_ctx->is_modem_up = is_up;
+	mutex_unlock(&ipa3_ctx->lock);
+}

+ 2 - 1
drivers/platform/msm/ipa/ipa_v3/rmnet_ipa.c

@@ -3632,13 +3632,13 @@ static int ipa3_lcl_mdm_ssr_notifier_cb(struct notifier_block *this,
 	case SUBSYS_AFTER_SHUTDOWN:
 #endif
 		IPAWANINFO("IPA Received MPSS AFTER_SHUTDOWN\n");
+		ipa3_set_modem_up(false);
 		if (atomic_read(&rmnet_ipa3_ctx->is_ssr) &&
 			ipa3_ctx_get_type(IPA_HW_TYPE) < IPA_HW_v4_0)
 			ipa3_q6_post_shutdown_cleanup();
 
 		if (ipa3_ctx_get_flag(IPA_ENDP_DELAY_WA_EN))
 			ipa3_client_prod_post_shutdown_cleanup();
-
 		IPAWANINFO("IPA AFTER_SHUTDOWN handling is complete\n");
 		break;
 #if IS_ENABLED(CONFIG_QCOM_Q6V5_PAS)
@@ -3663,6 +3663,7 @@ static int ipa3_lcl_mdm_ssr_notifier_cb(struct notifier_block *this,
 	case SUBSYS_AFTER_POWERUP:
 #endif
 		IPAWANINFO("IPA received MPSS AFTER_POWERUP\n");
+		ipa3_set_modem_up(true);
 		if (!atomic_read(&rmnet_ipa3_ctx->is_initialized) &&
 		       atomic_read(&rmnet_ipa3_ctx->is_ssr))
 			platform_driver_register(&rmnet_ipa_driver);