aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGleb Natapov <gleb@redhat.com>2011-02-09 05:09:46 -0500
committerMarcelo Tosatti <mtosatti@redhat.com>2011-03-17 12:08:30 -0400
commit7049467b5383432e178cc4124e53aebd83638916 (patch)
tree821003369bf041d8df42272d3b9f0c1d369b3625
parent23f3e99132aa5c5f887648c50597d8f2b5800417 (diff)
KVM: remove isr_ack logic from PIC
isr_ack logic was added by e48258009d to avoid unnecessary IPIs. Back then it made sense, but now the code checks that vcpu is ready to accept interrupt before sending IPI, so this logic is no longer needed. The patch removes it. Fixes a regression with Debian/Hurd. Signed-off-by: Gleb Natapov <gleb@redhat.com> Reported-and-tested-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Avi Kivity <avi@redhat.com>
-rw-r--r--arch/x86/kvm/i8259.c25
-rw-r--r--arch/x86/kvm/x86.c4
2 files changed, 2 insertions, 27 deletions
diff --git a/arch/x86/kvm/i8259.c b/arch/x86/kvm/i8259.c
index 3cece05e4ac4..19fe855e7953 100644
--- a/arch/x86/kvm/i8259.c
+++ b/arch/x86/kvm/i8259.c
@@ -62,9 +62,6 @@ static void pic_unlock(struct kvm_pic *s)
62 } 62 }
63 63
64 if (!found) 64 if (!found)
65 found = s->kvm->bsp_vcpu;
66
67 if (!found)
68 return; 65 return;
69 66
70 kvm_make_request(KVM_REQ_EVENT, found); 67 kvm_make_request(KVM_REQ_EVENT, found);
@@ -75,7 +72,6 @@ static void pic_unlock(struct kvm_pic *s)
75static void pic_clear_isr(struct kvm_kpic_state *s, int irq) 72static void pic_clear_isr(struct kvm_kpic_state *s, int irq)
76{ 73{
77 s->isr &= ~(1 << irq); 74 s->isr &= ~(1 << irq);
78 s->isr_ack |= (1 << irq);
79 if (s != &s->pics_state->pics[0]) 75 if (s != &s->pics_state->pics[0])
80 irq += 8; 76 irq += 8;
81 /* 77 /*
@@ -89,16 +85,6 @@ static void pic_clear_isr(struct kvm_kpic_state *s, int irq)
89 pic_lock(s->pics_state); 85 pic_lock(s->pics_state);
90} 86}
91 87
92void kvm_pic_clear_isr_ack(struct kvm *kvm)
93{
94 struct kvm_pic *s = pic_irqchip(kvm);
95
96 pic_lock(s);
97 s->pics[0].isr_ack = 0xff;
98 s->pics[1].isr_ack = 0xff;
99 pic_unlock(s);
100}
101
102/* 88/*
103 * set irq level. If an edge is detected, then the IRR is set to 1 89 * set irq level. If an edge is detected, then the IRR is set to 1
104 */ 90 */
@@ -281,7 +267,6 @@ void kvm_pic_reset(struct kvm_kpic_state *s)
281 s->irr = 0; 267 s->irr = 0;
282 s->imr = 0; 268 s->imr = 0;
283 s->isr = 0; 269 s->isr = 0;
284 s->isr_ack = 0xff;
285 s->priority_add = 0; 270 s->priority_add = 0;
286 s->irq_base = 0; 271 s->irq_base = 0;
287 s->read_reg_select = 0; 272 s->read_reg_select = 0;
@@ -545,15 +530,11 @@ static int picdev_read(struct kvm_io_device *this,
545 */ 530 */
546static void pic_irq_request(struct kvm *kvm, int level) 531static void pic_irq_request(struct kvm *kvm, int level)
547{ 532{
548 struct kvm_vcpu *vcpu = kvm->bsp_vcpu;
549 struct kvm_pic *s = pic_irqchip(kvm); 533 struct kvm_pic *s = pic_irqchip(kvm);
550 int irq = pic_get_irq(&s->pics[0]);
551 534
552 s->output = level; 535 if (!s->output)
553 if (vcpu && level && (s->pics[0].isr_ack & (1 << irq))) {
554 s->pics[0].isr_ack &= ~(1 << irq);
555 s->wakeup_needed = true; 536 s->wakeup_needed = true;
556 } 537 s->output = level;
557} 538}
558 539
559static const struct kvm_io_device_ops picdev_ops = { 540static const struct kvm_io_device_ops picdev_ops = {
@@ -575,8 +556,6 @@ struct kvm_pic *kvm_create_pic(struct kvm *kvm)
575 s->pics[1].elcr_mask = 0xde; 556 s->pics[1].elcr_mask = 0xde;
576 s->pics[0].pics_state = s; 557 s->pics[0].pics_state = s;
577 s->pics[1].pics_state = s; 558 s->pics[1].pics_state = s;
578 s->pics[0].isr_ack = 0xff;
579 s->pics[1].isr_ack = 0xff;
580 559
581 /* 560 /*
582 * Initialize PIO device 561 * Initialize PIO device
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index d9855b8584cf..9000829d06cb 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -2669,8 +2669,6 @@ static int kvm_vcpu_ioctl_x86_set_vcpu_events(struct kvm_vcpu *vcpu,
2669 vcpu->arch.interrupt.pending = events->interrupt.injected; 2669 vcpu->arch.interrupt.pending = events->interrupt.injected;
2670 vcpu->arch.interrupt.nr = events->interrupt.nr; 2670 vcpu->arch.interrupt.nr = events->interrupt.nr;
2671 vcpu->arch.interrupt.soft = events->interrupt.soft; 2671 vcpu->arch.interrupt.soft = events->interrupt.soft;
2672 if (vcpu->arch.interrupt.pending && irqchip_in_kernel(vcpu->kvm))
2673 kvm_pic_clear_isr_ack(vcpu->kvm);
2674 if (events->flags & KVM_VCPUEVENT_VALID_SHADOW) 2672 if (events->flags & KVM_VCPUEVENT_VALID_SHADOW)
2675 kvm_x86_ops->set_interrupt_shadow(vcpu, 2673 kvm_x86_ops->set_interrupt_shadow(vcpu,
2676 events->interrupt.shadow); 2674 events->interrupt.shadow);
@@ -5621,8 +5619,6 @@ int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu,
5621 if (pending_vec < max_bits) { 5619 if (pending_vec < max_bits) {
5622 kvm_queue_interrupt(vcpu, pending_vec, false); 5620 kvm_queue_interrupt(vcpu, pending_vec, false);
5623 pr_debug("Set back pending irq %d\n", pending_vec); 5621 pr_debug("Set back pending irq %d\n", pending_vec);
5624 if (irqchip_in_kernel(vcpu->kvm))
5625 kvm_pic_clear_isr_ack(vcpu->kvm);
5626 } 5622 }
5627 5623
5628 kvm_set_segment(vcpu, &sregs->cs, VCPU_SREG_CS); 5624 kvm_set_segment(vcpu, &sregs->cs, VCPU_SREG_CS);