2 * arch/arm64/mm/hugetlbpage.c
4 * Copyright (C) 2013 Linaro Ltd.
6 * Based on arch/x86/mm/hugetlbpage.c.
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 #include <linux/init.h>
25 #include <linux/hugetlb.h>
26 #include <linux/pagemap.h>
27 #include <linux/err.h>
28 #include <linux/sysctl.h>
31 #include <asm/tlbflush.h>
32 #include <asm/pgalloc.h>
34 int pmd_huge(pmd_t pmd)
36 return !(pmd_val(pmd) & PMD_TABLE_BIT);
39 int pud_huge(pud_t pud)
41 #ifndef __PAGETABLE_PMD_FOLDED
42 return !(pud_val(pud) & PUD_TABLE_BIT);
48 static __init int setup_hugepagesz(char *opt)
50 unsigned long ps = memparse(opt, &opt);
52 hugetlb_add_hstate(PMD_SHIFT - PAGE_SHIFT);
53 } else if (ps == PUD_SIZE) {
54 hugetlb_add_hstate(PUD_SHIFT - PAGE_SHIFT);
56 pr_err("hugepagesz: Unsupported page size %lu M\n", ps >> 20);
61 __setup("hugepagesz=", setup_hugepagesz);