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

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

msm: adsprpc: Map uncached buffers as non-coherent



Map un-cached buffers as non io-coherent to avoid snooping overhead.

Change-Id: I612f9c4217cf7c9df93208a96b8c32fa8758276c
Acked-by: default avatarViswanatham Paduchuri <vpaduchu@qti.qualcomm.com>
Signed-off-by: default avatarTharun Kumar Merugu <mtharu@codeaurora.org>
parent 780c4f61
Loading
Loading
Loading
Loading
+26 −3
Original line number Diff line number Diff line
@@ -572,6 +572,13 @@ static int fastrpc_mmap_create(struct fastrpc_file *fl, int fd,
		goto bail;
	if (sess->smmu.enabled) {
		attrs = DMA_ATTR_EXEC_MAPPING;

		if (map->attr & FASTRPC_ATTR_NON_COHERENT ||
			(sess->smmu.coherent && map->uncached))
			attrs |= DMA_ATTR_FORCE_NON_COHERENT;
		else if (map->attr & FASTRPC_ATTR_COHERENT)
			attrs |= DMA_ATTR_FORCE_COHERENT;

		VERIFY(err, map->table->nents ==
			msm_dma_map_sg_attrs(sess->dev,
				map->table->sgl, map->table->nents,
@@ -1121,7 +1128,7 @@ static int get_args(uint32_t kernel, struct smq_invoke_ctx *ctx)
	for (i = 0; i < M_FDLIST; i++)
		fdlist[i] = 0;
	crclist = (uint32_t *)&fdlist[M_FDLIST];
	memset(crclist, 0, sizeof(uint32_t)*M_FDLIST);
	memset(crclist, 0, sizeof(uint32_t)*M_CRCLIST);

	/* copy non ion buffers */
	PERF(ctx->fl->profile, ctx->fl->perf.copy,
@@ -1169,10 +1176,14 @@ static int get_args(uint32_t kernel, struct smq_invoke_ctx *ctx)
		int i = ctx->overps[oix]->raix;
		struct fastrpc_mmap *map = ctx->maps[i];

		if (ctx->fl->sctx->smmu.coherent)
			continue;
		if (map && map->uncached)
			continue;
		if (ctx->fl->sctx->smmu.coherent &&
			!(map && (map->attr & FASTRPC_ATTR_NON_COHERENT)))
			continue;
		if (map && (map->attr & FASTRPC_ATTR_COHERENT))
			continue;

		if (rpra[i].buf.len && ctx->overps[oix]->mstart)
			dmac_flush_range(uint64_to_ptr(rpra[i].buf.pv),
			uint64_to_ptr(rpra[i].buf.pv + rpra[i].buf.len));
@@ -1261,6 +1272,12 @@ static void inv_args_pre(struct smq_invoke_ctx *ctx)
			continue;
		if (!rpra[i].buf.len)
			continue;
		if (ctx->fl->sctx->smmu.coherent &&
			!(map && (map->attr & FASTRPC_ATTR_NON_COHERENT)))
			continue;
		if (map && (map->attr & FASTRPC_ATTR_COHERENT))
			continue;

		if (buf_page_start(ptr_to_uint64((void *)rpra)) ==
				buf_page_start(rpra[i].buf.pv))
			continue;
@@ -1291,6 +1308,12 @@ static void inv_args(struct smq_invoke_ctx *ctx)
			continue;
		if (!rpra[i].buf.len)
			continue;
		if (ctx->fl->sctx->smmu.coherent &&
			!(map && (map->attr & FASTRPC_ATTR_NON_COHERENT)))
			continue;
		if (map && (map->attr & FASTRPC_ATTR_COHERENT))
			continue;

		if (buf_page_start(ptr_to_uint64((void *)rpra)) ==
				buf_page_start(rpra[i].buf.pv)) {
			continue;
+6 −0
Original line number Diff line number Diff line
@@ -36,6 +36,12 @@
/* Set for buffers that have no virtual mapping in userspace */
#define FASTRPC_ATTR_NOVA 0x1

/* Set for buffers that are NOT dma coherent */
#define FASTRPC_ATTR_NON_COHERENT 0x2

/* Set for buffers that are dma coherent */
#define FASTRPC_ATTR_COHERENT 0x4

/* Driver should operate in parallel with the co-processor */
#define FASTRPC_MODE_PARALLEL    0