Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _ASM_POWERPC_BOOK3S_64_PGTABLE_64K_H
0003 #define _ASM_POWERPC_BOOK3S_64_PGTABLE_64K_H
0004 
0005 #ifndef __ASSEMBLY__
0006 #ifdef CONFIG_HUGETLB_PAGE
0007 /*
0008  * We have PGD_INDEX_SIZ = 12 and PTE_INDEX_SIZE = 8, so that we can have
0009  * 16GB hugepage pte in PGD and 16MB hugepage pte at PMD;
0010  *
0011  * Defined in such a way that we can optimize away code block at build time
0012  * if CONFIG_HUGETLB_PAGE=n.
0013  *
0014  * returns true for pmd migration entries, THP, devmap, hugetlb
0015  * But compile time dependent on CONFIG_HUGETLB_PAGE
0016  */
0017 static inline int pmd_huge(pmd_t pmd)
0018 {
0019     /*
0020      * leaf pte for huge page
0021      */
0022     return !!(pmd_raw(pmd) & cpu_to_be64(_PAGE_PTE));
0023 }
0024 
0025 static inline int pud_huge(pud_t pud)
0026 {
0027     /*
0028      * leaf pte for huge page
0029      */
0030     return !!(pud_raw(pud) & cpu_to_be64(_PAGE_PTE));
0031 }
0032 
0033 static inline int pgd_huge(pgd_t pgd)
0034 {
0035     /*
0036      * leaf pte for huge page
0037      */
0038     return !!(pgd_raw(pgd) & cpu_to_be64(_PAGE_PTE));
0039 }
0040 #define pgd_huge pgd_huge
0041 
0042 /*
0043  * With 64k page size, we have hugepage ptes in the pgd and pmd entries. We don't
0044  * need to setup hugepage directory for them. Our pte and page directory format
0045  * enable us to have this enabled.
0046  */
0047 static inline int hugepd_ok(hugepd_t hpd)
0048 {
0049     return 0;
0050 }
0051 
0052 #define is_hugepd(pdep)         0
0053 
0054 /*
0055  * This should never get called
0056  */
0057 static inline int get_hugepd_cache_index(int index)
0058 {
0059     BUG();
0060 }
0061 
0062 #endif /* CONFIG_HUGETLB_PAGE */
0063 
0064 static inline int remap_4k_pfn(struct vm_area_struct *vma, unsigned long addr,
0065                    unsigned long pfn, pgprot_t prot)
0066 {
0067     if (radix_enabled())
0068         BUG();
0069     return hash__remap_4k_pfn(vma, addr, pfn, prot);
0070 }
0071 #endif  /* __ASSEMBLY__ */
0072 #endif /*_ASM_POWERPC_BOOK3S_64_PGTABLE_64K_H */