diff options
author | Hollis Blanchard <hollisb@us.ibm.com> | 2008-04-25 18:55:49 -0400 |
---|---|---|
committer | Avi Kivity <avi@qumranet.com> | 2008-05-04 07:44:44 -0400 |
commit | 45c5eb67da5a668abe79c23a7e64dbc87a600f90 (patch) | |
tree | b2b9ff85ecb5b35d246d68da94b20cb9f9912bff /include/asm-powerpc | |
parent | 3fe913e7c550a869e250d04c34410f7a6e263f7c (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')
-rw-r--r-- | include/asm-powerpc/kvm_host.h | 1 | ||||
-rw-r--r-- | include/asm-powerpc/kvm_ppc.h | 5 |
2 files changed, 6 insertions, 0 deletions
diff --git a/include/asm-powerpc/kvm_host.h b/include/asm-powerpc/kvm_host.h index 04ffbb8e0a35..81a69d711017 100644 --- a/include/asm-powerpc/kvm_host.h +++ b/include/asm-powerpc/kvm_host.h | |||
@@ -59,6 +59,7 @@ struct kvm_vcpu_stat { | |||
59 | u32 emulated_inst_exits; | 59 | u32 emulated_inst_exits; |
60 | u32 dec_exits; | 60 | u32 dec_exits; |
61 | u32 ext_intr_exits; | 61 | u32 ext_intr_exits; |
62 | u32 halt_wakeup; | ||
62 | }; | 63 | }; |
63 | 64 | ||
64 | struct tlbe { | 65 | struct tlbe { |
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) | |||
77 | clear_bit(priority, &vcpu->arch.pending_exceptions); | 77 | clear_bit(priority, &vcpu->arch.pending_exceptions); |
78 | } | 78 | } |
79 | 79 | ||
80 | /* Helper function for "full" MSR writes. No need to call this if only EE is | ||
81 | * changing. */ | ||
80 | static inline void kvmppc_set_msr(struct kvm_vcpu *vcpu, u32 new_msr) | 82 | static inline void kvmppc_set_msr(struct kvm_vcpu *vcpu, u32 new_msr) |
81 | { | 83 | { |
82 | if ((new_msr & MSR_PR) != (vcpu->arch.msr & MSR_PR)) | 84 | if ((new_msr & MSR_PR) != (vcpu->arch.msr & MSR_PR)) |
83 | kvmppc_mmu_priv_switch(vcpu, new_msr & MSR_PR); | 85 | kvmppc_mmu_priv_switch(vcpu, new_msr & MSR_PR); |
84 | 86 | ||
85 | vcpu->arch.msr = new_msr; | 87 | vcpu->arch.msr = new_msr; |
88 | |||
89 | if (vcpu->arch.msr & MSR_WE) | ||
90 | kvm_vcpu_block(vcpu); | ||
86 | } | 91 | } |
87 | 92 | ||
88 | #endif /* __POWERPC_KVM_PPC_H__ */ | 93 | #endif /* __POWERPC_KVM_PPC_H__ */ |