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

Commit aabd8761 authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "msm: adsprpc: Invalidate remote output buffers"

parents ab499355 9eba884d
Loading
Loading
Loading
Loading
+16 −13
Original line number Diff line number Diff line
@@ -1771,29 +1771,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)
{
@@ -1962,11 +1964,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));
@@ -1985,7 +1989,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);