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

Configure Feed

Select the types of activity you want to include in your feed.

misc: fastrpc: Add mmap request assigning for static PD pool

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: Abel Vesa <abel.vesa@linaro.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Link: https://lore.kernel.org/r/20221125071405.148786-10-srinivas.kandagatla@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Abel Vesa and committed by
Greg Kroah-Hartman
532ad70c 76e8e4ac

+18 -1
+18 -1
drivers/misc/fastrpc.c
··· 1839 1839 if (copy_from_user(&req, argp, sizeof(req))) 1840 1840 return -EFAULT; 1841 1841 1842 - if (req.flags != ADSP_MMAP_ADD_PAGES) { 1842 + if (req.flags != ADSP_MMAP_ADD_PAGES && req.flags != ADSP_MMAP_REMOTE_HEAP_ADDR) { 1843 1843 dev_err(dev, "flag not supported 0x%x\n", req.flags); 1844 + 1844 1845 return -EINVAL; 1845 1846 } 1846 1847 ··· 1886 1885 1887 1886 /* let the client know the address to use */ 1888 1887 req.vaddrout = rsp_msg.vaddr; 1888 + 1889 + /* Add memory to static PD pool, protection thru hypervisor */ 1890 + if (req.flags != ADSP_MMAP_REMOTE_HEAP_ADDR && fl->cctx->vmcount) { 1891 + struct qcom_scm_vmperm perm; 1892 + int err = 0; 1893 + 1894 + perm.vmid = QCOM_SCM_VMID_HLOS; 1895 + perm.perm = QCOM_SCM_PERM_RWX; 1896 + err = qcom_scm_assign_mem(buf->phys, buf->size, 1897 + &(fl->cctx->vmperms[0].vmid), &perm, 1); 1898 + if (err) { 1899 + dev_err(fl->sctx->dev, "Failed to assign memory phys 0x%llx size 0x%llx err %d", 1900 + buf->phys, buf->size, err); 1901 + goto err_assign; 1902 + } 1903 + } 1889 1904 1890 1905 spin_lock(&fl->lock); 1891 1906 list_add_tail(&buf->node, &fl->mmaps);