diff options
author | 2025-02-20 13:48:56 +0000 | |
---|---|---|
committer | 2025-02-24 11:06:55 -0800 | |
commit | d9f943f76506f60b9b74ce04caead6ce81b12fe0 (patch) | |
tree | 0c1adfbc3c7bb40ce8379f25c6229bee40aaaf58 | |
parent | KVM: arm64: Hide ID_AA64MMFR2_EL1.NV from guest and userspace (diff) | |
download | linux-rng-d9f943f76506f60b9b74ce04caead6ce81b12fe0.tar.xz linux-rng-d9f943f76506f60b9b74ce04caead6ce81b12fe0.zip |
KVM: arm64: Mark HCR.EL2.E2H RES0 when ID_AA64MMFR1_EL1.VH is zero
Enforce HCR_EL2.E2H being RES0 when VHE is disabled, so that we can
actually rely on that bit never being flipped behind our back.
Signed-off-by: Marc Zyngier <maz@kernel.org>
Reviewed-by: Joey Gouly <joey.gouly@arm.com>
Link: https://lore.kernel.org/r/20250220134907.554085-4-maz@kernel.org
Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
-rw-r--r-- | arch/arm64/kvm/nested.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/arch/arm64/kvm/nested.c b/arch/arm64/kvm/nested.c index 0c9387d2f507..ed3add7d32f6 100644 --- a/arch/arm64/kvm/nested.c +++ b/arch/arm64/kvm/nested.c @@ -1034,6 +1034,8 @@ int kvm_init_nv_sysregs(struct kvm_vcpu *vcpu) res0 |= (HCR_TEA | HCR_TERR); if (!kvm_has_feat(kvm, ID_AA64MMFR1_EL1, LO, IMP)) res0 |= HCR_TLOR; + if (!kvm_has_feat(kvm, ID_AA64MMFR1_EL1, VH, IMP)) + res0 |= HCR_E2H; if (!kvm_has_feat(kvm, ID_AA64MMFR4_EL1, E2H0, IMP)) res1 |= HCR_E2H; set_sysreg_masks(kvm, HCR_EL2, res0, res1); |