mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	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>
This commit is contained in:
		
							parent
							
								
									76e8e4ace1
								
							
						
					
					
						commit
						532ad70c6d
					
				
					 1 changed files with 18 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -1839,8 +1839,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;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1886,6 +1887,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);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue