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

Commit 536db1e4 authored by Ravi Gummadidala's avatar Ravi Gummadidala Committed by Gerrit - the friendly Code Review server
Browse files

msm: ipa: add support for GFP_DMA allocations



IPA HW is only 32-bit capable. The use of SMMU S1 to workaround
this HW limitation has a significant performance impact. To
workaround the HW limitation without using SMMU S1, IPA driver
needs to control memory allocations such that they are 32-bit
addressable directly. This commit adds that support for the RX
buffer allocations that are not covered by the DMA mask setting of
the IPA device.

Change-Id: I05f92fa6f10da76b3c4b3c154263da4d5a33d551
Signed-off-by: default avatarRavi Gummadidala <rgummadi@codeaurora.org>
parent 37bc52a5
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -53,6 +53,10 @@ memory allocation over a PCIe bridge
                                configures embedded pipe filtering rules
- qcom,skip-uc-pipe-reset:      Boolean context flag to indicate whether
                                a pipe reset via the IPA uC is required
- qcom,use-dma-zone:            Boolean context flag to indicate whether memory
                                allocations controlled by IPA driver that do not
				specify a struct device * should use GFP_DMA to
				workaround IPA HW limitations

IPA pipe sub nodes (A2 static pipes configurations):

+8 −0
Original line number Diff line number Diff line
@@ -3103,6 +3103,7 @@ static int ipa_init(const struct ipa_plat_drv_res *resource_p,
	ipa_ctx->modem_cfg_emb_pipe_flt = resource_p->modem_cfg_emb_pipe_flt;
	ipa_ctx->wan_rx_ring_size = resource_p->wan_rx_ring_size;
	ipa_ctx->skip_uc_pipe_reset = resource_p->skip_uc_pipe_reset;
	ipa_ctx->use_dma_zone = resource_p->use_dma_zone;

	/* default aggregation parameters */
	ipa_ctx->aggregation_type = IPA_MBIM_16;
@@ -3674,6 +3675,13 @@ static int get_ipa_dts_configuration(struct platform_device *pdev,
		ipa_drv_res->skip_uc_pipe_reset
		? "True" : "False");

	ipa_drv_res->use_dma_zone =
		of_property_read_bool(pdev->dev.of_node,
		"qcom,use-dma-zone");
	IPADBG(": use dma zone = %s\n",
		ipa_drv_res->use_dma_zone
		? "True" : "False");

	/* Get IPA wrapper address */
	resource = platform_get_resource_byname(pdev, IORESOURCE_MEM,
			"ipa-base");
+6 −4
Original line number Diff line number Diff line
@@ -1050,7 +1050,7 @@ int ipa_setup_sys_pipe(struct ipa_sys_connect_params *sys_in, u32 *clnt_hdl)
	ep->connect.options = ep->sys->sps_option;
	ep->connect.desc.size = sys_in->desc_fifo_sz;
	ep->connect.desc.base = dma_alloc_coherent(ipa_ctx->pdev,
			ep->connect.desc.size, &dma_addr, 0);
			ep->connect.desc.size, &dma_addr, GFP_KERNEL);
	if (!ipa_ctx->smmu_present) {
		ep->connect.desc.phys_base = dma_addr;
	} else {
@@ -1400,7 +1400,7 @@ static void ipa_wq_repl_rx(struct work_struct *work)
	struct ipa_sys_context *sys;
	void *ptr;
	struct ipa_rx_pkt_wrapper *rx_pkt;
	gfp_t flag = GFP_KERNEL;
	gfp_t flag = GFP_KERNEL | (ipa_ctx->use_dma_zone ? GFP_DMA : 0);
	u32 next;
	u32 curr;

@@ -1565,7 +1565,8 @@ static void ipa_alloc_wlan_rx_common_cache(u32 size)
	void *ptr;
	struct ipa_rx_pkt_wrapper *rx_pkt;
	int rx_len_cached = 0;
	gfp_t flag = GFP_NOWAIT | __GFP_NOWARN;
	gfp_t flag = GFP_NOWAIT | __GFP_NOWARN |
		(ipa_ctx->use_dma_zone ? GFP_DMA : 0);

	rx_len_cached = ipa_ctx->wc_memb.wlan_comm_total_cnt;
	while (rx_len_cached < size) {
@@ -1635,7 +1636,8 @@ static void ipa_replenish_rx_cache(struct ipa_sys_context *sys)
	struct ipa_rx_pkt_wrapper *rx_pkt;
	int ret;
	int rx_len_cached = 0;
	gfp_t flag = GFP_NOWAIT | __GFP_NOWARN;
	gfp_t flag = GFP_NOWAIT | __GFP_NOWARN |
		(ipa_ctx->use_dma_zone ? GFP_DMA : 0);

	rx_len_cached = sys->len;

+2 −0
Original line number Diff line number Diff line
@@ -1223,6 +1223,7 @@ struct ipa_context {
	unsigned long peer_bam_dev;
	u32 peer_bam_map_cnt;
	u32 wdi_map_cnt;
	bool use_dma_zone;
};

/**
@@ -1272,6 +1273,7 @@ struct ipa_plat_drv_res {
	bool modem_cfg_emb_pipe_flt;
	u32 wan_rx_ring_size;
	bool skip_uc_pipe_reset;
	bool use_dma_zone;
};

struct ipa_mem_partition {