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

Commit 0dcd4a43 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: ipa3: pre-allocate IP_PKT_INIT" into msm-4.9

parents 94820feb cd3902d0
Loading
Loading
Loading
Loading
+53 −0
Original line number Diff line number Diff line
@@ -4246,6 +4246,52 @@ static int ipa3_tz_unlock_reg(struct ipa3_context *ipa3_ctx)
	return 0;
}

static int ipa3_alloc_pkt_init(void)
{
	struct ipa_mem_buffer mem;
	struct ipahal_imm_cmd_pyld *cmd_pyld;
	struct ipahal_imm_cmd_ip_packet_init cmd = {0};
	int i;

	cmd_pyld = ipahal_construct_imm_cmd(IPA_IMM_CMD_IP_PACKET_INIT,
		&cmd, false);
	if (!cmd_pyld) {
		IPAERR("failed to construct IMM cmd\n");
		return -ENOMEM;
	}

	mem.size = cmd_pyld->len * ipa3_ctx->ipa_num_pipes;
	mem.base = dma_alloc_coherent(ipa3_ctx->pdev, mem.size,
		&mem.phys_base, GFP_KERNEL);
	if (!mem.base) {
		IPAERR("failed to alloc DMA buff of size %d\n", mem.size);
		ipahal_destroy_imm_cmd(cmd_pyld);
		return -ENOMEM;
	}
	ipahal_destroy_imm_cmd(cmd_pyld);

	memset(mem.base, 0, mem.size);
	for (i = 0; i < ipa3_ctx->ipa_num_pipes; i++) {
		cmd.destination_pipe_index = i;
		cmd_pyld = ipahal_construct_imm_cmd(IPA_IMM_CMD_IP_PACKET_INIT,
			&cmd, false);
		if (!cmd_pyld) {
			IPAERR("failed to construct IMM cmd\n");
			dma_free_coherent(ipa3_ctx->pdev,
				mem.size,
				mem.base,
				mem.phys_base);
			return -ENOMEM;
		}
		memcpy(mem.base + i * cmd_pyld->len, cmd_pyld->data,
			cmd_pyld->len);
		ipa3_ctx->pkt_init_imm[i] = mem.phys_base + i * cmd_pyld->len;
		ipahal_destroy_imm_cmd(cmd_pyld);
	}

	return 0;
}

/**
* ipa3_pre_init() - Initialize the IPA Driver.
* This part contains all initialization which doesn't require IPA HW, such
@@ -4655,6 +4701,13 @@ static int ipa3_pre_init(const struct ipa3_plat_drv_res *resource_p,
		goto fail_create_apps_resource;
	}

	result = ipa3_alloc_pkt_init();
	if (result) {
		IPAERR("Failed to alloc pkt_init payload\n");
		result = -ENODEV;
		goto fail_create_apps_resource;
	}

	if (ipa3_ctx->ipa_hw_type >= IPA_HW_v3_5)
		ipa3_enable_dcd();

+4 −14
Original line number Diff line number Diff line
@@ -1152,7 +1152,7 @@ static void ipa3_tx_comp_usr_notify_release(void *user1, int user2)
		dev_kfree_skb_any(skb);
}

static void ipa3_tx_cmd_comp(void *user1, int user2)
void ipa3_tx_cmd_comp(void *user1, int user2)
{
	ipahal_destroy_imm_cmd(user1);
}
@@ -1187,7 +1187,6 @@ int ipa3_tx_dp(enum ipa_client_type dst, struct sk_buff *skb,
	struct ipa3_desc *desc;
	struct ipa3_desc _desc[3];
	int dst_ep_idx;
	struct ipahal_imm_cmd_ip_packet_init cmd;
	struct ipahal_imm_cmd_pyld *cmd_pyld = NULL;
	struct ipa3_sys_context *sys;
	int src_ep_idx;
@@ -1274,14 +1273,6 @@ int ipa3_tx_dp(enum ipa_client_type dst, struct sk_buff *skb,

	if (dst_ep_idx != -1) {
		/* SW data path */
		cmd.destination_pipe_index = dst_ep_idx;
		cmd_pyld = ipahal_construct_imm_cmd(
			IPA_IMM_CMD_IP_PACKET_INIT, &cmd, true);
		if (unlikely(!cmd_pyld)) {
			IPAERR("failed to construct ip_packet_init imm cmd\n");
			goto fail_mem;
		}

		data_idx = 0;
		if (sys->policy == IPA_POLICY_NOINTR_MODE) {
			/*
@@ -1299,11 +1290,10 @@ int ipa3_tx_dp(enum ipa_client_type dst, struct sk_buff *skb,
		}
		desc[data_idx].opcode =
			ipahal_imm_cmd_get_opcode(IPA_IMM_CMD_IP_PACKET_INIT);
		desc[data_idx].pyld = cmd_pyld->data;
		desc[data_idx].len = cmd_pyld->len;
		desc[data_idx].dma_address_valid = true;
		desc[data_idx].dma_address = ipa3_ctx->pkt_init_imm[dst_ep_idx];
		desc[data_idx].type = IPA_IMM_CMD_DESC;
		desc[data_idx].callback = ipa3_tx_cmd_comp;
		desc[data_idx].user1 = cmd_pyld;
		desc[data_idx].callback = NULL;
		data_idx++;
		desc[data_idx].pyld = skb->data;
		desc[data_idx].len = skb_headlen(skb);
+1 −0
Original line number Diff line number Diff line
@@ -1173,6 +1173,7 @@ struct ipa3_context {
	u32 curr_ipa_clk_rate;
	bool q6_proxy_clk_vote_valid;
	u32 ipa_num_pipes;
	dma_addr_t pkt_init_imm[IPA3_MAX_NUM_PIPES];

	struct ipa3_wlan_comm_memb wc_memb;