This is an automated email from the ASF dual-hosted git repository.

xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new c5655d5a11 arm64/tbi: Unified TBI flags for MTE and software kasan
c5655d5a11 is described below

commit c5655d5a11d8ed88571db3f961d1fd6b55509265
Author: wangmingrong1 <[email protected]>
AuthorDate: Tue Jan 7 16:46:54 2025 +0800

    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 <[email protected]>
---
 arch/arm64/Kconfig                |  5 +++++
 arch/arm64/src/common/arm64_mmu.c | 14 ++++----------
 mm/Kconfig                        |  1 +
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 38349d6af4..e251388088 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -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
diff --git a/arch/arm64/src/common/arm64_mmu.c 
b/arch/arm64/src/common/arm64_mmu.c
index 95745e08f6..b64ccdc525 100644
--- a/arch/arm64/src/common/arm64_mmu.c
+++ b/arch/arm64/src/common/arm64_mmu.c
@@ -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;
 }
diff --git a/mm/Kconfig b/mm/Kconfig
index 167f679c84..6d77d27e3e 100644
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -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

Reply via email to