Skip to content

Commit 415a072

Browse files
Srinivas-Kandagatlagregkh
authored andcommitted
misc: fastrpc: make sure memory read and writes are visible
dma_alloc_coherent buffers could have writes queued in store buffers so commit them before sending buffer to DSP using correct dma barriers. Same with vice-versa. Fixes: c68cfb7 ("misc: fastrpc: Add support for context Invoke method") Signed-off-by: Srinivas Kandagatla <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent b49f6d8 commit 415a072

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/misc/fastrpc.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -792,6 +792,9 @@ static int fastrpc_internal_invoke(struct fastrpc_user *fl, u32 kernel,
792792
if (err)
793793
goto bail;
794794
}
795+
796+
/* make sure that all CPU memory writes are seen by DSP */
797+
dma_wmb();
795798
/* Send invoke buffer to remote dsp */
796799
err = fastrpc_invoke_send(fl->sctx, ctx, kernel, handle);
797800
if (err)
@@ -808,6 +811,8 @@ static int fastrpc_internal_invoke(struct fastrpc_user *fl, u32 kernel,
808811
goto bail;
809812

810813
if (ctx->nscalars) {
814+
/* make sure that all memory writes by DSP are seen by CPU */
815+
dma_rmb();
811816
/* populate all the output buffers with results */
812817
err = fastrpc_put_args(ctx, kernel);
813818
if (err)

0 commit comments

Comments
 (0)