pgalloc.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com)
  4. * Copyright 2003 PathScale, Inc.
  5. * Derived from include/asm-i386/pgalloc.h and include/asm-i386/pgtable.h
  6. */
  7. #ifndef __UM_PGALLOC_H
  8. #define __UM_PGALLOC_H
  9. #include <linux/mm.h>
  10. #include <asm-generic/pgalloc.h>
  11. #define pmd_populate_kernel(mm, pmd, pte) \
  12. set_pmd(pmd, __pmd(_PAGE_TABLE + (unsigned long) __pa(pte)))
  13. #define pmd_populate(mm, pmd, pte) \
  14. set_pmd(pmd, __pmd(_PAGE_TABLE + \
  15. ((unsigned long long)page_to_pfn(pte) << \
  16. (unsigned long long) PAGE_SHIFT)))
  17. /*
  18. * Allocate and free page tables.
  19. */
  20. extern pgd_t *pgd_alloc(struct mm_struct *);
  21. #define __pte_free_tlb(tlb, pte, address) \
  22. tlb_remove_ptdesc((tlb), page_ptdesc(pte))
  23. #if CONFIG_PGTABLE_LEVELS > 2
  24. #define __pmd_free_tlb(tlb, pmd, address) \
  25. tlb_remove_ptdesc((tlb), virt_to_ptdesc(pmd))
  26. #if CONFIG_PGTABLE_LEVELS > 3
  27. #define __pud_free_tlb(tlb, pud, address) \
  28. tlb_remove_ptdesc((tlb), virt_to_ptdesc(pud))
  29. #endif
  30. #endif
  31. #endif