Skip to content

Commit 2e3e356

Browse files
LeviYeoReumctmarinas
authored andcommitted
kselftest/arm64/mte: Check MTE_FAR feature is supported
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 <[email protected]> Reviewed-by: Mark Brown <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Catalin Marinas <[email protected]>
1 parent cfafa51 commit 2e3e356

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

tools/testing/selftests/arm64/mte/mte_common_util.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
#define INIT_BUFFER_SIZE 256
2727

2828
struct mte_fault_cxt cur_mte_cxt;
29+
bool mtefar_support;
2930
static unsigned int mte_cur_mode;
3031
static unsigned int mte_cur_pstate_tco;
3132

@@ -325,12 +326,15 @@ int mte_switch_mode(int mte_option, unsigned long incl_mask)
325326
int mte_default_setup(void)
326327
{
327328
unsigned long hwcaps2 = getauxval(AT_HWCAP2);
329+
unsigned long hwcaps3 = getauxval(AT_HWCAP3);
328330
unsigned long en = 0;
329331
int ret;
330332

331333
if (!(hwcaps2 & HWCAP2_MTE))
332334
ksft_exit_skip("MTE features unavailable\n");
333335

336+
mtefar_support = !!(hwcaps3 & HWCAP3_MTE_FAR);
337+
334338
/* Get current mte mode */
335339
ret = prctl(PR_GET_TAGGED_ADDR_CTRL, en, 0, 0, 0);
336340
if (ret < 0) {

tools/testing/selftests/arm64/mte/mte_common_util.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ struct mte_fault_cxt {
3737
};
3838

3939
extern struct mte_fault_cxt cur_mte_cxt;
40+
extern bool mtefar_support;
4041

4142
/* MTE utility functions */
4243
void mte_default_handler(int signum, siginfo_t *si, void *uc);

0 commit comments

Comments
 (0)