Merge "uio: msm_sharedmem: Add a function to release the shared RAM section"
This commit is contained in:
commit
e4340a3ea8
1 changed files with 31 additions and 1 deletions
|
@ -1,4 +1,4 @@
|
||||||
/* Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
|
/* Copyright (c) 2013-2018, The Linux Foundation. All rights reserved.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License version 2 and
|
* it under the terms of the GNU General Public License version 2 and
|
||||||
|
@ -75,6 +75,24 @@ static int sharedmem_mmap(struct uio_info *info, struct vm_area_struct *vma)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void free_shared_ram_perms(u32 client_id, phys_addr_t addr, u32 size)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
u32 source_vmlist[2] = {VMID_HLOS, VMID_MSS_MSA};
|
||||||
|
int dest_vmids[1] = {VMID_HLOS};
|
||||||
|
int dest_perms[1] = {PERM_READ|PERM_WRITE|PERM_EXEC};
|
||||||
|
|
||||||
|
if (client_id != MPSS_RMTS_CLIENT_ID)
|
||||||
|
return;
|
||||||
|
|
||||||
|
ret = hyp_assign_phys(addr, size, source_vmlist, 2, dest_vmids,
|
||||||
|
dest_perms, 1);
|
||||||
|
if (ret != 0) {
|
||||||
|
pr_err("hyp_assign_phys failed IPA=0x016%pa size=%u err=%d\n",
|
||||||
|
&addr, size, ret);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Setup the shared ram permissions.
|
/* Setup the shared ram permissions.
|
||||||
* This function currently supports the mpss client only.
|
* This function currently supports the mpss client only.
|
||||||
*/
|
*/
|
||||||
|
@ -184,6 +202,17 @@ out:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void msm_sharedmem_shutdown(struct platform_device *pdev)
|
||||||
|
{
|
||||||
|
struct uio_info *info = dev_get_drvdata(&pdev->dev);
|
||||||
|
|
||||||
|
phys_addr_t shared_mem_addr = info->mem[0].addr;
|
||||||
|
u32 shared_mem_size = info->mem[0].size;
|
||||||
|
|
||||||
|
free_shared_ram_perms(MPSS_RMTS_CLIENT_ID, shared_mem_addr,
|
||||||
|
shared_mem_size);
|
||||||
|
}
|
||||||
|
|
||||||
static int msm_sharedmem_remove(struct platform_device *pdev)
|
static int msm_sharedmem_remove(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct uio_info *info = dev_get_drvdata(&pdev->dev);
|
struct uio_info *info = dev_get_drvdata(&pdev->dev);
|
||||||
|
@ -202,6 +231,7 @@ MODULE_DEVICE_TABLE(of, msm_sharedmem_of_match);
|
||||||
static struct platform_driver msm_sharedmem_driver = {
|
static struct platform_driver msm_sharedmem_driver = {
|
||||||
.probe = msm_sharedmem_probe,
|
.probe = msm_sharedmem_probe,
|
||||||
.remove = msm_sharedmem_remove,
|
.remove = msm_sharedmem_remove,
|
||||||
|
.shutdown = msm_sharedmem_shutdown,
|
||||||
.driver = {
|
.driver = {
|
||||||
.name = DRIVER_NAME,
|
.name = DRIVER_NAME,
|
||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
|
|
Loading…
Add table
Reference in a new issue