KVM: arm64: nv: Emulate PSTATE.M for a guest hypervisor
authorMarc Zyngier <maz@kernel.org>
Thu, 9 Feb 2023 17:58:16 +0000 (17:58 +0000)
committerOliver Upton <oliver.upton@linux.dev>
Sat, 11 Feb 2023 10:13:29 +0000 (10:13 +0000)
commitd9552fe133f9f7c357460b041e2d3b20310adf8d
treebe2a0d3d3db5083e7a596dc9b29d1286b9815e8a
parent9da117eec9243f41c349071773784ca5f9c5d473
KVM: arm64: nv: Emulate PSTATE.M for a guest hypervisor

We can no longer blindly copy the VCPU's PSTATE into SPSR_EL2 and return
to the guest and vice versa when taking an exception to the hypervisor,
because we emulate virtual EL2 in EL1 and therefore have to translate
the mode field from EL2 to EL1 and vice versa.

This requires keeping track of the state we enter the guest, for which
we transiently use a dedicated flag.

Reviewed-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Reviewed-by: Alexandru Elisei <alexandru.elisei@arm.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20230209175820.1939006-15-maz@kernel.org
Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
arch/arm64/include/asm/kvm_host.h
arch/arm64/kvm/hyp/include/hyp/sysreg-sr.h
arch/arm64/kvm/hyp/vhe/switch.c