1
0
Fork 0
alistair23-linux/virt/kvm/arm
Mark Rutland 3c2483f154 KVM: arm/arm64: Correct CPSR on exception entry
When KVM injects an exception into a guest, it generates the CPSR value
from scratch, configuring CPSR.{M,A,I,T,E}, and setting all other
bits to zero.

This isn't correct, as the architecture specifies that some CPSR bits
are (conditionally) cleared or set upon an exception, and others are
unchanged from the original context.

This patch adds logic to match the architectural behaviour. To make this
simple to follow/audit/extend, documentation references are provided,
and bits are configured in order of their layout in SPSR_EL2. This
layout can be seen in the diagram on ARM DDI 0487E.a page C5-426.

Note that this code is used by both arm and arm64, and is intended to
fuction with the SPSR_EL2 and SPSR_HYP layouts.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Reviewed-by: Alexandru Elisei <alexandru.elisei@arm.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/20200108134324.46500-3-mark.rutland@arm.com
2020-01-19 18:06:14 +00:00
..
hyp KVM: arm: vgic-v3: Mark expected switch fall-through 2019-07-26 15:37:11 +01:00
vgic KVM: arm/arm64: vgic: Handle GICR_PENDBASER.PTZ filed as RAZ 2020-01-19 16:05:11 +00:00
aarch32.c KVM: arm/arm64: Correct CPSR on exception entry 2020-01-19 18:06:14 +00:00
arch_timer.c KVM: arm/arm64: Let the timer expire in hardirq context on RT 2019-11-07 16:13:33 +00:00
arm.c KVM: arm: Remove duplicate include 2020-01-19 18:03:33 +00:00
hypercalls.c KVM: arm64: Support stolen time reporting via shared structure 2019-10-21 19:20:28 +01:00
mmio.c KVM: arm64: Only sign-extend MMIO up to register width 2020-01-19 16:05:10 +00:00
mmu.c KVM: arm/arm64: Re-check VMA on detecting a poisoned page 2020-01-19 18:05:20 +00:00
perf.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 234 2019-06-19 17:09:07 +02:00
pmu.c KVM: arm64: pmu: Reset sample period on overflow handling 2019-10-20 10:47:07 +01:00
psci.c KVM: arm/arm64: Factor out hypercall handling from PSCI code 2019-10-21 19:20:26 +01:00
pvtime.c KVM: arm64: Provide VCPU attributes for stolen time 2019-10-21 19:20:29 +01:00
trace.h KVM: arm/arm64: Fix TRACE_INCLUDE_PATH 2019-02-19 21:05:51 +00:00