hugetlbpage.c (d053cf0d771f6547cb0537759a9af63cf402908d) hugetlbpage.c (ae94da898133947c2d1f005da10838478e4548db)
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * IA-32 Huge TLB Page Support for Kernel.
4 *
5 * Copyright (C) 2002, Rohit Seth <rohit.seth@intel.com>
6 */
7
8#include <linux/init.h>

--- 167 unchanged lines hidden (view full) ---

176 pgoff, flags);
177 else
178 return hugetlb_get_unmapped_area_topdown(file, addr, len,
179 pgoff, flags);
180}
181#endif /* CONFIG_HUGETLB_PAGE */
182
183#ifdef CONFIG_X86_64
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * IA-32 Huge TLB Page Support for Kernel.
4 *
5 * Copyright (C) 2002, Rohit Seth <rohit.seth@intel.com>
6 */
7
8#include <linux/init.h>

--- 167 unchanged lines hidden (view full) ---

176 pgoff, flags);
177 else
178 return hugetlb_get_unmapped_area_topdown(file, addr, len,
179 pgoff, flags);
180}
181#endif /* CONFIG_HUGETLB_PAGE */
182
183#ifdef CONFIG_X86_64
184bool __init arch_hugetlb_valid_size(unsigned long size)
185{
186 if (size == PMD_SIZE)
187 return true;
188 else if (size == PUD_SIZE && boot_cpu_has(X86_FEATURE_GBPAGES))
189 return true;
190 else
191 return false;
192}
193
184static __init int setup_hugepagesz(char *opt)
185{
186 unsigned long ps = memparse(opt, &opt);
194static __init int setup_hugepagesz(char *opt)
195{
196 unsigned long ps = memparse(opt, &opt);
187 if (ps == PMD_SIZE) {
188 hugetlb_add_hstate(PMD_SHIFT - PAGE_SHIFT);
189 } else if (ps == PUD_SIZE && boot_cpu_has(X86_FEATURE_GBPAGES)) {
190 hugetlb_add_hstate(PUD_SHIFT - PAGE_SHIFT);
197
198 if (arch_hugetlb_valid_size(ps)) {
199 hugetlb_add_hstate(ilog2(ps) - PAGE_SHIFT);
191 } else {
192 hugetlb_bad_size();
193 printk(KERN_ERR "hugepagesz: Unsupported page size %lu M\n",
194 ps >> 20);
195 return 0;
196 }
197 return 1;
198}

--- 13 unchanged lines hidden ---
200 } else {
201 hugetlb_bad_size();
202 printk(KERN_ERR "hugepagesz: Unsupported page size %lu M\n",
203 ps >> 20);
204 return 0;
205 }
206 return 1;
207}

--- 13 unchanged lines hidden ---