From: Abel Vesa <abel.vesa@linaro.org>
To: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>,
Amol Maheshwari <amahesh@qti.qualcomm.com>,
Andy Gross <agross@kernel.org>,
Bjorn Andersson <andersson@kernel.org>,
Konrad Dybcio <konrad.dybcio@somainline.org>,
Ekansh Gupta <quic_ekagupt@quicinc.com>
Cc: Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>,
Arnd Bergmann <arnd@arndb.de>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-arm-msm@vger.kernel.org,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
devicetree@vger.kernel.org
Subject: [PATCH v2 09/10] misc: fastrpc: Add mmap request assigning for static PD pool
Date: Fri, 2 Sep 2022 18:48:59 +0300 [thread overview]
Message-ID: <20220902154900.3404524-10-abel.vesa@linaro.org> (raw)
In-Reply-To: <20220902154900.3404524-1-abel.vesa@linaro.org>
If the mmap request is to add pages and thre are VMIDs associated with
that context, do a call to SCM to reassign that memory. Do not do this
for remote heap allocation, that is done on init create static process
only.
Co-developed-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Abel Vesa <abel.vesa@linaro.org>
---
drivers/misc/fastrpc.c | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/drivers/misc/fastrpc.c b/drivers/misc/fastrpc.c
index 41eabdf0a256..66dc71e20e4f 100644
--- a/drivers/misc/fastrpc.c
+++ b/drivers/misc/fastrpc.c
@@ -1849,8 +1849,9 @@ static int fastrpc_req_mmap(struct fastrpc_user *fl, char __user *argp)
if (copy_from_user(&req, argp, sizeof(req)))
return -EFAULT;
- if (req.flags != ADSP_MMAP_ADD_PAGES) {
+ if (req.flags != ADSP_MMAP_ADD_PAGES && req.flags != ADSP_MMAP_REMOTE_HEAP_ADDR) {
dev_err(dev, "flag not supported 0x%x\n", req.flags);
+
return -EINVAL;
}
@@ -1896,6 +1897,22 @@ static int fastrpc_req_mmap(struct fastrpc_user *fl, char __user *argp)
/* let the client know the address to use */
req.vaddrout = rsp_msg.vaddr;
+ /* Add memory to static PD pool, protection thru hypervisor */
+ if (req.flags != ADSP_MMAP_REMOTE_HEAP_ADDR && fl->cctx->vmcount) {
+ struct qcom_scm_vmperm perm;
+ int err = 0;
+
+ perm.vmid = QCOM_SCM_VMID_HLOS;
+ perm.perm = QCOM_SCM_PERM_RWX;
+ err = qcom_scm_assign_mem(buf->phys, buf->size,
+ &(fl->cctx->vmperms[0].vmid), &perm, 1);
+ if (err) {
+ dev_err(fl->sctx->dev, "Failed to assign memory phys 0x%llx size 0x%llx err %d",
+ buf->phys, buf->size, err);
+ goto err_assign;
+ }
+ }
+
spin_lock(&fl->lock);
list_add_tail(&buf->node, &fl->mmaps);
spin_unlock(&fl->lock);
--
2.34.1
next prev parent reply other threads:[~2022-09-02 15:57 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-02 15:48 [PATCH v2 00/10] misc: fastrpc: Add audiopd support Abel Vesa
2022-09-02 15:48 ` [PATCH v2 01/10] misc: fastrpc: Rename audio protection domain to root Abel Vesa
2022-09-02 15:48 ` [PATCH v2 02/10] misc: fastrpc: Add reserved mem support Abel Vesa
2022-09-02 15:48 ` [PATCH v2 03/10] dt-bindings: misc: fastrpc: Document memory-region property Abel Vesa
2022-09-04 19:29 ` Krzysztof Kozlowski
2022-09-05 7:53 ` Abel Vesa
2022-09-02 15:48 ` [PATCH v2 04/10] misc: fastrpc: Add fastrpc_remote_heap_alloc Abel Vesa
2022-09-02 15:48 ` [PATCH v2 05/10] misc: fastrpc: Use fastrpc_map_put in fastrpc_map_create on fail Abel Vesa
2022-09-06 14:10 ` Srinivas Kandagatla
2022-09-02 15:48 ` [PATCH v2 06/10] misc: fastrpc: Rework fastrpc_req_munmap Abel Vesa
2022-09-02 15:48 ` [PATCH v2 07/10] misc: fastrpc: Add support for audiopd Abel Vesa
2022-09-03 2:36 ` kernel test robot
2022-09-03 3:18 ` kernel test robot
2022-09-06 14:10 ` Srinivas Kandagatla
2022-09-02 15:48 ` [PATCH v2 08/10] misc: fastrpc: Safekeep mmaps on interrupted invoke Abel Vesa
2022-09-06 14:10 ` Srinivas Kandagatla
2022-09-02 15:48 ` Abel Vesa [this message]
2022-09-02 15:49 ` [PATCH v2 10/10] misc: fastrpc: Add dma_mask to fastrpc_channel_ctx Abel Vesa
2022-09-06 14:12 ` [PATCH v2 00/10] misc: fastrpc: Add audiopd support Srinivas Kandagatla
2022-09-07 10:01 ` Abel Vesa
2022-11-25 7:13 [PATCH v2 00/10] misc: fastrpc: patches for 6.2 Srinivas Kandagatla
2022-11-25 7:14 ` [PATCH v2 09/10] misc: fastrpc: Add mmap request assigning for static PD pool 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=20220902154900.3404524-10-abel.vesa@linaro.org \
--to=abel.vesa@linaro.org \
--cc=agross@kernel.org \
--cc=amahesh@qti.qualcomm.com \
--cc=andersson@kernel.org \
--cc=arnd@arndb.de \
--cc=devicetree@vger.kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=konrad.dybcio@somainline.org \
--cc=krzysztof.kozlowski@linaro.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=quic_ekagupt@quicinc.com \
--cc=robh@kernel.org \
--cc=srinivas.kandagatla@linaro.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;
as well as URLs for NNTP newsgroup(s).