]> git.baikalelectronics.ru Git - kernel.git/commit
arm64: KVM: Consistently advance singlestep when emulating instructions
authorMark Rutland <mark.rutland@arm.com>
Fri, 9 Nov 2018 15:07:11 +0000 (15:07 +0000)
committerMarc Zyngier <marc.zyngier@arm.com>
Tue, 18 Dec 2018 14:11:37 +0000 (14:11 +0000)
commitbc3d8e676cbbe58e91882d4af825e22aa26042ee
tree854152408fc000dcb53d6256d8843d2656468506
parent6c5527f7635a2a83b46269f5829ddaf91eefe313
arm64: KVM: Consistently advance singlestep when emulating instructions

When we emulate a guest instruction, we don't advance the hardware
singlestep state machine, and thus the guest will receive a software
step exception after a next instruction which is not emulated by the
host.

We bodge around this in an ad-hoc fashion. Sometimes we explicitly check
whether userspace requested a single step, and fake a debug exception
from within the kernel. Other times, we advance the HW singlestep state
rely on the HW to generate the exception for us. Thus, the observed step
behaviour differs for host and guest.

Let's make this simpler and consistent by always advancing the HW
singlestep state machine when we skip an instruction. Thus we can rely
on the hardware to generate the singlestep exception for us, and never
need to explicitly check for an active-pending step, nor do we need to
fake a debug exception from the guest.

Cc: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Christoffer Dall <christoffer.dall@arm.com>
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
arch/arm/include/asm/kvm_host.h
arch/arm64/include/asm/kvm_emulate.h
arch/arm64/include/asm/kvm_host.h
arch/arm64/kvm/debug.c
arch/arm64/kvm/handle_exit.c
arch/arm64/kvm/hyp/switch.c
arch/arm64/kvm/hyp/vgic-v2-cpuif-proxy.c
virt/kvm/arm/arm.c
virt/kvm/arm/hyp/vgic-v3-sr.c