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

Commit 4f2dcc86 authored by Tharun Kumar Merugu's avatar Tharun Kumar Merugu Committed by Sundara Vinayagam
Browse files

msm: ADSPRPC: change fastrpc driver to support legacy chipsets



Set legacy flag if device node has qcom,msm-fastrpc-legacy-compute
attribute. Assign CMA base address and CMA size before doing CMA
memory protection.

Change-Id: Id457f5b0808d3c60ac8a2c7ef90866d82d46e935
Acked-by: default avatarChenna Kesava Raju <chennak@qti.qualcomm.com>
Signed-off-by: default avatarTharun Kumar Merugu <mtharu@codeaurora.org>
parent ad8801e6
Loading
Loading
Loading
Loading
+8 −11
Original line number Original line Diff line number Diff line
@@ -3505,7 +3505,6 @@ static int fastrpc_cb_probe(struct device *dev)


static int fastrpc_cb_legacy_probe(struct device *dev)
static int fastrpc_cb_legacy_probe(struct device *dev)
{
{
	struct fastrpc_apps *me = &gfa;
	struct fastrpc_channel_ctx *chan;
	struct fastrpc_channel_ctx *chan;
	struct fastrpc_session_ctx *first_sess = NULL, *sess = NULL;
	struct fastrpc_session_ctx *first_sess = NULL, *sess = NULL;
	const char *name;
	const char *name;
@@ -3574,7 +3573,6 @@ static int fastrpc_cb_legacy_probe(struct device *dev)
		sess->smmu.secure = false;
		sess->smmu.secure = false;
		chan->sesscount++;
		chan->sesscount++;
	}
	}
	me->legacy = 1;
bail:
bail:
	kfree(sids);
	kfree(sids);
	return err;
	return err;
@@ -3627,7 +3625,6 @@ static int fastrpc_probe(struct platform_device *pdev)
	int err = 0;
	int err = 0;
	struct fastrpc_apps *me = &gfa;
	struct fastrpc_apps *me = &gfa;
	struct device *dev = &pdev->dev;
	struct device *dev = &pdev->dev;
	struct smq_phy_page range;
	struct device_node *ion_node, *node;
	struct device_node *ion_node, *node;
	struct platform_device *ion_pdev;
	struct platform_device *ion_pdev;
	struct cma *cma;
	struct cma *cma;
@@ -3651,6 +3648,7 @@ static int fastrpc_probe(struct platform_device *pdev)
	if (of_device_is_compatible(dev->of_node,
	if (of_device_is_compatible(dev->of_node,
					"qcom,msm-fastrpc-legacy-compute")) {
					"qcom,msm-fastrpc-legacy-compute")) {
		me->glink = false;
		me->glink = false;
		me->legacy = 1;
	}
	}


	if (of_device_is_compatible(dev->of_node,
	if (of_device_is_compatible(dev->of_node,
@@ -3661,7 +3659,6 @@ static int fastrpc_probe(struct platform_device *pdev)
	if (of_device_is_compatible(dev->of_node,
	if (of_device_is_compatible(dev->of_node,
					"qcom,msm-adsprpc-mem-region")) {
					"qcom,msm-adsprpc-mem-region")) {
		me->dev = dev;
		me->dev = dev;
		range.addr = 0;
		ion_node = of_find_compatible_node(NULL, NULL, "qcom,msm-ion");
		ion_node = of_find_compatible_node(NULL, NULL, "qcom,msm-ion");
		if (ion_node) {
		if (ion_node) {
			for_each_available_child_of_node(ion_node, node) {
			for_each_available_child_of_node(ion_node, node) {
@@ -3674,13 +3671,14 @@ static int fastrpc_probe(struct platform_device *pdev)
					break;
					break;
				cma = dev_get_cma_area(&ion_pdev->dev);
				cma = dev_get_cma_area(&ion_pdev->dev);
				if (cma) {
				if (cma) {
					range.addr = cma_get_base(cma);
					me->range.addr = cma_get_base(cma);
					range.size = (size_t)cma_get_size(cma);
					me->range.size =
						(size_t)cma_get_size(cma);
				}
				}
				break;
				break;
			}
			}
		}
		}
		if (range.addr && !of_property_read_bool(dev->of_node,
		if (me->range.addr && !of_property_read_bool(dev->of_node,
							 "restrict-access")) {
							 "restrict-access")) {
			int srcVM[1] = {VMID_HLOS};
			int srcVM[1] = {VMID_HLOS};
			int destVM[4] = {VMID_HLOS, VMID_MSS_MSA, VMID_SSC_Q6,
			int destVM[4] = {VMID_HLOS, VMID_MSS_MSA, VMID_SSC_Q6,
@@ -3691,12 +3689,11 @@ static int fastrpc_probe(struct platform_device *pdev)
				PERM_READ | PERM_WRITE | PERM_EXEC,
				PERM_READ | PERM_WRITE | PERM_EXEC,
				};
				};


			VERIFY(err, !hyp_assign_phys(range.addr, range.size,
			VERIFY(err, !hyp_assign_phys(me->range.addr,
					srcVM, 1, destVM, destVMperm, 4));
					me->range.size, srcVM, 1,
					destVM, destVMperm, 4));
			if (err)
			if (err)
				goto bail;
				goto bail;
			me->range.addr = range.addr;
			me->range.size = range.size;
		}
		}
		return 0;
		return 0;
	}
	}