[PATCH v3 0/9] KVM: arm64: Fix kvm_reset_vcpu() and SError handling for nested virt
From: Dan Carpenter
Date: Mon Nov 30 2026 - 03:48:35 EST
Our formal proof work at Pereq found a way to trigger a WARN() by
injecting two SErrors. That single patch evolved into 8 fixes and
a self test.
Changes in v3:
PATCH 1: KVM: arm64: nv: Use a vcpu request to reprogram the PMU
This is a new patch. Sashiko found a sleeping in atomic bug. Move
kvm_pmu_nested_transition() to a vCPU request to fix this as Oliver
Upton suggested.
PATCH 3: KVM: arm64: Reset SP_EL1, ELR_EL1 and SPSR_EL1 when resetting a vcpu
Do this in kvm_reset_vcpu_core() which is the shared helper with s390
as Suzuki Poulose suggested.
PATCH 6: KVM: arm64: nv: Replace a pending SError when injecting a new one
Improve the commit message as Oliver requested
Changes in v2:
Added 7 new bug fixes and a selftest.
- Link to v2: https://lore.kernel.org/all/20261125-double_exception-v2-0-224689d8a764@xxxxxxxx/
Included in v1:
[PATCH v2 7/8] KVM: arm64: nv: Re-inject a stored SError after the exit is handled
- Link to v1: https://patch.msgid.link/20261123-double_exception-v1-1-cd82b59a232d@xxxxxxxx
Signed-off-by: Dan Carpenter <dan@xxxxxxxx>
---
To: Marc Zyngier <maz@xxxxxxxxxx>
To: Oliver Upton <oupton@xxxxxxxxxx>
To: Fuad Tabba <fuad.tabba@xxxxxxxxx>
To: Joey Gouly <joey.gouly@xxxxxxx>
To: Steffen Eiden <seiden@xxxxxxxxxxxxx>
To: Suzuki K Poulose <suzuki.poulose@xxxxxxx>
To: Zenghui Yu <yuzenghui@xxxxxxxxxx>
To: Catalin Marinas <catalin.marinas@xxxxxxx>
To: Will Deacon <will@xxxxxxxxxx>
To: Mark Rutland <mark.rutland@xxxxxxx>
To: Rusty Russell <rusty@xxxxxxxxxxxxxxx>
To: Marcelo Tosatti <mtosatti@xxxxxxxxxx>
To: James Morse <james.morse@xxxxxxx>
To: Sebastian Ott <sebott@xxxxxxxxxx>
To: Eric Auger <eric.auger@xxxxxxxxxx>
To: Paolo Bonzini <pbonzini@xxxxxxxxxx>
To: Sean Christopherson <seanjc@xxxxxxxxxx>
To: Shuah Khan <shuah@xxxxxxxxxx>
Cc: Karthik Bhargavan <karthik@xxxxxxxx>
Cc: Clément Blaudeau <clement@xxxxxxxxxxx>
Cc: linux-arm-kernel@xxxxxxxxxxxxxxxxxxx
Cc: kvmarm@xxxxxxxxxxxxxxx
Cc: linux-kernel@xxxxxxxxxxxxxxx
Cc: kvm@xxxxxxxxxxxxxxx
Cc: linux-kselftest@xxxxxxxxxxxxxxx
Signed-off-by: Dan Carpenter <dan@xxxxxxxx>
---
Dan Carpenter (9):
KVM: arm64: nv: Use a vcpu request to reprogram the PMU
KVM: arm64: Drop an incomplete MMIO access when resetting a vcpu
KVM: arm64: Reset SP_EL1, ELR_EL1 and SPSR_EL1 when resetting a vcpu
KVM: arm64: Discard a pending SError when resetting a vcpu
KVM: arm64: nv: Discard nested SError in kvm_reset_vcpu()
KVM: arm64: nv: Replace a pending SError when injecting a new one
KVM: arm64: nv: Don't deliver a pending SError to the wrong guest
KVM: arm64: nv: Re-inject a stored SError after the exit is handled
KVM: arm64: selftests: Test that a vcpu reset clears the vcpu's state
arch/arm64/include/asm/kvm_emulate.h | 9 ++
arch/arm64/include/asm/kvm_host.h | 1 +
arch/arm64/kvm/arm.c | 4 +
arch/arm64/kvm/emulate-nested.c | 18 ++-
arch/arm64/kvm/inject_fault.c | 10 ++
arch/arm64/kvm/nested.c | 16 +-
arch/arm64/kvm/reset.c | 5 +
tools/testing/selftests/kvm/Makefile.kvm | 1 +
tools/testing/selftests/kvm/arm64/vcpu_reset.c | 210 +++++++++++++++++++++++++
9 files changed, 262 insertions(+), 12 deletions(-)
---
base-commit: adcad7f4e6332cff3d6d7165f41584899f598534
change-id: 20261130-double_exception_v3-a92fc5e456b4
Best regards,
--
Dan Carpenter <dan@xxxxxxxx>