aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorAlexander Graf <agraf@suse.de>2012-08-16 07:10:16 -0400
committerAlexander Graf <agraf@suse.de>2012-10-05 17:38:50 -0400
commit7a08c2740f07fb8c3769d1f137721835ead7652f (patch)
tree1cfdddd3d9839cea56cc6a6a38a148c3236d4e25 /arch
parentceb985f9d18cba2efdef08b8d31751c2c2b20d77 (diff)
KVM: PPC: BookE: Support FPU on non-hv systems
When running on HV aware hosts, we can not trap when the guest sets the FP bit, so we just let it do so when it wants to, because it has full access to MSR. For non-HV aware hosts with an FPU (like 440), we need to also adjust the shadow MSR though. Otherwise the guest gets an FP unavailable trap even when it really enabled the FP bit in MSR. Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'arch')
-rw-r--r--arch/powerpc/kvm/booke.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
index 959aae96469c..5f0476a602d8 100644
--- a/arch/powerpc/kvm/booke.c
+++ b/arch/powerpc/kvm/booke.c
@@ -122,6 +122,16 @@ static void kvmppc_vcpu_sync_spe(struct kvm_vcpu *vcpu)
122} 122}
123#endif 123#endif
124 124
125static void kvmppc_vcpu_sync_fpu(struct kvm_vcpu *vcpu)
126{
127#if defined(CONFIG_PPC_FPU) && !defined(CONFIG_KVM_BOOKE_HV)
128 /* We always treat the FP bit as enabled from the host
129 perspective, so only need to adjust the shadow MSR */
130 vcpu->arch.shadow_msr &= ~MSR_FP;
131 vcpu->arch.shadow_msr |= vcpu->arch.shared->msr & MSR_FP;
132#endif
133}
134
125/* 135/*
126 * Helper function for "full" MSR writes. No need to call this if only 136 * Helper function for "full" MSR writes. No need to call this if only
127 * EE/CE/ME/DE/RI are changing. 137 * EE/CE/ME/DE/RI are changing.
@@ -138,6 +148,7 @@ void kvmppc_set_msr(struct kvm_vcpu *vcpu, u32 new_msr)
138 148
139 kvmppc_mmu_msr_notify(vcpu, old_msr); 149 kvmppc_mmu_msr_notify(vcpu, old_msr);
140 kvmppc_vcpu_sync_spe(vcpu); 150 kvmppc_vcpu_sync_spe(vcpu);
151 kvmppc_vcpu_sync_fpu(vcpu);
141} 152}
142 153
143static void kvmppc_booke_queue_irqprio(struct kvm_vcpu *vcpu, 154static void kvmppc_booke_queue_irqprio(struct kvm_vcpu *vcpu,