Skip to contentSkip to conversation

arm64/cpufeatures/kvm: Add ARMv8.9 FEAT_ECBHB bits in ID_AA64MMFR1 register

PATCH In review Roy, Patrick 1 participant 2 messages Jul 30, 2025 – Aug 19, 2025 Stable branch

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm64/cpufeatures/kvm: Add ARMv8.9 FEAT_ECBHB bits in ID_AA64MMFR1 register

From: Nianyao Tang <[email protected]>

[ upstream commit e8cde32f111f7f5681a7bad3ec747e9e697569a9 ]

Enable ECBHB bits in ID_AA64MMFR1 register as per ARM DDI 0487K.a specification.

When guest OS read ID_AA64MMFR1_EL1, kvm emulate this reg using ftr_id_aa64mmfr1 and always return ID_AA64MMFR1_EL1.ECBHB=0 to guest. It results in guest syscall jump to tramp ventry, which is not needed in implementation with ID_AA64MMFR1_EL1.ECBHB=1.
Let's make the guest syscall process the same as the host.

This fixes performance regressions introduced by commit a53b3599d9bf ("arm64: errata: Add newer ARM cores to the spectre_bhb_loop_affected() lists") for guests running on neoverse v2 hardware, which supports ECBHB.

---
 arch/arm64/kernel/cpufeature.c | 1 +
 1 file changed, 1 insertion(+)
arch/arm64/kernel/cpufeature.c +1 -0
index 840cc48b5147..5d2322eeee47 100644
@@ -343,6 +343,7 @@ static const struct arm64_ftr_bits ftr_id_aa64mmfr0[] = {
 };
 
 static const struct arm64_ftr_bits ftr_id_aa64mmfr1[] = {
+	ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64MMFR1_EL1_ECBHB_SHIFT, 4, 0),
 	ARM64_FTR_BITS(FTR_HIDDEN, FTR_NONSTRICT, FTR_LOWER_SAFE, ID_AA64MMFR1_EL1_TIDCP1_SHIFT, 4, 0),
 	ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64MMFR1_EL1_AFP_SHIFT, 4, 0),
 	ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64MMFR1_EL1_ETS_SHIFT, 4, 0),
Signature · 1 line
2.50.1
#1 lore raw
Quoted 31 lines · Patrick

From: Nianyao Tang <[email protected]>

[ upstream commit e8cde32f111f7f5681a7bad3ec747e9e697569a9 ]

Enable ECBHB bits in ID_AA64MMFR1 register as per ARM DDI 0487K.a specification.

When guest OS read ID_AA64MMFR1_EL1, kvm emulate this reg using ftr_id_aa64mmfr1 and always return ID_AA64MMFR1_EL1.ECBHB=0 to guest. It results in guest syscall jump to tramp ventry, which is not needed in implementation with ID_AA64MMFR1_EL1.ECBHB=1.
Let's make the guest syscall process the same as the host.

This fixes performance regressions introduced by commit a53b3599d9bf ("arm64: errata: Add newer ARM cores to the spectre_bhb_loop_affected() lists") for guests running on neoverse v2 hardware, which supports ECBHB.

---
 arch/arm64/kernel/cpufeature.c | 1 +
 1 file changed, 1 insertion(+)
arch/arm64/kernel/cpufeature.c +0 -0
index 840cc48b5147..5d2322eeee47 100644

arch/arm64/kernel/cpufeature.c static const struct arm64_ftr_bits ftr_id_aa64mmfr0[] = { · line 349

Quoted 7 lines
arch/arm64/kernel/cpufeature.c +1 -0
@@ -343,6 +343,7 @@ static const struct arm64_ftr_bits ftr_id_aa64mmfr0[] = {
 };
 
 static const struct arm64_ftr_bits ftr_id_aa64mmfr1[] = {
+	ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64MMFR1_EL1_ECBHB_SHIFT, 4, 0),
 	ARM64_FTR_BITS(FTR_HIDDEN, FTR_NONSTRICT, FTR_LOWER_SAFE, ID_AA64MMFR1_EL1_TIDCP1_SHIFT, 4, 0),
 	ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64MMFR1_EL1_AFP_SHIFT, 4, 0),
 	ARM64_FTR_BITS(FTR_HIDDEN, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64MMFR1_EL1_ETS_SHIFT, 4, 0),

Hi Greg,

Friendly ping on this one? I saw 6.1.148 got released but this didn't get picked up (but you grabbed the 6.6 backport of the same commit during the last cycle). Did I mess something up with the backport process?

Best,
Patrick