From: "Dwivedi, Avaneesh Kumar (avani)" <akdwived@codeaurora.org>
To: Bjorn Andersson <bjorn.andersson@linaro.org>
Cc: sboyd@codeaurora.org, agross@codeaurora.org,
linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-remoteproc@vger.kernel.org
Subject: Re: [PATCH v7 3/4] remoteproc: qcom: Make secure world call for mem ownership switch
Date: Mon, 16 Oct 2017 18:48:30 +0530 [thread overview]
Message-ID: <614163ca-3c51-3381-a3cc-62f19176b23e@codeaurora.org> (raw)
In-Reply-To: <20171012181805.GF1165@minitux>
On 10/12/2017 11:48 PM, Bjorn Andersson wrote:
> On Fri 21 Jul 03:49 PDT 2017, Avaneesh Kumar Dwivedi wrote:
>
>> MSS proc on msm8996 can not access fw loaded region without stage
>> second translation of memory pages where mpss image are loaded.
>> This patch in order to enable mss boot on msm8996 invoke scm call
>> to switch or share ownership between apps and modem.
>>
>> Signed-off-by: Avaneesh Kumar Dwivedi <akdwived@codeaurora.org>
>> ---
>> drivers/remoteproc/qcom_q6v5_pil.c | 90 ++++++++++++++++++++++++++++++++++++--
>> 1 file changed, 87 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/remoteproc/qcom_q6v5_pil.c b/drivers/remoteproc/qcom_q6v5_pil.c
> [..]
>> +static int q6v5_xfer_mem_ownership(struct q6v5 *qproc, int *current_perm,
>> + bool remote_owner, phys_addr_t addr,
>> + size_t size)
>> +{
>> + struct qcom_scm_vmperm next;
>> + int ret;
>> +
>> + if (!qproc->need_mem_protection)
>> + return 0;
>> + if (remote_owner && *current_perm == BIT(QCOM_SCM_VMID_MSS_MSA))
>> + return 0;
>> + if (!remote_owner && *current_perm == BIT(QCOM_SCM_VMID_HLOS))
>> + return 0;
>> +
>> + next.vmid = remote_owner ? QCOM_SCM_VMID_MSS_MSA : QCOM_SCM_VMID_HLOS;
>> + next.perm = remote_owner ? QCOM_SCM_PERM_RW : QCOM_SCM_PERM_RWX;
>> +
>> + ret = qcom_scm_assign_mem(addr, ALIGN(size, SZ_4K),
>> + *current_perm, &next, 1);
>> + if (ret < 0) {
>> + pr_err("Failed to assign memory access in range %p to %p to %s ret = %d\n",
>> + (void *)addr, (void *)(addr + size),
>> + remote_owner ? "mss" : "hlos", ret);
> qcom_scm_assign_mem() also prints an error when this happens, there's no
> need for that. I'm happy with you dropping the print from
> qcom_scm_assign_mem() and keeping this one.
>
>> + return ret;
>> + }
>> +
>> + *current_perm = ret;
>> + return 0;
>> +}
>> +
>> static int q6v5_load(struct rproc *rproc, const struct firmware *fw)
>> {
>> struct q6v5 *qproc = rproc->priv;
>> @@ -450,6 +484,8 @@ static int q6v5_mpss_init_image(struct q6v5 *qproc, const struct firmware *fw)
>> {
>> unsigned long dma_attrs = DMA_ATTR_FORCE_CONTIGUOUS;
>> dma_addr_t phys;
>> + int mdata_perm;
>> + int xferop_ret;
>> void *ptr;
>> int ret;
>>
>> @@ -461,6 +497,12 @@ static int q6v5_mpss_init_image(struct q6v5 *qproc, const struct firmware *fw)
>>
>> memcpy(ptr, fw->data, fw->size);
>>
>> + /* Hypervisor mapping to access metadata by modem */
>> + mdata_perm = BIT(QCOM_SCM_VMID_HLOS);
>> + ret = q6v5_xfer_mem_ownership(qproc, &mdata_perm,
>> + 1, phys, fw->size);
> Please use "true" instead of "1".
OK Sure, will do it.
>> + if (ret)
>> + return -EAGAIN;
> Please keep a empty line here, to keep the "paragraphs" or "chunks" of
> code split up.
OK.
>
>> writel(phys, qproc->rmb_base + RMB_PMI_META_DATA_REG);
>> writel(RMB_CMD_META_DATA_READY, qproc->rmb_base + RMB_MBA_COMMAND_REG);
>>
> Regards,
> Bjorn
> --
> To unsubscribe from this list: send the line "unsubscribe linux-remoteproc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project.
next prev parent reply other threads:[~2017-10-16 13:18 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-21 10:49 [PATCH v7 0/4] Add memory ownership switch support and enable mss rproc on msm8996 Avaneesh Kumar Dwivedi
2017-07-21 10:49 ` [PATCH v7 1/4] firmware: scm: Add new SCM call API for switching memory ownership Avaneesh Kumar Dwivedi
2017-10-12 18:11 ` Bjorn Andersson
2017-10-16 13:15 ` Dwivedi, Avaneesh Kumar (avani)
2017-07-21 10:49 ` [PATCH v7 2/4] remoteproc: qcom: refactor mss fw image loading sequence Avaneesh Kumar Dwivedi
2017-10-12 18:12 ` Bjorn Andersson
2017-07-21 10:49 ` [PATCH v7 3/4] remoteproc: qcom: Make secure world call for mem ownership switch Avaneesh Kumar Dwivedi
2017-10-12 18:18 ` Bjorn Andersson
2017-10-16 13:18 ` Dwivedi, Avaneesh Kumar (avani) [this message]
2017-07-21 10:49 ` [PATCH v7 4/4] remoteproc: qcom: Add support for mss remoteproc on msm8996 Avaneesh Kumar Dwivedi
2017-10-12 18:20 ` Bjorn Andersson
2017-10-16 13:19 ` Dwivedi, Avaneesh Kumar (avani)
2017-10-16 18:58 ` Bjorn Andersson
2017-10-19 5:32 ` Sricharan R
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=614163ca-3c51-3381-a3cc-62f19176b23e@codeaurora.org \
--to=akdwived@codeaurora.org \
--cc=agross@codeaurora.org \
--cc=bjorn.andersson@linaro.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-remoteproc@vger.kernel.org \
--cc=sboyd@codeaurora.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