summaryrefslogtreecommitdiff
path: root/drivers/misc
diff options
context:
space:
mode:
authorJeya R <jeyr@codeaurora.org>2021-09-23 11:37:52 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-10-05 17:11:03 +0300
commit847afd7bd5607ca974e562d7b2b8f800c4594fe6 (patch)
tree35df8da61bffa6c72c5aa8b86b25932c5a9a928a /drivers/misc
parent304b0ba0a21b216683bc887d18dc5ad8d7d94752 (diff)
downloadlinux-847afd7bd5607ca974e562d7b2b8f800c4594fe6.tar.xz
misc: fastrpc: copy to user only for non-DMA-BUF heap buffers
fastrpc_put_args is copying all the output buffers to user. For large number of output context buffers, this might cause performance degradation. Copying is not needed for DMA-BUF heap buffers. Signed-off-by: Jeya R <jeyr@codeaurora.org> Link: https://lore.kernel.org/r/1632386272-18139-1-git-send-email-jeyr@codeaurora.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc')
-rw-r--r--drivers/misc/fastrpc.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c
index bd7811e3f761..e0d0c894c5fd 100644
--- a/drivers/misc/fastrpc.c
+++ b/drivers/misc/fastrpc.c
@@ -890,15 +890,17 @@ static int fastrpc_put_args(struct fastrpc_invoke_ctx *ctx,
inbufs = REMOTE_SCALARS_INBUFS(ctx->sc);
for (i = inbufs; i < ctx->nbufs; ++i) {
- void *src = (void *)(uintptr_t)rpra[i].pv;
- void *dst = (void *)(uintptr_t)ctx->args[i].ptr;
- u64 len = rpra[i].len;
+ if (!ctx->maps[i]) {
+ void *src = (void *)(uintptr_t)rpra[i].pv;
+ void *dst = (void *)(uintptr_t)ctx->args[i].ptr;
+ u64 len = rpra[i].len;
- if (!kernel) {
- if (copy_to_user((void __user *)dst, src, len))
- return -EFAULT;
- } else {
- memcpy(dst, src, len);
+ if (!kernel) {
+ if (copy_to_user((void __user *)dst, src, len))
+ return -EFAULT;
+ } else {
+ memcpy(dst, src, len);
+ }
}
}