On vcpu reset, we expect all the registers to be brought back
to their initial state, which happens to be a bunch of zeroes.
However, some recent commit broke this, and is now leaving a bunch
of registers (such as the FP state) with whatever was left by the
guest. My bad.
Zero the reset of the state (32bit SPSRs and FPSIMD state).
Cc: stable(a)vger.kernel.org
Fixes: e47c2055c68e ("KVM: arm64: Make struct kvm_regs userspace-only")
Signed-off-by: Marc Zyngier <maz(a)kernel.org>
---
Notes:
v2: Only reset the FPSIMD state and the AArch32 SPSRs to avoid
corrupting CNTVOFF in creative ways.
arch/arm64/kvm/reset.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/arch/arm64/kvm/reset.c b/arch/arm64/kvm/reset.c
index bd354cd45d28..4b5acd84b8c8 100644
--- a/arch/arm64/kvm/reset.c
+++ b/arch/arm64/kvm/reset.c
@@ -242,6 +242,11 @@ int kvm_reset_vcpu(struct kvm_vcpu *vcpu)
/* Reset core registers */
memset(vcpu_gp_regs(vcpu), 0, sizeof(*vcpu_gp_regs(vcpu)));
+ memset(&vcpu->arch.ctxt.fp_regs, 0, sizeof(vcpu->arch.ctxt.fp_regs));
+ vcpu->arch.ctxt.spsr_abt = 0;
+ vcpu->arch.ctxt.spsr_und = 0;
+ vcpu->arch.ctxt.spsr_irq = 0;
+ vcpu->arch.ctxt.spsr_fiq = 0;
vcpu_gp_regs(vcpu)->pstate = pstate;
/* Reset system registers */
--
2.30.2
The new MMU for two-dimensional paging had some missing TLB flushes
in 5.10 and 5.11. This series backports some generic improvements
to simplify the backport in the last four patches.
Ben Gardon (5):
KVM: x86/mmu: change TDP MMU yield function returns to match
cond_resched
KVM: x86/mmu: Merge flush and non-flush tdp_mmu_iter_cond_resched
KVM: x86/mmu: Rename goal_gfn to next_last_level_gfn
KVM: x86/mmu: Ensure forward progress when yielding in TDP MMU iter
KVM: x86/mmu: Yield in TDU MMU iter even if no SPTES changed
Paolo Bonzini (1):
KVM: x86/mmu: preserve pending TLB flush across calls to
kvm_tdp_mmu_zap_sp
Sean Christopherson (3):
KVM: x86/mmu: Ensure TLBs are flushed when yielding during GFN range
zap
KVM: x86/mmu: Ensure TLBs are flushed for TDP MMU during NX zapping
KVM: x86/mmu: Don't allow TDP MMU to yield when recovering NX pages
arch/x86/kvm/mmu/mmu.c | 13 ++---
arch/x86/kvm/mmu/tdp_iter.c | 30 +++--------
arch/x86/kvm/mmu/tdp_iter.h | 11 +++--
arch/x86/kvm/mmu/tdp_mmu.c | 99 ++++++++++++++++++++++++-------------
arch/x86/kvm/mmu/tdp_mmu.h | 18 ++++++-
5 files changed, 103 insertions(+), 68 deletions(-)
--
2.26.2