1
0
Fork 0
alistair23-linux/arch/arm64
Mark Rutland 1cfbb484de KVM: arm/arm64: Correct AArch32 SPSR on exception entry
Confusingly, there are three SPSR layouts that a kernel may need to deal
with:

(1) An AArch64 SPSR_ELx view of an AArch64 pstate
(2) An AArch64 SPSR_ELx view of an AArch32 pstate
(3) An AArch32 SPSR_* view of an AArch32 pstate

When the KVM AArch32 support code deals with SPSR_{EL2,HYP}, it's either
dealing with #2 or #3 consistently. On arm64 the PSR_AA32_* definitions
match the AArch64 SPSR_ELx view, and on arm the PSR_AA32_* definitions
match the AArch32 SPSR_* view.

However, when we inject an exception into an AArch32 guest, we have to
synthesize the AArch32 SPSR_* that the guest will see. Thus, an AArch64
host needs to synthesize layout #3 from layout #2.

This patch adds a new host_spsr_to_spsr32() helper for this, and makes
use of it in the KVM AArch32 support code. For arm64 we need to shuffle
the DIT bit around, and remove the SS bit, while for arm we can use the
value as-is.

I've open-coded the bit manipulation for now to avoid having to rework
the existing PSR_* definitions into PSR64_AA32_* and PSR32_AA32_*
definitions. I hope to perform a more thorough refactoring in future so
that we can handle pstate view manipulation more consistently across the
kernel tree.

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-4-mark.rutland@arm.com
2020-01-19 18:06:14 +00:00
..
boot arm64: dts: ls1028a: fix reboot node 2019-12-12 09:59:38 +08:00
configs arm64: defconfig: re-run savedefconfig 2019-12-05 13:20:17 -08:00
crypto crypto: arch - conditionalize crypto api in arch glue for lib code 2019-11-27 13:08:49 +08:00
include KVM: arm/arm64: Correct AArch32 SPSR on exception entry 2020-01-19 18:06:14 +00:00
kernel arm64: cpu_errata: Add Hisilicon TSV110 to spectre-v2 safe list 2019-12-20 17:57:22 +00:00
kvm KVM: arm64: Correct PSTATE on exception entry 2020-01-19 18:06:13 +00:00
lib arm64: uaccess: Remove uaccess_*_not_uao asm macros 2019-11-20 18:51:54 +00:00
mm arm64 updates for 5.5: 2019-12-06 14:18:01 -08:00
net arm64: bpf: optimize modulo operation 2019-09-03 15:44:40 +02:00
xen xen/efi: have a common runtime setup function 2019-10-02 10:31:07 -04:00
Kbuild arm64: add arch/arm64/Kbuild 2019-08-21 18:47:15 +01:00
Kconfig dma-mapping updates for 5.5-rc1 2019-11-28 11:16:43 -08:00
Kconfig.debug treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
Kconfig.platforms i.MX SoC update for 5.5: 2019-11-06 07:46:42 -08:00
Makefile arm64: implement ftrace with regs 2019-11-06 14:17:35 +00:00