Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3586230c authored by Gidon Studinski's avatar Gidon Studinski
Browse files

msm: ipa: pipe reallocation



Reallocated endpoint numbers according to a predefined list. This enables
Modem processor to use IPA HW in addition to Apps processor. As a part of
this change, the following changes were made:
- Add new clients for IPA 2.0
- Reallocate endpoint numbers to the new and existing pipes
- Removed usage of IPA mode parameter
- Changed the initialization of ep_mapping array so it is more
manageable

Change-Id: I427dd7af674e74fa541b033e22ce844c6d2b717c
Signed-off-by: default avatarGidon Studinski <gidons@codeaurora.org>
parent 6102a066
Loading
Loading
Loading
Loading
+9 −14
Original line number Diff line number Diff line
@@ -664,7 +664,7 @@ int ipa_setup_dflt_rt_tables(void)

	rt_rule_entry = &rt_rule->rules[0];
	rt_rule_entry->at_rear = 1;
	rt_rule_entry->rule.dst = IPA_CLIENT_A5_LAN_WAN_CONS;
	rt_rule_entry->rule.dst = IPA_CLIENT_APPS_LAN_CONS;
	rt_rule_entry->rule.hdr_hdl = ipa_ctx->excp_hdr_hdl;

	if (ipa_add_rt_rule(rt_rule)) {
@@ -742,10 +742,9 @@ static int ipa_setup_exception_path(void)
	ipa_ctx->excp_hdr_hdl = hdr_entry->hdr_hdl;

	/* set the route register to pass exception packets to Apps */
	route.route_def_pipe = ipa_get_ep_mapping(ipa_ctx->mode,
			IPA_CLIENT_A5_LAN_WAN_CONS);
	route.route_frag_def_pipe = ipa_get_ep_mapping(ipa_ctx->mode,
			IPA_CLIENT_A5_LAN_WAN_CONS);
	route.route_def_pipe = ipa_get_ep_mapping(IPA_CLIENT_APPS_LAN_CONS);
	route.route_frag_def_pipe = ipa_get_ep_mapping(
		IPA_CLIENT_APPS_LAN_CONS);
	route.route_def_hdr_table = !ipa_ctx->hdr_tbl_lcl;

	if (ipa_cfg_route(&route)) {
@@ -1030,10 +1029,10 @@ static int ipa_setup_apps_pipes(void)

	/* CMD OUT (A5->IPA) */
	memset(&sys_in, 0, sizeof(struct ipa_sys_connect_params));
	sys_in.client = IPA_CLIENT_A5_CMD_PROD;
	sys_in.client = IPA_CLIENT_APPS_CMD_PROD;
	sys_in.desc_fifo_sz = IPA_SYS_DESC_FIFO_SZ;
	sys_in.ipa_ep_cfg.mode.mode = IPA_DMA;
	sys_in.ipa_ep_cfg.mode.dst = IPA_CLIENT_A5_LAN_WAN_CONS;
	sys_in.ipa_ep_cfg.mode.dst = IPA_CLIENT_APPS_LAN_CONS;
	if (ipa_setup_sys_pipe(&sys_in, &ipa_ctx->clnt_hdl_cmd)) {
		IPAERR(":setup sys pipe failed.\n");
		result = -EPERM;
@@ -1064,9 +1063,9 @@ static int ipa_setup_apps_pipes(void)
	}
	IPADBG("default routing was set\n");

	/* LAN-WAN IN (IPA->A5) */
	/* LAN IN (IPA->A5) */
	memset(&sys_in, 0, sizeof(struct ipa_sys_connect_params));
	sys_in.client = IPA_CLIENT_A5_LAN_WAN_CONS;
	sys_in.client = IPA_CLIENT_APPS_LAN_CONS;
	sys_in.desc_fifo_sz = IPA_SYS_DESC_FIFO_SZ;
	if (ipa_ctx->ipa_hw_type == IPA_HW_v1_1) {
		sys_in.ipa_ep_cfg.hdr.hdr_a5_mux = 1;
@@ -1092,10 +1091,9 @@ static int ipa_setup_apps_pipes(void)

	/* LAN-WAN OUT (A5->IPA) */
	memset(&sys_in, 0, sizeof(struct ipa_sys_connect_params));
	sys_in.client = IPA_CLIENT_A5_LAN_WAN_PROD;
	sys_in.client = IPA_CLIENT_APPS_LAN_WAN_PROD;
	sys_in.desc_fifo_sz = IPA_SYS_TX_DATA_DESC_FIFO_SZ;
	sys_in.ipa_ep_cfg.mode.mode = IPA_BASIC;
	sys_in.ipa_ep_cfg.mode.dst = IPA_CLIENT_A5_LAN_WAN_CONS;
	if (ipa_setup_sys_pipe(&sys_in, &ipa_ctx->clnt_hdl_data_out)) {
		IPAERR(":setup sys pipe failed.\n");
		result = -EPERM;
@@ -1748,9 +1746,6 @@ static int ipa_init(const struct ipa_plat_drv_res *resource_p,
		goto fail_flt_rule_cache;
	}

	/* set up the default op mode */
	ipa_ctx->mode = IPA_MODE_MOBILE_AP_WAN;

	/* init the lookaside cache */
	ipa_ctx->flt_rule_cache = kmem_cache_create("IPA FLT",
			sizeof(struct ipa_flt_entry), 0, 0, NULL);
+1 −1
Original line number Diff line number Diff line
@@ -580,7 +580,7 @@ bool ipa_emb_ul_pipes_empty(void)
{
	struct sps_pipe *emb_ipa_ul =
		ipa_ctx->ep[ipa_get_ep_mapping(
			ipa_ctx->mode, IPA_CLIENT_A5_LAN_WAN_PROD)].ep_hdl;
			IPA_CLIENT_APPS_LAN_WAN_PROD)].ep_hdl;
	struct sps_pipe *emb_ipa_to_dma =
		bridge[IPA_BRIDGE_TYPE_EMBEDDED].pipe[IPA_UL_FROM_IPA].pipe;
	struct sps_pipe *emb_dma_to_a2 =
+3 −2
Original line number Diff line number Diff line
@@ -143,6 +143,8 @@ static void ipa_program_holb(struct ipa_ep_context *ep, int ipa_ep_idx)
	if (IPA_CLIENT_IS_PROD(ep->client))
		return;

	memset(&holb, 0, sizeof(holb));

	switch (ep->client) {
	case IPA_CLIENT_A2_TETHERED_CONS:
	case IPA_CLIENT_A2_EMBEDDED_CONS:
@@ -187,8 +189,7 @@ int ipa_connect(const struct ipa_connect_params *in, struct ipa_sps_params *sps,
		return -EINVAL;
	}


	ipa_ep_idx = ipa_get_ep_mapping(ipa_ctx->mode, in->client);
	ipa_ep_idx = ipa_get_ep_mapping(in->client);
	if (ipa_ep_idx == -1) {
		IPAERR("fail to alloc EP.\n");
		goto fail;
+23 −9
Original line number Diff line number Diff line
@@ -23,28 +23,43 @@

const char *ipa_client_name[] = {
	__stringify(IPA_CLIENT_HSIC1_PROD),
	__stringify(IPA_CLIENT_WLAN1_PROD),
	__stringify(IPA_CLIENT_HSIC2_PROD),
	__stringify(IPA_CLIENT_USB2_PROD),
	__stringify(IPA_CLIENT_HSIC3_PROD),
	__stringify(IPA_CLIENT_USB3_PROD),
	__stringify(IPA_CLIENT_HSIC4_PROD),
	__stringify(IPA_CLIENT_USB4_PROD),
	__stringify(IPA_CLIENT_HSIC5_PROD),
	__stringify(IPA_CLIENT_USB_PROD),
	__stringify(IPA_CLIENT_A5_WLAN_AMPDU_PROD),
	__stringify(IPA_CLIENT_A2_EMBEDDED_PROD),
	__stringify(IPA_CLIENT_A2_TETHERED_PROD),
	__stringify(IPA_CLIENT_A5_LAN_WAN_PROD),
	__stringify(IPA_CLIENT_A5_CMD_PROD),
	__stringify(IPA_CLIENT_APPS_LAN_WAN_PROD),
	__stringify(IPA_CLIENT_APPS_CMD_PROD),
	__stringify(IPA_CLIENT_Q6_LAN_PROD),
	__stringify(IPA_CLIENT_Q6_CMD_PROD),

	__stringify(IPA_CLIENT_HSIC1_CONS),
	__stringify(IPA_CLIENT_WLAN1_CONS),
	__stringify(IPA_CLIENT_HSIC2_CONS),
	__stringify(IPA_CLIENT_USB2_CONS),
	__stringify(IPA_CLIENT_WLAN2_CONS),
	__stringify(IPA_CLIENT_HSIC3_CONS),
	__stringify(IPA_CLIENT_USB3_CONS),
	__stringify(IPA_CLIENT_WLAN3_CONS),
	__stringify(IPA_CLIENT_HSIC4_CONS),
	__stringify(IPA_CLIENT_USB4_CONS),
	__stringify(IPA_CLIENT_WLAN4_CONS),
	__stringify(IPA_CLIENT_HSIC5_CONS),
	__stringify(IPA_CLIENT_USB_CONS),
	__stringify(IPA_CLIENT_A2_EMBEDDED_CONS),
	__stringify(IPA_CLIENT_A2_TETHERED_CONS),
	__stringify(IPA_CLIENT_A5_LAN_WAN_CONS),
	__stringify(IPA_CLIENT_APPS_LAN_CONS),
	__stringify(IPA_CLIENT_APPS_WAN_CONS),
	__stringify(IPA_CLIENT_Q6_LAN_CONS),
	__stringify(IPA_CLIENT_MAX),
	__stringify(IPA_CLIENT_Q6_WAN_CONS),
};

const char *ipa_ic_name[] = {
@@ -617,8 +632,7 @@ static ssize_t ipa_read_rt(struct file *file, char __user *ubuf, size_t count,
					entry->tbl->idx, entry->tbl->name,
					entry->tbl->ref_cnt, i, entry->rule.dst,
					ipa_client_name[entry->rule.dst],
					ipa_get_ep_mapping(ipa_ctx->mode,
						entry->rule.dst),
					ipa_get_ep_mapping(entry->rule.dst),
					!ipa_ctx->hdr_tbl_lcl,
					hdr_ofst >> 2,
					entry->rule.attrib.attrib_mask);
@@ -679,7 +693,7 @@ static ssize_t ipa_read_flt(struct file *file, char __user *ubuf, size_t count,
				rt_tbl_idx = ~0;
			else
				rt_tbl_idx = rt_tbl->idx;
			k = ipa_get_client_mapping(ipa_ctx->mode, j);
			k = ipa_get_client_mapping(j);
			nbytes = scnprintf(dbg_buff + cnt,
					IPA_MAX_MSG_LEN - cnt,
					"ep_idx:%d name:%s rule_idx:%d act:%d rt_tbl_idx:%d "
+10 −12
Original line number Diff line number Diff line
@@ -559,7 +559,7 @@ int ipa_send_cmd(u16 num_desc, struct ipa_desc *descr)

	IPADBG("sending command\n");

	ep_idx = ipa_get_ep_mapping(ipa_ctx->mode, IPA_CLIENT_A5_CMD_PROD);
	ep_idx = ipa_get_ep_mapping(IPA_CLIENT_APPS_CMD_PROD);
	sys = ipa_ctx->ep[ep_idx].sys;

	ipa_inc_client_enable_clks();
@@ -872,7 +872,7 @@ int ipa_setup_sys_pipe(struct ipa_sys_connect_params *sys_in, u32 *clnt_hdl)
		goto fail_gen;
	}

	ipa_ep_idx = ipa_get_ep_mapping(ipa_ctx->mode, sys_in->client);
	ipa_ep_idx = ipa_get_ep_mapping(sys_in->client);
	if (ipa_ep_idx == -1) {
		IPAERR("Invalid client.\n");
		goto fail_gen;
@@ -1120,11 +1120,10 @@ int ipa_tx_dp(enum ipa_client_type dst, struct sk_buff *skb,
	 *
	 */
	if (IPA_CLIENT_IS_CONS(dst)) {
		src_ep_idx = ipa_get_ep_mapping(ipa_ctx->mode,
				IPA_CLIENT_A5_LAN_WAN_PROD);
		dst_ep_idx = ipa_get_ep_mapping(ipa_ctx->mode, dst);
		src_ep_idx = ipa_get_ep_mapping(IPA_CLIENT_APPS_LAN_WAN_PROD);
		dst_ep_idx = ipa_get_ep_mapping(dst);
	} else {
		src_ep_idx = ipa_get_ep_mapping(ipa_ctx->mode, dst);
		src_ep_idx = ipa_get_ep_mapping(dst);
		if (meta && meta->pkt_init_dst_ep_valid)
			dst_ep_idx = meta->pkt_init_dst_ep;
		else
@@ -1641,7 +1640,7 @@ static void ipa_sps_irq_rx_no_aggr_notify(struct sps_event_notify *notify)
static int ipa_assign_policy(struct ipa_sys_connect_params *in,
		struct ipa_sys_context *sys)
{
	if (in->client == IPA_CLIENT_A5_CMD_PROD) {
	if (in->client == IPA_CLIENT_APPS_CMD_PROD) {
		sys->policy = IPA_POLICY_INTR_MODE;
		sys->sps_option = (SPS_O_AUTO_ENABLE | SPS_O_EOT);
		sys->sps_callback = ipa_sps_irq_tx_no_aggr_notify;
@@ -1649,7 +1648,7 @@ static int ipa_assign_policy(struct ipa_sys_connect_params *in,
	}

	if (ipa_ctx->ipa_hw_type == IPA_HW_v1_1) {
		if (in->client == IPA_CLIENT_A5_LAN_WAN_PROD) {
		if (in->client == IPA_CLIENT_APPS_LAN_WAN_PROD) {
			sys->policy = IPA_POLICY_INTR_POLL_MODE;
			sys->sps_option = (SPS_O_AUTO_ENABLE | SPS_O_EOT |
					SPS_O_ACK_TRANSFERS);
@@ -1658,7 +1657,7 @@ static int ipa_assign_policy(struct ipa_sys_connect_params *in,
			INIT_DELAYED_WORK(&sys->switch_to_intr_work,
				switch_to_intr_tx_work_func);
			atomic_set(&sys->curr_polling_state, 0);
		} else if (in->client == IPA_CLIENT_A5_LAN_WAN_CONS) {
		} else if (in->client == IPA_CLIENT_APPS_LAN_CONS) {
			sys->policy = IPA_POLICY_INTR_POLL_MODE;
			sys->sps_option = (SPS_O_AUTO_ENABLE | SPS_O_EOT |
					SPS_O_ACK_TRANSFERS | SPS_O_NO_DISABLE);
@@ -1690,13 +1689,12 @@ static int ipa_assign_policy(struct ipa_sys_connect_params *in,
			sys->sps_option = SPS_O_AUTO_ENABLE;
			sys->sps_callback = NULL;
			in->ipa_ep_cfg.status.status_ep =
				ipa_get_ep_mapping(ipa_ctx->mode,
						IPA_CLIENT_A5_LAN_WAN_CONS);
				ipa_get_ep_mapping(IPA_CLIENT_APPS_LAN_CONS);
		} else {
			sys->policy = IPA_POLICY_INTR_MODE;
			sys->sps_option = (SPS_O_AUTO_ENABLE | SPS_O_EOT);
			sys->sps_callback = ipa_sps_irq_rx_no_aggr_notify;
			if (in->client == IPA_CLIENT_A5_LAN_WAN_CONS) {
			if (in->client == IPA_CLIENT_APPS_LAN_CONS) {
				INIT_DELAYED_WORK(&sys->replenish_rx_work,
						replenish_rx_work_func);
				sys->rx_buff_sz = IPA_LAN_RX_BUFF_SZ;
Loading