Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _ASM_POWERPC_NOHASH_HUGETLB_BOOK3E_H
0003 #define _ASM_POWERPC_NOHASH_HUGETLB_BOOK3E_H
0004 
0005 static inline pte_t *hugepd_page(hugepd_t hpd)
0006 {
0007     if (WARN_ON(!hugepd_ok(hpd)))
0008         return NULL;
0009 
0010     return (pte_t *)((hpd_val(hpd) & ~HUGEPD_SHIFT_MASK) | PD_HUGE);
0011 }
0012 
0013 static inline unsigned int hugepd_shift(hugepd_t hpd)
0014 {
0015     return hpd_val(hpd) & HUGEPD_SHIFT_MASK;
0016 }
0017 
0018 static inline pte_t *hugepte_offset(hugepd_t hpd, unsigned long addr,
0019                     unsigned int pdshift)
0020 {
0021     /*
0022      * On FSL BookE, we have multiple higher-level table entries that
0023      * point to the same hugepte.  Just use the first one since they're all
0024      * identical.  So for that case, idx=0.
0025      */
0026     return hugepd_page(hpd);
0027 }
0028 
0029 void flush_hugetlb_page(struct vm_area_struct *vma, unsigned long vmaddr);
0030 
0031 static inline void hugepd_populate(hugepd_t *hpdp, pte_t *new, unsigned int pshift)
0032 {
0033     /* We use the old format for PPC_FSL_BOOK3E */
0034     *hpdp = __hugepd(((unsigned long)new & ~PD_HUGE) | pshift);
0035 }
0036 
0037 static inline int check_and_get_huge_psize(int shift)
0038 {
0039     if (shift & 1)  /* Not a power of 4 */
0040         return -EINVAL;
0041 
0042     return shift_to_mmu_psize(shift);
0043 }
0044 
0045 #endif /* _ASM_POWERPC_NOHASH_HUGETLB_BOOK3E_H */