[PATCH 1/6] arm64/cpufeature: Fix field sign for DIT hwcap detection

Mark Rutland mark.rutland at arm.com
Fri Dec 9 04:25:26 PST 2022


On Thu, Dec 08, 2022 at 04:03:22PM +0000, Mark Brown wrote:
> Since it was added our hwcap for DIT has specified that DIT is a signed
> field but this appears to be incorrect, the two values for the enumeration
> are:
> 
> 	0b0000	NI
> 	0b0001	IMP
> 
> which look like a normal signed enumeration and the in-kernel DIT usage
> added by 01ab991fc0ee ("arm64: Enable data independent timing (DIT) in the
> kernel") detects the feature with a signed enum. Fix the hwcap to specify
> the field as signed.

s/signed/unsigned/ for the three instances after the values.

> Fixes: 7206dc93a58f ("arm64: Expose Arm v8.4 features")
> Signed-off-by: Mark Brown <broonie at kernel.org>

Yup, that should definitely be UNSIGNED. Luckily this wouldn't blow up unless
we had 7+ revisions to the DIT feature, but it should still be fixed.

The other fields added in that original commit all look correct to me.

With the s/signed/unsigned/ foxup above:

Reviewed-by: Mark Rutland <mark.rutland at arm.com>

Mark.

> ---
>  arch/arm64/kernel/cpufeature.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
> index 7e76e1fda2a1..c687b0052a3f 100644
> --- a/arch/arm64/kernel/cpufeature.c
> +++ b/arch/arm64/kernel/cpufeature.c
> @@ -2775,7 +2775,7 @@ static const struct arm64_cpu_capabilities arm64_elf_hwcaps[] = {
>  	HWCAP_CAP(SYS_ID_AA64PFR0_EL1, ID_AA64PFR0_EL1_FP_SHIFT, 4, FTR_SIGNED, 1, CAP_HWCAP, KERNEL_HWCAP_FPHP),
>  	HWCAP_CAP(SYS_ID_AA64PFR0_EL1, ID_AA64PFR0_EL1_AdvSIMD_SHIFT, 4, FTR_SIGNED, 0, CAP_HWCAP, KERNEL_HWCAP_ASIMD),
>  	HWCAP_CAP(SYS_ID_AA64PFR0_EL1, ID_AA64PFR0_EL1_AdvSIMD_SHIFT, 4, FTR_SIGNED, 1, CAP_HWCAP, KERNEL_HWCAP_ASIMDHP),
> -	HWCAP_CAP(SYS_ID_AA64PFR0_EL1, ID_AA64PFR0_EL1_DIT_SHIFT, 4, FTR_SIGNED, 1, CAP_HWCAP, KERNEL_HWCAP_DIT),
> +	HWCAP_CAP(SYS_ID_AA64PFR0_EL1, ID_AA64PFR0_EL1_DIT_SHIFT, 4, FTR_UNSIGNED, 1, CAP_HWCAP, KERNEL_HWCAP_DIT),
>  	HWCAP_CAP(SYS_ID_AA64ISAR1_EL1, ID_AA64ISAR1_EL1_DPB_SHIFT, 4, FTR_UNSIGNED, 1, CAP_HWCAP, KERNEL_HWCAP_DCPOP),
>  	HWCAP_CAP(SYS_ID_AA64ISAR1_EL1, ID_AA64ISAR1_EL1_DPB_SHIFT, 4, FTR_UNSIGNED, 2, CAP_HWCAP, KERNEL_HWCAP_DCPODP),
>  	HWCAP_CAP(SYS_ID_AA64ISAR1_EL1, ID_AA64ISAR1_EL1_JSCVT_SHIFT, 4, FTR_UNSIGNED, 1, CAP_HWCAP, KERNEL_HWCAP_JSCVT),
> 
> -- 
> 2.30.2
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel



More information about the linux-arm-kernel mailing list