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

Commit 140e1c89 authored by Sathish Ambley's avatar Sathish Ambley
Browse files

msm: ADSPRPC: Use modem heap for MDSP buffer allocations



Use modem heap for all Modem DSP buffer allocations by updating the
device node appropriately.

Change-Id: I0b4c2a90797edff78214d367c474da0c9f65d127
Acked-by: default avatarHimateja Reddy <hmreddy@qti.qualcomm.com>
Signed-off-by: default avatarSathish Ambley <sathishambley@codeaurora.org>
parent a877e0f9
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
Qualcomm Technologies, Inc. FastRPC MDSP CMA Heap

The MSM MDSPRPC memory device allocates CMA memory, for sharing memory
of FastRPC buffers to remote processor(MDSP).

Required properties:
-compatible: Must be "qcom,msm-mdsprpc-mem-region"
-memory-region: A phandle that points to a memory heap where the
heap memory is allocated

Example:
	qcom,mdsprpc-mem {
		compatible = "qcom,msm-mdsprpc-mem-region";
		memory-region = <&mdsp_mem>;
	};
+19 −2
Original line number Diff line number Diff line
@@ -212,6 +212,7 @@ struct fastrpc_apps {
	spinlock_t hlock;
	struct ion_client *client;
	struct device *dev;
	struct device *modem_cma_dev;
	bool glink;
};

@@ -1717,17 +1718,26 @@ static int fastrpc_session_alloc(struct fastrpc_channel_ctx *chan, int *session)
	struct fastrpc_apps *me = &gfa;
	int idx = 0, err = 0;

	if (chan->sesscount) {
	switch (chan->channel) {
	case SMD_APPS_QDSP:
		idx = ffz(chan->bitmap);
		VERIFY(err, idx < chan->sesscount);
		if (err)
			goto bail;
		set_bit(idx, &chan->bitmap);
	} else {
		break;
	case SMD_APPS_DSPS:
		VERIFY(err, me->dev != NULL);
		if (err)
			goto bail;
		chan->session[0].dev = me->dev;
		break;
	case SMD_APPS_MODEM:
		VERIFY(err, me->dev != NULL);
		if (err)
			goto bail;
		chan->session[0].dev = me->modem_cma_dev;
		break;
	}

	chan->session[idx].smmu.faults = 0;
@@ -2142,6 +2152,7 @@ static struct of_device_id fastrpc_match_table[] = {
	{ .compatible = "qcom,msm-fastrpc-compute-cb", },
	{ .compatible = "qcom,msm-fastrpc-legacy-compute-cb", },
	{ .compatible = "qcom,msm-adsprpc-mem-region", },
	{ .compatible = "qcom,msm-mdsprpc-mem-region", },
	{}
};

@@ -2314,6 +2325,12 @@ static int fastrpc_probe(struct platform_device *pdev)
		return 0;
	}

	if (of_device_is_compatible(dev->of_node,
					"qcom,msm-mdsprpc-mem-region")) {
		me->modem_cma_dev = dev;
		return 0;
	}

	me->glink = of_property_read_bool(dev->of_node, "qcom,fastrpc-glink");
	pr_info("adsprpc: channel link type: %d\n", me->glink);