• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __GCMA_H__
3 #define __GCMA_H__
4 
5 #include <linux/types.h>
6 
7 #ifdef CONFIG_GCMA
8 enum gcma_stat_type {
9 	ALLOCATED_PAGE,
10 	STORED_PAGE,
11 	LOADED_PAGE,
12 	EVICTED_PAGE,
13 	CACHED_PAGE,
14 	DISCARDED_PAGE,
15 	TOTAL_PAGE,
16 	NUM_OF_GCMA_STAT,
17 };
18 
19 #ifdef CONFIG_GCMA_SYSFS
20 u64 gcma_stat_get(enum gcma_stat_type type);
21 #else
gcma_stat_get(enum gcma_stat_type type)22 static inline u64 gcma_stat_get(enum gcma_stat_type type) { return 0; }
23 #endif
24 
25 /*
26  * NOTE: allocated pages are still marked reserved and when freeing them
27  * the caller should ensure they are isolated and not referenced by anyone
28  * other than the caller.
29  */
30 extern void gcma_alloc_range(unsigned long start_pfn, unsigned long end_pfn);
31 extern void gcma_free_range(unsigned long start_pfn, unsigned long end_pfn);
32 extern int register_gcma_area(const char *name, phys_addr_t base,
33 				phys_addr_t size);
34 #else
gcma_alloc_range(unsigned long start_pfn,unsigned long end_pfn)35 static inline void gcma_alloc_range(unsigned long start_pfn,
36 				    unsigned long end_pfn) {}
gcma_free_range(unsigned long start_pfn,unsigned long end_pfn)37 static inline void gcma_free_range(unsigned long start_pfn,
38 				   unsigned long end_pfn) {}
register_gcma_area(const char * name,phys_addr_t base,phys_addr_t size)39 static inline int register_gcma_area(const char *name, phys_addr_t base,
40 				     phys_addr_t size) { return -EINVAL; }
41 #endif
42 
43 #endif
44