]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/blame - arch/powerpc/include/asm/book3s/64/pgtable-4k.h
License cleanup: add SPDX GPL-2.0 license identifier to files with no license
[mirror_ubuntu-focal-kernel.git] / arch / powerpc / include / asm / book3s / 64 / pgtable-4k.h
CommitLineData
b2441318 1/* SPDX-License-Identifier: GPL-2.0 */
a9252aae
AK
2#ifndef _ASM_POWERPC_BOOK3S_64_PGTABLE_4K_H
3#define _ASM_POWERPC_BOOK3S_64_PGTABLE_4K_H
4/*
5 * hash 4k can't share hugetlb and also doesn't support THP
6 */
c0a6c719
AK
7#ifndef __ASSEMBLY__
8#ifdef CONFIG_HUGETLB_PAGE
9static inline int pmd_huge(pmd_t pmd)
10{
11 /*
12 * leaf pte for huge page
13 */
14 if (radix_enabled())
66c570f5 15 return !!(pmd_raw(pmd) & cpu_to_be64(_PAGE_PTE));
c0a6c719
AK
16 return 0;
17}
18
19static inline int pud_huge(pud_t pud)
20{
21 /*
22 * leaf pte for huge page
23 */
24 if (radix_enabled())
66c570f5 25 return !!(pud_raw(pud) & cpu_to_be64(_PAGE_PTE));
c0a6c719
AK
26 return 0;
27}
28
29static inline int pgd_huge(pgd_t pgd)
30{
31 /*
32 * leaf pte for huge page
33 */
34 if (radix_enabled())
66c570f5 35 return !!(pgd_raw(pgd) & cpu_to_be64(_PAGE_PTE));
c0a6c719
AK
36 return 0;
37}
38#define pgd_huge pgd_huge
39/*
40 * With radix , we have hugepage ptes in the pud and pmd entries. We don't
41 * need to setup hugepage directory for them. Our pte and page directory format
42 * enable us to have this enabled.
43 */
44static inline int hugepd_ok(hugepd_t hpd)
45{
46 if (radix_enabled())
47 return 0;
48 return hash__hugepd_ok(hpd);
49}
50#define is_hugepd(hpd) (hugepd_ok(hpd))
aad71e39
ME
51
52#else /* !CONFIG_HUGETLB_PAGE */
53static inline int pmd_huge(pmd_t pmd) { return 0; }
54static inline int pud_huge(pud_t pud) { return 0; }
c0a6c719 55#endif /* CONFIG_HUGETLB_PAGE */
aad71e39 56
c0a6c719 57#endif /* __ASSEMBLY__ */
a9252aae
AK
58
59#endif /*_ASM_POWERPC_BOOK3S_64_PGTABLE_4K_H */