diff options
author | Scott Wood <scottwood@freescale.com> | 2011-06-14 19:34:31 -0400 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2011-07-12 06:16:32 -0400 |
commit | 4cd35f675ba41a99a477e28a6add4a66833325f2 (patch) | |
tree | d4b26dadccbad63b63ce90b358efa5903c4e075e /arch/powerpc/kvm/booke.h | |
parent | ecee273fc48f7f48f0c2f074335c43aaa790c308 (diff) |
KVM: PPC: e500: Save/restore SPE state
This is done lazily. The SPE save will be done only if the guest has
used SPE since the last preemption or heavyweight exit. Restore will be
done only on demand, when enabling MSR_SPE in the shadow MSR, in response
to an SPE fault or mtmsr emulation.
For SPEFSCR, Linux already switches it on context switch (non-lazily), so
the only remaining bit is to save it between qemu and the guest.
Signed-off-by: Liu Yu <yu.liu@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'arch/powerpc/kvm/booke.h')
-rw-r--r-- | arch/powerpc/kvm/booke.h | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/arch/powerpc/kvm/booke.h b/arch/powerpc/kvm/booke.h index 492bb7030358..0fa1732ddcb7 100644 --- a/arch/powerpc/kvm/booke.h +++ b/arch/powerpc/kvm/booke.h | |||
@@ -52,24 +52,18 @@ | |||
52 | 52 | ||
53 | extern unsigned long kvmppc_booke_handlers; | 53 | extern unsigned long kvmppc_booke_handlers; |
54 | 54 | ||
55 | /* Helper function for "full" MSR writes. No need to call this if only EE is | 55 | void kvmppc_set_msr(struct kvm_vcpu *vcpu, u32 new_msr); |
56 | * changing. */ | ||
57 | static inline void kvmppc_set_msr(struct kvm_vcpu *vcpu, u32 new_msr) | ||
58 | { | ||
59 | if ((new_msr & MSR_PR) != (vcpu->arch.shared->msr & MSR_PR)) | ||
60 | kvmppc_mmu_priv_switch(vcpu, new_msr & MSR_PR); | ||
61 | |||
62 | vcpu->arch.shared->msr = new_msr; | ||
63 | |||
64 | if (vcpu->arch.shared->msr & MSR_WE) { | ||
65 | kvm_vcpu_block(vcpu); | ||
66 | kvmppc_set_exit_type(vcpu, EMULATED_MTMSRWE_EXITS); | ||
67 | }; | ||
68 | } | ||
69 | 56 | ||
70 | int kvmppc_booke_emulate_op(struct kvm_run *run, struct kvm_vcpu *vcpu, | 57 | int kvmppc_booke_emulate_op(struct kvm_run *run, struct kvm_vcpu *vcpu, |
71 | unsigned int inst, int *advance); | 58 | unsigned int inst, int *advance); |
72 | int kvmppc_booke_emulate_mfspr(struct kvm_vcpu *vcpu, int sprn, int rt); | 59 | int kvmppc_booke_emulate_mfspr(struct kvm_vcpu *vcpu, int sprn, int rt); |
73 | int kvmppc_booke_emulate_mtspr(struct kvm_vcpu *vcpu, int sprn, int rs); | 60 | int kvmppc_booke_emulate_mtspr(struct kvm_vcpu *vcpu, int sprn, int rs); |
74 | 61 | ||
62 | /* low-level asm code to transfer guest state */ | ||
63 | void kvmppc_load_guest_spe(struct kvm_vcpu *vcpu); | ||
64 | void kvmppc_save_guest_spe(struct kvm_vcpu *vcpu); | ||
65 | |||
66 | /* high-level function, manages flags, host state */ | ||
67 | void kvmppc_vcpu_disable_spe(struct kvm_vcpu *vcpu); | ||
68 | |||
75 | #endif /* __KVM_BOOKE_H__ */ | 69 | #endif /* __KVM_BOOKE_H__ */ |