diff options
author | Marc Zyngier <marc.zyngier@arm.com> | 2015-10-28 13:17:35 +0100 |
---|---|---|
committer | Marc Zyngier <marc.zyngier@arm.com> | 2016-02-29 19:34:16 +0100 |
commit | edef528dc4bdab1504e72e0f5436b18f3777efc0 (patch) | |
tree | 3c92349e2b145f5c7fe7707441016af330762d47 /arch/arm64/kvm/hyp/sysreg-sr.c | |
parent | arm64: KVM: VHE: Introduce unified system register accessors (diff) | |
download | linux-edef528dc4bdab1504e72e0f5436b18f3777efc0.tar.xz linux-edef528dc4bdab1504e72e0f5436b18f3777efc0.zip |
arm64: KVM: VHE: Differenciate host/guest sysreg save/restore
With ARMv8, host and guest share the same system register file,
making the save/restore procedure completely symetrical.
With VHE, host and guest now have different requirements, as they
use different sysregs.
In order to prepare for this, add split sysreg save/restore functions
for both host and guest. No functional changes yet.
Acked-by: Christoffer Dall <christoffer.dall@linaro.org>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Diffstat (limited to 'arch/arm64/kvm/hyp/sysreg-sr.c')
-rw-r--r-- | arch/arm64/kvm/hyp/sysreg-sr.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/arch/arm64/kvm/hyp/sysreg-sr.c b/arch/arm64/kvm/hyp/sysreg-sr.c index 425630980229..bd5b543f90da 100644 --- a/arch/arm64/kvm/hyp/sysreg-sr.c +++ b/arch/arm64/kvm/hyp/sysreg-sr.c @@ -24,7 +24,7 @@ #include "hyp.h" /* ctxt is already in the HYP VA space */ -void __hyp_text __sysreg_save_state(struct kvm_cpu_context *ctxt) +static void __hyp_text __sysreg_save_state(struct kvm_cpu_context *ctxt) { ctxt->sys_regs[MPIDR_EL1] = read_sysreg(vmpidr_el2); ctxt->sys_regs[CSSELR_EL1] = read_sysreg(csselr_el1); @@ -57,7 +57,17 @@ void __hyp_text __sysreg_save_state(struct kvm_cpu_context *ctxt) ctxt->gp_regs.spsr[KVM_SPSR_EL1]= read_sysreg(spsr_el1); } -void __hyp_text __sysreg_restore_state(struct kvm_cpu_context *ctxt) +void __hyp_text __sysreg_save_host_state(struct kvm_cpu_context *ctxt) +{ + __sysreg_save_state(ctxt); +} + +void __hyp_text __sysreg_save_guest_state(struct kvm_cpu_context *ctxt) +{ + __sysreg_save_state(ctxt); +} + +static void __hyp_text __sysreg_restore_state(struct kvm_cpu_context *ctxt) { write_sysreg(ctxt->sys_regs[MPIDR_EL1], vmpidr_el2); write_sysreg(ctxt->sys_regs[CSSELR_EL1], csselr_el1); @@ -90,6 +100,16 @@ void __hyp_text __sysreg_restore_state(struct kvm_cpu_context *ctxt) write_sysreg(ctxt->gp_regs.spsr[KVM_SPSR_EL1], spsr_el1); } +void __hyp_text __sysreg_restore_host_state(struct kvm_cpu_context *ctxt) +{ + __sysreg_restore_state(ctxt); +} + +void __hyp_text __sysreg_restore_guest_state(struct kvm_cpu_context *ctxt) +{ + __sysreg_restore_state(ctxt); +} + void __hyp_text __sysreg32_save_state(struct kvm_vcpu *vcpu) { u64 *spsr, *sysreg; |