aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kvm/powerpc.c
diff options
context:
space:
mode:
authorScott Wood <scottwood@freescale.com>2011-04-27 17:24:10 -0500
committerAvi Kivity <avi@redhat.com>2011-05-22 08:47:50 -0400
commiteab176722f4628b2d9cf76221a43dd3a0e37e632 (patch)
tree4b1e9e9ecb6adc4fb97c47ad5a3c174d3ad942ef /arch/powerpc/kvm/powerpc.c
parent1a040b26c5c915b317103b87ae7006d40443f197 (diff)
downloadkernel_samsung_smdk4412-eab176722f4628b2d9cf76221a43dd3a0e37e632.zip
kernel_samsung_smdk4412-eab176722f4628b2d9cf76221a43dd3a0e37e632.tar.gz
kernel_samsung_smdk4412-eab176722f4628b2d9cf76221a43dd3a0e37e632.tar.bz2
KVM: PPC: booke: save/restore VRSAVE (a.k.a. USPRG0)
Linux doesn't use USPRG0 (now renamed VRSAVE in the architecture, even when Altivec isn't involved), but a guest might. Signed-off-by: Scott Wood <scottwood@freescale.com> Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'arch/powerpc/kvm/powerpc.c')
-rw-r--r--arch/powerpc/kvm/powerpc.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
index ec3d2e7..9e6aa8b 100644
--- a/arch/powerpc/kvm/powerpc.c
+++ b/arch/powerpc/kvm/powerpc.c
@@ -298,12 +298,25 @@ void kvm_arch_vcpu_uninit(struct kvm_vcpu *vcpu)
void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
{
+#ifdef CONFIG_BOOKE
+ /*
+ * vrsave (formerly usprg0) isn't used by Linux, but may
+ * be used by the guest.
+ *
+ * On non-booke this is associated with Altivec and
+ * is handled by code in book3s.c.
+ */
+ mtspr(SPRN_VRSAVE, vcpu->arch.vrsave);
+#endif
kvmppc_core_vcpu_load(vcpu, cpu);
}
void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu)
{
kvmppc_core_vcpu_put(vcpu);
+#ifdef CONFIG_BOOKE
+ vcpu->arch.vrsave = mfspr(SPRN_VRSAVE);
+#endif
}
int kvm_arch_vcpu_ioctl_set_guest_debug(struct kvm_vcpu *vcpu,