hugetlbfs: add arch_hugetlb_valid_size
[linux-2.6-microblaze.git] / arch / arm64 / mm / hugetlbpage.c
index 0be3355..2ac41ce 100644 (file)
@@ -464,17 +464,26 @@ static int __init hugetlbpage_init(void)
 }
 arch_initcall(hugetlbpage_init);
 
-static __init int setup_hugepagesz(char *opt)
+bool __init arch_hugetlb_valid_size(unsigned long size)
 {
-       unsigned long ps = memparse(opt, &opt);
-
-       switch (ps) {
+       switch (size) {
 #ifdef CONFIG_ARM64_4K_PAGES
        case PUD_SIZE:
 #endif
        case CONT_PMD_SIZE:
        case PMD_SIZE:
        case CONT_PTE_SIZE:
+               return true;
+       }
+
+       return false;
+}
+
+static __init int setup_hugepagesz(char *opt)
+{
+       unsigned long ps = memparse(opt, &opt);
+
+       if (arch_hugetlb_valid_size(ps)) {
                add_huge_page_size(ps);
                return 1;
        }