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

Commit 9eba884d authored by Tharun Kumar Merugu's avatar Tharun Kumar Merugu
Browse files

msm: adsprpc: Invalidate remote output buffers



Before sending the remote non-coherent buffer to QDSP,
invalidate the buffer to make sure that no dirty
data in the cache line is flushed when QDSP is updating the
buffer. Furthermore, even if the context bank is configured
as coherent, invalidate the remote buffers that are marked
as non-coherent.

Change-Id: I1dedde09b727d4263cd34d7f577d8f6997cb4f00
Acked-by: default avatarVishnu Karthik D <vikarthi@qti.qualcomm.com>
Signed-off-by: default avatarTharun Kumar Merugu <mtharu@codeaurora.org>
parent 0fe1d128
Loading
Loading
Loading
Loading
+16 −13
Original line number Diff line number Diff line
@@ -1755,29 +1755,31 @@ static void inv_args_pre(struct smq_invoke_ctx *ctx)
				uint64_to_ptr(rpra[i].buf.pv))) {
			if (map && map->buf) {
				dma_buf_begin_cpu_access(map->buf,
					DMA_TO_DEVICE);
					DMA_BIDIRECTIONAL);
				dma_buf_end_cpu_access(map->buf,
					DMA_TO_DEVICE);
			} else
					DMA_BIDIRECTIONAL);
			} else {
				dmac_flush_range(
					uint64_to_ptr(rpra[i].buf.pv), (char *)
					uint64_to_ptr(rpra[i].buf.pv + 1));
			}
		}

		end = (uintptr_t)uint64_to_ptr(rpra[i].buf.pv +
							rpra[i].buf.len);
		if (!IS_CACHE_ALIGNED(end)) {
			if (map && map->buf) {
				dma_buf_begin_cpu_access(map->buf,
					DMA_TO_DEVICE);
					DMA_BIDIRECTIONAL);
				dma_buf_end_cpu_access(map->buf,
					DMA_TO_DEVICE);
			} else
					DMA_BIDIRECTIONAL);
			} else {
				dmac_flush_range((char *)end,
					(char *)end + 1);
			}
		}
	}
}

static void inv_args(struct smq_invoke_ctx *ctx)
{
@@ -1942,11 +1944,13 @@ static int fastrpc_internal_invoke(struct fastrpc_file *fl, uint32_t mode,
			goto bail;
	}

	if (!fl->sctx->smmu.coherent) {
	PERF(fl->profile, GET_COUNTER(perf_counter, PERF_INVARGS),
	inv_args_pre(ctx);
	PERF_END);
	}

	PERF(fl->profile, GET_COUNTER(perf_counter, PERF_INVARGS),
	inv_args(ctx);
	PERF_END);

	PERF(fl->profile, GET_COUNTER(perf_counter, PERF_LINK),
	VERIFY(err, 0 == fastrpc_invoke_send(ctx, kernel, invoke->handle));
@@ -1965,7 +1969,6 @@ static int fastrpc_internal_invoke(struct fastrpc_file *fl, uint32_t mode,
	}

	PERF(fl->profile, GET_COUNTER(perf_counter, PERF_INVARGS),
	if (!fl->sctx->smmu.coherent)
	inv_args(ctx);
	PERF_END);