Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6ab54ff4 authored by Mitchel Humpherys's avatar Mitchel Humpherys Committed by Liam Mark
Browse files

msm: secure_buffer: Add helper function to convert VMIDs into strings



It can be useful to convert secure VMID values into strings.  Provide a
helper function to do so.

Change-Id: If907a0bac92c5d164154c0e5dfe67933115163c8
Signed-off-by: default avatarMitchel Humpherys <mitchelh@codeaurora.org>
Signed-off-by: default avatarPatrick Daly <pdaly@codeaurora.org>
parent 7d881050
Loading
Loading
Loading
Loading
+32 −0
Original line number Diff line number Diff line
@@ -363,6 +363,38 @@ int hyp_assign_phys(phys_addr_t addr, u64 size, u32 *source_vm_list,
	return ret;
}

const char *msm_secure_vmid_to_string(int secure_vmid)
{
	switch (secure_vmid) {
	case VMID_HLOS:
		return "VMID_HLOS";
	case VMID_CP_TOUCH:
		return "VMID_CP_TOUCH";
	case VMID_CP_BITSTREAM:
		return "VMID_CP_BITSTREAM";
	case VMID_CP_PIXEL:
		return "VMID_CP_PIXEL";
	case VMID_CP_NON_PIXEL:
		return "VMID_CP_NON_PIXEL";
	case VMID_CP_CAMERA:
		return "VMID_CP_CAMERA";
	case VMID_HLOS_FREE:
		return "VMID_HLOS_FREE";
	case VMID_MSS_MSA:
		return "VMID_MSS_MSA";
	case VMID_MSS_NONMSA:
		return "VMID_MSS_NONMSA";
	case VMID_CP_SEC_DISPLAY:
		return "VMID_CP_SEC_DISPLAY";
	case VMID_CP_APP:
		return "VMID_CP_APP";
	case VMID_INVAL:
		return "VMID_INVAL";
	default:
		return "Unknown VMID";
	}
}

#define MAKE_CP_VERSION(major, minor, patch) \
	(((major & 0x3FF) << 22) | ((minor & 0x3FF) << 12) | (patch & 0xFFF))

+9 −0
Original line number Diff line number Diff line
@@ -28,6 +28,10 @@
#define VMID_CP_SEC_DISPLAY 0x11
#define VMID_CP_APP 0x12
#define VMID_INVAL -1
/*
 * if you add a secure VMID here make sure you update
 * msm_secure_vmid_to_string
 */

#define PERM_READ                       0x4
#define PERM_WRITE                      0x2
@@ -44,6 +48,7 @@ int hyp_assign_phys(phys_addr_t addr, u64 size,
			u32 *source_vmlist, int source_nelems,
			int *dest_vmids, int *dest_perms, int dest_nelems);
bool msm_secure_v2_is_supported(void);
const char *msm_secure_vmid_to_string(int secure_vmid);
#else
static inline int msm_secure_table(struct sg_table *table)
{
@@ -72,5 +77,9 @@ static inline bool msm_secure_v2_is_supported(void)
{
	return false;
}
const char *msm_secure_vmid_to_string(int secure_vmid)
{
	return "N/A";
}
#endif
#endif