Loading drivers/uio/msm_sharedmem/msm_sharedmem.c +33 −0 Original line number Diff line number Diff line Loading @@ -19,10 +19,15 @@ #include <linux/err.h> #include <linux/of.h> #include <linux/dma-mapping.h> #include <soc/qcom/secure_buffer.h> #include "sharedmem_qmi.h" #define CLIENT_ID_PROP "qcom,client-id" #define MPSS_RMTS_CLIENT_ID 1 static int uio_get_mem_index(struct uio_info *info, struct vm_area_struct *vma) { if (vma->vm_pgoff >= MAX_UIO_MAPS) Loading Loading @@ -70,6 +75,31 @@ static int sharedmem_mmap(struct uio_info *info, struct vm_area_struct *vma) return result; } /* Setup the shared ram permissions. * This function currently supports the mpss client only. */ static void setup_shared_ram_perms(u32 client_id, phys_addr_t addr, u32 size) { int ret; u32 source_vmlist[1] = {VMID_HLOS}; int dest_vmids[2] = {VMID_HLOS, VMID_MSS_MSA}; int dest_perms[2] = {PERM_READ|PERM_WRITE , PERM_READ|PERM_WRITE}; if (client_id != MPSS_RMTS_CLIENT_ID) return; ret = hyp_assign_phys(addr, size, source_vmlist, 1, dest_vmids, dest_perms, 2); if (ret != 0) { if (ret == -ENOSYS) pr_warn("hyp_assign_phys is not supported!"); else pr_err("hyp_assign_phys failed IPA=0x%016llX size=%u err=%d\n", addr, size, ret); } } static int msm_sharedmem_probe(struct platform_device *pdev) { int ret = 0; Loading Loading @@ -124,6 +154,9 @@ static int msm_sharedmem_probe(struct platform_device *pdev) } } /* Set up the permissions for the shared ram that was allocated. */ setup_shared_ram_perms(client_id, shared_mem_pyhsical, shared_mem_size); /* Setup device */ info->mmap = sharedmem_mmap; /* Custom mmap function. */ info->name = clnt_res->name; Loading Loading
drivers/uio/msm_sharedmem/msm_sharedmem.c +33 −0 Original line number Diff line number Diff line Loading @@ -19,10 +19,15 @@ #include <linux/err.h> #include <linux/of.h> #include <linux/dma-mapping.h> #include <soc/qcom/secure_buffer.h> #include "sharedmem_qmi.h" #define CLIENT_ID_PROP "qcom,client-id" #define MPSS_RMTS_CLIENT_ID 1 static int uio_get_mem_index(struct uio_info *info, struct vm_area_struct *vma) { if (vma->vm_pgoff >= MAX_UIO_MAPS) Loading Loading @@ -70,6 +75,31 @@ static int sharedmem_mmap(struct uio_info *info, struct vm_area_struct *vma) return result; } /* Setup the shared ram permissions. * This function currently supports the mpss client only. */ static void setup_shared_ram_perms(u32 client_id, phys_addr_t addr, u32 size) { int ret; u32 source_vmlist[1] = {VMID_HLOS}; int dest_vmids[2] = {VMID_HLOS, VMID_MSS_MSA}; int dest_perms[2] = {PERM_READ|PERM_WRITE , PERM_READ|PERM_WRITE}; if (client_id != MPSS_RMTS_CLIENT_ID) return; ret = hyp_assign_phys(addr, size, source_vmlist, 1, dest_vmids, dest_perms, 2); if (ret != 0) { if (ret == -ENOSYS) pr_warn("hyp_assign_phys is not supported!"); else pr_err("hyp_assign_phys failed IPA=0x%016llX size=%u err=%d\n", addr, size, ret); } } static int msm_sharedmem_probe(struct platform_device *pdev) { int ret = 0; Loading Loading @@ -124,6 +154,9 @@ static int msm_sharedmem_probe(struct platform_device *pdev) } } /* Set up the permissions for the shared ram that was allocated. */ setup_shared_ram_perms(client_id, shared_mem_pyhsical, shared_mem_size); /* Setup device */ info->mmap = sharedmem_mmap; /* Custom mmap function. */ info->name = clnt_res->name; Loading