xref: /openbmc/linux/mm/cma.h (revision dbf563ee)
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __MM_CMA_H__
3 #define __MM_CMA_H__
4 
5 #include <linux/debugfs.h>
6 
7 #define CMA_MAX_NAME 64
8 
9 struct cma {
10 	unsigned long   base_pfn;
11 	unsigned long   count;
12 	unsigned long   *bitmap;
13 	unsigned int order_per_bit; /* Order of pages represented by one bit */
14 	struct mutex    lock;
15 #ifdef CONFIG_CMA_DEBUGFS
16 	struct hlist_head mem_head;
17 	spinlock_t mem_head_lock;
18 	struct debugfs_u32_array dfs_bitmap;
19 #endif
20 	char name[CMA_MAX_NAME];
21 };
22 
23 extern struct cma cma_areas[MAX_CMA_AREAS];
24 extern unsigned cma_area_count;
25 
26 static inline unsigned long cma_bitmap_maxno(struct cma *cma)
27 {
28 	return cma->count >> cma->order_per_bit;
29 }
30 
31 #endif
32