Fuad reports that on QEMU, the DIR trapping is still effective after a vcpu exit and that the host is running nVHE, resulting in a BUG() (we only expect DIR to be trapped for the guest, and never the host). As it turns out, this is an implementation-dependent behaviour, which the architecture allows, but that seem to be relatively uncommon across implementations. Fix this by completely zeroing the ICH_HCR_EL2 register when the vcpu exits. Reported-by: Fuad Tabba Fixes: ca30799f7c2d0 ("KVM: arm64: Turn vgic-v3 errata traps into a patched-in constant") Closes: https://lore.kernel.org/r/CA+EHjTzRwswNq+hZQDD5tXj+-0nr04OmR201mHmi82FJ0VHuJA@mail.gmail.com Signed-off-by: Marc Zyngier --- arch/arm64/kvm/hyp/vgic-v3-sr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/kvm/hyp/vgic-v3-sr.c b/arch/arm64/kvm/hyp/vgic-v3-sr.c index e950efa225478..71199e1a92940 100644 --- a/arch/arm64/kvm/hyp/vgic-v3-sr.c +++ b/arch/arm64/kvm/hyp/vgic-v3-sr.c @@ -243,7 +243,7 @@ void __vgic_v3_save_state(struct vgic_v3_cpu_if *cpu_if) cpu_if->vgic_hcr |= val & ICH_HCR_EL2_EOIcount; } - write_gicreg(compute_ich_hcr(cpu_if) & ~ICH_HCR_EL2_En, ICH_HCR_EL2); + write_gicreg(0, ICH_HCR_EL2); } void __vgic_v3_restore_state(struct vgic_v3_cpu_if *cpu_if) -- 2.47.3