lkml.org 
[lkml]   [2023]   [Oct]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH v2 1/5] misc: fastrpc: Add CRC support for remote buffers
From
Hi Ekansh,
Thankyou for the patch,

Looks like this series depends on Multi Mode series, can you include
them together.

--srini

On 20/09/2023 11:31, Ekansh Gupta wrote:
> CRC check for input and output argument helps in ensuring data
> consistency over a remote call. If user intends to enable CRC check,
> first local user CRC is calculated at user end and a CRC buffer is
> passed to DSP to capture remote CRC values. DSP is expected to
> write to the remote CRC buffer which is then compared at user level
> with the local CRC values.
>
> Signed-off-by: Ekansh Gupta <quic_ekangupt@quicinc.com>
> ---
> drivers/misc/fastrpc.c | 10 +++++++++-
> 1 file changed, 9 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c
> index 04eaf6c..337ec1f 100644
> --- a/drivers/misc/fastrpc.c
> +++ b/drivers/misc/fastrpc.c
> @@ -610,6 +610,7 @@ static struct fastrpc_invoke_ctx *fastrpc_context_alloc(
> /* Released in fastrpc_context_put() */
> fastrpc_channel_ctx_get(cctx);
>
> + ctx->crc = (u32 *)(uintptr_t)invoke->crc;
> ctx->sc = sc;
> ctx->retval = -1;
> ctx->pid = current->pid;
> @@ -1063,6 +1064,7 @@ static int fastrpc_put_args(struct fastrpc_invoke_ctx *ctx,
> struct fastrpc_invoke_buf *list;
> struct fastrpc_phy_page *pages;
> u64 *fdlist;
> + u32 *crclist;
> int i, inbufs, outbufs, handles;
>
> inbufs = REMOTE_SCALARS_INBUFS(ctx->sc);
> @@ -1070,7 +1072,8 @@ static int fastrpc_put_args(struct fastrpc_invoke_ctx *ctx,
> handles = REMOTE_SCALARS_INHANDLES(ctx->sc) + REMOTE_SCALARS_OUTHANDLES(ctx->sc);
> list = fastrpc_invoke_buf_start(rpra, ctx->nscalars);
> pages = fastrpc_phy_page_start(list, ctx->nscalars);
> - fdlist = (uint64_t *)(pages + inbufs + outbufs + handles);
> + fdlist = (u64 *)(pages + inbufs + outbufs + handles);
> + crclist = (u32 *)(fdlist + FASTRPC_MAX_FDLIST);
>
> for (i = inbufs; i < ctx->nbufs; ++i) {
> if (!ctx->maps[i]) {
> @@ -1094,6 +1097,10 @@ static int fastrpc_put_args(struct fastrpc_invoke_ctx *ctx,
> fastrpc_map_put(mmap);
> }
>
> + if (ctx->crc && crclist && rpra) {
> + if (copy_to_user((void __user *)ctx->crc, crclist, FASTRPC_MAX_CRCLIST * sizeof(u32)))
> + return -EFAULT;
> + }
> return 0;
> }
>
> @@ -1706,6 +1713,7 @@ static int fastrpc_multimode_invoke(struct fastrpc_user *fl, char __user *argp)
>
> switch (invoke.req) {
> case FASTRPC_INVOKE:
> + case FASTRPC_INVOKE_ENHANCED:
> /* nscalars is truncated here to max supported value */
> if (copy_from_user(&einv, (void __user *)(uintptr_t)invoke.invparam,
> invoke.size))

\
 
 \ /
  Last update: 2023-10-02 11:44    [W:0.055 / U:0.196 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site