KVM: Disable CR8 intercept if tpr patching is active
authorGleb Natapov <gleb@redhat.com>
Mon, 11 May 2009 10:35:54 +0000 (13:35 +0300)
committerAvi Kivity <avi@redhat.com>
Wed, 10 Jun 2009 08:48:59 +0000 (11:48 +0300)
Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
arch/x86/kvm/x86.c

index beb806b03a2eeb7f18ffd54b5673566333af323c..249540f985132f79922736a8dd49f8febeb71bdf 100644 (file)
@@ -3142,7 +3142,10 @@ static void update_cr8_intercept(struct kvm_vcpu *vcpu)
        if (!kvm_x86_ops->update_cr8_intercept)
                return;
 
-       max_irr = kvm_lapic_find_highest_irr(vcpu);
+       if (!vcpu->arch.apic->vapic_addr)
+               max_irr = kvm_lapic_find_highest_irr(vcpu);
+       else
+               max_irr = -1;
 
        if (max_irr != -1)
                max_irr >>= 4;
@@ -3249,10 +3252,8 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
                kvm_x86_ops->enable_irq_window(vcpu);
 
        if (kvm_lapic_enabled(vcpu)) {
-               if (!vcpu->arch.apic->vapic_addr)
-                       update_cr8_intercept(vcpu);
-               else
-                       kvm_lapic_sync_to_vapic(vcpu);
+               update_cr8_intercept(vcpu);
+               kvm_lapic_sync_to_vapic(vcpu);
        }
 
        up_read(&vcpu->kvm->slots_lock);