Loading Documentation/devicetree/bindings/arm/msm/msm_ion.txt 0 → 100644 +72 −0 Original line number Diff line number Diff line ION Memory Manager (ION) ION is a memory manager that allows for sharing of buffers between different processes and between user space and kernel space. ION manages different memory spaces by separating the memory spaces into "heaps". Depending on the type of heap ION must reserve memory using the msm specific memory reservation bindings (see Documentation/devicetree/bindings/arm/msm/memory-reserve.txt). Required properties for Ion - compatible: "qcom,msm-ion" All child nodes of a qcom,msm-ion node are interpreted as Ion heap configurations. Required properties for Ion heaps - reg: The ID of the ION heap. - qcom,ion-heap-type: The heap type to use for this heap. Should be one of the following: - "SYSTEM" - "SYSTEM_CONTIG" - "CARVEOUT" - "CHUNK" - "CP" - "DMA" - "SECURE_DMA" Optional properties for Ion heaps - compatible: "qcom,msm-ion-reserve" This is required if memory is to be reserved as specified by qcom,memory-reservation-size below. - qcom,heap-align: Alignment of start of the memory in the heap. - qcom,heap-adjacent: ID of heap this heap needs to be adjacent to. - qcom,memory-reservation-size: size of reserved memory for the ION heap. - qcom,memory-reservation-type: type of memory to be reserved (see memory-reserve.txt for information about memory reservations) - qcom,default-prefetch-size: Base value to be used for prefetching optimizations. Ignored if the heap does not support prefetching. Will set to a reasonable default value (e.g. the maximum heap size) if this option is not set. Example: qcom,ion { compatible = "qcom,msm-ion"; #address-cells = <1>; #size-cells = <0>; qcom,ion-heap@25 { reg = <25>; qcom,ion-heap-type = "SYSTEM"; }; qcom,ion-heap@8 { /* CP_MM HEAP */ compatible = "qcom,msm-ion-reserve"; reg = <8>; qcom,heap-align = <0x1000>; linux,contiguous-region = <&secure_mem>; qcom,ion-heap-type = "SECURE_DMA"; }; qcom,ion-heap@29 { /* FIRMWARE HEAP */ compatible = "qcom,msm-ion-reserve"; reg = <29>; qcom,heap-align = <0x20000>; qcom,heap-adjacent = <8>; qcom,memory-reservation-type = "EBI1"; /* reserve EBI memory */ qcom,memory-reservation-size = <0xA00000>; qcom,ion-heap-type = "CARVEOUT"; }; }; drivers/staging/android/ion/Kconfig +33 −1 Original line number Diff line number Diff line menuconfig ION bool "Ion Memory Manager" depends on HAVE_MEMBLOCK && HAS_DMA && MMU depends on HAVE_MEMBLOCK && HAS_DMA && MMU && ION_MSM select GENERIC_ALLOCATOR select DMA_SHARED_BUFFER ---help--- Loading Loading @@ -33,3 +33,35 @@ config ION_TEGRA help Choose this option if you wish to use ion on an nVidia Tegra. config ION_HISI tristate "Ion for Hisilicon" depends on ARCH_HISI && ION help Choose this option if you wish to use ion on Hisilicon Platform. source "drivers/staging/android/ion/hisilicon/Kconfig" config ION_POOL_CACHE_POLICY bool "Ion set page pool cache policy" depends on ION && X86 default y if X86 help Choose this option if need to explicity set cache policy of the pages in the page pool. config ION_MSM tristate "Ion for MSM" depends on ARCH_QCOM && CMA select MSM_SECURE_BUFFER help Choose this option if you wish to use ion on an MSM target. Features include allocating heaps from device tree, buffer cache maintenance, and a custom ioctl/compat_ioctl. Enable utility functions used by ion_system_heap. config ALLOC_BUFFERS_IN_4K_CHUNKS bool "Turns off allocation optimization and allocate only 4K pages" depends on ARCH_QCOM && ION help Choose this option if you want ION to allocate buffers in only 4KB chunks. drivers/staging/android/ion/Makefile +4 −2 Original line number Diff line number Diff line obj-$(CONFIG_ION) += ion.o ion_heap.o ion_page_pool.o ion_system_heap.o \ ion_carveout_heap.o ion_chunk_heap.o ion_cma_heap.o ion_carveout_heap.o ion_chunk_heap.o ion_cma_heap.o \ ion_system_secure_heap.o obj-$(CONFIG_ION_TEST) += ion_test.o ifdef CONFIG_COMPAT obj-$(CONFIG_ION) += compat_ion.o endif obj-$(CONFIG_ION_DUMMY) += ion_dummy_driver.o obj-$(CONFIG_ION_TEGRA) += tegra/ obj-$(CONFIG_ION_HISI) += hisilicon/ obj-$(CONFIG_ION_MSM) += msm/ drivers/staging/android/ion/compat_ion.c +3 −3 Original line number Diff line number Diff line Loading @@ -137,7 +137,7 @@ long compat_ion_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) data32 = compat_ptr(arg); data = compat_alloc_user_space(sizeof(*data)); if (data == NULL) if (!data) return -EFAULT; err = compat_get_ion_allocation_data(data32, data); Loading @@ -156,7 +156,7 @@ long compat_ion_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) data32 = compat_ptr(arg); data = compat_alloc_user_space(sizeof(*data)); if (data == NULL) if (!data) return -EFAULT; err = compat_get_ion_handle_data(data32, data); Loading @@ -173,7 +173,7 @@ long compat_ion_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) data32 = compat_ptr(arg); data = compat_alloc_user_space(sizeof(*data)); if (data == NULL) if (!data) return -EFAULT; err = compat_get_ion_custom_data(data32, data); Loading drivers/staging/android/ion/compat_ion.h +3 −0 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ * drivers/staging/android/ion/compat_ion.h * * Copyright (C) 2013 Google, Inc. * Copyright (c) 2016, The Linux Foundation. All rights reserved. * * This software is licensed under the terms of the GNU General Public * License version 2, as published by the Free Software Foundation, and Loading @@ -21,6 +22,8 @@ long compat_ion_ioctl(struct file *filp, unsigned int cmd, unsigned long arg); #define compat_ion_user_handle_t compat_int_t #else #define compat_ion_ioctl NULL Loading Loading
Documentation/devicetree/bindings/arm/msm/msm_ion.txt 0 → 100644 +72 −0 Original line number Diff line number Diff line ION Memory Manager (ION) ION is a memory manager that allows for sharing of buffers between different processes and between user space and kernel space. ION manages different memory spaces by separating the memory spaces into "heaps". Depending on the type of heap ION must reserve memory using the msm specific memory reservation bindings (see Documentation/devicetree/bindings/arm/msm/memory-reserve.txt). Required properties for Ion - compatible: "qcom,msm-ion" All child nodes of a qcom,msm-ion node are interpreted as Ion heap configurations. Required properties for Ion heaps - reg: The ID of the ION heap. - qcom,ion-heap-type: The heap type to use for this heap. Should be one of the following: - "SYSTEM" - "SYSTEM_CONTIG" - "CARVEOUT" - "CHUNK" - "CP" - "DMA" - "SECURE_DMA" Optional properties for Ion heaps - compatible: "qcom,msm-ion-reserve" This is required if memory is to be reserved as specified by qcom,memory-reservation-size below. - qcom,heap-align: Alignment of start of the memory in the heap. - qcom,heap-adjacent: ID of heap this heap needs to be adjacent to. - qcom,memory-reservation-size: size of reserved memory for the ION heap. - qcom,memory-reservation-type: type of memory to be reserved (see memory-reserve.txt for information about memory reservations) - qcom,default-prefetch-size: Base value to be used for prefetching optimizations. Ignored if the heap does not support prefetching. Will set to a reasonable default value (e.g. the maximum heap size) if this option is not set. Example: qcom,ion { compatible = "qcom,msm-ion"; #address-cells = <1>; #size-cells = <0>; qcom,ion-heap@25 { reg = <25>; qcom,ion-heap-type = "SYSTEM"; }; qcom,ion-heap@8 { /* CP_MM HEAP */ compatible = "qcom,msm-ion-reserve"; reg = <8>; qcom,heap-align = <0x1000>; linux,contiguous-region = <&secure_mem>; qcom,ion-heap-type = "SECURE_DMA"; }; qcom,ion-heap@29 { /* FIRMWARE HEAP */ compatible = "qcom,msm-ion-reserve"; reg = <29>; qcom,heap-align = <0x20000>; qcom,heap-adjacent = <8>; qcom,memory-reservation-type = "EBI1"; /* reserve EBI memory */ qcom,memory-reservation-size = <0xA00000>; qcom,ion-heap-type = "CARVEOUT"; }; };
drivers/staging/android/ion/Kconfig +33 −1 Original line number Diff line number Diff line menuconfig ION bool "Ion Memory Manager" depends on HAVE_MEMBLOCK && HAS_DMA && MMU depends on HAVE_MEMBLOCK && HAS_DMA && MMU && ION_MSM select GENERIC_ALLOCATOR select DMA_SHARED_BUFFER ---help--- Loading Loading @@ -33,3 +33,35 @@ config ION_TEGRA help Choose this option if you wish to use ion on an nVidia Tegra. config ION_HISI tristate "Ion for Hisilicon" depends on ARCH_HISI && ION help Choose this option if you wish to use ion on Hisilicon Platform. source "drivers/staging/android/ion/hisilicon/Kconfig" config ION_POOL_CACHE_POLICY bool "Ion set page pool cache policy" depends on ION && X86 default y if X86 help Choose this option if need to explicity set cache policy of the pages in the page pool. config ION_MSM tristate "Ion for MSM" depends on ARCH_QCOM && CMA select MSM_SECURE_BUFFER help Choose this option if you wish to use ion on an MSM target. Features include allocating heaps from device tree, buffer cache maintenance, and a custom ioctl/compat_ioctl. Enable utility functions used by ion_system_heap. config ALLOC_BUFFERS_IN_4K_CHUNKS bool "Turns off allocation optimization and allocate only 4K pages" depends on ARCH_QCOM && ION help Choose this option if you want ION to allocate buffers in only 4KB chunks.
drivers/staging/android/ion/Makefile +4 −2 Original line number Diff line number Diff line obj-$(CONFIG_ION) += ion.o ion_heap.o ion_page_pool.o ion_system_heap.o \ ion_carveout_heap.o ion_chunk_heap.o ion_cma_heap.o ion_carveout_heap.o ion_chunk_heap.o ion_cma_heap.o \ ion_system_secure_heap.o obj-$(CONFIG_ION_TEST) += ion_test.o ifdef CONFIG_COMPAT obj-$(CONFIG_ION) += compat_ion.o endif obj-$(CONFIG_ION_DUMMY) += ion_dummy_driver.o obj-$(CONFIG_ION_TEGRA) += tegra/ obj-$(CONFIG_ION_HISI) += hisilicon/ obj-$(CONFIG_ION_MSM) += msm/
drivers/staging/android/ion/compat_ion.c +3 −3 Original line number Diff line number Diff line Loading @@ -137,7 +137,7 @@ long compat_ion_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) data32 = compat_ptr(arg); data = compat_alloc_user_space(sizeof(*data)); if (data == NULL) if (!data) return -EFAULT; err = compat_get_ion_allocation_data(data32, data); Loading @@ -156,7 +156,7 @@ long compat_ion_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) data32 = compat_ptr(arg); data = compat_alloc_user_space(sizeof(*data)); if (data == NULL) if (!data) return -EFAULT; err = compat_get_ion_handle_data(data32, data); Loading @@ -173,7 +173,7 @@ long compat_ion_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) data32 = compat_ptr(arg); data = compat_alloc_user_space(sizeof(*data)); if (data == NULL) if (!data) return -EFAULT; err = compat_get_ion_custom_data(data32, data); Loading
drivers/staging/android/ion/compat_ion.h +3 −0 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ * drivers/staging/android/ion/compat_ion.h * * Copyright (C) 2013 Google, Inc. * Copyright (c) 2016, The Linux Foundation. All rights reserved. * * This software is licensed under the terms of the GNU General Public * License version 2, as published by the Free Software Foundation, and Loading @@ -21,6 +22,8 @@ long compat_ion_ioctl(struct file *filp, unsigned int cmd, unsigned long arg); #define compat_ion_user_handle_t compat_int_t #else #define compat_ion_ioctl NULL Loading