hugetlb-e500.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _ASM_POWERPC_NOHASH_HUGETLB_E500_H
  3. #define _ASM_POWERPC_NOHASH_HUGETLB_E500_H
  4. static inline pte_t *hugepd_page(hugepd_t hpd)
  5. {
  6. if (WARN_ON(!hugepd_ok(hpd)))
  7. return NULL;
  8. return (pte_t *)((hpd_val(hpd) & ~HUGEPD_SHIFT_MASK) | PD_HUGE);
  9. }
  10. static inline unsigned int hugepd_shift(hugepd_t hpd)
  11. {
  12. return hpd_val(hpd) & HUGEPD_SHIFT_MASK;
  13. }
  14. static inline pte_t *hugepte_offset(hugepd_t hpd, unsigned long addr,
  15. unsigned int pdshift)
  16. {
  17. /*
  18. * On FSL BookE, we have multiple higher-level table entries that
  19. * point to the same hugepte. Just use the first one since they're all
  20. * identical. So for that case, idx=0.
  21. */
  22. return hugepd_page(hpd);
  23. }
  24. void flush_hugetlb_page(struct vm_area_struct *vma, unsigned long vmaddr);
  25. static inline void hugepd_populate(hugepd_t *hpdp, pte_t *new, unsigned int pshift)
  26. {
  27. /* We use the old format for PPC_E500 */
  28. *hpdp = __hugepd(((unsigned long)new & ~PD_HUGE) | pshift);
  29. }
  30. static inline int check_and_get_huge_psize(int shift)
  31. {
  32. if (shift & 1) /* Not a power of 4 */
  33. return -EINVAL;
  34. return shift_to_mmu_psize(shift);
  35. }
  36. #endif /* _ASM_POWERPC_NOHASH_HUGETLB_E500_H */