All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arm64: cpufeature: remove duplicate ID_AA64ISAR2_EL1 entry
@ 2022-05-11 16:20 Kristina Martsenko
  2022-05-11 17:49 ` Suzuki K Poulose
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Kristina Martsenko @ 2022-05-11 16:20 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Catalin Marinas, Will Deacon, Suzuki K Poulose, Vladimir Murzin,
	Marc Zyngier

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@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);
 	}
 }
 
-- 
2.25.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] arm64: cpufeature: remove duplicate ID_AA64ISAR2_EL1 entry
  2022-05-11 16:20 [PATCH] arm64: cpufeature: remove duplicate ID_AA64ISAR2_EL1 entry Kristina Martsenko
@ 2022-05-11 17:49 ` Suzuki K Poulose
  2022-05-12  8:15 ` Vladimir Murzin
  2022-05-12 13:05 ` Will Deacon
  2 siblings, 0 replies; 4+ messages in thread
From: Suzuki K Poulose @ 2022-05-11 17:49 UTC (permalink / raw)
  To: Kristina Martsenko, linux-arm-kernel
  Cc: Catalin Marinas, Will Deacon, Vladimir Murzin, Marc Zyngier

On 11/05/2022 17:20, 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@arm.com>

Reviewed-by: Suzuki K Poulose <suzuki.poulose@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);
>   	}
>   }
>   


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] arm64: cpufeature: remove duplicate ID_AA64ISAR2_EL1 entry
  2022-05-11 16:20 [PATCH] arm64: cpufeature: remove duplicate ID_AA64ISAR2_EL1 entry Kristina Martsenko
  2022-05-11 17:49 ` Suzuki K Poulose
@ 2022-05-12  8:15 ` Vladimir Murzin
  2022-05-12 13:05 ` Will Deacon
  2 siblings, 0 replies; 4+ messages in thread
From: Vladimir Murzin @ 2022-05-12  8:15 UTC (permalink / raw)
  To: Kristina Martsenko, linux-arm-kernel
  Cc: Catalin Marinas, Will Deacon, Suzuki K Poulose, Marc Zyngier

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@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@arm.com>


Cheers
Vladimir

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] arm64: cpufeature: remove duplicate ID_AA64ISAR2_EL1 entry
  2022-05-11 16:20 [PATCH] arm64: cpufeature: remove duplicate ID_AA64ISAR2_EL1 entry Kristina Martsenko
  2022-05-11 17:49 ` Suzuki K Poulose
  2022-05-12  8:15 ` Vladimir Murzin
@ 2022-05-12 13:05 ` Will Deacon
  2 siblings, 0 replies; 4+ messages in thread
From: Will Deacon @ 2022-05-12 13:05 UTC (permalink / raw)
  To: Kristina Martsenko, linux-arm-kernel
  Cc: catalin.marinas, kernel-team, Will Deacon, Vladimir Murzin,
	Marc Zyngier, Suzuki K Poulose

On Wed, 11 May 2022 17:20:30 +0100, 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.
> 
> [...]

Applied to arm64 (for-next/fixes), thanks!

[1/1] arm64: cpufeature: remove duplicate ID_AA64ISAR2_EL1 entry
      https://git.kernel.org/arm64/c/2de7689c7caa

Cheers,
-- 
Will

https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-05-12 13:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-11 16:20 [PATCH] arm64: cpufeature: remove duplicate ID_AA64ISAR2_EL1 entry Kristina Martsenko
2022-05-11 17:49 ` Suzuki K Poulose
2022-05-12  8:15 ` Vladimir Murzin
2022-05-12 13:05 ` Will Deacon

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.