瀏覽代碼

msm: ipa3: Configured new ep for modem throughput.

For measuring modem throughput initialize new
ep and configure HOLB and drop stats on that
ep.

Change-Id: Ic218877f7301c6d182742de2e0645f53ac5d7528
Signed-off-by: Piyush Dhyani <[email protected]>
Piyush Dhyani 4 年之前
父節點
當前提交
9872fb01ae

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

@@ -7217,6 +7217,14 @@ static int ipa3_post_init(const struct ipa3_plat_drv_res *resource_p,
 	uc_hdlrs.ipa_uc_holb_enabled_hdlr = ipa3_uc_holb_client_handler;
 	ipa3_uc_register_handlers(IPA_HW_FEATURE_COMMON, &uc_hdlrs);
 
+	if (ipa3_ctx->use_tput_est_ep) {
+		result = ipa3_setup_tput_pipe();
+		if (result)
+			IPAERR(":Failed configuring throughput moniter ep\n");
+		else
+			IPADBG(":Throughput moniter ep configured\n");
+	}
+
 	result = ipa3_wdi_init();
 	if (result)
 		IPAERR(":wdi init failed (%d)\n", -result);
@@ -8199,6 +8207,7 @@ static int ipa3_pre_init(const struct ipa3_plat_drv_res *resource_p,
 	ipa3_ctx->ulso_ip_id_min = resource_p->ulso_ip_id_min;
 	ipa3_ctx->ulso_ip_id_max = resource_p->ulso_ip_id_max;
 	ipa3_ctx->use_pm_wrapper = resource_p->use_pm_wrapper;
+	ipa3_ctx->use_tput_est_ep = resource_p->use_tput_est_ep;
 
 	if (resource_p->gsi_fw_file_name) {
 		ipa3_ctx->gsi_fw_file_name =
@@ -9051,6 +9060,7 @@ static int get_ipa_dts_configuration(struct platform_device *pdev,
 	ipa_drv_res->ipa_config_is_auto = false;
 	ipa_drv_res->max_num_smmu_cb = IPA_SMMU_CB_MAX;
 	ipa_drv_res->ipa_endp_delay_wa_v2 = false;
+	ipa_drv_res->use_tput_est_ep = false;
 
 	/* Get IPA HW Version */
 	result = of_property_read_u32(pdev->dev.of_node, "qcom,ipa-hw-ver",
@@ -9506,6 +9516,13 @@ static int get_ipa_dts_configuration(struct platform_device *pdev,
 		ipa_drv_res->use_pm_wrapper
 		? "Needed" : "Not needed");
 
+	ipa_drv_res->use_tput_est_ep =
+		of_property_read_bool(pdev->dev.of_node,
+		"qcom,use-tput-estmation-pipe");
+	IPADBG(": Use Tput estimation ep = %s\n",
+		ipa_drv_res->use_tput_est_ep
+		? "Needed" : "Not needed");
+
 	elem_num = of_property_count_elems_of_size(pdev->dev.of_node,
 		"qcom,mhi-event-ring-id-limits", sizeof(u32));
 

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

@@ -65,6 +65,7 @@ int ipa3_enable_data_path(u32 clnt_hdl)
 		 * on other end from IPA hw.
 		 */
 		if ((ep->client == IPA_CLIENT_USB_DPL_CONS) ||
+				(ep->client == IPA_CLIENT_TPUT_CONS) ||
 				(ep->client == IPA_CLIENT_MHI_DPL_CONS) ||
 				(ep->client == IPA_CLIENT_MHI_QDSS_CONS))
 			holb_cfg.en = IPA_HOLB_TMR_EN;

+ 52 - 5
drivers/platform/msm/ipa/ipa_v3/ipa_dp.c

@@ -1147,6 +1147,52 @@ static void ipa_pm_sys_pipe_cb(void *p, enum ipa_pm_cb_event event)
 	}
 }
 
+int ipa3_setup_tput_pipe(void)
+{
+	struct ipa3_ep_context *ep;
+	int ipa_ep_idx, result;
+	struct ipa_sys_connect_params sys_in;
+
+	memset(&sys_in, 0, sizeof(struct ipa_sys_connect_params));
+	sys_in.client = IPA_CLIENT_TPUT_CONS;
+	sys_in.desc_fifo_sz = IPA_SYS_TPUT_EP_DESC_FIFO_SZ;
+
+	ipa_ep_idx = ipa3_get_ep_mapping(sys_in.client);
+	if (ipa_ep_idx == IPA_EP_NOT_ALLOCATED) {
+		IPAERR("Invalid client.\n");
+		return -EFAULT;
+	}
+	ep = &ipa3_ctx->ep[ipa_ep_idx];
+	if (ep->valid == 1) {
+		IPAERR("EP %d already allocated.\n", ipa_ep_idx);
+		return -EFAULT;
+	}
+	IPA_ACTIVE_CLIENTS_INC_EP(sys_in.client);
+	memset(ep, 0, offsetof(struct ipa3_ep_context, sys));
+	ep->valid = 1;
+	ep->client = sys_in.client;
+
+	result = ipa_gsi_setup_channel(&sys_in, ep);
+	if (result) {
+		IPAERR("Failed to setup GSI channel\n");
+		goto fail_setup;
+	}
+
+	result = ipa3_enable_data_path(ipa_ep_idx);
+	if (result) {
+		IPAERR("enable data path failed res=%d ep=%d.\n", result,
+			 ipa_ep_idx);
+		goto fail_setup;
+	}
+	IPA_ACTIVE_CLIENTS_DEC_EP(sys_in.client);
+	return 0;
+
+fail_setup:
+	memset(&ipa3_ctx->ep[ipa_ep_idx], 0, sizeof(struct ipa3_ep_context));
+	IPA_ACTIVE_CLIENTS_DEC_EP(sys_in.client);
+	return result;
+}
+
 /**
  * ipa3_setup_sys_pipe() - Setup an IPA GPI pipe and perform
  * IPA EP configuration
@@ -5095,7 +5141,7 @@ static int ipa_gsi_setup_channel(struct ipa_sys_connect_params *in,
 	 */
 	ring_size = 2 * in->desc_fifo_sz;
 	ep->gsi_evt_ring_hdl = ~0;
-	if (ep->sys->use_comm_evt_ring) {
+	if (ep->sys && ep->sys->use_comm_evt_ring) {
 		if (ipa3_ctx->gsi_evt_comm_ring_rem < ring_size) {
 			IPAERR("not enough space in common event ring\n");
 			IPAERR("available: %d needed: %d\n",
@@ -5123,7 +5169,7 @@ static int ipa_gsi_setup_channel(struct ipa_sys_connect_params *in,
 			goto fail_setup_event_ring;
 		}
 		return result;
-	} else if (ep->sys->policy != IPA_POLICY_NOINTR_MODE ||
+	} else if ((ep->sys && ep->sys->policy != IPA_POLICY_NOINTR_MODE) ||
 			IPA_CLIENT_IS_CONS(ep->client)) {
 		result = ipa_gsi_setup_event_ring(ep, ring_size, mem_flag);
 		if (result)
@@ -5199,7 +5245,7 @@ static int ipa_gsi_setup_event_ring(struct ipa3_ep_context *ep,
 	ep->gsi_mem_info.evt_ring_base_vaddr =
 		gsi_evt_ring_props.ring_base_vaddr;
 
-	if (ep->sys->napi_obj) {
+	if (ep->sys && ep->sys->napi_obj) {
 		gsi_evt_ring_props.int_modt = IPA_GSI_EVT_RING_INT_MODT;
 		gsi_evt_ring_props.int_modc = IPA_GSI_EVT_RING_INT_MODC;
 	} else {
@@ -5207,7 +5253,7 @@ static int ipa_gsi_setup_event_ring(struct ipa3_ep_context *ep,
 		gsi_evt_ring_props.int_modc = 1;
 	}
 
-	if (ep->sys->ext_ioctl_v2 &&
+	if ((ep->sys && ep->sys->ext_ioctl_v2) &&
 		((ep->client == IPA_CLIENT_APPS_WAN_PROD) ||
 		(ep->client == IPA_CLIENT_APPS_WAN_CONS) ||
 		(ep->client == IPA_CLIENT_APPS_WAN_COAL_CONS) ||
@@ -5297,7 +5343,8 @@ static int ipa_gsi_setup_transfer_ring(struct ipa3_ep_context *ep,
 			gsi_channel_props.tx_poll = false;
 	} else {
 		gsi_channel_props.dir = GSI_CHAN_DIR_FROM_GSI;
-		gsi_channel_props.max_re_expected = ep->sys->rx_pool_sz;
+		if (ep->sys)
+			gsi_channel_props.max_re_expected = ep->sys->rx_pool_sz;
 	}
 
 	gsi_ep_info = ipa3_get_gsi_ep_info(ep->client);

+ 6 - 1
drivers/platform/msm/ipa/ipa_v3/ipa_hw_stats.c

@@ -1846,7 +1846,12 @@ int ipa_drop_stats_init(void)
 			&reg_idx);
 		pipe_bitmask[reg_idx] |= mask;
 	}
-
+	if (ipa3_ctx->use_tput_est_ep) {
+		mask = ipa_hw_stats_get_ep_bit_n_idx(
+			IPA_CLIENT_TPUT_CONS,
+			&reg_idx);
+		pipe_bitmask[reg_idx] |= mask;
+	}
 	/* Always enable drop stats for USB DPL Pipe. */
 	mask = ipa_hw_stats_get_ep_bit_n_idx(
 		IPA_CLIENT_USB_DPL_CONS,

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

@@ -61,6 +61,7 @@
 #define IPA_SYS_DESC_FIFO_SZ 0x800
 #define IPA_SYS_TX_DATA_DESC_FIFO_SZ 0x1000
 #define IPA_SYS_TX_DATA_DESC_FIFO_SZ_8K 0x2000
+#define IPA_SYS_TPUT_EP_DESC_FIFO_SZ 0x10
 #define IPA_COMMON_EVENT_RING_SIZE 0x7C00
 #define IPA_LAN_RX_HEADER_LENGTH (2)
 #define IPA_QMAP_HEADER_LENGTH (4)
@@ -2306,6 +2307,7 @@ struct ipa3_context {
 	u32 gsi_rmnet_ctl_evt_ring_irq;
 	u32 gsi_rmnet_ll_evt_ring_intvec;
 	u32 gsi_rmnet_ll_evt_ring_irq;
+	bool use_tput_est_ep;
 };
 
 struct ipa3_plat_drv_res {
@@ -2390,6 +2392,7 @@ struct ipa3_plat_drv_res {
 	u32 gsi_rmnet_ctl_evt_ring_irq;
 	u32 gsi_rmnet_ll_evt_ring_intvec;
 	u32 gsi_rmnet_ll_evt_ring_irq;
+	bool use_tput_est_ep;
 };
 
 /**
@@ -2858,6 +2861,8 @@ void ipa3_free_skb(struct ipa_rx_data *data);
 /*
  * System pipes
  */
+int ipa3_setup_tput_pipe(void);
+
 int ipa3_setup_sys_pipe(struct ipa_sys_connect_params *sys_in, u32 *clnt_hdl);
 
 int ipa3_teardown_sys_pipe(u32 clnt_hdl);

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

@@ -2640,7 +2640,12 @@ static const struct ipa_ep_configuration ipa3_ep_mapping
 			IPA_DPS_HPS_SEQ_TYPE_INVALID,
 			QMB_MASTER_SELECT_DDR,
 			{ 31, 31, 8, 8, IPA_EE_AP }, IPA_TX_INSTANCE_NA },
-
+	[IPA_4_5][IPA_CLIENT_TPUT_CONS]          = {
+			true, IPA_v4_5_GROUP_UL_DL,
+			false,
+			IPA_DPS_HPS_SEQ_TYPE_INVALID,
+			QMB_MASTER_SELECT_DDR,
+			{ 25, 16, 9, 9, IPA_EE_AP, GSI_SMART_PRE_FETCH, 4 } },
 	/* IPA_4_5_MHI */
 	[IPA_4_5_MHI][IPA_CLIENT_APPS_CMD_PROD]		= {
 			true, IPA_v4_5_MHI_GROUP_DDR,
@@ -4331,6 +4336,13 @@ static const struct ipa_ep_configuration ipa3_ep_mapping
 			QMB_MASTER_SELECT_DDR,
 			{ 18, 4, 9, 9, IPA_EE_Q6, GSI_ESCAPE_BUF_ONLY, 0 },
 			IPA_TX_INSTANCE_UL },
+	[IPA_5_0][IPA_CLIENT_TPUT_CONS] = {
+			true, IPA_v5_0_GROUP_UL,
+			false,
+			IPA_DPS_HPS_SEQ_TYPE_INVALID,
+			QMB_MASTER_SELECT_DDR,
+			{ 33, 6, 9, 9, IPA_EE_AP, GSI_SMART_PRE_FETCH, 3},
+			IPA_TX_INSTANCE_DL },
 
 	/* IPA_5_0_MHI */
 	[IPA_5_0_MHI][IPA_CLIENT_USB_PROD] = {
@@ -5948,6 +5960,9 @@ const char *ipa_clients_strings[IPA_CLIENT_MAX] = {
 	__stringify(IPA_CLIENT_APPS_WAN_LOW_LAT_DATA_PROD),
 	__stringify(IPA_CLIENT_APPS_WAN_LOW_LAT_DATA_CONS),
 	__stringify(IPA_CLIENT_Q6_DL_NLO_LL_DATA_PROD),
+	__stringify(RESERVERD_CONS_123),
+	__stringify(RESERVERD_PROD_124),
+	__stringify(IPA_CLIENT_TPUT_CONS),
 };
 EXPORT_SYMBOL(ipa_clients_strings);