]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
kselftest/arm64/mte: Check MTE_FAR feature is supported
authorYeoreum Yun <yeoreum.yun@arm.com>
Wed, 18 Jun 2025 08:45:09 +0000 (09:45 +0100)
committerCatalin Marinas <catalin.marinas@arm.com>
Wed, 2 Jul 2025 16:55:20 +0000 (17:55 +0100)
To run the MTE_FAR test when cpu supports MTE_FAR feature,
check the MTE_FAR feature is supported in mte test.

Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com>
Reviewed-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20250618084513.1761345-7-yeoreum.yun@arm.com
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
tools/testing/selftests/arm64/mte/mte_common_util.c
tools/testing/selftests/arm64/mte/mte_common_util.h

index 83240b980f9c1d7417a9e652c40e315462f282d6..5c5680a874982a04ec4b516500e77981febb8314 100644 (file)
@@ -26,6 +26,7 @@
 #define INIT_BUFFER_SIZE       256
 
 struct mte_fault_cxt cur_mte_cxt;
+bool mtefar_support;
 static unsigned int mte_cur_mode;
 static unsigned int mte_cur_pstate_tco;
 
@@ -325,12 +326,15 @@ int mte_switch_mode(int mte_option, unsigned long incl_mask)
 int mte_default_setup(void)
 {
        unsigned long hwcaps2 = getauxval(AT_HWCAP2);
+       unsigned long hwcaps3 = getauxval(AT_HWCAP3);
        unsigned long en = 0;
        int ret;
 
        if (!(hwcaps2 & HWCAP2_MTE))
                ksft_exit_skip("MTE features unavailable\n");
 
+       mtefar_support = !!(hwcaps3 & HWCAP3_MTE_FAR);
+
        /* Get current mte mode */
        ret = prctl(PR_GET_TAGGED_ADDR_CTRL, en, 0, 0, 0);
        if (ret < 0) {
index 6b109e84fa394ab989946dbe3dfd90d250777338..4e1dd959df9b80eed80e025de8b8a9d5c46405cd 100644 (file)
@@ -37,6 +37,7 @@ struct mte_fault_cxt {
 };
 
 extern struct mte_fault_cxt cur_mte_cxt;
+extern bool mtefar_support;
 
 /* MTE utility functions */
 void mte_default_handler(int signum, siginfo_t *si, void *uc);