arm64/tbi: Unified TBI flags for MTE and software kasan

The TCMA flag is not critical, it will be set separately in "arm64_mte.c"

Signed-off-by: wangmingrong1 <wangmingrong1@xiaomi.com>
This commit is contained in:
wangmingrong1 2025-01-07 16:46:54 +08:00 committed by Xiang Xiao
parent dd4ee256c3
commit c5655d5a11
3 changed files with 10 additions and 10 deletions

View file

@ -151,6 +151,7 @@ menu "ARMv8.5 architectural features"
config ARM64_MTE
bool "Memory Tagging Extension support"
select ARM64_TBI
default y
endmenu # "ARMv8.5 architectural features"
@ -164,6 +165,10 @@ config ARCH_SINGLE_SECURITY_STATE
GIC or other ARM architecture feature will with different
configure
config ARM64_TBI
bool "Top Byte Ignore support"
default n
config ARM64_SMP_BUSY_WAIT
bool "Busy wait when SMP boot"
default n

View file

@ -155,16 +155,10 @@
#define TCR_PS_BITS TCR_PS_BITS_4GB
#endif
#ifdef CONFIG_MM_KASAN_SW_TAGS
#define TCR_KASAN_SW_FLAGS (TCR_TBI0 | TCR_TBI1 | TCR_ASID_8)
#ifdef CONFIG_ARM64_TBI
#define TCR_TBI_FLAGS (TCR_TBI0 | TCR_TBI1 | TCR_ASID_8)
#else
#define TCR_KASAN_SW_FLAGS 0
#endif
#ifdef CONFIG_ARM64_MTE
#define TCR_MTE_FLAGS (TCR_TCMA1 | TCR_TBI0 | TCR_TBI1 | TCR_ASID_8)
#else
#define TCR_MTE_FLAGS 0
#define TCR_TBI_FLAGS 0
#endif
/****************************************************************************
@ -270,7 +264,7 @@ static uint64_t get_tcr(int el)
*/
tcr |= TCR_TG0_4K | TCR_SHARED_INNER | TCR_ORGN_WBWA |
TCR_IRGN_WBWA | TCR_KASAN_SW_FLAGS | TCR_MTE_FLAGS;
TCR_IRGN_WBWA | TCR_TBI_FLAGS;
return tcr;
}

View file

@ -344,6 +344,7 @@ config MM_KASAN_GENERIC
config MM_KASAN_SW_TAGS
bool "KAsan SW tags"
select ARM64_TBI
depends on ARCH_ARM64
---help---
KAsan based on software tags