| /OK3568_Linux_fs/kernel/mm/ |
| H A D | cma_debug.c | 3 * CMA DebugFS Interface 10 #include <linux/cma.h> 16 #include "cma.h" 36 struct cma *cma = data; in cma_used_get() local 39 mutex_lock(&cma->lock); in cma_used_get() 41 used = bitmap_weight(cma->bitmap, (int)cma_bitmap_maxno(cma)); in cma_used_get() 42 mutex_unlock(&cma->lock); in cma_used_get() 43 *val = (u64)used << cma->order_per_bit; in cma_used_get() 51 struct cma *cma = data; in cma_maxchunk_get() local 54 unsigned long bitmap_maxno = cma_bitmap_maxno(cma); in cma_maxchunk_get() [all …]
|
| H A D | cma.c | 15 #define pr_fmt(fmt) "cma: " fmt 32 #include <linux/cma.h> 38 #include <trace/events/cma.h> 43 #include "cma.h" 48 struct cma cma_areas[MAX_CMA_AREAS]; 52 phys_addr_t cma_get_base(const struct cma *cma) in cma_get_base() argument 54 return PFN_PHYS(cma->base_pfn); in cma_get_base() 57 unsigned long cma_get_size(const struct cma *cma) in cma_get_size() argument 59 return cma->count << PAGE_SHIFT; in cma_get_size() 62 const char *cma_get_name(const struct cma *cma) in cma_get_name() argument [all …]
|
| H A D | cma_sysfs.c | 3 * CMA SysFS Interface 8 #include <linux/cma.h> 13 #include "cma.h" 20 void cma_sysfs_account_success_pages(struct cma *cma, unsigned long nr_pages) in cma_sysfs_account_success_pages() argument 22 atomic64_add(nr_pages, &cma->nr_pages_succeeded); in cma_sysfs_account_success_pages() 25 void cma_sysfs_account_fail_pages(struct cma *cma, unsigned long nr_pages) in cma_sysfs_account_fail_pages() argument 27 atomic64_add(nr_pages, &cma->nr_pages_failed); in cma_sysfs_account_fail_pages() 30 static inline struct cma *cma_from_kobj(struct kobject *kobj) in cma_from_kobj() 32 return container_of(kobj, struct cma_kobject, kobj)->cma; in cma_from_kobj() 38 struct cma *cma = cma_from_kobj(kobj); in alloc_pages_success_show() local [all …]
|
| H A D | cma.h | 11 struct cma *cma; member 14 struct cma { struct 27 /* the number of CMA page successful allocations */ 29 /* the number of CMA page allocation failures */ 37 extern struct cma cma_areas[MAX_CMA_AREAS]; argument 40 static inline unsigned long cma_bitmap_maxno(struct cma *cma) in cma_bitmap_maxno() argument 42 return cma->count >> cma->order_per_bit; in cma_bitmap_maxno() 46 void cma_sysfs_account_success_pages(struct cma *cma, unsigned long nr_pages); 47 void cma_sysfs_account_fail_pages(struct cma *cma, unsigned long nr_pages); 49 static inline void cma_sysfs_account_success_pages(struct cma *cma, in cma_sysfs_account_success_pages() argument [all …]
|
| H A D | cma_debug_bitmap_hex.c | 3 * CMA DebugFS Interface 14 #include <linux/cma.h> 20 #include "cma.h" 94 static int cma_debugfs_add_one(struct cma *cma, struct dentry *root_dentry) in cma_debugfs_add_one() argument 99 scnprintf(name, sizeof(name), "cma-%s", cma->name); in cma_debugfs_add_one() 105 debugfs_create_u32_array_hex("bitmap_hex", 0444, tmp, &cma->dfs_bitmap); in cma_debugfs_add_one() 116 cma_debugfs_root = debugfs_lookup("cma", NULL); in rk_cma_debugfs_init()
|
| H A D | Kconfig | 262 depends on (NUMA || ARCH_ENABLE_MEMORY_HOTREMOVE || COMPACTION || CMA) && MMU 278 def_bool (MEMORY_ISOLATION && COMPACTION) || CMA 486 config CMA config 494 CMA reserves a region of memory and allows only movable pages to 502 bool "CMA not active to system" 503 depends on CMA 505 This forbids the CMA to active its pages to system memory, to keep 506 page from CMA never be borrowed by system. 511 bool "CMA debug messages (DEVELOPMENT)" 512 depends on DEBUG_KERNEL && CMA [all …]
|
| /OK3568_Linux_fs/kernel/drivers/soc/rockchip/ |
| H A D | rk_cma_procfs.c | 3 * CMA ProcFS Interface 8 #include <linux/cma.h> 14 #include "../../../mm/cma.h" 30 static void cma_procfs_show_bitmap(struct seq_file *s, struct cma *cma) in cma_procfs_show_bitmap() argument 32 int elements = DIV_ROUND_UP(cma_bitmap_maxno(cma), BITS_PER_BYTE * sizeof(u32)); in cma_procfs_show_bitmap() 34 u32 *array = (u32 *)cma->bitmap; in cma_procfs_show_bitmap() 48 static u64 cma_procfs_used_get(struct cma *cma) in cma_procfs_used_get() argument 52 mutex_lock(&cma->lock); in cma_procfs_used_get() 53 used = bitmap_weight(cma->bitmap, (int)cma_bitmap_maxno(cma)); in cma_procfs_used_get() 54 mutex_unlock(&cma->lock); in cma_procfs_used_get() [all …]
|
| /OK3568_Linux_fs/kernel/include/linux/ |
| H A D | cma.h | 10 * There is always at least global CMA area and a few optional 23 struct cma; 35 extern phys_addr_t cma_get_base(const struct cma *cma); 36 extern unsigned long cma_get_size(const struct cma *cma); 37 extern const char *cma_get_name(const struct cma *cma); 42 bool fixed, const char *name, struct cma **res_cma, 47 bool fixed, const char *name, struct cma **res_cma) in cma_declare_contiguous() 55 struct cma **res_cma); 56 extern struct page *cma_alloc(struct cma *cma, size_t count, unsigned int align, 58 extern bool cma_release(struct cma *cma, const struct page *pages, unsigned int count); [all …]
|
| /OK3568_Linux_fs/kernel/kernel/dma/ |
| H A D | contiguous.c | 11 * The Contiguous Memory Allocator (CMA) makes it possible to 32 * CMA tries to solve this issue by operating on memory regions 38 #define pr_fmt(fmt) "cma: " fmt 52 #include <linux/cma.h> 61 struct cma *dma_contiguous_default_area; 65 * Default global CMA area size can be defined in kernel's .config. 71 * Users, who want to set the size of global CMA area for their system 72 * should use cma= kernel parameter. 99 early_param("cma", early_cma); 103 static struct cma *dma_contiguous_pernuma_area[MAX_NUMNODES]; [all …]
|
| H A D | Kconfig | 112 depends on HAVE_DMA_CONTIGUOUS && CMA 118 You can disable CMA by specifying "cma=0" on the kernel's command 130 Enable this option to get pernuma CMA areas so that devices like 133 You can set the size of pernuma CMA by specifying "cma_pernuma=size" 145 Memory Allocator. If the size of 0 is selected, CMA is disabled by 146 default, but it can be enabled by passing cma=size[MG] to the kernel. 157 If 0 percent is selected, CMA is disabled by default, but it can be 158 enabled by passing cma=size[MG] to the kernel.
|
| H A D | pool.c | 6 #include <linux/cma.h> 63 struct cma *cma; in cma_in_zone() local 65 cma = dev_get_cma_area(NULL); in cma_in_zone() 66 if (!cma) in cma_in_zone() 69 size = cma_get_size(cma); in cma_in_zone() 73 /* CMA can't cross zone boundaries, see cma_activate_area() */ in cma_in_zone() 74 end = cma_get_base(cma) + size - 1; in cma_in_zone()
|
| /OK3568_Linux_fs/kernel/Documentation/admin-guide/mm/ |
| H A D | cma_debugfs.rst | 2 CMA Debugfs Interface 5 The CMA debugfs interface is useful to retrieve basic information out of the 6 different CMA areas and to test allocation/release in each of the areas. 8 Each CMA zone represents a directory under <debugfs>/cma/, indexed by the 9 kernel's CMA index. So the first CMA zone would be: 11 <debugfs>/cma/cma-0 16 - [RO] count: Amount of memory in the CMA area. 19 - [WO] alloc: Allocate N pages from that CMA area. For example:: 21 echo 5 > <debugfs>/cma/cma-2/alloc 23 would try to allocate 5 pages from the cma-2 area. [all …]
|
| /OK3568_Linux_fs/kernel/Documentation/ABI/testing/ |
| H A D | sysfs-kernel-mm-cma | 1 What: /sys/kernel/mm/cma/ 5 /sys/kernel/mm/cma/ contains a subdirectory for each CMA 6 heap name (also sometimes called CMA areas). 8 Each CMA heap subdirectory (that is, each 9 /sys/kernel/mm/cma/<cma-heap-name> directory) contains the 15 What: /sys/kernel/mm/cma/<cma-heap-name>/alloc_pages_success 19 the number of pages CMA API succeeded to allocate 21 What: /sys/kernel/mm/cma/<cma-heap-name>/alloc_pages_fail 25 the number of pages CMA API failed to allocate
|
| /OK3568_Linux_fs/kernel/drivers/dma-buf/rk_heaps/ |
| H A D | rk-cma-heap.c | 3 * DMABUF CMA heap exporter 16 #include <linux/cma.h> 29 #include "../../../mm/cma.h" 34 struct cma *cma; member 400 cma_release(cma_heap->cma, buffer->cma_pages, buffer->pagecount); in rk_cma_heap_dma_buf_release() 450 cma_pages = cma_alloc(cma_heap->cma, pagecount, align, GFP_KERNEL); in rk_cma_heap_allocate() 454 /* Clear the cma pages */ in rk_cma_heap_allocate() 521 cma_release(cma_heap->cma, cma_pages, pagecount); in rk_cma_heap_allocate() 541 page = cma_alloc(cma_heap->cma, pagecount, align, GFP_KERNEL); in rk_cma_heap_allocate_pages() 547 cma_release(cma_heap->cma, page, pagecount); in rk_cma_heap_allocate_pages() [all …]
|
| H A D | rk-dma-cma.c | 3 * Early setup for Rockchip DMA CMA 9 #include <linux/cma.h> 19 static struct cma *rk_dma_heap_cma; 60 PAGE_SIZE, 0, fix, "rk-dma-heap-cma", in rk_dma_heap_cma_setup() 74 struct cma *rk_dma_heap_get_cma(void) in rk_dma_heap_get_cma()
|
| H A D | Makefile | 3 rk-cma-heap-objs := rk-dma-cma.o rk-cma-heap.o 6 obj-$(CONFIG_DMABUF_HEAPS_ROCKCHIP_CMA_HEAP) += rk-cma-heap.o
|
| H A D | Kconfig | 12 tristate "DMA-BUF RockChip CMA Heap" 15 Choose this option to enable dma-buf RockChip CMA heap. This heap is backed 16 by the Contiguous Memory Allocator (CMA). If your system has these 20 int "Maximum PAGE_SIZE order of alignment for RockChip CMA Heap"
|
| /OK3568_Linux_fs/kernel/drivers/staging/android/ion/heaps/ |
| H A D | ion_cma_heap.c | 3 * ION Memory Allocator CMA heap exporter 14 #include <linux/cma.h> 20 struct cma *cma; member 25 /* ION CMA heap operations functions */ 41 pages = cma_alloc(cma_heap->cma, nr_pages, align, false); in ion_cma_allocate() 81 cma_release(cma_heap->cma, pages, nr_pages); in ion_cma_allocate() 92 cma_release(cma_heap->cma, pages, nr_pages); in ion_cma_free() 103 static int __ion_add_cma_heap(struct cma *cma, void *data) in __ion_add_cma_heap() argument 115 cma_heap->heap.name = cma_get_name(cma); in __ion_add_cma_heap() 121 cma_heap->cma = cma; in __ion_add_cma_heap() [all …]
|
| H A D | Kconfig | 10 tristate "Ion CMA heap support" 13 Choose this option to enable CMA heaps with Ion. This heap is backed 14 by the Contiguous Memory Allocator (CMA). If your system has these
|
| /OK3568_Linux_fs/kernel/drivers/gpu/drm/ |
| H A D | drm_gem_cma_helper.c | 3 * drm gem CMA (contiguous memory allocator) helper functions 26 * DOC: cma helpers 31 * The DRM GEM/CMA helpers use this allocator as a means to provide buffer 37 * __drm_gem_cma_create - Create a GEM CMA object without allocating memory 41 * This function creates and initializes a GEM CMA object of the given size, 85 * This function creates a CMA GEM object and allocates a contiguous chunk of 130 * This function creates a CMA GEM object, allocating a physically contiguous 167 * drm_gem_cma_free_object - free resources associated with a CMA GEM object 170 * This function frees the backing memory of the CMA GEM object, cleans up the 173 * Drivers using the CMA helpers should set this as their [all …]
|
| H A D | drm_fb_cma_helper.c | 3 * drm kms/fb cma (contiguous memory allocator) helper functions 21 * DOC: framebuffer cma helper functions 23 * Provides helper functions for creating a cma (contiguous memory allocator) 27 * callback function to create a cma backed framebuffer. 31 * drm_fb_cma_get_gem_obj() - Get CMA GEM object for framebuffer 35 * Return the CMA GEM object for given framebuffer. 59 * Return the CMA GEM address for given framebuffer.
|
| /OK3568_Linux_fs/kernel/drivers/dma-buf/heaps/ |
| H A D | cma_heap.c | 3 * DMABUF CMA heap exporter 12 #include <linux/cma.h> 28 struct cma *cma; member 256 cma_release(cma_heap->cma, buffer->cma_pages, buffer->pagecount); in cma_heap_dma_buf_release() 300 cma_pages = cma_alloc(cma_heap->cma, pagecount, align, GFP_KERNEL); in cma_heap_allocate() 304 /* Clear the cma pages */ in cma_heap_allocate() 357 cma_release(cma_heap->cma, cma_pages, pagecount); in cma_heap_allocate() 368 static int __add_cma_heap(struct cma *cma, void *data) in __add_cma_heap() argument 376 cma_heap->cma = cma; in __add_cma_heap() 378 exp_info.name = cma_get_name(cma); in __add_cma_heap() [all …]
|
| H A D | rk_cma_heap.c | 3 * DMABUF CMA heap exporter 15 #include <linux/cma.h> 31 struct cma *cma; member 326 cma_release(cma_heap->cma, buffer->cma_pages, buffer->pagecount); in cma_heap_dma_buf_release() 377 cma_pages = cma_alloc(cma_heap->cma, pagecount, align, GFP_KERNEL); in cma_heap_do_allocate() 381 /* Clear the cma pages */ in cma_heap_do_allocate() 441 cma_release(cma_heap->cma, cma_pages, pagecount); in cma_heap_do_allocate() 544 static int __add_cma_heap(struct cma *cma, void *data) in __add_cma_heap() argument 553 cma_heap->cma = cma; in __add_cma_heap() 555 exp_info.name = "cma"; in __add_cma_heap() [all …]
|
| /OK3568_Linux_fs/kernel/include/drm/ |
| H A D | drm_gem_cma_helper.h | 12 * struct drm_gem_cma_object - GEM object backed by CMA memory allocations 25 /* For objects with DMA memory allocated by GEM CMA */ 40 * DEFINE_DRM_GEM_CMA_FOPS() - macro to generate file operations for CMA drivers 43 * This macro autogenerates a suitable &struct file_operations for CMA based 113 * DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE - CMA GEM driver operations 134 * DRM_GEM_CMA_DRIVER_OPS - CMA GEM driver operations 149 * DRM_GEM_CMA_DRIVER_OPS_VMAP_WITH_DUMB_CREATE - CMA GEM driver operations 173 * DRM_GEM_CMA_DRIVER_OPS_VMAP - CMA GEM driver operations ensuring a virtual
|
| /OK3568_Linux_fs/kernel/Documentation/devicetree/bindings/staging/ion/ |
| H A D | rockchip-ion.txt | 7 - cma-heap: Allocate continous physicall region. 9 - reg0: base address of cma region 10 - reg1: size of cma region 19 cma-heap {
|