root/arch/powerpc/include/asm/nohash/32/hugetlb-8xx.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. hugepd_page
  2. hugepd_shift
  3. hugepte_offset
  4. flush_hugetlb_page
  5. hugepd_populate
  6. check_and_get_huge_psize

   1 /* SPDX-License-Identifier: GPL-2.0 */
   2 #ifndef _ASM_POWERPC_NOHASH_32_HUGETLB_8XX_H
   3 #define _ASM_POWERPC_NOHASH_32_HUGETLB_8XX_H
   4 
   5 #define PAGE_SHIFT_8M           23
   6 
   7 static inline pte_t *hugepd_page(hugepd_t hpd)
   8 {
   9         BUG_ON(!hugepd_ok(hpd));
  10 
  11         return (pte_t *)__va(hpd_val(hpd) & ~HUGEPD_SHIFT_MASK);
  12 }
  13 
  14 static inline unsigned int hugepd_shift(hugepd_t hpd)
  15 {
  16         return ((hpd_val(hpd) & _PMD_PAGE_MASK) >> 1) + 17;
  17 }
  18 
  19 static inline pte_t *hugepte_offset(hugepd_t hpd, unsigned long addr,
  20                                     unsigned int pdshift)
  21 {
  22         unsigned long idx = (addr & ((1UL << pdshift) - 1)) >> PAGE_SHIFT;
  23 
  24         return hugepd_page(hpd) + idx;
  25 }
  26 
  27 static inline void flush_hugetlb_page(struct vm_area_struct *vma,
  28                                       unsigned long vmaddr)
  29 {
  30         flush_tlb_page(vma, vmaddr);
  31 }
  32 
  33 static inline void hugepd_populate(hugepd_t *hpdp, pte_t *new, unsigned int pshift)
  34 {
  35         *hpdp = __hugepd(__pa(new) | _PMD_USER | _PMD_PRESENT |
  36                          (pshift == PAGE_SHIFT_8M ? _PMD_PAGE_8M : _PMD_PAGE_512K));
  37 }
  38 
  39 static inline int check_and_get_huge_psize(int shift)
  40 {
  41         return shift_to_mmu_psize(shift);
  42 }
  43 
  44 #endif /* _ASM_POWERPC_NOHASH_32_HUGETLB_8XX_H */

/* [<][>][^][v][top][bottom][index][help] */