Quoting Ankit Jain (2019-02-03 20:45:43) > diff --git a/drivers/soc/qcom/rmtfs_mem.c b/drivers/soc/qcom/rmtfs_mem.c > index 7200d76..6f5e8be 100644 > --- a/drivers/soc/qcom/rmtfs_mem.c > +++ b/drivers/soc/qcom/rmtfs_mem.c > @@ -137,6 +137,26 @@ static int qcom_rmtfs_mem_release(struct inode *inode, struct file *filp) > .name = "rmtfs", > }; > > +static int qcom_rmtfs_mem_mmap(struct file *filep, struct vm_area_struct *vma) > +{ > + struct qcom_rmtfs_mem *rmtfs_mem = filep->private_data; > + > + if (vma->vm_end - vma->vm_start > rmtfs_mem->size) { > + dev_dbg(&rmtfs_mem->dev, > + "vm_end[%lu] - vm_start[%lu] [%lu] > mem->size[%pa]\n", > + vma->vm_end, vma->vm_start, > + (vma->vm_end - vma->vm_start), &rmtfs_mem->size); > + return -EINVAL; > + } > + > + vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot); > + return remap_pfn_range(vma, > + vma->vm_start, > + rmtfs_mem->addr >> PAGE_SHIFT, > + vma->vm_end - vma->vm_start, > + vma->vm_page_prot); Just curious if we somehow enforce that the rmtfs_mem->size is a multiple of a PAGE_SIZE page (which can be 4K, 16K, or even 64K on arm64)? It's not like we're mapping in some extra stuff that isn't rmtfs memory right? > +} > + > static const struct file_operations qcom_rmtfs_mem_fops = { > .owner = THIS_MODULE, > .open = qcom_rmtfs_mem_open,