]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
KVM: arm64: nv: Fix SPSR_EL2 restore in kvm_hyp_handle_mops()
authorWeiming Shi <bestswngs@gmail.com>
Wed, 17 Jun 2026 04:08:21 +0000 (12:08 +0800)
committerMarc Zyngier <maz@kernel.org>
Wed, 17 Jun 2026 11:49:11 +0000 (12:49 +0100)
commitff1022c3de46753eb7eba2f6efd990569e66ff95
treeeffc0606df41f27698ec4614c47c00ab99d536fd
parent0074b82cdfcb5fd13710a0ac308ade68ac6f6fbe
KVM: arm64: nv: Fix SPSR_EL2 restore in kvm_hyp_handle_mops()

kvm_hyp_handle_mops() resets the single-step state machine as part of
rewinding state for a MOPS exception by modifying vcpu_cpsr() and
writing the result directly into hardware.

In the case of nested virtualization, vcpu_cpsr() is a synthetic value
such that the rest of KVM can deal with vEL2 cleanly. That means the
value requires translation before being written into hardware, which is
unfortunately missing from the MOPS handler.

Fix it by directly modifying SPSR_EL2 and avoiding the synthetic state
altogether, which will be resynchronized on the next 'full' exit back
to KVM.

Fixes: 2de451a329cf ("KVM: arm64: Add handler for MOPS exceptions")
Reported-by: Zhong Wang <wangzhong.c0ss4ck@bytedance.com>
Reported-by: Xuanqing Shi <shixuanqing.11@bytedance.com>
Link: https://lore.kernel.org/all/ajE4lHQevXNHpl1M@Air.local/
Cc: stable@vger.kernel.org
Signed-off-by: Weiming Shi <bestswngs@gmail.com>
Link: https://patch.msgid.link/20260617040820.2194831-2-bestswngs@gmail.com
Signed-off-by: Marc Zyngier <maz@kernel.org>
arch/arm64/kvm/hyp/include/hyp/switch.h