^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) /* SPDX-License-Identifier: GPL-2.0 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 3) * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 4) * Copyright 2003 PathScale, Inc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 5) * Derived from include/asm-i386/pgalloc.h and include/asm-i386/pgtable.h
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) #ifndef __UM_PGALLOC_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9) #define __UM_PGALLOC_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) #include <linux/mm.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) #include <asm-generic/pgalloc.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) #define pmd_populate_kernel(mm, pmd, pte) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16) set_pmd(pmd, __pmd(_PAGE_TABLE + (unsigned long) __pa(pte)))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) #define pmd_populate(mm, pmd, pte) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) set_pmd(pmd, __pmd(_PAGE_TABLE + \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) ((unsigned long long)page_to_pfn(pte) << \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) (unsigned long long) PAGE_SHIFT)))
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) #define pmd_pgtable(pmd) pmd_page(pmd)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25) * Allocate and free page tables.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) extern pgd_t *pgd_alloc(struct mm_struct *);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) #define __pte_free_tlb(tlb,pte, address) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) do { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) pgtable_pte_page_dtor(pte); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) tlb_remove_page((tlb),(pte)); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33) } while (0)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) #ifdef CONFIG_3_LEVEL_PGTABLES
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) #define __pmd_free_tlb(tlb, pmd, address) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38) do { \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) pgtable_pmd_page_dtor(virt_to_page(pmd)); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) tlb_remove_page((tlb),virt_to_page(pmd)); \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41) } while (0) \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46)