150acfb2bSThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */ 207037db5SPalmer Dabbelt /* 307037db5SPalmer Dabbelt * Copyright (C) 2012 Regents of the University of California 407037db5SPalmer Dabbelt */ 507037db5SPalmer Dabbelt 607037db5SPalmer Dabbelt #ifndef _ASM_RISCV_PGTABLE_BITS_H 707037db5SPalmer Dabbelt #define _ASM_RISCV_PGTABLE_BITS_H 807037db5SPalmer Dabbelt 907037db5SPalmer Dabbelt #define _PAGE_ACCESSED_OFFSET 6 1007037db5SPalmer Dabbelt 1107037db5SPalmer Dabbelt #define _PAGE_PRESENT (1 << 0) 1207037db5SPalmer Dabbelt #define _PAGE_READ (1 << 1) /* Readable */ 1307037db5SPalmer Dabbelt #define _PAGE_WRITE (1 << 2) /* Writable */ 1407037db5SPalmer Dabbelt #define _PAGE_EXEC (1 << 3) /* Executable */ 1507037db5SPalmer Dabbelt #define _PAGE_USER (1 << 4) /* User */ 1607037db5SPalmer Dabbelt #define _PAGE_GLOBAL (1 << 5) /* Global */ 1707037db5SPalmer Dabbelt #define _PAGE_ACCESSED (1 << 6) /* Set by hardware on any access */ 1807037db5SPalmer Dabbelt #define _PAGE_DIRTY (1 << 7) /* Set by hardware on any write */ 19*d5d2c264SYu Chien Peter Lin #define _PAGE_SOFT (3 << 8) /* Reserved for software */ 2007037db5SPalmer Dabbelt 21*d5d2c264SYu Chien Peter Lin #define _PAGE_SPECIAL (1 << 8) /* RSW: 0x1 */ 2207037db5SPalmer Dabbelt #define _PAGE_TABLE _PAGE_PRESENT 2307037db5SPalmer Dabbelt 24e3613bb8SStefan O'Rear /* 25e3613bb8SStefan O'Rear * _PAGE_PROT_NONE is set on not-present pages (and ignored by the hardware) to 26e3613bb8SStefan O'Rear * distinguish them from swapped out pages 27e3613bb8SStefan O'Rear */ 28fba88edeSNanyong Sun #define _PAGE_PROT_NONE _PAGE_GLOBAL 29e3613bb8SStefan O'Rear 3051a1007dSDavid Hildenbrand /* Used for swap PTEs only. */ 3151a1007dSDavid Hildenbrand #define _PAGE_SWP_EXCLUSIVE _PAGE_ACCESSED 3251a1007dSDavid Hildenbrand 3307037db5SPalmer Dabbelt #define _PAGE_PFN_SHIFT 10 3407037db5SPalmer Dabbelt 35f5397c3eSNanyong Sun /* 36f5397c3eSNanyong Sun * when all of R/W/X are zero, the PTE is a pointer to the next level 37f5397c3eSNanyong Sun * of the page table; otherwise, it is a leaf PTE. 38f5397c3eSNanyong Sun */ 39f5397c3eSNanyong Sun #define _PAGE_LEAF (_PAGE_READ | _PAGE_WRITE | _PAGE_EXEC) 4007037db5SPalmer Dabbelt 4107037db5SPalmer Dabbelt #endif /* _ASM_RISCV_PGTABLE_BITS_H */ 42