| .. | .. |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0-or-later */ |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * OpenRISC Linux |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 9 | 10 | * Copyright (C) 2003 Matjaz Breskvar <phoenix@bsemi.com> |
|---|
| 10 | 11 | * Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se> |
|---|
| 11 | 12 | * et al. |
|---|
| 12 | | - * |
|---|
| 13 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 14 | | - * it under the terms of the GNU General Public License as published by |
|---|
| 15 | | - * the Free Software Foundation; either version 2 of the License, or |
|---|
| 16 | | - * (at your option) any later version. |
|---|
| 17 | 13 | */ |
|---|
| 18 | 14 | |
|---|
| 19 | 15 | #ifndef __ASM_OPENRISC_PGALLOC_H |
|---|
| .. | .. |
|---|
| 23 | 19 | #include <linux/threads.h> |
|---|
| 24 | 20 | #include <linux/mm.h> |
|---|
| 25 | 21 | #include <linux/memblock.h> |
|---|
| 22 | + |
|---|
| 23 | +#define __HAVE_ARCH_PTE_ALLOC_ONE_KERNEL |
|---|
| 24 | +#include <asm-generic/pgalloc.h> |
|---|
| 26 | 25 | |
|---|
| 27 | 26 | extern int mem_init_done; |
|---|
| 28 | 27 | |
|---|
| .. | .. |
|---|
| 65 | 64 | } |
|---|
| 66 | 65 | #endif |
|---|
| 67 | 66 | |
|---|
| 68 | | -static inline void pgd_free(struct mm_struct *mm, pgd_t *pgd) |
|---|
| 69 | | -{ |
|---|
| 70 | | - free_page((unsigned long)pgd); |
|---|
| 71 | | -} |
|---|
| 72 | | - |
|---|
| 73 | | -extern pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long address); |
|---|
| 74 | | - |
|---|
| 75 | | -static inline struct page *pte_alloc_one(struct mm_struct *mm, |
|---|
| 76 | | - unsigned long address) |
|---|
| 77 | | -{ |
|---|
| 78 | | - struct page *pte; |
|---|
| 79 | | - pte = alloc_pages(GFP_KERNEL, 0); |
|---|
| 80 | | - if (!pte) |
|---|
| 81 | | - return NULL; |
|---|
| 82 | | - clear_page(page_address(pte)); |
|---|
| 83 | | - if (!pgtable_page_ctor(pte)) { |
|---|
| 84 | | - __free_page(pte); |
|---|
| 85 | | - return NULL; |
|---|
| 86 | | - } |
|---|
| 87 | | - return pte; |
|---|
| 88 | | -} |
|---|
| 89 | | - |
|---|
| 90 | | -static inline void pte_free_kernel(struct mm_struct *mm, pte_t *pte) |
|---|
| 91 | | -{ |
|---|
| 92 | | - free_page((unsigned long)pte); |
|---|
| 93 | | -} |
|---|
| 94 | | - |
|---|
| 95 | | -static inline void pte_free(struct mm_struct *mm, struct page *pte) |
|---|
| 96 | | -{ |
|---|
| 97 | | - pgtable_page_dtor(pte); |
|---|
| 98 | | - __free_page(pte); |
|---|
| 99 | | -} |
|---|
| 67 | +extern pte_t *pte_alloc_one_kernel(struct mm_struct *mm); |
|---|
| 100 | 68 | |
|---|
| 101 | 69 | #define __pte_free_tlb(tlb, pte, addr) \ |
|---|
| 102 | 70 | do { \ |
|---|
| 103 | | - pgtable_page_dtor(pte); \ |
|---|
| 71 | + pgtable_pte_page_dtor(pte); \ |
|---|
| 104 | 72 | tlb_remove_page((tlb), (pte)); \ |
|---|
| 105 | 73 | } while (0) |
|---|
| 106 | 74 | |
|---|
| 107 | 75 | #define pmd_pgtable(pmd) pmd_page(pmd) |
|---|
| 108 | | - |
|---|
| 109 | | -#define check_pgt_cache() do { } while (0) |
|---|
| 110 | 76 | |
|---|
| 111 | 77 | #endif |
|---|