KVM: arm64: Save PSTATE early on exit
authorMarc Zyngier <maz@kernel.org>
Tue, 16 Nov 2021 10:20:06 +0000 (10:20 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 17 Dec 2021 09:30:14 +0000 (10:30 +0100)
commit2b12c89527aecf8b20df0801a5b0c89053e6eefb
treefee8524ead7b066b4304c341939469dde4e4b8c9
parent906f7797a38f6b7d95ccececbb43748e80a2f652
KVM: arm64: Save PSTATE early on exit

[ Upstream commit 83bb2c1a01d7127d5adc7d69d7aaa3f7072de2b4 ]

In order to be able to use primitives such as vcpu_mode_is_32bit(),
we need to synchronize the guest PSTATE. However, this is currently
done deep into the bowels of the world-switch code, and we do have
helpers evaluating this much earlier (__vgic_v3_perform_cpuif_access
and handle_aarch32_guest, for example).

Move the saving of the guest pstate into the early fixups, which
cures the first issue. The second one will be addressed separately.

Tested-by: Fuad Tabba <tabba@google.com>
Reviewed-by: Fuad Tabba <tabba@google.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/arm64/kvm/hyp/include/hyp/switch.h
arch/arm64/kvm/hyp/include/hyp/sysreg-sr.h