1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3  * Copyright (C) 2012 Regents of the University of California
4  */
5 
6 #ifndef _ASM_RISCV_PGTABLE_32_H
7 #define _ASM_RISCV_PGTABLE_32_H
8 
9 #include <asm-generic/pgtable-nopmd.h>
10 #include <linux/bits.h>
11 #include <linux/const.h>
12 
13 /* Size of region mapped by a page global directory */
14 #define PGDIR_SHIFT     22
15 #define PGDIR_SIZE      (_AC(1, UL) << PGDIR_SHIFT)
16 #define PGDIR_MASK      (~(PGDIR_SIZE - 1))
17 
18 #define MAX_POSSIBLE_PHYSMEM_BITS 34
19 
20 /*
21  * rv32 PTE format:
22  * | XLEN-1  10 | 9             8 | 7 | 6 | 5 | 4 | 3 | 2 | 1 | 0
23  *       PFN      reserved for SW   D   A   G   U   X   W   R   V
24  */
25 #define _PAGE_PFN_MASK  GENMASK(31, 10)
26 
27 #define _PAGE_NOCACHE		0
28 #define _PAGE_IO		0
29 #define _PAGE_MTMASK		0
30 
31 /* Set of bits to preserve across pte_modify() */
32 #define _PAGE_CHG_MASK  (~(unsigned long)(_PAGE_PRESENT | _PAGE_READ |	\
33 					  _PAGE_WRITE | _PAGE_EXEC |	\
34 					  _PAGE_USER | _PAGE_GLOBAL))
35 
36 #endif /* _ASM_RISCV_PGTABLE_32_H */
37