mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-11-08 10:31:43 +01:00
nds32 has only two-level page tables and can use pgtable-nopmd and folding of the upper layers. Replace usage of include/asm-generic/4level-fixup.h and explicit definition of __PAGETABLE_PMD_FOLDED in nds32 with include/asm-generic/pgtable-nopmd.h and adjust page table manipulation macros and functions accordingly. Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Mike Rapoport <[email protected]> Cc: Anatoly Pugachev <[email protected]> Cc: Anton Ivanov <[email protected]> Cc: Arnd Bergmann <[email protected]> Cc: "David S. Miller" <[email protected]> Cc: Geert Uytterhoeven <[email protected]> Cc: Greentime Hu <[email protected]> Cc: Greg Ungerer <[email protected]> Cc: Helge Deller <[email protected]> Cc: "James E.J. Bottomley" <[email protected]> Cc: Jeff Dike <[email protected]> Cc: "Kirill A. Shutemov" <[email protected]> Cc: Mark Salter <[email protected]> Cc: Matt Turner <[email protected]> Cc: Michal Simek <[email protected]> Cc: Peter Rosin <[email protected]> Cc: Richard Weinberger <[email protected]> Cc: Rolf Eike Beer <[email protected]> Cc: Russell King <[email protected]> Cc: Russell King <[email protected]> Cc: Sam Creasey <[email protected]> Cc: Vincent Chen <[email protected]> Cc: Vineet Gupta <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
68 lines
1.5 KiB
C
68 lines
1.5 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
// Copyright (C) 2005-2017 Andes Technology Corporation
|
|
|
|
#ifndef _ASMNDS32_PGALLOC_H
|
|
#define _ASMNDS32_PGALLOC_H
|
|
|
|
#include <asm/processor.h>
|
|
#include <asm/cacheflush.h>
|
|
#include <asm/tlbflush.h>
|
|
#include <asm/proc-fns.h>
|
|
|
|
#define __HAVE_ARCH_PTE_ALLOC_ONE
|
|
#include <asm-generic/pgalloc.h> /* for pte_{alloc,free}_one */
|
|
|
|
/*
|
|
* Since we have only two-level page tables, these are trivial
|
|
*/
|
|
#define pmd_pgtable(pmd) pmd_page(pmd)
|
|
|
|
extern pgd_t *pgd_alloc(struct mm_struct *mm);
|
|
extern void pgd_free(struct mm_struct *mm, pgd_t * pgd);
|
|
|
|
static inline pgtable_t pte_alloc_one(struct mm_struct *mm)
|
|
{
|
|
pgtable_t pte;
|
|
|
|
pte = __pte_alloc_one(mm, GFP_PGTABLE_USER);
|
|
if (pte)
|
|
cpu_dcache_wb_page((unsigned long)page_address(pte));
|
|
|
|
return pte;
|
|
}
|
|
|
|
/*
|
|
* Populate the pmdp entry with a pointer to the pte. This pmd is part
|
|
* of the mm address space.
|
|
*
|
|
* Ensure that we always set both PMD entries.
|
|
*/
|
|
static inline void
|
|
pmd_populate_kernel(struct mm_struct *mm, pmd_t * pmdp, pte_t * ptep)
|
|
{
|
|
unsigned long pte_ptr = (unsigned long)ptep;
|
|
unsigned long pmdval;
|
|
|
|
BUG_ON(mm != &init_mm);
|
|
|
|
/*
|
|
* The pmd must be loaded with the physical
|
|
* address of the PTE table
|
|
*/
|
|
pmdval = __pa(pte_ptr) | _PAGE_KERNEL_TABLE;
|
|
set_pmd(pmdp, __pmd(pmdval));
|
|
}
|
|
|
|
static inline void
|
|
pmd_populate(struct mm_struct *mm, pmd_t * pmdp, pgtable_t ptep)
|
|
{
|
|
unsigned long pmdval;
|
|
|
|
BUG_ON(mm == &init_mm);
|
|
|
|
pmdval = page_to_pfn(ptep) << PAGE_SHIFT | _PAGE_USER_TABLE;
|
|
set_pmd(pmdp, __pmd(pmdval));
|
|
}
|
|
|
|
#endif
|