1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * Copyright (C) 2023 Arm Ltd. 4 */ 5 6 #ifndef _ASM_ARM64_POR_H 7 #define _ASM_ARM64_POR_H 8 9 #include <asm/sysreg.h> 10 11 #define POR_EL0_INIT POR_ELx_PERM_PREP(0, POE_RWX) 12 13 static inline bool por_elx_allows_read(u64 por, u8 pkey) 14 { 15 u8 perm = POR_ELx_PERM_GET(pkey, por); 16 17 return perm & POE_R; 18 } 19 20 static inline bool por_elx_allows_write(u64 por, u8 pkey) 21 { 22 u8 perm = POR_ELx_PERM_GET(pkey, por); 23 24 return perm & POE_W; 25 } 26 27 static inline bool por_elx_allows_exec(u64 por, u8 pkey) 28 { 29 u8 perm = POR_ELx_PERM_GET(pkey, por); 30 31 return perm & POE_X; 32 } 33 34 #endif /* _ASM_ARM64_POR_H */ 35