summaryrefslogtreecommitdiffstats
path: root/lib/parman.c
diff options
context:
space:
mode:
authorMark Rutland <mark.rutland@arm.com>2020-01-08 13:43:24 +0000
committerMarc Zyngier <maz@kernel.org>2020-01-19 18:06:14 +0000
commit1cfbb484de158e378e8971ac40f3082e53ecca55 (patch)
tree442302c7b68db803eb2fac2b01a81306372aaf5a /lib/parman.c
parent3c2483f15499b877ccb53250d88addb8c91da147 (diff)
downloadlinux-1cfbb484de158e378e8971ac40f3082e53ecca55.tar.bz2
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
Diffstat (limited to 'lib/parman.c')
0 files changed, 0 insertions, 0 deletions