[PATCH v3 1/3] arm64: add FEAT_MTE_TAGGED_FAR feature

Catalin Marinas catalin.marinas at arm.com
Fri May 2 10:12:40 PDT 2025


On Thu, Apr 10, 2025 at 08:47:19AM +0100, Yeoreum Yun wrote:
> Add FEAT_MTE_TAGGED_FAR cpucap which makes FAR_ELx report
> all non-address bits on a synchronous MTE tag check fault since Armv8.9
> 
> Signed-off-by: Yeoreum Yun <yeoreum.yun at arm.com>
> Acked-by: Yury Khrustalev <yury.khrustalev at arm.com>
[...]
> @@ -3191,6 +3199,7 @@ static const struct arm64_cpu_capabilities arm64_elf_hwcaps[] = {
>  #ifdef CONFIG_ARM64_MTE
>  	HWCAP_CAP(ID_AA64PFR1_EL1, MTE, MTE2, CAP_HWCAP, KERNEL_HWCAP_MTE),
>  	HWCAP_CAP(ID_AA64PFR1_EL1, MTE, MTE3, CAP_HWCAP, KERNEL_HWCAP_MTE3),
> +	HWCAP_CAP(ID_AA64PFR2_EL1, MTEFAR, IMP, CAP_HWCAP, KERNEL_HWCAP_MTE_FAR),

Nitpick: from a theoretical bisectability perspective, I'd move the
hwcap exposing to the following patch. The rest, feature detection etc
can stay in this file. Otherwise, one can apply this patch, see the
hwcap but not get the actual behaviour.

>  #endif /* CONFIG_ARM64_MTE */
>  	HWCAP_CAP(ID_AA64MMFR0_EL1, ECV, IMP, CAP_HWCAP, KERNEL_HWCAP_ECV),
>  	HWCAP_CAP(ID_AA64MMFR1_EL1, AFP, IMP, CAP_HWCAP, KERNEL_HWCAP_AFP),
> diff --git a/arch/arm64/kernel/cpuinfo.c b/arch/arm64/kernel/cpuinfo.c
> index 285d7d538342..e2b13454e38a 100644
> --- a/arch/arm64/kernel/cpuinfo.c
> +++ b/arch/arm64/kernel/cpuinfo.c
> @@ -160,6 +160,7 @@ static const char *const hwcap_str[] = {
>  	[KERNEL_HWCAP_SME_SFEXPA]	= "smesfexpa",
>  	[KERNEL_HWCAP_SME_STMOP]	= "smestmop",
>  	[KERNEL_HWCAP_SME_SMOP4]	= "smesmop4",
> +	[KERNEL_HWCAP_MTE_FAR]		= "mte_far",

Personal preference: "mtefar" (no underscore), mostly because there's no
other underscore in the hwcap strings yet ;).

-- 
Catalin



More information about the linux-arm-kernel mailing list