diff options
author | Abhinav Asati <asatiabhi@codeaurora.org> | 2019-07-26 13:37:52 +0530 |
---|---|---|
committer | Julan Hsu <julanhsu@google.com> | 2019-08-21 15:30:20 +0000 |
commit | b152d0d0df7553461569572b485438a02ce54675 (patch) | |
tree | 6e68c5e70aeb9130862bddda0ca253aabee67c4b | |
parent | 4bdee373f35035ef9958cb07511af2a7fd341fea (diff) |
Revert "CHROMIUM: WAR: misc: fastrpc: allocate process release context before hand"
This reverts commit 32df5e2e9cb61b3b0a537e79e3cf29c056443eb3.
BUG=b:137202421
TEST=None
Signed-off-by: Abhinav Asati <asatiabhi@codeaurora.org>
Change-Id: Ie337ac0a19a901ee92787d76d5eb9280ea6858eb
Signed-off-by: Vamsi Singamsetty <vamssi@codeaurora.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/1724473
Reviewed-by: Julan Hsu <julanhsu@google.com>
Tested-by: Julan Hsu <julanhsu@google.com>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
-rw-r--r-- | drivers/misc/fastrpc.c | 64 |
1 files changed, 24 insertions, 40 deletions
diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c index 1fa5ae38da8d..83f7c62c4514 100644 --- a/drivers/misc/fastrpc.c +++ b/drivers/misc/fastrpc.c @@ -197,9 +197,6 @@ struct fastrpc_user { struct fastrpc_channel_ctx *cctx; struct fastrpc_session_ctx *sctx; struct fastrpc_buf *init_mem; - struct fastrpc_invoke_ctx *rctx; - struct fastrpc_invoke_args rctx_args; - int rctx_tgid; int tgid; int pd; @@ -907,8 +904,7 @@ static int fastrpc_invoke_send(struct fastrpc_session_ctx *sctx, static int fastrpc_internal_invoke(struct fastrpc_user *fl, u32 kernel, u32 handle, u32 sc, - struct fastrpc_invoke_args *args, - struct fastrpc_invoke_ctx *_ctx) + struct fastrpc_invoke_args *args) { struct fastrpc_invoke_ctx *ctx = NULL; int err = 0; @@ -919,18 +915,14 @@ static int fastrpc_internal_invoke(struct fastrpc_user *fl, u32 kernel, if (!fl->cctx->rpdev) return -EPIPE; - if (!_ctx) { - ctx = fastrpc_context_alloc(fl, kernel, sc, args); - if (IS_ERR(ctx)) - return PTR_ERR(ctx); + ctx = fastrpc_context_alloc(fl, kernel, sc, args); + if (IS_ERR(ctx)) + return PTR_ERR(ctx); - if (ctx->nscalars) { - err = fastrpc_get_args(kernel, ctx); - if (err) - goto bail; - } - } else { - ctx = _ctx; + if (ctx->nscalars) { + err = fastrpc_get_args(kernel, ctx); + if (err) + goto bail; } /* make sure that all CPU memory writes are seen by DSP */ @@ -972,24 +964,6 @@ bail: return err; } -static int fastrpc_alloc_dsp_process_release_ctx(struct fastrpc_user *fl) -{ - u32 sc; - - fl->rctx_tgid = fl->tgid; - fl->rctx_args.ptr = (u64)(uintptr_t)&fl->rctx_tgid; - fl->rctx_args.length = sizeof(int); - fl->rctx_args.fd = -1; - fl->rctx_args.reserved = 0; - sc = FASTRPC_SCALARS(FASTRPC_RMID_INIT_RELEASE, 1, 0); - - fl->rctx = fastrpc_context_alloc(fl, true, sc, &fl->rctx_args); - if (IS_ERR(fl->rctx)) - return -ENOMEM; - - return fastrpc_get_args(true, fl->rctx); -} - static int fastrpc_init_create_process(struct fastrpc_user *fl, char __user *argp) { @@ -1078,13 +1052,13 @@ static int fastrpc_init_create_process(struct fastrpc_user *fl, sc = FASTRPC_SCALARS(FASTRPC_RMID_INIT_CREATE_ATTR, 6, 0); err = fastrpc_internal_invoke(fl, true, FASTRPC_INIT_HANDLE, - sc, args, NULL); + sc, args); if (err) goto err_invoke; kfree(args); - return fastrpc_alloc_dsp_process_release_ctx(fl); + return 0; err_invoke: fl->init_mem = NULL; @@ -1134,8 +1108,19 @@ static void fastrpc_session_free(struct fastrpc_channel_ctx *cctx, static int fastrpc_release_current_dsp_process(struct fastrpc_user *fl) { + struct fastrpc_invoke_args args[1]; + int tgid = 0; + u32 sc; + + tgid = fl->tgid; + args[0].ptr = (u64)(uintptr_t) &tgid; + args[0].length = sizeof(tgid); + args[0].fd = -1; + args[0].reserved = 0; + sc = FASTRPC_SCALARS(FASTRPC_RMID_INIT_RELEASE, 1, 0); + return fastrpc_internal_invoke(fl, true, FASTRPC_INIT_HANDLE, - 0, NULL, fl->rctx); + sc, &args[0]); } static int fastrpc_device_release(struct inode *inode, struct file *file) @@ -1287,7 +1272,7 @@ static int fastrpc_init_attach(struct fastrpc_user *fl) fl->pd = 0; return fastrpc_internal_invoke(fl, true, FASTRPC_INIT_HANDLE, - sc, &args[0], NULL); + sc, &args[0]); } static int fastrpc_invoke(struct fastrpc_user *fl, char __user *argp) @@ -1314,8 +1299,7 @@ static int fastrpc_invoke(struct fastrpc_user *fl, char __user *argp) } } - err = fastrpc_internal_invoke(fl, false, inv.handle, - inv.sc, args, NULL); + err = fastrpc_internal_invoke(fl, false, inv.handle, inv.sc, args); kfree(args); return err; |