msm: adsprpc: maintain local copy of rpra offloaded to DSP
Since DSP is not supposed to modify the base pointer rpra of the input/output arguments offloaded to DSP, maintain a local copy of the pointer and use it after receiving interrupt from DSP. Change-Id: I4afade7184cb2aca148060fb0cda06c6174f3b55 Acked-by: Maitreyi Gupta <maitreyi@qti.qualcomm.com> Signed-off-by: Tharun Kumar Merugu <mtharu@codeaurora.org> Signed-off-by: Mohammed Nayeem Ur Rahman <mohara@codeaurora.org>
This commit is contained in:
parent
f328b4d28d
commit
1f3eb68e71
1 changed files with 39 additions and 18 deletions
|
@ -179,10 +179,12 @@ struct smq_invoke_ctx {
|
|||
int tgid;
|
||||
remote_arg_t *lpra;
|
||||
remote_arg64_t *rpra;
|
||||
remote_arg64_t *lrpra; /* Local copy of rpra for put_args */
|
||||
int *fds;
|
||||
unsigned *attrs;
|
||||
struct fastrpc_mmap **maps;
|
||||
struct fastrpc_buf *buf;
|
||||
struct fastrpc_buf *lbuf;
|
||||
size_t used;
|
||||
struct fastrpc_file *fl;
|
||||
uint32_t sc;
|
||||
|
@ -1090,6 +1092,7 @@ static void context_free(struct smq_invoke_ctx *ctx)
|
|||
for (i = 0; i < nbufs; ++i)
|
||||
fastrpc_mmap_free(ctx->maps[i]);
|
||||
fastrpc_buf_free(ctx->buf, 1);
|
||||
fastrpc_buf_free(ctx->lbuf, 1);
|
||||
ctx->magic = 0;
|
||||
ctx->ctxid = 0;
|
||||
|
||||
|
@ -1202,7 +1205,7 @@ static void fastrpc_file_list_dtor(struct fastrpc_apps *me)
|
|||
|
||||
static int get_args(uint32_t kernel, struct smq_invoke_ctx *ctx)
|
||||
{
|
||||
remote_arg64_t *rpra;
|
||||
remote_arg64_t *rpra, *lrpra;
|
||||
remote_arg_t *lpra = ctx->lpra;
|
||||
struct smq_invoke_buf *list;
|
||||
struct smq_phy_page *pages, *ipage;
|
||||
|
@ -1211,10 +1214,11 @@ static int get_args(uint32_t kernel, struct smq_invoke_ctx *ctx)
|
|||
int outbufs = REMOTE_SCALARS_OUTBUFS(sc);
|
||||
int bufs = inbufs + outbufs;
|
||||
uintptr_t args;
|
||||
size_t rlen = 0, copylen = 0, metalen = 0;
|
||||
size_t rlen = 0, copylen = 0, metalen = 0, lrpralen = 0;
|
||||
int i, inh, oix;
|
||||
int err = 0;
|
||||
int mflags = 0;
|
||||
DEFINE_DMA_ATTRS(ctx_attrs);
|
||||
|
||||
/* calculate size of the metadata */
|
||||
rpra = NULL;
|
||||
|
@ -1233,7 +1237,22 @@ static int get_args(uint32_t kernel, struct smq_invoke_ctx *ctx)
|
|||
ipage += 1;
|
||||
}
|
||||
metalen = copylen = (size_t)&ipage[0];
|
||||
/* calculate len requreed for copying */
|
||||
|
||||
/* allocate new local rpra buffer */
|
||||
lrpralen = (size_t)&list[0];
|
||||
if (lrpralen) {
|
||||
err = fastrpc_buf_alloc(ctx->fl, lrpralen, ctx_attrs,
|
||||
0, 0, &ctx->lbuf);
|
||||
if (err)
|
||||
goto bail;
|
||||
}
|
||||
if (ctx->lbuf->virt)
|
||||
memset(ctx->lbuf->virt, 0, lrpralen);
|
||||
|
||||
lrpra = ctx->lbuf->virt;
|
||||
ctx->lrpra = lrpra;
|
||||
|
||||
/* calculate len required for copying */
|
||||
for (oix = 0; oix < inbufs + outbufs; ++oix) {
|
||||
int i = ctx->overps[oix]->raix;
|
||||
uintptr_t mstart, mend;
|
||||
|
@ -1259,8 +1278,6 @@ static int get_args(uint32_t kernel, struct smq_invoke_ctx *ctx)
|
|||
|
||||
/* allocate new buffer */
|
||||
if (copylen) {
|
||||
DEFINE_DMA_ATTRS(ctx_attrs);
|
||||
|
||||
err = fastrpc_buf_alloc(ctx->fl, copylen, ctx_attrs,
|
||||
0, 0, &ctx->buf);
|
||||
if (err)
|
||||
|
@ -1292,13 +1309,13 @@ static int get_args(uint32_t kernel, struct smq_invoke_ctx *ctx)
|
|||
}
|
||||
/* map ion buffers */
|
||||
PERF(ctx->fl->profile, ctx->fl->perf.map,
|
||||
for (i = 0; i < inbufs + outbufs; ++i) {
|
||||
for (i = 0; rpra && lrpra && i < inbufs + outbufs; ++i) {
|
||||
struct fastrpc_mmap *map = ctx->maps[i];
|
||||
uint64_t buf = ptr_to_uint64(lpra[i].buf.pv);
|
||||
size_t len = lpra[i].buf.len;
|
||||
|
||||
rpra[i].buf.pv = 0;
|
||||
rpra[i].buf.len = len;
|
||||
rpra[i].buf.pv = lrpra[i].buf.pv = 0;
|
||||
rpra[i].buf.len = lrpra[i].buf.len = len;
|
||||
if (!len)
|
||||
continue;
|
||||
if (map) {
|
||||
|
@ -1326,14 +1343,14 @@ static int get_args(uint32_t kernel, struct smq_invoke_ctx *ctx)
|
|||
pages[idx].addr = map->phys + offset;
|
||||
pages[idx].size = num << PAGE_SHIFT;
|
||||
}
|
||||
rpra[i].buf.pv = buf;
|
||||
rpra[i].buf.pv = lrpra[i].buf.pv = buf;
|
||||
}
|
||||
PERF_END);
|
||||
|
||||
/* copy non ion buffers */
|
||||
PERF(ctx->fl->profile, ctx->fl->perf.copy,
|
||||
rlen = copylen - metalen;
|
||||
for (oix = 0; rpra && oix < inbufs + outbufs; ++oix) {
|
||||
for (oix = 0; rpra && lrpra && oix < inbufs + outbufs; ++oix) {
|
||||
int i = ctx->overps[oix]->raix;
|
||||
struct fastrpc_mmap *map = ctx->maps[i];
|
||||
size_t mlen;
|
||||
|
@ -1352,7 +1369,8 @@ static int get_args(uint32_t kernel, struct smq_invoke_ctx *ctx)
|
|||
VERIFY(err, rlen >= mlen);
|
||||
if (err)
|
||||
goto bail;
|
||||
rpra[i].buf.pv = (args - ctx->overps[oix]->offset);
|
||||
rpra[i].buf.pv = lrpra[i].buf.pv =
|
||||
(args - ctx->overps[oix]->offset);
|
||||
pages[list[i].pgidx].addr = ctx->buf->phys -
|
||||
ctx->overps[oix]->offset +
|
||||
(copylen - rlen);
|
||||
|
@ -1384,7 +1402,8 @@ static int get_args(uint32_t kernel, struct smq_invoke_ctx *ctx)
|
|||
if (map && (map->attr & FASTRPC_ATTR_COHERENT))
|
||||
continue;
|
||||
|
||||
if (rpra && rpra[i].buf.len && ctx->overps[oix]->mstart) {
|
||||
if (rpra && lrpra && rpra[i].buf.len &&
|
||||
ctx->overps[oix]->mstart) {
|
||||
if (map && map->handle)
|
||||
msm_ion_do_cache_op(ctx->fl->apps->client,
|
||||
map->handle,
|
||||
|
@ -1400,10 +1419,12 @@ static int get_args(uint32_t kernel, struct smq_invoke_ctx *ctx)
|
|||
PERF_END);
|
||||
|
||||
inh = inbufs + outbufs;
|
||||
for (i = 0; rpra && i < REMOTE_SCALARS_INHANDLES(sc); i++) {
|
||||
rpra[inh + i].buf.pv = ptr_to_uint64(ctx->lpra[inh + i].buf.pv);
|
||||
rpra[inh + i].buf.len = ctx->lpra[inh + i].buf.len;
|
||||
rpra[inh + i].h = ctx->lpra[inh + i].h;
|
||||
for (i = 0; rpra && lrpra && i < REMOTE_SCALARS_INHANDLES(sc); i++) {
|
||||
rpra[inh + i].buf.pv = lrpra[inh + i].buf.pv =
|
||||
ptr_to_uint64(ctx->lpra[inh + i].buf.pv);
|
||||
rpra[inh + i].buf.len = lrpra[inh + i].buf.len =
|
||||
ctx->lpra[inh + i].buf.len;
|
||||
rpra[inh + i].h = lrpra[inh + i].h = ctx->lpra[inh + i].h;
|
||||
}
|
||||
|
||||
bail:
|
||||
|
@ -1414,7 +1435,7 @@ static int put_args(uint32_t kernel, struct smq_invoke_ctx *ctx,
|
|||
remote_arg_t *upra)
|
||||
{
|
||||
uint32_t sc = ctx->sc;
|
||||
remote_arg64_t *rpra = ctx->rpra;
|
||||
remote_arg64_t *rpra = ctx->lrpra;
|
||||
int i, inbufs, outbufs, outh, size;
|
||||
int err = 0;
|
||||
|
||||
|
@ -1503,7 +1524,7 @@ static void inv_args(struct smq_invoke_ctx *ctx)
|
|||
{
|
||||
int i, inbufs, outbufs;
|
||||
uint32_t sc = ctx->sc;
|
||||
remote_arg64_t *rpra = ctx->rpra;
|
||||
remote_arg64_t *rpra = ctx->lrpra;
|
||||
int inv = 0;
|
||||
|
||||
inbufs = REMOTE_SCALARS_INBUFS(sc);
|
||||
|
|
Loading…
Add table
Reference in a new issue