2024-08-22 16:11:01 +01:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0 */
|
|
|
|
/*
|
|
|
|
* Copyright (C) 2023 Arm Ltd.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _ASM_ARM64_POR_H
|
|
|
|
#define _ASM_ARM64_POR_H
|
|
|
|
|
2025-02-19 16:40:27 +00:00
|
|
|
#include <asm/sysreg.h>
|
2024-08-22 16:11:01 +01:00
|
|
|
|
2025-02-19 16:40:29 +00:00
|
|
|
#define POR_EL0_INIT POR_ELx_PERM_PREP(0, POE_RWX)
|
|
|
|
|
2024-08-22 16:11:01 +01:00
|
|
|
static inline bool por_elx_allows_read(u64 por, u8 pkey)
|
|
|
|
{
|
2025-02-19 16:40:27 +00:00
|
|
|
u8 perm = POR_ELx_PERM_GET(pkey, por);
|
2024-08-22 16:11:01 +01:00
|
|
|
|
|
|
|
return perm & POE_R;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline bool por_elx_allows_write(u64 por, u8 pkey)
|
|
|
|
{
|
2025-02-19 16:40:27 +00:00
|
|
|
u8 perm = POR_ELx_PERM_GET(pkey, por);
|
2024-08-22 16:11:01 +01:00
|
|
|
|
|
|
|
return perm & POE_W;
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline bool por_elx_allows_exec(u64 por, u8 pkey)
|
|
|
|
{
|
2025-02-19 16:40:27 +00:00
|
|
|
u8 perm = POR_ELx_PERM_GET(pkey, por);
|
2024-08-22 16:11:01 +01:00
|
|
|
|
|
|
|
return perm & POE_X;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* _ASM_ARM64_POR_H */
|