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

Commit 2b78a1e4 authored by Liam Mark's avatar Liam Mark Committed by Isaac J. Manjarres
Browse files

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: default avatarLiam Mark <lmark@codeaurora.org>
[isaacm@codeaurora.org: Relocate changes to new header locations]
Signed-off-by: default avatarIsaac J. Manjarres <isaacm@codeaurora.org>
parent 1b851a56
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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)
+22 −0
Original line number Diff line number Diff line
@@ -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 */