KVM: PPC: booke: Do Not start decrementer when SPRN_DEC set 0
authorBharat Bhushan <[email protected]>
Mon, 31 Oct 2011 08:52:08 +0000 (14:22 +0530)
committerAvi Kivity <[email protected]>
Mon, 5 Mar 2012 12:52:25 +0000 (14:52 +0200)
As per specification the decrementer interrupt not happen when DEC is written
with 0. Also when DEC is zero, no decrementer running. So we should not start
hrtimer for decrementer when DEC = 0.

Signed-off-by: Bharat Bhushan <[email protected]>
Signed-off-by: Alexander Graf <[email protected]>
Signed-off-by: Avi Kivity <[email protected]>
arch/powerpc/kvm/emulate.c

index 4337f99fa0fa0706b57e8a343af8d04e9e3158b9..b6df56dd93ba279afb1eb8e4661729e8b78f2382 100644 (file)
@@ -77,7 +77,8 @@ static int kvmppc_dec_enabled(struct kvm_vcpu *vcpu)
 #else
 static int kvmppc_dec_enabled(struct kvm_vcpu *vcpu)
 {
-       return vcpu->arch.tcr & TCR_DIE;
+       /* On BOOKE, DEC = 0 is as good as decrementer not enabled */
+       return (vcpu->arch.tcr & TCR_DIE) && vcpu->arch.dec;
 }
 #endif