pgtable.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _ASM_POWERPC_BOOK3S_PGTABLE_H
  3. #define _ASM_POWERPC_BOOK3S_PGTABLE_H
  4. #ifdef CONFIG_PPC64
  5. #include <asm/book3s/64/pgtable.h>
  6. #else
  7. #include <asm/book3s/32/pgtable.h>
  8. #endif
  9. #ifndef __ASSEMBLY__
  10. /* Insert a PTE, top-level function is out of line. It uses an inline
  11. * low level function in the respective pgtable-* files
  12. */
  13. extern void set_pte_at(struct mm_struct *mm, unsigned long addr, pte_t *ptep,
  14. pte_t pte);
  15. #define __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS
  16. extern int ptep_set_access_flags(struct vm_area_struct *vma, unsigned long address,
  17. pte_t *ptep, pte_t entry, int dirty);
  18. struct file;
  19. extern pgprot_t phys_mem_access_prot(struct file *file, unsigned long pfn,
  20. unsigned long size, pgprot_t vma_prot);
  21. #define __HAVE_PHYS_MEM_ACCESS_PROT
  22. void __update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t *ptep);
  23. /*
  24. * This gets called at the end of handling a page fault, when
  25. * the kernel has put a new PTE into the page table for the process.
  26. * We use it to ensure coherency between the i-cache and d-cache
  27. * for the page which has just been mapped in.
  28. * On machines which use an MMU hash table, we use this to put a
  29. * corresponding HPTE into the hash table ahead of time, instead of
  30. * waiting for the inevitable extra hash-table miss exception.
  31. */
  32. static inline void update_mmu_cache(struct vm_area_struct *vma, unsigned long address, pte_t *ptep)
  33. {
  34. if (IS_ENABLED(CONFIG_PPC32) && !mmu_has_feature(MMU_FTR_HPTE_TABLE))
  35. return;
  36. if (radix_enabled())
  37. return;
  38. __update_mmu_cache(vma, address, ptep);
  39. }
  40. #endif /* __ASSEMBLY__ */
  41. #endif