1e652f694SMike Kravetz #ifndef _ASM_GENERIC_HUGETLB_ENCODE_H_
2e652f694SMike Kravetz #define _ASM_GENERIC_HUGETLB_ENCODE_H_
3e652f694SMike Kravetz 
4e652f694SMike Kravetz /*
5e652f694SMike Kravetz  * Several system calls take a flag to request "hugetlb" huge pages.
6e652f694SMike Kravetz  * Without further specification, these system calls will use the
7e652f694SMike Kravetz  * system's default huge page size.  If a system supports multiple
8e652f694SMike Kravetz  * huge page sizes, the desired huge page size can be specified in
9e652f694SMike Kravetz  * bits [26:31] of the flag arguments.  The value in these 6 bits
10e652f694SMike Kravetz  * will encode the log2 of the huge page size.
11e652f694SMike Kravetz  *
12e652f694SMike Kravetz  * The following definitions are associated with this huge page size
13e652f694SMike Kravetz  * encoding in flag arguments.  System call specific header files
14e652f694SMike Kravetz  * that use this encoding should include this file.  They can then
15e652f694SMike Kravetz  * provide definitions based on these with their own specific prefix.
16e652f694SMike Kravetz  * for example:
17e652f694SMike Kravetz  * #define MAP_HUGE_SHIFT HUGETLB_FLAG_ENCODE_SHIFT
18e652f694SMike Kravetz  */
19e652f694SMike Kravetz 
20e652f694SMike Kravetz #define HUGETLB_FLAG_ENCODE_SHIFT	26
21e652f694SMike Kravetz #define HUGETLB_FLAG_ENCODE_MASK	0x3f
22e652f694SMike Kravetz 
23*710bb68cSMatthias Goergens #define HUGETLB_FLAG_ENCODE_16KB	(14U << HUGETLB_FLAG_ENCODE_SHIFT)
24*710bb68cSMatthias Goergens #define HUGETLB_FLAG_ENCODE_64KB	(16U << HUGETLB_FLAG_ENCODE_SHIFT)
25*710bb68cSMatthias Goergens #define HUGETLB_FLAG_ENCODE_512KB	(19U << HUGETLB_FLAG_ENCODE_SHIFT)
26*710bb68cSMatthias Goergens #define HUGETLB_FLAG_ENCODE_1MB		(20U << HUGETLB_FLAG_ENCODE_SHIFT)
27*710bb68cSMatthias Goergens #define HUGETLB_FLAG_ENCODE_2MB		(21U << HUGETLB_FLAG_ENCODE_SHIFT)
28*710bb68cSMatthias Goergens #define HUGETLB_FLAG_ENCODE_8MB		(23U << HUGETLB_FLAG_ENCODE_SHIFT)
29*710bb68cSMatthias Goergens #define HUGETLB_FLAG_ENCODE_16MB	(24U << HUGETLB_FLAG_ENCODE_SHIFT)
30*710bb68cSMatthias Goergens #define HUGETLB_FLAG_ENCODE_32MB	(25U << HUGETLB_FLAG_ENCODE_SHIFT)
31*710bb68cSMatthias Goergens #define HUGETLB_FLAG_ENCODE_256MB	(28U << HUGETLB_FLAG_ENCODE_SHIFT)
32*710bb68cSMatthias Goergens #define HUGETLB_FLAG_ENCODE_512MB	(29U << HUGETLB_FLAG_ENCODE_SHIFT)
33*710bb68cSMatthias Goergens #define HUGETLB_FLAG_ENCODE_1GB		(30U << HUGETLB_FLAG_ENCODE_SHIFT)
34*710bb68cSMatthias Goergens #define HUGETLB_FLAG_ENCODE_2GB		(31U << HUGETLB_FLAG_ENCODE_SHIFT)
35*710bb68cSMatthias Goergens #define HUGETLB_FLAG_ENCODE_16GB	(34U << HUGETLB_FLAG_ENCODE_SHIFT)
36e652f694SMike Kravetz 
37e652f694SMike Kravetz #endif /* _ASM_GENERIC_HUGETLB_ENCODE_H_ */
38