Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a84b2323 authored by Tharun Kumar Merugu's avatar Tharun Kumar Merugu
Browse files

msm: adsprpc: allocate local copy of remote args from heap



Currently, local copy of remote arguments is stored in a dma buffer
allocated using dma_alloc_attrs. However, since this buffer is not
shared with the remote subsystem, it can be allocated using
kzalloc.

Change-Id: If654dc25f940442960dc22bb4b53be73bdd8cd78
Acked-by: default avatarVishnu Karthik D <vikarthi@qti.qualcomm.com>
Signed-off-by: default avatarTharun Kumar Merugu <mtharu@codeaurora.org>
parent eca47d45
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -263,7 +263,6 @@ struct smq_invoke_ctx {
	unsigned int *attrs;
	struct fastrpc_mmap **maps;
	struct fastrpc_buf *buf;
	struct fastrpc_buf *lbuf;
	size_t used;
	struct fastrpc_file *fl;
	uint32_t handle;
@@ -1425,7 +1424,8 @@ static void context_free(struct smq_invoke_ctx *ctx)
	mutex_unlock(&ctx->fl->map_mutex);

	fastrpc_buf_free(ctx->buf, 1);
	fastrpc_buf_free(ctx->lbuf, 1);
	kfree(ctx->lrpra);
	ctx->lrpra = NULL;
	ctx->magic = 0;
	ctx->ctxid = 0;

@@ -1605,7 +1605,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;
@@ -1628,6 +1628,7 @@ static int get_args(uint32_t kernel, struct smq_invoke_ctx *ctx)

	/* calculate size of the metadata */
	rpra = NULL;
	lrpra = NULL;
	list = smq_invoke_buf_start(rpra, sc);
	pages = smq_phy_page_start(sc, list);
	ipage = pages;
@@ -1671,11 +1672,12 @@ static int get_args(uint32_t kernel, struct smq_invoke_ctx *ctx)
	/* allocate new local rpra buffer */
	lrpralen = (size_t)&list[0];
	if (lrpralen) {
		err = fastrpc_buf_alloc(ctx->fl, lrpralen, 0, 0, 0, &ctx->lbuf);
		lrpra = kzalloc(lrpralen, GFP_KERNEL);
		VERIFY(err, !IS_ERR_OR_NULL(lrpra));
		if (err)
			goto bail;
	}
	ctx->lrpra = ctx->lbuf->virt;
	ctx->lrpra = lrpra;

	/* calculate len required for copying */
	for (oix = 0; oix < inbufs + outbufs; ++oix) {