mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
To: Ekansh Gupta <quic_ekangupt@quicinc.com>, linux-arm-msm@vger.kernel.org
Cc: gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v7 2/5] misc: fastrpc: Add CRC support for remote buffers
Date: Fri, 24 Nov 2023 13:26:56 +0000	[thread overview]
Message-ID: <c79617c2-6023-4179-84db-3e37f3c1b050@linaro.org> (raw)
In-Reply-To: <20231121094844.5764-3-quic_ekangupt@quicinc.com>



On 21/11/2023 09:48, 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>
> ---
> Changes in v7:
>    - Rebase the patch to latest kernel version
> 
>   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 265e34f53c4e..55f126c779cb 100644
> --- a/drivers/misc/fastrpc.c
> +++ b/drivers/misc/fastrpc.c
> @@ -611,6 +611,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;
> @@ -1067,6 +1068,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);
> @@ -1074,7 +1076,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]) {
> @@ -1099,6 +1102,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;
>   }
>   
> @@ -1719,6 +1726,7 @@ static int fastrpc_multimode_invoke(struct fastrpc_user *fl, char __user *argp)
>   
>   	switch (invoke.req) {
>   	case FASTRPC_INVOKE:
> +	case FASTRPC_INVOKE_ENHANCED:

Isn't this change part of 1/5 patch?



>   		/* nscalars is truncated here to max supported value */
>   		if (copy_from_user(&einv, (void __user *)(uintptr_t)invoke.invparam,
>   				   invoke.size))

  reply	other threads:[~2023-11-24 13:27 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-21  9:48 [PATCH v7 0/5] Add multimode invoke request IOCTL support Ekansh Gupta
2023-11-21  9:48 ` [PATCH v7 1/5] misc: fastrpc: Add fastrpc multimode invoke request support Ekansh Gupta
2023-11-22 15:45   ` kernel test robot
2023-11-21  9:48 ` [PATCH v7 2/5] misc: fastrpc: Add CRC support for remote buffers Ekansh Gupta
2023-11-24 13:26   ` Srinivas Kandagatla [this message]
2023-11-21  9:48 ` [PATCH v7 3/5] misc: fastrpc: Capture kernel and DSP performance counters Ekansh Gupta
2023-11-24 13:26   ` Srinivas Kandagatla
2023-11-21  9:48 ` [PATCH v7 4/5] misc: fastrpc: Add support to save and restore interrupted Ekansh Gupta
2023-11-21  9:48 ` [PATCH v7 5/5] misc: fastrpc: Add support to allocate shared context bank Ekansh Gupta
2023-11-24 13:26   ` Srinivas Kandagatla
2023-11-25  7:09   ` Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c79617c2-6023-4179-84db-3e37f3c1b050@linaro.org \
    --to=srinivas.kandagatla@linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=quic_ekangupt@quicinc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®