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

Commit 11f7cc67 authored by Tharun Kumar Merugu's avatar Tharun Kumar Merugu Committed by Gerrit - the friendly Code Review server
Browse files

msm: adsprpc: workaround to enable smmu stage 1 for slpi



sm8150 has a hardware bug in the slpi-smmu interface where the stream
ID is not removed from the IOVA. This software workaround modifies
the start address of the IOVA address space for fastrpc slpi context banks.

Change-Id: I5368749b6f21ee33bf0c93b77403f2d34520718b
Acked-by: default avatarThyagarajan Venkatanarayanan <venkatan@qti.qualcomm.com>
Signed-off-by: default avatarTharun Kumar Merugu <mtharu@codeaurora.org>
parent 5eadaf73
Loading
Loading
Loading
Loading
+11 −5
Original line number Diff line number Diff line
@@ -430,7 +430,7 @@ static void fastrpc_buf_free(struct fastrpc_buf *buf, int cache)
		int destVM[1] = {VMID_HLOS};
		int destVMperm[1] = {PERM_READ | PERM_WRITE | PERM_EXEC};

		if (fl->sctx->smmu.cb)
		if (fl->sctx->smmu.cb && fl->cid != SDSP_DOMAIN_ID)
			buf->phys &= ~((uint64_t)fl->sctx->smmu.cb << 32);
		vmid = fl->apps->channel[fl->cid].vmid;
		if (vmid) {
@@ -754,6 +754,7 @@ static int fastrpc_mmap_create(struct fastrpc_file *fl, int fd,
		}
		map->phys = sg_dma_address(map->table->sgl);
		if (sess->smmu.cb) {
			if (fl->cid != SDSP_DOMAIN_ID)
				map->phys += ((uint64_t)sess->smmu.cb << 32);
			for_each_sg(map->table->sgl, sgl, map->table->nents,
				sgl_index)
@@ -831,7 +832,7 @@ static int fastrpc_buf_alloc(struct fastrpc_file *fl, size_t size,
	}
	if (err)
		goto bail;
	if (fl->sctx->smmu.cb)
	if (fl->sctx->smmu.cb && fl->cid != SDSP_DOMAIN_ID)
		buf->phys += ((uint64_t)fl->sctx->smmu.cb << 32);
	vmid = fl->apps->channel[fl->cid].vmid;
	if (vmid) {
@@ -2958,8 +2959,8 @@ static int fastrpc_cb_probe(struct device *dev)
	struct fastrpc_session_ctx *sess;
	struct of_phandle_args iommuspec;
	const char *name;
	unsigned int start = 0x80000000;
	int err = 0, i;
	dma_addr_t start = 0x80000000;
	int err = 0, cid, i;
	int secure_vmid = VMID_CP_PIXEL;

	VERIFY(err, NULL != (name = of_get_property(dev->of_node,
@@ -2975,6 +2976,7 @@ static int fastrpc_cb_probe(struct device *dev)
	VERIFY(err, i < NUM_CHANNELS);
	if (err)
		goto bail;
	cid = i;
	chan = &gcinfo[i];
	VERIFY(err, chan->sesscount < NUM_SESSIONS);
	if (err)
@@ -2991,6 +2993,10 @@ static int fastrpc_cb_probe(struct device *dev)
						"dma-coherent");
	sess->smmu.secure = of_property_read_bool(dev->of_node,
						"qcom,secure-context-bank");
	if (cid == SDSP_DOMAIN_ID) {
		start += ((uint64_t)sess->smmu.cb << 32);
		dma_set_mask(dev, DMA_BIT_MASK(36));
	}
	if (sess->smmu.secure)
		start = 0x60000000;
	VERIFY(err, !IS_ERR_OR_NULL(sess->smmu.mapping =