Commit 83b5bd62 authored by Catalin Marinas's avatar Catalin Marinas

arm64: Move PSTATE.TCO setting to separate functions

For consistency with __uaccess_{disable,enable}_hw_pan(), move the
PSTATE.TCO setting into dedicated __uaccess_{disable,enable}_tco()
functions.
Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
Acked-by: default avatarVincenzo Frascino <vincenzo.frascino@arm.com>
Acked-by: default avatarMark Rutland <mark.rutland@arm.com>
parent f34d93f3
...@@ -176,10 +176,21 @@ static inline void __uaccess_enable_hw_pan(void) ...@@ -176,10 +176,21 @@ static inline void __uaccess_enable_hw_pan(void)
* The Tag check override (TCO) bit disables temporarily the tag checking * The Tag check override (TCO) bit disables temporarily the tag checking
* preventing the issue. * preventing the issue.
*/ */
static inline void uaccess_disable_privileged(void) static inline void __uaccess_disable_tco(void)
{ {
asm volatile(ALTERNATIVE("nop", SET_PSTATE_TCO(0), asm volatile(ALTERNATIVE("nop", SET_PSTATE_TCO(0),
ARM64_MTE, CONFIG_KASAN_HW_TAGS)); ARM64_MTE, CONFIG_KASAN_HW_TAGS));
}
static inline void __uaccess_enable_tco(void)
{
asm volatile(ALTERNATIVE("nop", SET_PSTATE_TCO(1),
ARM64_MTE, CONFIG_KASAN_HW_TAGS));
}
static inline void uaccess_disable_privileged(void)
{
__uaccess_disable_tco();
if (uaccess_ttbr0_disable()) if (uaccess_ttbr0_disable())
return; return;
...@@ -189,8 +200,7 @@ static inline void uaccess_disable_privileged(void) ...@@ -189,8 +200,7 @@ static inline void uaccess_disable_privileged(void)
static inline void uaccess_enable_privileged(void) static inline void uaccess_enable_privileged(void)
{ {
asm volatile(ALTERNATIVE("nop", SET_PSTATE_TCO(1), __uaccess_enable_tco();
ARM64_MTE, CONFIG_KASAN_HW_TAGS));
if (uaccess_ttbr0_enable()) if (uaccess_ttbr0_enable())
return; return;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment