mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-25 06:03:36 -04:00
ion: msm: Add support for querying the security state of heaps
ION clients may want to know about the security state of a heap prior to allocating from it, so expose an interface for querying the security state of a heap. Change-Id: Ibf832792ffbc81b5b96b8ddbc507db5418a47928 Signed-off-by: Isaac J. Manjarres <isaacm@codeaurora.org>
This commit is contained in:
parent
f1efdc30c2
commit
878cf94a7a
2 changed files with 21 additions and 1 deletions
|
|
@ -1,6 +1,6 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <linux/err.h>
|
||||
|
|
@ -229,6 +229,19 @@ struct device *msm_ion_heap_device_by_id(int heap_id)
|
|||
}
|
||||
EXPORT_SYMBOL(msm_ion_heap_device_by_id);
|
||||
|
||||
bool msm_ion_heap_is_secure(int heap_id)
|
||||
{
|
||||
struct ion_heap *heap = ion_heap_by_id(heap_id);
|
||||
|
||||
if (IS_ERR(heap) || !(heap->type == ION_HEAP_TYPE_SECURE_CARVEOUT ||
|
||||
heap->type == ION_HEAP_TYPE_SYSTEM_SECURE ||
|
||||
heap->type == ION_HEAP_TYPE_HYP_CMA))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
EXPORT_SYMBOL(msm_ion_heap_is_secure);
|
||||
|
||||
int msm_ion_heap_prefetch(int heap_id, struct ion_prefetch_region *regions,
|
||||
int nr_regions)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -37,6 +37,8 @@ int msm_ion_heap_drain(int heap_id, struct ion_prefetch_region *regions,
|
|||
|
||||
int get_ion_flags(u32 vmid);
|
||||
|
||||
bool msm_ion_heap_is_secure(int heap_id);
|
||||
|
||||
#else
|
||||
|
||||
static inline struct device *msm_ion_heap_device_by_id(int heap_id)
|
||||
|
|
@ -74,5 +76,10 @@ static inline int get_ion_flags(u32 vmid)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
static inline bool msm_ion_heap_is_secure(int heap_id)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_ION_MSM_HEAPS */
|
||||
#endif /* _MSM_ION_H */
|
||||
|
|
|
|||
Loading…
Reference in a new issue