por.h 612 B

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