summaryrefslogtreecommitdiff
path: root/drivers/kvm/irq.c
diff options
context:
space:
mode:
authorQing He <qing.he@intel.com>2007-09-17 10:47:13 +0400
committerAvi Kivity <avi@qumranet.com>2007-10-13 12:18:26 +0400
commit40487c680d5855459dfdce340df13d40071bb774 (patch)
treeabc0ec56ecb1b6d1533b918621c060a1d38fccef /drivers/kvm/irq.c
parent5cd4f6fd8506f59cb8a232f364c54f6bd8e5150a (diff)
downloadlinux-40487c680d5855459dfdce340df13d40071bb774.tar.xz
KVM: deliver PIC interrupt only to vcpu0
This patch changes the PIC interrupts delivery. Now it is only delivered to vcpu0 when either condition is met (on vcpu0): 1. local APIC is hardware disabled 2. LVT0 is unmasked and configured to delivery mode ExtInt It fixes the 2x faster wall clock on x86_64 and SMP i386 Linux guests Signed-off-by: Eddie (Yaozu) Dong <eddie.dong@intel.com> Signed-off-by: Qing He <qing.he@intel.com> Signed-off-by: Avi Kivity <avi@qumranet.com>
Diffstat (limited to 'drivers/kvm/irq.c')
-rw-r--r--drivers/kvm/irq.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/kvm/irq.c b/drivers/kvm/irq.c
index b88e50115588..7628c7ff628f 100644
--- a/drivers/kvm/irq.c
+++ b/drivers/kvm/irq.c
@@ -33,8 +33,11 @@ int kvm_cpu_has_interrupt(struct kvm_vcpu *v)
struct kvm_pic *s;
if (kvm_apic_has_interrupt(v) == -1) { /* LAPIC */
- s = pic_irqchip(v->kvm); /* PIC */
- return s->output;
+ if (kvm_apic_accept_pic_intr(v)) {
+ s = pic_irqchip(v->kvm); /* PIC */
+ return s->output;
+ } else
+ return 0;
}
return 1;
}
@@ -50,9 +53,11 @@ int kvm_cpu_get_interrupt(struct kvm_vcpu *v)
vector = kvm_get_apic_interrupt(v); /* APIC */
if (vector == -1) {
- s = pic_irqchip(v->kvm);
- s->output = 0; /* PIC */
- vector = kvm_pic_read_irq(s);
+ if (kvm_apic_accept_pic_intr(v)) {
+ s = pic_irqchip(v->kvm);
+ s->output = 0; /* PIC */
+ vector = kvm_pic_read_irq(s);
+ }
}
return vector;
}