Loading drivers/staging/android/ion/heaps/ion_secure_util.c +1 −0 Original line number Diff line number Diff line Loading @@ -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) Loading drivers/staging/android/ion/heaps/msm_ion.c +43 −0 Original line number Diff line number Diff line Loading @@ -4,6 +4,8 @@ */ #include <linux/err.h> #include <linux/debugfs.h> #include <linux/file.h> #include <linux/io.h> #include <linux/platform_device.h> #include <linux/slab.h> Loading Loading @@ -95,6 +97,46 @@ static struct heap_types_info { MAKE_HEAP_TYPE_MAPPING(HYP_CMA), }; static int msm_ion_debug_heap_show(struct seq_file *s, void *unused) { struct msm_ion_heap *msm_heap = s->private; if (msm_heap && msm_heap->debug_show) msm_heap->debug_show(&msm_heap->ion_heap, s, unused); return 0; } static int msm_ion_debug_heap_open(struct inode *inode, struct file *file) { return single_open(file, msm_ion_debug_heap_show, inode->i_private); } static const struct file_operations msm_ion_debug_heap_fops = { .open = msm_ion_debug_heap_open, .read = seq_read, .llseek = seq_lseek, .release = single_release, }; static void msm_ion_debugfs_create_file(struct msm_ion_heap *msm_heap) { char debug_name[64], buf[256]; struct dentry *debugfs_root; struct ion_heap *heap; if (msm_heap && msm_heap->debug_show && msm_heap->ion_heap.debugfs_dir) { heap = &msm_heap->ion_heap; debugfs_root = heap->debugfs_dir; scnprintf(debug_name, 64, "%s_stats", heap->name); if (!debugfs_create_file(debug_name, 0664, debugfs_root, msm_heap, &msm_ion_debug_heap_fops)) pr_err("Failed to create heap debugfs at %s/%s\n", dentry_path(debugfs_root, buf, 256), debug_name); } } static struct ion_heap *ion_heap_create(struct ion_platform_heap *heap_data) { struct ion_heap *heap = NULL; Loading Loading @@ -451,6 +493,7 @@ static int msm_ion_probe(struct platform_device *pdev) } ion_device_add_heap(heaps[i]); msm_ion_debugfs_create_file(to_msm_ion_heap(heaps[i])); } free_pdata(pdata); Loading drivers/staging/android/ion/heaps/msm_ion_priv.h +4 −0 Original line number Diff line number Diff line Loading @@ -81,11 +81,15 @@ struct ion_platform_heap { * struct msm_ion_heap - defines an ion heap, as well as additional information * relevant to the heap. * @dev: the device structure associated with the heap * @debug_show: called when the heap debug file is read to add any heap specific * debug info to output * @ion_heap: ion heap * */ struct msm_ion_heap { struct device *dev; int (*debug_show)(struct ion_heap *heap, struct seq_file *s, void *unused); struct ion_heap ion_heap; }; Loading include/linux/msm_ion.h +22 −0 Original line number Diff line number Diff line Loading @@ -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> Loading @@ -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) Loading @@ -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 */ Loading
drivers/staging/android/ion/heaps/ion_secure_util.c +1 −0 Original line number Diff line number Diff line Loading @@ -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) Loading
drivers/staging/android/ion/heaps/msm_ion.c +43 −0 Original line number Diff line number Diff line Loading @@ -4,6 +4,8 @@ */ #include <linux/err.h> #include <linux/debugfs.h> #include <linux/file.h> #include <linux/io.h> #include <linux/platform_device.h> #include <linux/slab.h> Loading Loading @@ -95,6 +97,46 @@ static struct heap_types_info { MAKE_HEAP_TYPE_MAPPING(HYP_CMA), }; static int msm_ion_debug_heap_show(struct seq_file *s, void *unused) { struct msm_ion_heap *msm_heap = s->private; if (msm_heap && msm_heap->debug_show) msm_heap->debug_show(&msm_heap->ion_heap, s, unused); return 0; } static int msm_ion_debug_heap_open(struct inode *inode, struct file *file) { return single_open(file, msm_ion_debug_heap_show, inode->i_private); } static const struct file_operations msm_ion_debug_heap_fops = { .open = msm_ion_debug_heap_open, .read = seq_read, .llseek = seq_lseek, .release = single_release, }; static void msm_ion_debugfs_create_file(struct msm_ion_heap *msm_heap) { char debug_name[64], buf[256]; struct dentry *debugfs_root; struct ion_heap *heap; if (msm_heap && msm_heap->debug_show && msm_heap->ion_heap.debugfs_dir) { heap = &msm_heap->ion_heap; debugfs_root = heap->debugfs_dir; scnprintf(debug_name, 64, "%s_stats", heap->name); if (!debugfs_create_file(debug_name, 0664, debugfs_root, msm_heap, &msm_ion_debug_heap_fops)) pr_err("Failed to create heap debugfs at %s/%s\n", dentry_path(debugfs_root, buf, 256), debug_name); } } static struct ion_heap *ion_heap_create(struct ion_platform_heap *heap_data) { struct ion_heap *heap = NULL; Loading Loading @@ -451,6 +493,7 @@ static int msm_ion_probe(struct platform_device *pdev) } ion_device_add_heap(heaps[i]); msm_ion_debugfs_create_file(to_msm_ion_heap(heaps[i])); } free_pdata(pdata); Loading
drivers/staging/android/ion/heaps/msm_ion_priv.h +4 −0 Original line number Diff line number Diff line Loading @@ -81,11 +81,15 @@ struct ion_platform_heap { * struct msm_ion_heap - defines an ion heap, as well as additional information * relevant to the heap. * @dev: the device structure associated with the heap * @debug_show: called when the heap debug file is read to add any heap specific * debug info to output * @ion_heap: ion heap * */ struct msm_ion_heap { struct device *dev; int (*debug_show)(struct ion_heap *heap, struct seq_file *s, void *unused); struct ion_heap ion_heap; }; Loading
include/linux/msm_ion.h +22 −0 Original line number Diff line number Diff line Loading @@ -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> Loading @@ -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) Loading @@ -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 */