[PATCH] arm64: cpufeature: remove duplicate ID_AA64ISAR2_EL1 entry

Vladimir Murzin vladimir.murzin at arm.com
Thu May 12 01:15:47 PDT 2022


On 5/11/22 5:20 PM, Kristina Martsenko wrote:
> The ID register table should have one entry per ID register but
> currently has two entries for ID_AA64ISAR2_EL1. Only one entry has an
> override, and get_arm64_ftr_reg() can end up choosing the other, causing
> the override to be ignored. Fix this by removing the duplicate entry.
> 
> While here, also make the check in sort_ftr_regs() more strict so that
> duplicate entries can't be added in the future.
> 
> Fixes: def8c222f054 ("arm64: Add support of PAuth QARMA3 architected algorithm")
> Signed-off-by: Kristina Martsenko <kristina.martsenko at arm.com>
> ---
>   arch/arm64/kernel/cpufeature.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
> index d72c4b4d389c..2cb9cc9e0eff 100644
> --- a/arch/arm64/kernel/cpufeature.c
> +++ b/arch/arm64/kernel/cpufeature.c
> @@ -654,7 +654,6 @@ static const struct __ftr_reg_entry {
>   	ARM64_FTR_REG(SYS_ID_AA64ISAR0_EL1, ftr_id_aa64isar0),
>   	ARM64_FTR_REG_OVERRIDE(SYS_ID_AA64ISAR1_EL1, ftr_id_aa64isar1,
>   			       &id_aa64isar1_override),
> -	ARM64_FTR_REG(SYS_ID_AA64ISAR2_EL1, ftr_id_aa64isar2),
>   	ARM64_FTR_REG_OVERRIDE(SYS_ID_AA64ISAR2_EL1, ftr_id_aa64isar2,
>   			       &id_aa64isar2_override),
>   
> @@ -810,7 +809,7 @@ static void __init sort_ftr_regs(void)
>   		 * to sys_id for subsequent binary search in get_arm64_ftr_reg()
>   		 * to work correctly.
>   		 */
> -		BUG_ON(arm64_ftr_regs[i].sys_id < arm64_ftr_regs[i - 1].sys_id);
> +		BUG_ON(arm64_ftr_regs[i].sys_id <= arm64_ftr_regs[i - 1].sys_id);
>   	}
>   }
>   

Nice catch! FWIW

Reviewed-by: Vladimir Murzin <vladimir.murzin at arm.com>


Cheers
Vladimir



More information about the linux-arm-kernel mailing list