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

Commit a6117089 authored by Tharun Kumar Merugu's avatar Tharun Kumar Merugu Committed by Mohammed Nayeem Ur Rahman
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>
Signed-off-by: default avatarMohammed Nayeem Ur Rahman <mohara@codeaurora.org>
parent 13738fad
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -221,7 +221,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;
@@ -1271,7 +1270,8 @@ static void context_free(struct smq_invoke_ctx *ctx)
		fastrpc_mmap_free(ctx->maps[i], 0);
	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;

@@ -1437,6 +1437,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;
@@ -1481,14 +1482,14 @@ 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;
	}
	if (ctx->lbuf->virt)
		memset(ctx->lbuf->virt, 0, lrpralen);
	if (lrpra)
		memset(lrpra, 0, lrpralen);

	lrpra = ctx->lbuf->virt;
	ctx->lrpra = lrpra;

	/* calculate len required for copying */