Skip to content

Commit 479965a

Browse files
kristina-martsenkowilldeacon
authored andcommitted
arm64: cpufeature: Fix CLRBHB and BC detection
ClearBHB support is indicated by the CLRBHB field in ID_AA64ISAR2_EL1. Following some refactoring the kernel incorrectly checks the BC field instead. Fix the detection to use the right field. (Note: The original ClearBHB support had it as FTR_HIGHER_SAFE, but this patch uses FTR_LOWER_SAFE, which seems more correct.) Also fix the detection of BC (hinted conditional branches) to use FTR_LOWER_SAFE, so that it is not reported on mismatched systems. Fixes: 356137e ("arm64/sysreg: Make BHB clear feature defines match the architecture") Fixes: 8fcc828 ("arm64/sysreg: Convert ID_AA64ISAR2_EL1 to automatic generation") Cc: stable@vger.kernel.org Signed-off-by: Kristina Martsenko <kristina.martsenko@arm.com> Reviewed-by: Mark Brown <broonie@kernel.org> Link: https://lore.kernel.org/r/20230912133429.2606875-1-kristina.martsenko@arm.com Signed-off-by: Will Deacon <will@kernel.org>
1 parent 215b215 commit 479965a

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

arch/arm64/include/asm/cpufeature.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,7 @@ static inline bool supports_clearbhb(int scope)
663663
isar2 = read_sanitised_ftr_reg(SYS_ID_AA64ISAR2_EL1);
664664

665665
return cpuid_feature_extract_unsigned_field(isar2,
666-
ID_AA64ISAR2_EL1_BC_SHIFT);
666+
ID_AA64ISAR2_EL1_CLRBHB_SHIFT);
667667
}
668668

669669
const struct cpumask *system_32bit_el0_cpumask(void);

arch/arm64/kernel/cpufeature.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,8 @@ static const struct arm64_ftr_bits ftr_id_aa64isar1[] = {
222222
static const struct arm64_ftr_bits ftr_id_aa64isar2[] = {
223223
ARM64_FTR_BITS(FTR_VISIBLE, FTR_NONSTRICT, FTR_LOWER_SAFE, ID_AA64ISAR2_EL1_CSSC_SHIFT, 4, 0),
224224
ARM64_FTR_BITS(FTR_VISIBLE, FTR_NONSTRICT, FTR_LOWER_SAFE, ID_AA64ISAR2_EL1_RPRFM_SHIFT, 4, 0),
225-
ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_HIGHER_SAFE, ID_AA64ISAR2_EL1_BC_SHIFT, 4, 0),
225+
ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64ISAR2_EL1_CLRBHB_SHIFT, 4, 0),
226+
ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64ISAR2_EL1_BC_SHIFT, 4, 0),
226227
ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64ISAR2_EL1_MOPS_SHIFT, 4, 0),
227228
ARM64_FTR_BITS(FTR_VISIBLE_IF_IS_ENABLED(CONFIG_ARM64_PTR_AUTH),
228229
FTR_STRICT, FTR_EXACT, ID_AA64ISAR2_EL1_APA3_SHIFT, 4, 0),

arch/arm64/tools/sysreg

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1347,7 +1347,11 @@ UnsignedEnum 51:48 RPRFM
13471347
0b0000 NI
13481348
0b0001 IMP
13491349
EndEnum
1350-
Res0 47:28
1350+
Res0 47:32
1351+
UnsignedEnum 31:28 CLRBHB
1352+
0b0000 NI
1353+
0b0001 IMP
1354+
EndEnum
13511355
UnsignedEnum 27:24 PAC_frac
13521356
0b0000 NI
13531357
0b0001 IMP

0 commit comments

Comments
 (0)