]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
misc: fastrpc: make sure memory read and writes are visible
authorSrinivas Kandagatla <srinivas.kandagatla@linaro.org>
Thu, 7 Mar 2019 10:12:24 +0000 (10:12 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 31 May 2019 13:43:46 +0000 (06:43 -0700)
[ Upstream commit 415a0729bd1225f0ffbc0ba82888dd65772554f7 ]

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: c68cfb718c8f ("misc: fastrpc: Add support for context Invoke method")
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/misc/fastrpc.c

index 9996c83ba5cb9bb2adf6d5a820a129b0f790db44..a10937652ca73de447a260bad76c3350a473ef56 100644 (file)
@@ -790,6 +790,9 @@ static int fastrpc_internal_invoke(struct fastrpc_user *fl,  u32 kernel,
                if (err)
                        goto bail;
        }
+
+       /* make sure that all CPU memory writes are seen by DSP */
+       dma_wmb();
        /* Send invoke buffer to remote dsp */
        err = fastrpc_invoke_send(fl->sctx, ctx, kernel, handle);
        if (err)
@@ -806,6 +809,8 @@ static int fastrpc_internal_invoke(struct fastrpc_user *fl,  u32 kernel,
                goto bail;
 
        if (ctx->nscalars) {
+               /* make sure that all memory writes by DSP are seen by CPU */
+               dma_rmb();
                /* populate all the output buffers with results */
                err = fastrpc_put_args(ctx, kernel);
                if (err)