| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-only */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Page table support for the Hexagon architecture |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright (c) 2010-2011, The Linux Foundation. All rights reserved. |
|---|
| 5 | | - * |
|---|
| 6 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 7 | | - * it under the terms of the GNU General Public License version 2 and |
|---|
| 8 | | - * only version 2 as published by the Free Software Foundation. |
|---|
| 9 | | - * |
|---|
| 10 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 11 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 12 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 13 | | - * GNU General Public License for more details. |
|---|
| 14 | | - * |
|---|
| 15 | | - * You should have received a copy of the GNU General Public License |
|---|
| 16 | | - * along with this program; if not, write to the Free Software |
|---|
| 17 | | - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|---|
| 18 | | - * 02110-1301, USA. |
|---|
| 19 | 6 | */ |
|---|
| 20 | 7 | |
|---|
| 21 | 8 | #ifndef _ASM_PGALLOC_H |
|---|
| .. | .. |
|---|
| 24 | 11 | #include <asm/mem-layout.h> |
|---|
| 25 | 12 | #include <asm/atomic.h> |
|---|
| 26 | 13 | |
|---|
| 27 | | -#define check_pgt_cache() do {} while (0) |
|---|
| 14 | +#include <asm-generic/pgalloc.h> |
|---|
| 28 | 15 | |
|---|
| 29 | 16 | extern unsigned long long kmap_generation; |
|---|
| 30 | 17 | |
|---|
| .. | .. |
|---|
| 52 | 39 | mm->context.ptbase = __pa(pgd); |
|---|
| 53 | 40 | |
|---|
| 54 | 41 | return pgd; |
|---|
| 55 | | -} |
|---|
| 56 | | - |
|---|
| 57 | | -static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd) |
|---|
| 58 | | -{ |
|---|
| 59 | | - free_page((unsigned long) pgd); |
|---|
| 60 | | -} |
|---|
| 61 | | - |
|---|
| 62 | | -static inline struct page *pte_alloc_one(struct mm_struct *mm, |
|---|
| 63 | | - unsigned long address) |
|---|
| 64 | | -{ |
|---|
| 65 | | - struct page *pte; |
|---|
| 66 | | - |
|---|
| 67 | | - pte = alloc_page(GFP_KERNEL | __GFP_ZERO); |
|---|
| 68 | | - if (!pte) |
|---|
| 69 | | - return NULL; |
|---|
| 70 | | - if (!pgtable_page_ctor(pte)) { |
|---|
| 71 | | - __free_page(pte); |
|---|
| 72 | | - return NULL; |
|---|
| 73 | | - } |
|---|
| 74 | | - return pte; |
|---|
| 75 | | -} |
|---|
| 76 | | - |
|---|
| 77 | | -/* _kernel variant gets to use a different allocator */ |
|---|
| 78 | | -static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, |
|---|
| 79 | | - unsigned long address) |
|---|
| 80 | | -{ |
|---|
| 81 | | - gfp_t flags = GFP_KERNEL | __GFP_ZERO; |
|---|
| 82 | | - return (pte_t *) __get_free_page(flags); |
|---|
| 83 | | -} |
|---|
| 84 | | - |
|---|
| 85 | | -static inline void pte_free(struct mm_struct *mm, struct page *pte) |
|---|
| 86 | | -{ |
|---|
| 87 | | - pgtable_page_dtor(pte); |
|---|
| 88 | | - __free_page(pte); |
|---|
| 89 | | -} |
|---|
| 90 | | - |
|---|
| 91 | | -static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte) |
|---|
| 92 | | -{ |
|---|
| 93 | | - free_page((unsigned long)pte); |
|---|
| 94 | 42 | } |
|---|
| 95 | 43 | |
|---|
| 96 | 44 | static inline void pmd_populate(struct mm_struct *mm, pmd_t *pmd, |
|---|
| .. | .. |
|---|
| 141 | 89 | |
|---|
| 142 | 90 | #define __pte_free_tlb(tlb, pte, addr) \ |
|---|
| 143 | 91 | do { \ |
|---|
| 144 | | - pgtable_page_dtor((pte)); \ |
|---|
| 92 | + pgtable_pte_page_dtor((pte)); \ |
|---|
| 145 | 93 | tlb_remove_page((tlb), (pte)); \ |
|---|
| 146 | 94 | } while (0) |
|---|
| 147 | 95 | |
|---|