ion: msm: Expose ION API to query buffer VM information

Allow ION clients to be able to determine the VM information associated
with an ION buffer, such as the VMIDs it is assigned to as well as the
VM permissions.

Change-Id: Id0be0b505bc84beff373e4e2ae16b71ec4f09d43
Signed-off-by: Liam Mark <lmark@codeaurora.org>
[isaacm@codeaurora.org: Relocate changes to new header locations]
Signed-off-by: Isaac J. Manjarres <isaacm@codeaurora.org>
This commit is contained in:
Liam Mark 2019-05-02 09:50:12 -07:00 • committed by Isaac J. Manjarres
commit 2b78a1e427
2 changed files with 23 additions and 0 deletions

View file

@ -90,6 +90,7 @@ int ion_populate_vm_list(unsigned long flags, unsigned int *vm_list,
}
return 0;
}
EXPORT_SYMBOL(ion_populate_vm_list);
int ion_hyp_unassign_sg(struct sg_table *sgt, int *source_vm_list,
int source_nelems, bool clear_page_private)

View file

@ -6,6 +6,7 @@
#ifndef _MSM_ION_H
#define _MSM_ION_H
#include <linux/bitmap.h>
#include <linux/device.h>
#include <uapi/linux/msm_ion.h>
@ -13,6 +14,16 @@
struct device *msm_ion_heap_device_by_id(int heap_id);
static inline unsigned int ion_get_flags_num_vm_elems(unsigned int flags)
{
unsigned long vm_flags = flags & ION_FLAGS_CP_MASK;
return ((unsigned int)bitmap_weight(&vm_flags, BITS_PER_LONG));
}
int ion_populate_vm_list(unsigned long flags, unsigned int *vm_list,
int nelems);
#else
static inline struct device *msm_ion_heap_device_by_id(int heap_id)
@ -20,5 +31,16 @@ static inline struct device *msm_ion_heap_device_by_id(int heap_id)
return ERR_PTR(-ENODEV);
}
static inline unsigned int ion_get_flags_num_vm_elems(unsigned int flags)
{
return 0;
}
static inline int ion_populate_vm_list(unsigned long flags,
unsigned int *vm_list, int nelems)
{
return -EINVAL;
}
#endif /* CONFIG_ION_MSM_HEAPS */
#endif /* _MSM_ION_H */