Skip to content

Commit 1eccad3

Browse files
Fuad TabbaMarc Zyngier
authored andcommitted
KVM: arm64: Fix the value of the CPTR_EL2 RES1 bitmask for nVHE
Since the introduction of SME, bit 12 in CPTR_EL2 (nVHE) is TSM for trapping SME, instead of RES1, as per ARM ARM DDI 0487K.a, section D23.2.34. Fix the value of CPTR_NVHE_EL2_RES1 to reflect that, and adjust the code that relies on it accordingly. Signed-off-by: Fuad Tabba <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Marc Zyngier <[email protected]>
1 parent 8f7df79 commit 1eccad3

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

arch/arm64/include/asm/kvm_arm.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@
300300
#define CPTR_EL2_TSM (1 << 12)
301301
#define CPTR_EL2_TFP (1 << CPTR_EL2_TFP_SHIFT)
302302
#define CPTR_EL2_TZ (1 << 8)
303-
#define CPTR_NVHE_EL2_RES1 0x000032ff /* known RES1 bits in CPTR_EL2 (nVHE) */
303+
#define CPTR_NVHE_EL2_RES1 (BIT(13) | BIT(9) | GENMASK(7, 0))
304304
#define CPTR_NVHE_EL2_RES0 (GENMASK(63, 32) | \
305305
GENMASK(29, 21) | \
306306
GENMASK(19, 14) | \

arch/arm64/include/asm/kvm_emulate.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -640,8 +640,8 @@ static __always_inline void kvm_reset_cptr_el2(struct kvm_vcpu *vcpu)
640640

641641
if (vcpu_has_sve(vcpu) && guest_owns_fp_regs())
642642
val |= CPTR_EL2_TZ;
643-
if (cpus_have_final_cap(ARM64_SME))
644-
val &= ~CPTR_EL2_TSM;
643+
if (!cpus_have_final_cap(ARM64_SME))
644+
val |= CPTR_EL2_TSM;
645645
}
646646

647647
kvm_write_cptr_el2(val);

0 commit comments

Comments
 (0)