From: Jeya R <jeyr@codeaurora.org>
To: linux-arm-msm@vger.kernel.org, srinivas.kandagatla@linaro.org
Cc: Jeya R <jeyr@codeaurora.org>,
gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org,
fastrpc.upstream@qti.qualcomm.com, bkumar@qti.qualcomm.com,
ekangupt@qti.qualcomm.com, jeyr@qti.qualcomm.com
Subject: [PATCH 1/2] misc: fastrpc: Add fdlist implementation
Date: Tue, 30 Nov 2021 18:27:49 +0530 [thread overview]
Message-ID: <1638277072-6459-3-git-send-email-jeyr@codeaurora.org> (raw)
In-Reply-To: <1638277072-6459-1-git-send-email-jeyr@codeaurora.org>
Add fdlist implementation to support dma handles. fdlist is populated
by DSP if any map is no longer used and it is freed during put_args.
Signed-off-by: Jeya R <jeyr@codeaurora.org>
---
drivers/misc/fastrpc.c | 22 ++++++++++++++++++++--
1 file changed, 20 insertions(+), 2 deletions(-)
diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c
index 39aca77..3c937ff 100644
--- a/drivers/misc/fastrpc.c
+++ b/drivers/misc/fastrpc.c
@@ -353,7 +353,7 @@ static void fastrpc_context_free(struct kref *ref)
ctx = container_of(ref, struct fastrpc_invoke_ctx, refcount);
cctx = ctx->cctx;
- for (i = 0; i < ctx->nscalars; i++)
+ for (i = 0; i < ctx->nbufs; i++)
fastrpc_map_put(ctx->maps[i]);
if (ctx->buf)
@@ -785,6 +785,7 @@ static int fastrpc_get_args(u32 kernel, struct fastrpc_invoke_ctx *ctx)
err = fastrpc_buf_alloc(ctx->fl, dev, pkt_size, &ctx->buf);
if (err)
return err;
+ memset(ctx->buf->virt, 0, pkt_size);
rpra = ctx->buf->virt;
list = ctx->buf->virt + ctx->nscalars * sizeof(*rpra);
@@ -887,9 +888,19 @@ static int fastrpc_put_args(struct fastrpc_invoke_ctx *ctx,
u32 kernel)
{
struct fastrpc_remote_arg *rpra = ctx->rpra;
- int i, inbufs;
+ struct fastrpc_map *mmap = NULL;
+ struct fastrpc_invoke_buf *list;
+ struct fastrpc_phy_page *pages;
+ u64 *fdlist;
+ int i, inbufs, outbufs, handles;
inbufs = REMOTE_SCALARS_INBUFS(ctx->sc);
+ outbufs = REMOTE_SCALARS_OUTBUFS(ctx->sc);
+ handles = REMOTE_SCALARS_INHANDLES(ctx->sc) + REMOTE_SCALARS_OUTHANDLES(ctx->sc);
+ list = ctx->buf->virt + ctx->nscalars * sizeof(*rpra);
+ pages = ctx->buf->virt + ctx->nscalars * (sizeof(*list) +
+ sizeof(*rpra));
+ fdlist = (uint64_t *)(pages + inbufs + outbufs + handles);
for (i = inbufs; i < ctx->nbufs; ++i) {
if (!ctx->maps[i]) {
@@ -906,6 +917,13 @@ static int fastrpc_put_args(struct fastrpc_invoke_ctx *ctx,
}
}
+ for (i = 0; i < FASTRPC_MAX_FDLIST; i++) {
+ if (!fdlist[i])
+ break;
+ if (!fastrpc_map_find(fl, (int)fdlist[i], &mmap))
+ fastrpc_map_put(mmap);
+ }
+
return 0;
}
--
2.7.4
next prev parent reply other threads:[~2021-11-30 12:58 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-30 12:57 [PATCH 0/3] Add vmid property and mapping attribute Jeya R
2021-11-30 12:57 ` [PATCH 1/3] dt-bindings: misc: add fastrpc domain vmid property Jeya R
2021-11-30 13:17 ` Srinivas Kandagatla
2021-11-30 12:57 ` Jeya R [this message]
2021-11-30 20:20 ` [PATCH 1/2] misc: fastrpc: Add fdlist implementation kernel test robot
2021-11-30 20:20 ` kernel test robot
2021-11-30 23:52 ` kernel test robot
2021-11-30 23:52 ` kernel test robot
2021-11-30 12:57 ` [PATCH 2/2] misc: fastrpc: Add dma handle implementation Jeya R
2021-11-30 22:44 ` kernel test robot
2021-11-30 22:44 ` kernel test robot
2021-12-01 0:22 ` kernel test robot
2021-12-01 0:22 ` kernel test robot
2021-11-30 12:57 ` [PATCH 2/3] misc: fastrpc: Read virtual machine IDs during probe Jeya R
2021-11-30 12:57 ` [PATCH 3/3] misc: fastrpc: Handle mapping of invoke argument with attribute Jeya R
2021-11-30 18:18 ` kernel test robot
2021-11-30 18:18 ` kernel test robot
[not found] <1638276897-6146-1-git-send-email-jeyr@codeaurora.org>
2021-11-30 12:54 ` [PATCH 1/2] misc: fastrpc: Add fdlist implementation Jeya R
2021-11-30 13:12 ` Srinivas Kandagatla
-- strict thread matches above, loose matches on Subject: below --
2021-11-29 5:28 [PATCH 0/2] Add DMA handle implementation Jeya R
2021-11-29 5:28 ` [PATCH 1/2] misc: fastrpc: Add fdlist implementation Jeya R
2021-11-29 7:40 ` kernel test robot
2021-11-29 7:40 ` kernel test robot
2021-11-29 8:00 ` kernel test robot
2021-11-29 8:00 ` kernel test robot
2021-11-29 15:12 ` Srinivas Kandagatla
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=1638277072-6459-3-git-send-email-jeyr@codeaurora.org \
--to=jeyr@codeaurora.org \
--cc=bkumar@qti.qualcomm.com \
--cc=ekangupt@qti.qualcomm.com \
--cc=fastrpc.upstream@qti.qualcomm.com \
--cc=gregkh@linuxfoundation.org \
--cc=jeyr@qti.qualcomm.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=srinivas.kandagatla@linaro.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.