[patch 2/8] KVM: move lapic timer ack to EOI handler

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



lapic timer is acked on interrupt injection, move it to EOI
handler.

Signed-off-by: Marcelo Tosatti <mtosatti@xxxxxxxxxx>

Index: kvm-new/arch/x86/kvm/lapic.c
===================================================================
--- kvm-new.orig/arch/x86/kvm/lapic.c
+++ kvm-new/arch/x86/kvm/lapic.c
@@ -427,6 +427,7 @@ int kvm_apic_compare_prio(struct kvm_vcp
 static void apic_set_eoi(struct kvm_lapic *apic)
 {
 	int vector = apic_find_highest_isr(apic);
+	int lvt_vector = apic_get_reg(apic, APIC_LVTT) & APIC_VECTOR_MASK;
 	int trigger_mode;
 	/*
 	 * Not every write EOI will has corresponding ISR,
@@ -435,6 +436,9 @@ static void apic_set_eoi(struct kvm_lapi
 	if (vector == -1)
 		return;
 
+	if (vector == lvt_vector)
+		kvm_timer_ack(&apic->lapic_timer);
+
 	apic_clear_vector(vector, apic->regs + APIC_ISR);
 	apic_update_ppr(apic);
 
@@ -982,10 +986,8 @@ void kvm_inject_apic_timer_irqs(struct k
 {
 	struct kvm_lapic *apic = vcpu->arch.apic;
 
-	if (apic && kvm_timer_has_pending(&apic->lapic_timer)) {
-		if (kvm_apic_local_deliver(apic, APIC_LVTT))
-			kvm_timer_ack(&apic->lapic_timer);
-	}
+	if (apic && kvm_timer_has_pending(&apic->lapic_timer))
+		kvm_apic_local_deliver(apic, APIC_LVTT);
 }
 
 int kvm_get_apic_interrupt(struct kvm_vcpu *vcpu)

-- 

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux