KVM: vmx: move sync_pir_to_irr from apic_find_highest_irr to callers
authorPaolo Bonzini <pbonzini@redhat.com>
Mon, 19 Dec 2016 12:29:03 +0000 (13:29 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 15 Feb 2017 13:54:34 +0000 (14:54 +0100)
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/x86/kvm/lapic.c
arch/x86/kvm/x86.c

index 120afc2bcfd303d52951784898b4479ccd5e985c..8af6db9b64aa1f06c7711aebca33193a08f7a8f7 100644 (file)
@@ -410,8 +410,6 @@ static inline int apic_find_highest_irr(struct kvm_lapic *apic)
        if (!apic->irr_pending)
                return -1;
 
-       if (apic->vcpu->arch.apicv_active)
-               kvm_x86_ops->sync_pir_to_irr(apic->vcpu);
        result = apic_search_irr(apic);
        ASSERT(result == -1 || result >= 16);
 
@@ -581,7 +579,10 @@ static void pv_eoi_clr_pending(struct kvm_vcpu *vcpu)
 
 static int apic_has_interrupt_for_ppr(struct kvm_lapic *apic, u32 ppr)
 {
-       int highest_irr = apic_find_highest_irr(apic);
+       int highest_irr;
+       if (apic->vcpu->arch.apicv_active)
+               kvm_x86_ops->sync_pir_to_irr(apic->vcpu);
+       highest_irr = apic_find_highest_irr(apic);
        if (highest_irr == -1 || (highest_irr & 0xF0) <= ppr)
                return -1;
        return highest_irr;
index 204793f0f0e2dc28ef8ffaaacae57dc0f5b7e0ac..8f80da161e800f3d69a315478f804e9ec5526001 100644 (file)
@@ -6822,9 +6822,11 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu)
                 * Update architecture specific hints for APIC
                 * virtual interrupt delivery.
                 */
-               if (vcpu->arch.apicv_active)
+               if (vcpu->arch.apicv_active) {
+                       kvm_x86_ops->sync_pir_to_irr(vcpu);
                        kvm_x86_ops->hwapic_irr_update(vcpu,
                                kvm_lapic_find_highest_irr(vcpu));
+               }
        }
 
        if (kvm_check_request(KVM_REQ_EVENT, vcpu) || req_int_win) {