1
0
Fork 0
alistair23-linux/arch
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
..
alpha alpha: use pgtable-nopud instead of 4level-fixup 2019-12-04 19:44:14 -08:00
arc treewide: Use sizeof_field() macro 2019-12-09 10:36:44 -08:00
arm KVM: arm/arm64: Correct AArch32 SPSR on exception entry 2020-01-19 18:06:14 +00:00
arm64 KVM: arm/arm64: Correct AArch32 SPSR on exception entry 2020-01-19 18:06:14 +00:00
c6x c6x: use pgtable-nopud instead of 4level-fixup 2019-12-04 19:44:15 -08:00
csky dma-mapping updates for 5.5-rc1 2019-11-28 11:16:43 -08:00
h8300 h8300: Move EXCEPTION_TABLE to RO_DATA segment 2019-11-04 18:12:55 +01:00
hexagon Kbuild updates for v5.5 2019-12-02 17:35:04 -08:00
ia64 drm msm + fixes for 5.5-rc1 2019-12-06 10:28:09 -08:00
m68k Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gerg/m68knommu 2019-12-05 12:20:42 -08:00
microblaze microblaze: use pgtable-nopmd instead of 4level-fixup 2019-12-04 19:44:15 -08:00
mips Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2019-12-22 09:54:33 -08:00
nds32 nds32: use pgtable-nopmd instead of 4level-fixup 2019-12-04 19:44:15 -08:00
nios2 nios2: Fix ioremap 2019-12-12 16:34:33 +08:00
openrisc OpenRISC updates for 5.5 2019-12-02 17:18:43 -08:00
parisc parisc: Fix compiler warnings in debug_core.c 2019-12-20 21:01:42 +01:00
powerpc PPC: 2019-12-22 10:26:59 -08:00
riscv riscv: export flush_icache_all to modules 2019-12-27 21:51:01 -08:00
s390 s390/ftrace: save traced function caller 2019-12-18 23:29:26 +01:00
sh Wimplicit-fallthrough patches for 5.5-rc2 2019-12-14 16:10:22 -08:00
sparc treewide: Use sizeof_field() macro 2019-12-09 10:36:44 -08:00
um um: add support for folded p4d page tables 2019-12-04 19:44:15 -08:00
unicore32 generic ioremap support 2019-11-28 10:57:12 -08:00
x86 PPC: 2019-12-22 10:26:59 -08:00
xtensa arch: sembuf.h: make uapi asm/sembuf.h self-contained 2019-12-04 19:44:14 -08:00
.gitignore
Kconfig arch/Kconfig: fix indentation 2019-12-04 19:44:12 -08:00