125981136fb13bcacf5f475f3e0ec750341e1e671Christopher Ferris#ifndef _ASM_GENERIC_HUGETLB_ENCODE_H_
225981136fb13bcacf5f475f3e0ec750341e1e671Christopher Ferris#define _ASM_GENERIC_HUGETLB_ENCODE_H_
325981136fb13bcacf5f475f3e0ec750341e1e671Christopher Ferris
425981136fb13bcacf5f475f3e0ec750341e1e671Christopher Ferris/*
525981136fb13bcacf5f475f3e0ec750341e1e671Christopher Ferris * Several system calls take a flag to request "hugetlb" huge pages.
625981136fb13bcacf5f475f3e0ec750341e1e671Christopher Ferris * Without further specification, these system calls will use the
725981136fb13bcacf5f475f3e0ec750341e1e671Christopher Ferris * system's default huge page size.  If a system supports multiple
825981136fb13bcacf5f475f3e0ec750341e1e671Christopher Ferris * huge page sizes, the desired huge page size can be specified in
925981136fb13bcacf5f475f3e0ec750341e1e671Christopher Ferris * bits [26:31] of the flag arguments.  The value in these 6 bits
1025981136fb13bcacf5f475f3e0ec750341e1e671Christopher Ferris * will encode the log2 of the huge page size.
1125981136fb13bcacf5f475f3e0ec750341e1e671Christopher Ferris *
1225981136fb13bcacf5f475f3e0ec750341e1e671Christopher Ferris * The following definitions are associated with this huge page size
1325981136fb13bcacf5f475f3e0ec750341e1e671Christopher Ferris * encoding in flag arguments.  System call specific header files
1425981136fb13bcacf5f475f3e0ec750341e1e671Christopher Ferris * that use this encoding should include this file.  They can then
1525981136fb13bcacf5f475f3e0ec750341e1e671Christopher Ferris * provide definitions based on these with their own specific prefix.
1625981136fb13bcacf5f475f3e0ec750341e1e671Christopher Ferris * for example:
1725981136fb13bcacf5f475f3e0ec750341e1e671Christopher Ferris * #define MAP_HUGE_SHIFT HUGETLB_FLAG_ENCODE_SHIFT
1825981136fb13bcacf5f475f3e0ec750341e1e671Christopher Ferris */
1925981136fb13bcacf5f475f3e0ec750341e1e671Christopher Ferris
2025981136fb13bcacf5f475f3e0ec750341e1e671Christopher Ferris#define HUGETLB_FLAG_ENCODE_SHIFT	26
2125981136fb13bcacf5f475f3e0ec750341e1e671Christopher Ferris#define HUGETLB_FLAG_ENCODE_MASK	0x3f
2225981136fb13bcacf5f475f3e0ec750341e1e671Christopher Ferris
2325981136fb13bcacf5f475f3e0ec750341e1e671Christopher Ferris#define HUGETLB_FLAG_ENCODE_64KB	(16 << HUGETLB_FLAG_ENCODE_SHIFT)
2425981136fb13bcacf5f475f3e0ec750341e1e671Christopher Ferris#define HUGETLB_FLAG_ENCODE_512KB	(19 << HUGETLB_FLAG_ENCODE_SHIFT)
2525981136fb13bcacf5f475f3e0ec750341e1e671Christopher Ferris#define HUGETLB_FLAG_ENCODE_1MB		(20 << HUGETLB_FLAG_ENCODE_SHIFT)
2625981136fb13bcacf5f475f3e0ec750341e1e671Christopher Ferris#define HUGETLB_FLAG_ENCODE_2MB		(21 << HUGETLB_FLAG_ENCODE_SHIFT)
2725981136fb13bcacf5f475f3e0ec750341e1e671Christopher Ferris#define HUGETLB_FLAG_ENCODE_8MB		(23 << HUGETLB_FLAG_ENCODE_SHIFT)
2825981136fb13bcacf5f475f3e0ec750341e1e671Christopher Ferris#define HUGETLB_FLAG_ENCODE_16MB	(24 << HUGETLB_FLAG_ENCODE_SHIFT)
2925981136fb13bcacf5f475f3e0ec750341e1e671Christopher Ferris#define HUGETLB_FLAG_ENCODE_256MB	(28 << HUGETLB_FLAG_ENCODE_SHIFT)
3025981136fb13bcacf5f475f3e0ec750341e1e671Christopher Ferris#define HUGETLB_FLAG_ENCODE_1GB		(30 << HUGETLB_FLAG_ENCODE_SHIFT)
3125981136fb13bcacf5f475f3e0ec750341e1e671Christopher Ferris#define HUGETLB_FLAG_ENCODE_2GB		(31 << HUGETLB_FLAG_ENCODE_SHIFT)
3225981136fb13bcacf5f475f3e0ec750341e1e671Christopher Ferris#define HUGETLB_FLAG_ENCODE_16GB	(34 << HUGETLB_FLAG_ENCODE_SHIFT)
3325981136fb13bcacf5f475f3e0ec750341e1e671Christopher Ferris
3425981136fb13bcacf5f475f3e0ec750341e1e671Christopher Ferris#endif /* _ASM_GENERIC_HUGETLB_ENCODE_H_ */
35