OSDN Git Service

KVM: arm64: Save/restore sp_el0 as part of __guest_enter
authorMarc Zyngier <maz@kernel.org>
Fri, 24 Apr 2020 13:24:34 +0000 (14:24 +0100)
committerMarc Zyngier <maz@kernel.org>
Thu, 30 Apr 2020 11:01:35 +0000 (12:01 +0100)
commit6e977984f6d8e5689e079de1fd2e337cd17dcca5
treefe02529b5123e36c32eb36a0401c28e8958336dd
parent6aea9e050394e83ac9fbd9fb0cb77c173e5bcae1
KVM: arm64: Save/restore sp_el0 as part of __guest_enter

We currently save/restore sp_el0 in C code. This is a bit unsafe,
as a lot of the C code expects 'current' to be accessible from
there (and the opportunity to run kernel code in HYP is specially
great with VHE).

Instead, let's move the save/restore of sp_el0 to the assembly
code (in __guest_enter), making sure that sp_el0 is correct
very early on when we exit the guest, and is preserved as long
as possible to its host value when we enter the guest.

Reviewed-by: Andrew Jones <drjones@redhat.com>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
arch/arm64/kvm/hyp/entry.S
arch/arm64/kvm/hyp/sysreg-sr.c