diff options
author | James Morse <james.morse@arm.com> | 2018-01-08 15:38:11 +0000 |
---|---|---|
committer | Catalin Marinas <catalin.marinas@arm.com> | 2018-01-13 10:45:10 +0000 |
commit | e1281f56f114f3a945bf9ec30698bd3caa59d322 (patch) | |
tree | 7f0ba9927a35325d2de07f223ba04f634f5f7b12 /arch/arm64/include/asm/uaccess.h | |
parent | ed8b20d457d72e9e2a30533b436fdb4ea1c70b38 (diff) | |
download | blackbird-op-linux-e1281f56f114f3a945bf9ec30698bd3caa59d322.tar.gz blackbird-op-linux-e1281f56f114f3a945bf9ec30698bd3caa59d322.zip |
arm64: uaccess: Add PAN helper
Add __uaccess_{en,dis}able_hw_pan() helpers to set/clear the PSTATE.PAN
bit.
Signed-off-by: James Morse <james.morse@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Diffstat (limited to 'arch/arm64/include/asm/uaccess.h')
-rw-r--r-- | arch/arm64/include/asm/uaccess.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/arch/arm64/include/asm/uaccess.h b/arch/arm64/include/asm/uaccess.h index 6eadf55ebaf0..3821fab01d7d 100644 --- a/arch/arm64/include/asm/uaccess.h +++ b/arch/arm64/include/asm/uaccess.h @@ -168,6 +168,18 @@ static inline bool uaccess_ttbr0_enable(void) } #endif +static inline void __uaccess_disable_hw_pan(void) +{ + asm(ALTERNATIVE("nop", SET_PSTATE_PAN(0), ARM64_HAS_PAN, + CONFIG_ARM64_PAN)); +} + +static inline void __uaccess_enable_hw_pan(void) +{ + asm(ALTERNATIVE("nop", SET_PSTATE_PAN(1), ARM64_HAS_PAN, + CONFIG_ARM64_PAN)); +} + #define __uaccess_disable(alt) \ do { \ if (!uaccess_ttbr0_disable()) \ |