uio: msm_sharedmem: Add support for HYP call

Add support for HYP call to setup the sharedmem permissions
for the MPSS client.

Change-Id: I3b48ae962865d8d0a0ea6e3fbb8e21278b59c690
Signed-off-by: Nikhilesh Reddy <reddyn@codeaurora.org>
[riteshh@codeaurora.org: fixed trivial merge conflicts]
Signed-off-by: Ritesh Harjani <riteshh@codeaurora.org>
Signed-off-by: Ankit Jain <jankit@codeaurora.org>
Signed-off-by: Richard Patrick <richardp@codeaurora.org>
Signed-off-by: Richard Patrick <quic_richardp@quicinc.com>
Signed-off-by: Sayali Lokhande <quic_sayalil@quicinc.com>
This commit is contained in:
Nikhilesh Reddy 2015-06-04 11:31:42 -07:00 committed by Gerrit - the friendly Code Review server
parent bde16d2a83
commit d995fc0a0f

View File

@ -13,7 +13,10 @@
#include <linux/of.h>
#include <linux/dma-mapping.h>
#include <soc/qcom/secure_buffer.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)
{
@ -62,6 +65,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 == -EINVAL)
pr_warn("hyp_assign_phys is not supported!\n");
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;
@ -112,6 +140,9 @@ static int msm_sharedmem_probe(struct platform_device *pdev)
return -ENOMEM;
}
/* 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;