Skip to content

Commit a283d7f

Browse files
quic-ekanguptgregkh
authored andcommitted
misc: fastrpc: Pass proper arguments to scm call
For CMA memory allocation, ownership is assigned to DSP to make it accessible by the PD running on the DSP. With current implementation HLOS VM is stored in the channel structure during rpmsg_probe and this VM is passed to qcom_scm call as the source VM. The qcom_scm call will overwrite the passed source VM with the next VM which would cause a problem in case the scm call is again needed. Adding a local copy of source VM whereever scm call is made to avoid this problem. Fixes: 0871561 ("misc: fastrpc: Add support for audiopd") Cc: stable <stable@kernel.org> Signed-off-by: Ekansh Gupta <quic_ekangupt@quicinc.com> Reviewed-by: Elliot Berman <quic_eberman@quicinc.com> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Link: https://lore.kernel.org/r/20240224114247.85953-2-srinivas.kandagatla@linaro.org Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent f53641a commit a283d7f

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

drivers/misc/fastrpc.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,6 @@ struct fastrpc_channel_ctx {
263263
int domain_id;
264264
int sesscount;
265265
int vmcount;
266-
u64 perms;
267266
struct qcom_scm_vmperm vmperms[FASTRPC_MAX_VMIDS];
268267
struct rpmsg_device *rpdev;
269268
struct fastrpc_session_ctx session[FASTRPC_MAX_SESSIONS];
@@ -1279,9 +1278,11 @@ static int fastrpc_init_create_static_process(struct fastrpc_user *fl,
12791278

12801279
/* Map if we have any heap VMIDs associated with this ADSP Static Process. */
12811280
if (fl->cctx->vmcount) {
1281+
u64 src_perms = BIT(QCOM_SCM_VMID_HLOS);
1282+
12821283
err = qcom_scm_assign_mem(fl->cctx->remote_heap->phys,
12831284
(u64)fl->cctx->remote_heap->size,
1284-
&fl->cctx->perms,
1285+
&src_perms,
12851286
fl->cctx->vmperms, fl->cctx->vmcount);
12861287
if (err) {
12871288
dev_err(fl->sctx->dev, "Failed to assign memory with phys 0x%llx size 0x%llx err %d",
@@ -1915,8 +1916,10 @@ static int fastrpc_req_mmap(struct fastrpc_user *fl, char __user *argp)
19151916

19161917
/* Add memory to static PD pool, protection thru hypervisor */
19171918
if (req.flags == ADSP_MMAP_REMOTE_HEAP_ADDR && fl->cctx->vmcount) {
1919+
u64 src_perms = BIT(QCOM_SCM_VMID_HLOS);
1920+
19181921
err = qcom_scm_assign_mem(buf->phys, (u64)buf->size,
1919-
&fl->cctx->perms, fl->cctx->vmperms, fl->cctx->vmcount);
1922+
&src_perms, fl->cctx->vmperms, fl->cctx->vmcount);
19201923
if (err) {
19211924
dev_err(fl->sctx->dev, "Failed to assign memory phys 0x%llx size 0x%llx err %d",
19221925
buf->phys, buf->size, err);
@@ -2290,7 +2293,6 @@ static int fastrpc_rpmsg_probe(struct rpmsg_device *rpdev)
22902293

22912294
if (vmcount) {
22922295
data->vmcount = vmcount;
2293-
data->perms = BIT(QCOM_SCM_VMID_HLOS);
22942296
for (i = 0; i < data->vmcount; i++) {
22952297
data->vmperms[i].vmid = vmids[i];
22962298
data->vmperms[i].perm = QCOM_SCM_PERM_RWX;

0 commit comments

Comments
 (0)