Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

misc: fastrpc: Pass proper scm arguments for static process init

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>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20230811115643.38578-4-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Ekansh Gupta and committed by
Greg Kroah-Hartman
fe6518d5 a2cb9cd6

+9 -4
+9 -4
drivers/misc/fastrpc.c
··· 1325 1325 return 0; 1326 1326 err_invoke: 1327 1327 if (fl->cctx->vmcount) { 1328 - struct qcom_scm_vmperm perm; 1328 + u64 src_perms = 0; 1329 + struct qcom_scm_vmperm dst_perms; 1330 + u32 i; 1329 1331 1330 - perm.vmid = QCOM_SCM_VMID_HLOS; 1331 - perm.perm = QCOM_SCM_PERM_RWX; 1332 + for (i = 0; i < fl->cctx->vmcount; i++) 1333 + src_perms |= BIT(fl->cctx->vmperms[i].vmid); 1334 + 1335 + dst_perms.vmid = QCOM_SCM_VMID_HLOS; 1336 + dst_perms.perm = QCOM_SCM_PERM_RWX; 1332 1337 err = qcom_scm_assign_mem(fl->cctx->remote_heap->phys, 1333 1338 (u64)fl->cctx->remote_heap->size, 1334 - &fl->cctx->perms, &perm, 1); 1339 + &src_perms, &dst_perms, 1); 1335 1340 if (err) 1336 1341 dev_err(fl->sctx->dev, "Failed to assign memory phys 0x%llx size 0x%llx err %d", 1337 1342 fl->cctx->remote_heap->phys, fl->cctx->remote_heap->size, err);