1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef _LINUX_HUGETLB_CMA_H
3 #define _LINUX_HUGETLB_CMA_H
4
5 #ifdef CONFIG_CMA
6 void hugetlb_cma_free_folio(struct folio *folio);
7 struct folio *hugetlb_cma_alloc_folio(struct hstate *h, gfp_t gfp_mask,
8 int nid, nodemask_t *nodemask);
9 struct huge_bootmem_page *hugetlb_cma_alloc_bootmem(struct hstate *h, int *nid,
10 bool node_exact);
11 void hugetlb_cma_check(void);
12 bool hugetlb_cma_exclusive_alloc(void);
13 unsigned long hugetlb_cma_total_size(void);
14 void hugetlb_cma_validate_params(void);
15 bool hugetlb_early_cma(struct hstate *h);
16 #else
hugetlb_cma_free_folio(struct folio * folio)17 static inline void hugetlb_cma_free_folio(struct folio *folio)
18 {
19 }
20
hugetlb_cma_alloc_folio(struct hstate * h,gfp_t gfp_mask,int nid,nodemask_t * nodemask)21 static inline struct folio *hugetlb_cma_alloc_folio(struct hstate *h,
22 gfp_t gfp_mask, int nid, nodemask_t *nodemask)
23 {
24 return NULL;
25 }
26
27 static inline
hugetlb_cma_alloc_bootmem(struct hstate * h,int * nid,bool node_exact)28 struct huge_bootmem_page *hugetlb_cma_alloc_bootmem(struct hstate *h, int *nid,
29 bool node_exact)
30 {
31 return NULL;
32 }
33
hugetlb_cma_check(void)34 static inline void hugetlb_cma_check(void)
35 {
36 }
37
hugetlb_cma_exclusive_alloc(void)38 static inline bool hugetlb_cma_exclusive_alloc(void)
39 {
40 return false;
41 }
42
hugetlb_cma_total_size(void)43 static inline unsigned long hugetlb_cma_total_size(void)
44 {
45 return 0;
46 }
47
hugetlb_cma_validate_params(void)48 static inline void hugetlb_cma_validate_params(void)
49 {
50 }
51
hugetlb_early_cma(struct hstate * h)52 static inline bool hugetlb_early_cma(struct hstate *h)
53 {
54 return false;
55 }
56 #endif
57 #endif
58