]> git.baikalelectronics.ru Git - kernel.git/commit
KVM: arm64: Correct PSTATE on exception entry
authorMark Rutland <mark.rutland@arm.com>
Wed, 8 Jan 2020 13:43:22 +0000 (13:43 +0000)
committerMarc Zyngier <maz@kernel.org>
Sun, 19 Jan 2020 18:06:13 +0000 (18:06 +0000)
commit9ea938896e618351cd56484c64f7445a9bbb75cf
tree55db763fe3532befdc110a64a1076cad9082ea81
parent9aa7c2bb36c1f8017c9c0ae40e54b9b2cc17c7ff
KVM: arm64: Correct PSTATE on exception entry

When KVM injects an exception into a guest, it generates the PSTATE
value from scratch, configuring PSTATE.{M[4:0],DAIF}, and setting all
other bits to zero.

This isn't correct, as the architecture specifies that some PSTATE 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-429.

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-2-mark.rutland@arm.com
arch/arm64/include/uapi/asm/ptrace.h
arch/arm64/kvm/inject_fault.c