treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / arch / powerpc / include / asm / book3s / 64 / pgtable-4k.h
blob4e697bc2f4cde914db1ef09732764f8500b158a7
1 /* SPDX-License-Identifier: GPL-2.0 */
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 */
7 #ifndef __ASSEMBLY__
8 #ifdef CONFIG_HUGETLB_PAGE
9 static inline int pmd_huge(pmd_t pmd)
12 * leaf pte for huge page
14 if (radix_enabled())
15 return !!(pmd_raw(pmd) & cpu_to_be64(_PAGE_PTE));
16 return 0;
19 static inline int pud_huge(pud_t pud)
22 * leaf pte for huge page
24 if (radix_enabled())
25 return !!(pud_raw(pud) & cpu_to_be64(_PAGE_PTE));
26 return 0;
29 static inline int pgd_huge(pgd_t pgd)
32 * leaf pte for huge page
34 if (radix_enabled())
35 return !!(pgd_raw(pgd) & cpu_to_be64(_PAGE_PTE));
36 return 0;
38 #define pgd_huge pgd_huge
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.
44 static inline int hugepd_ok(hugepd_t hpd)
46 if (radix_enabled())
47 return 0;
48 return hash__hugepd_ok(hpd);
50 #define is_hugepd(hpd) (hugepd_ok(hpd))
53 * 16M and 16G huge page directory tables are allocated from slab cache
56 #define H_16M_CACHE_INDEX (PAGE_SHIFT + H_PTE_INDEX_SIZE + H_PMD_INDEX_SIZE - 24)
57 #define H_16G_CACHE_INDEX \
58 (PAGE_SHIFT + H_PTE_INDEX_SIZE + H_PMD_INDEX_SIZE + H_PUD_INDEX_SIZE - 34)
60 static inline int get_hugepd_cache_index(int index)
62 switch (index) {
63 case H_16M_CACHE_INDEX:
64 return HTLB_16M_INDEX;
65 case H_16G_CACHE_INDEX:
66 return HTLB_16G_INDEX;
67 default:
68 BUG();
70 /* should not reach */
73 #endif /* CONFIG_HUGETLB_PAGE */
75 #endif /* __ASSEMBLY__ */
77 #endif /*_ASM_POWERPC_BOOK3S_64_PGTABLE_4K_H */