summaryrefslogtreecommitdiff
path: root/include/asm-powerpc/kvm_ppc.h
diff options
context:
space:
mode:
authorHollis Blanchard <hollisb@us.ibm.com>2008-04-25 17:55:49 -0500
committerAvi Kivity <avi@qumranet.com>2008-05-04 14:44:44 +0300
commit45c5eb67da5a668abe79c23a7e64dbc87a600f90 (patch)
treeb2b9ff85ecb5b35d246d68da94b20cb9f9912bff /include/asm-powerpc/kvm_ppc.h
parent3fe913e7c550a869e250d04c34410f7a6e263f7c (diff)
KVM: ppc: Handle guest idle by emulating MSR[WE] writes
This reduces host CPU usage when the guest is idle. However, the guest must set MSR[WE] in its idle loop, which Linux did not do until 2.6.26. Signed-off-by: Hollis Blanchard <hollisb@us.ibm.com> Signed-off-by: Jerone Young <jyoung5@us.ibm.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'include/asm-powerpc/kvm_ppc.h')
-rw-r--r--include/asm-powerpc/kvm_ppc.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/include/asm-powerpc/kvm_ppc.h b/include/asm-powerpc/kvm_ppc.h
index 7ac820308a7e..b35a7e3ef978 100644
--- a/include/asm-powerpc/kvm_ppc.h
+++ b/include/asm-powerpc/kvm_ppc.h
@@ -77,12 +77,17 @@ static inline void kvmppc_clear_exception(struct kvm_vcpu *vcpu, int exception)
clear_bit(priority, &vcpu->arch.pending_exceptions);
}
+/* Helper function for "full" MSR writes. No need to call this if only EE is
+ * changing. */
static inline void kvmppc_set_msr(struct kvm_vcpu *vcpu, u32 new_msr)
{
if ((new_msr & MSR_PR) != (vcpu->arch.msr & MSR_PR))
kvmppc_mmu_priv_switch(vcpu, new_msr & MSR_PR);
vcpu->arch.msr = new_msr;
+
+ if (vcpu->arch.msr & MSR_WE)
+ kvm_vcpu_block(vcpu);
}
#endif /* __POWERPC_KVM_PPC_H__ */