pgalloc.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. #ifndef _ASM_IA64_PGALLOC_H
  3. #define _ASM_IA64_PGALLOC_H
  4. /*
  5. * This file contains the functions and defines necessary to allocate
  6. * page tables.
  7. *
  8. * This hopefully works with any (fixed) ia-64 page-size, as defined
  9. * in <asm/page.h> (currently 8192).
  10. *
  11. * Copyright (C) 1998-2001 Hewlett-Packard Co
  12. * David Mosberger-Tang <[email protected]>
  13. * Copyright (C) 2000, Goutham Rao <[email protected]>
  14. */
  15. #include <linux/compiler.h>
  16. #include <linux/mm.h>
  17. #include <linux/page-flags.h>
  18. #include <linux/threads.h>
  19. #include <asm-generic/pgalloc.h>
  20. #include <asm/mmu_context.h>
  21. static inline pgd_t *pgd_alloc(struct mm_struct *mm)
  22. {
  23. return (pgd_t *)__get_free_page(GFP_KERNEL | __GFP_ZERO);
  24. }
  25. #if CONFIG_PGTABLE_LEVELS == 4
  26. static inline void
  27. p4d_populate(struct mm_struct *mm, p4d_t * p4d_entry, pud_t * pud)
  28. {
  29. p4d_val(*p4d_entry) = __pa(pud);
  30. }
  31. #define __pud_free_tlb(tlb, pud, address) pud_free((tlb)->mm, pud)
  32. #endif /* CONFIG_PGTABLE_LEVELS == 4 */
  33. static inline void
  34. pud_populate(struct mm_struct *mm, pud_t * pud_entry, pmd_t * pmd)
  35. {
  36. pud_val(*pud_entry) = __pa(pmd);
  37. }
  38. #define __pmd_free_tlb(tlb, pmd, address) pmd_free((tlb)->mm, pmd)
  39. static inline void
  40. pmd_populate(struct mm_struct *mm, pmd_t * pmd_entry, pgtable_t pte)
  41. {
  42. pmd_val(*pmd_entry) = page_to_phys(pte);
  43. }
  44. static inline void
  45. pmd_populate_kernel(struct mm_struct *mm, pmd_t * pmd_entry, pte_t * pte)
  46. {
  47. pmd_val(*pmd_entry) = __pa(pte);
  48. }
  49. #define __pte_free_tlb(tlb, pte, address) pte_free((tlb)->mm, pte)
  50. #endif /* _ASM_IA64_PGALLOC_H */