Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Sasha Levin | 28b24c1 | 2015-04-14 15:44:57 -0700 | [diff] [blame] | 2 | #ifndef __MM_CMA_H__ |
| 3 | #define __MM_CMA_H__ |
| 4 | |
Jakub Kicinski | a2b992c | 2020-07-09 17:42:44 -0700 | [diff] [blame] | 5 | #include <linux/debugfs.h> |
| 6 | |
Barry Song | 18e98e5 | 2020-08-11 18:31:57 -0700 | [diff] [blame^] | 7 | #define CMA_MAX_NAME 64 |
| 8 | |
Sasha Levin | 28b24c1 | 2015-04-14 15:44:57 -0700 | [diff] [blame] | 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; |
Sasha Levin | 26b02a1 | 2015-04-14 15:44:59 -0700 | [diff] [blame] | 15 | #ifdef CONFIG_CMA_DEBUGFS |
| 16 | struct hlist_head mem_head; |
| 17 | spinlock_t mem_head_lock; |
Jakub Kicinski | a2b992c | 2020-07-09 17:42:44 -0700 | [diff] [blame] | 18 | struct debugfs_u32_array dfs_bitmap; |
Sasha Levin | 26b02a1 | 2015-04-14 15:44:59 -0700 | [diff] [blame] | 19 | #endif |
Barry Song | 18e98e5 | 2020-08-11 18:31:57 -0700 | [diff] [blame^] | 20 | char name[CMA_MAX_NAME]; |
Sasha Levin | 28b24c1 | 2015-04-14 15:44:57 -0700 | [diff] [blame] | 21 | }; |
| 22 | |
| 23 | extern struct cma cma_areas[MAX_CMA_AREAS]; |
| 24 | extern unsigned cma_area_count; |
| 25 | |
Gregory Fong | f21838e | 2015-08-14 15:35:21 -0700 | [diff] [blame] | 26 | static inline unsigned long cma_bitmap_maxno(struct cma *cma) |
Sasha Levin | 28b24c1 | 2015-04-14 15:44:57 -0700 | [diff] [blame] | 27 | { |
| 28 | return cma->count >> cma->order_per_bit; |
| 29 | } |
| 30 | |
| 31 | #endif |