From: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
To: Ekansh Gupta <quic_ekangupt@quicinc.com>, linux-arm-msm@vger.kernel.org
Cc: ekangupt@qti.qualcomm.com, gregkh@linuxfoundation.org,
linux-kernel@vger.kernel.org, bkumar@qti.qualcomm.com,
fastrpc.upstream@qti.qualcomm.com, stable <stable@kernel.org>
Subject: Re: [PATCH v1] misc: fastrpc: Pass proper scm arguments for static process init
Date: Mon, 12 Jun 2023 12:10:32 +0100 [thread overview]
Message-ID: <16d255fc-7186-11a9-58b5-2d3787f69d59@linaro.org> (raw)
In-Reply-To: <1685972918-30371-1-git-send-email-quic_ekangupt@quicinc.com>
Thanks Ekansh for the patch.
On 05/06/2023 14:48, Ekansh Gupta wrote:
> Memory is allocated for dynamic loading when audio daemon is trying
> to attach to audioPD on DSP side. This memory is allocated from
> reserved CMA memory region and needs ownership assignment to
> new VMID in order to use it from audioPD.
>
> In the current implementation, arguments are not correctly passed
> to the scm call which might result in failure of dynamic loading
> on audioPD. Added changes to pass correct arguments during daemon
> attach request.
>
> Fixes: 0871561055e6 ("misc: fastrpc: Add support for audiopd")
> Cc: stable <stable@kernel.org>
> Tested-by: Ekansh Gupta <quic_ekangupt@quicinc.com>
> Signed-off-by: Ekansh Gupta <quic_ekangupt@quicinc.com>
> ---
> drivers/misc/fastrpc.c | 31 +++++++++++++++++++++++++------
> 1 file changed, 25 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c
> index 30d4d04..b7335dd 100644
> --- a/drivers/misc/fastrpc.c
> +++ b/drivers/misc/fastrpc.c
> @@ -1278,10 +1278,23 @@ static int fastrpc_init_create_static_process(struct fastrpc_user *fl,
>
> /* Map if we have any heap VMIDs associated with this ADSP Static Process. */
> if (fl->cctx->vmcount) {
> + u64 src_perms = BIT(QCOM_SCM_VMID_HLOS);
This is redundant too, we already have cctx->perms initialized to
exactly same bit map.
> + struct qcom_scm_vmperm *dst_perms;
> + u32 i;
> +
> + dst_perms = kcalloc(fl->cctx->vmcount,
> + sizeof(struct qcom_scm_vmperm), GFP_KERNEL);
> + if (!dst_perms)
> + return -ENOMEM;
> + for (i = 0; i < fl->cctx->vmcount; i++) {
> + dst_perms[i].vmid = fl->cctx->vmperms[i].vmid;
> + dst_perms[i].perm = fl->cctx->vmperms[i].perm;
why do we need to copy this to another struct when we already have this
information in fl->cctx->vmperms ?
> + }
> +
> err = qcom_scm_assign_mem(fl->cctx->remote_heap->phys,
> (u64)fl->cctx->remote_heap->size,
> - &fl->cctx->perms,
> - fl->cctx->vmperms, fl->cctx->vmcount);
> + &src_perms, dst_perms, fl->cctx->vmcount);
> + kfree(dst_perms);
> if (err) {
> dev_err(fl->sctx->dev, "Failed to assign memory with phys 0x%llx size 0x%llx err %d",
> fl->cctx->remote_heap->phys, fl->cctx->remote_heap->size, err);
> @@ -1322,13 +1335,19 @@ static int fastrpc_init_create_static_process(struct fastrpc_user *fl,
> return 0;
> err_invoke:
> if (fl->cctx->vmcount) {
> - struct qcom_scm_vmperm perm;
> + u64 src_perms = 0;
> + struct qcom_scm_vmperm dst_perms;
> + u32 i;
>
> - perm.vmid = QCOM_SCM_VMID_HLOS;
> - perm.perm = QCOM_SCM_PERM_RWX;
> + for (i = 0; i < fl->cctx->vmcount; i++) {
> + src_perms |= BIT(fl->cctx->vmperms[i].vmid);
> + }
no need for brackets here.
> +
> + dst_perms.vmid = QCOM_SCM_VMID_HLOS;
> + dst_perms.perm = QCOM_SCM_PERM_RWX;
> err = qcom_scm_assign_mem(fl->cctx->remote_heap->phys,
> (u64)fl->cctx->remote_heap->size,
> - &fl->cctx->perms, &perm, 1);
> + &src_perms, &dst_perms, 1);
> if (err)
> dev_err(fl->sctx->dev, "Failed to assign memory phys 0x%llx size 0x%llx err %d",
> fl->cctx->remote_heap->phys, fl->cctx->remote_heap->size, err);
next prev parent reply other threads:[~2023-06-12 11:34 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-05 13:48 Ekansh Gupta
2023-06-12 11:10 ` Srinivas Kandagatla [this message]
2023-06-23 13:48 ` Ekansh Gupta
2023-08-02 15:00 ` 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=16d255fc-7186-11a9-58b5-2d3787f69d59@linaro.org \
--to=srinivas.kandagatla@linaro.org \
--cc=bkumar@qti.qualcomm.com \
--cc=ekangupt@qti.qualcomm.com \
--cc=fastrpc.upstream@qti.qualcomm.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=quic_ekangupt@quicinc.com \
--cc=stable@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®