Merge "mem-buf: Replace *_TRUSTED_UI with *_TRUSTED_VM"

This commit is contained in:
qctecmdr 2020-04-08 03:42:49 -07:00 • committed by Gerrit - the friendly Code Review server
commit 9261aacbb1
6 changed files with 22 additions and 15 deletions

View file

@ -1101,8 +1101,8 @@ static int mem_buf_remove_mem(struct mem_buf_desc *membuf)
static bool is_valid_mem_buf_vmid(u32 mem_buf_vmid)
{
if ((mem_buf_vmid == MEM_BUF_VMID_HLOS) ||
(mem_buf_vmid == MEM_BUF_VMID_TRUSTED_UI))
if ((mem_buf_vmid == MEM_BUF_VMID_PRIMARY_VM) ||
(mem_buf_vmid == MEM_BUF_VMID_TRUSTED_VM))
return true;
return false;
@ -1115,11 +1115,21 @@ static bool is_valid_mem_buf_perms(u32 mem_buf_perms)
static int mem_buf_vmid_to_vmid(u32 mem_buf_vmid)
{
if (mem_buf_vmid == MEM_BUF_VMID_HLOS)
return VMID_HLOS;
else if (mem_buf_vmid == MEM_BUF_VMID_TRUSTED_UI)
return VMID_TRUSTED_UI;
return -EINVAL;
int ret;
hh_vmid_t vmid;
enum hh_vm_names vm_name;
if (mem_buf_vmid == MEM_BUF_VMID_PRIMARY_VM)
vm_name = HH_PRIMARY_VM;
else if (mem_buf_vmid == MEM_BUF_VMID_TRUSTED_VM)
vm_name = HH_TRUSTED_VM;
else
return -EINVAL;
ret = hh_rm_get_vmid(vm_name, &vmid);
if (!ret)
return vmid;
return ret;
}
static int mem_buf_perms_to_perms(u32 mem_buf_perms)

View file

@ -280,8 +280,6 @@ const char *msm_secure_vmid_to_string(int secure_vmid)
return "VMID_CP_SPSS_SP_SHARED";
case VMID_CP_SPSS_HLOS_SHARED:
return "VMID_CP_SPSS_HLOS_SHARED";
case VMID_TRUSTED_UI:
return "VMID_TRUSTED_UI";
case VMID_INVAL:
return "VMID_INVAL";
default:

View file

@ -60,7 +60,7 @@ int get_secure_vmid(unsigned long flags)
return VMID_CP_SPSS_HLOS_SHARED;
if (flags & ION_FLAG_CP_CDSP)
return VMID_CP_CDSP;
if (flags & ION_FLAG_CP_TRUSTED_UI) {
if (flags & ION_FLAG_CP_TRUSTED_VM) {
ret = hh_rm_get_vmid(HH_TRUSTED_VM, &vmid);
if (!ret)
return vmid;
@ -103,7 +103,7 @@ int get_ion_flags(u32 vmid)
ret = hh_rm_get_vmid(HH_TRUSTED_VM, &trusted_vm_vmid);
if (!ret && vmid == trusted_vm_vmid)
return ION_FLAG_CP_TRUSTED_UI;
return ION_FLAG_CP_TRUSTED_VM;
return -EINVAL;
}
EXPORT_SYMBOL(get_ion_flags);

View file

@ -33,7 +33,6 @@ enum vmid {
VMID_CP_SPSS_SP_SHARED = 0x22,
VMID_CP_SPSS_HLOS_SHARED = 0x24,
VMID_CP_CDSP = 0x2A,
VMID_TRUSTED_UI = 0x31,
VMID_LAST,
VMID_INVAL = -1
};

View file

@ -21,8 +21,8 @@ enum mem_buf_mem_type {
};
/* The mem-buf values that represent VMIDs for an ACL. */
#define MEM_BUF_VMID_HLOS 0
#define MEM_BUF_VMID_TRUSTED_UI 1
#define MEM_BUF_VMID_PRIMARY_VM 0
#define MEM_BUF_VMID_TRUSTED_VM 1
#define MEM_BUF_PERM_FLAG_READ (1U << 0)
#define MEM_BUF_PERM_FLAG_WRITE (1U << 1)

View file

@ -27,7 +27,7 @@ enum msm_ion_heap_types {
* Flags to be used when allocating from the secure heap for
* content protection
*/
#define ION_FLAG_CP_TRUSTED_UI ION_BIT(15)
#define ION_FLAG_CP_TRUSTED_VM ION_BIT(15)
/* ION_FLAG_POOL_FORCE_ALLOC uses ION_BIT(16) */
#define ION_FLAG_CP_TOUCH ION_BIT(17)
#define ION_FLAG_CP_BITSTREAM ION_BIT(18)